Engine:
authorsmxx
Fri, 28 May 2010 19:48:51 +0000
changeset 3484 3c65b1d979cd
parent 3483 54ff8cbabaa6
child 3485 ab91c56a9050
Engine: * Fixed aiming for Ballgun and Flamethrower
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
--- a/hedgewars/GSHandlers.inc	Fri May 28 16:21:54 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Fri May 28 19:48:51 2010 +0000
@@ -2612,8 +2612,8 @@
     dec(Gear^.Timer);
     HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
     HedgehogChAngle(HHGear);
-    gX := hwRound(Gear^.X);
-    gY := hwRound(Gear^.Y);
+    gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle);
+    gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle);
     if (Gear^.Timer mod 100) = 0 then
     begin
         rx := rndSign(getRandom * _0_1);
@@ -3639,8 +3639,8 @@
     dec(Gear^.Timer);
     HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
     HedgehogChAngle(HHGear);
-    gX := hwRound(Gear^.X);
-    gY := hwRound(Gear^.Y);
+    gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle);
+    gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle);
     if (Gear^.Timer mod 100) = 0 then
     begin
         rx := rndSign(getRandom * _0_1);
--- a/hedgewars/HHHandlers.inc	Fri May 28 16:21:54 2010 +0000
+++ b/hedgewars/HHHandlers.inc	Fri May 28 19:48:51 2010 +0000
@@ -200,7 +200,7 @@
                   amHellishBomb: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtHellishBomb,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
                        amNapalm: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 2, _0, _0, 0);
                         amDrill: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtDrill, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
-                      amBallgun: CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtBallgun,  0, xx * _0_5, yy * _0_5, 0);
+                      amBallgun: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtBallgun,  0, xx * _0_5, yy * _0_5, 0);
                     amJetpack: CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtJetpack, 0, _0, _0, 0);
                     amBirdy: begin
                              PlaySound(sndWhistle);
@@ -226,7 +226,7 @@
                                FollowGear:= AddGear(TargetPoint.X, 0, gtPiano, 0, _0, _0, 0);
                                PauseMusic
                                end;
-                      amFlamethrower: CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtFlamethrower,  0, xx * _0_5, yy * _0_5, 0);
+                      amFlamethrower: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtFlamethrower,  0, xx * _0_5, yy * _0_5, 0);
                   end;
 
         uStats.AmmoUsed(Ammo^[CurSlot, CurAmmo].AmmoType);