I have constated a little bug with the uzi : when you shoot with an exactly 90° angle , bullets are too speedy for this angle and make hole on the middle of a wall instead of the border.
An example on this screen : http://thibouf.free.fr/wormux/uzi%20bug.png
Th probleme is that for some angle, in each iteration, an incrementation of 1 in pos.X, pos.Y is too much incremented.
I have made a patch which correct by swithing between increment pos.X or pos.Y in function of the angle. ( pos.Y for upwards and downwards, pos.X else) .
I also made a little modification for checking if the bullet is outside of the map, because it did not check for the Y side and the bullet did not stop at the top of the map.
-Thibaud
Index: src/weapon/uzi.cpp
===================================================================
--- src/weapon/uzi.cpp (révision 769)
+++ src/weapon/uzi.cpp (copie de travail)
@@ -21,6 +21,7 @@
#include "uzi.h"
#include <sstream>
+#include <iostream>
#include "weapon_tools.h"
#include "../game/time.h"
#include "../interface/game_msg.h"
@@ -81,18 +82,33 @@
angle = ActiveTeam().crosshair.GetAngleRad();
a = sin(angle)/cos(angle);
b = pos.y - ( a * pos.x ) ;
+ Point2i delta_pos ;
// Move the bullet !!
projectile->SetXY( pos );
projectile->Ready();
projectile->is_active = true;
-
+
while( projectile->is_active ){
- pos.y = (int)((a*pos.x) + b);
+
+ // shooting upwards ( -3pi/4 < angle <-pi/4 )
+ if (angle < -0.78 && angle > -2.36){
+ pos.x = (int)((pos.y-b)/a); //Calculate x
+ delta_pos.y=-1; //Increment y
+ //shooting downwards ( 3pi/4 > angle > pi/4 )
+ }else if (angle > 0.78 && angle < 2.36){
+ pos.x = (int)((pos.y-b)/a); //Calculate x
+ delta_pos.y=1; //Increment y
+ // else shooting at right or left
+ }else{
+ pos.y = (int)((a*pos.x) + b); //Calculate y
+ delta_pos.x=ActiveCharacter().GetDirection(); //Increment x
+ }
projectile->SetXY( pos );
+
// the bullet in gone outside the map
- if (projectile->IsGhost()) {
+ if ( ( world.EstHorsMondeX(projectile->GetX()) ) || ( world.EstHorsMondeY(projectile->GetY()) )) { //IsGhost does not check the Y side.
projectile->is_active=false;
return true;
}
@@ -105,7 +121,7 @@
return true;
}
- pos.x += ActiveCharacter().GetDirection();
+ pos += delta_pos;
}
return true;
_______________________________________________ Wormux-dev mailing list [email protected] https://mail.gna.org/listinfo/wormux-dev
