Disable long jump in artillery mode, make snipre rifle single shot
authornemo
Sun, 03 May 2009 21:12:34 +0000
changeset 2024 2985f3bd18b7
parent 2023 41d3afaa20c7
child 2025 692308790912
Disable long jump in artillery mode, make snipre rifle single shot
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
--- a/hedgewars/GSHandlers.inc	Sun May 03 17:35:10 2009 +0000
+++ b/hedgewars/GSHandlers.inc	Sun May 03 21:12:34 2009 +0000
@@ -495,22 +495,27 @@
 
 procedure doStepSniperRifleShot(Gear: PGear);
 begin
+cArtillery:= true;
 if not cLaserSighting then // game doesn't have default laser sight. turn it on and give them a chance to aim
     begin
     cLaserSighting:= true;
-    cArtillery:= true;
 	DeleteGear(Gear);
 	AfterAttack;
-    dec(CurrentHedgehog^.AttacksNum);
     exit 
-    end;
+    end
+else
+    inc(CurrentHedgehog^.AttacksNum); // burn up a shot, Tiy wants only a single shot
 
 if (PHedgehog(Gear^.Hedgehog)^.Gear^.Message and gm_Attack) <> 0 then
     begin
 	Gear^.State:= Gear^.State or gstAnimation;
     PlaySound(sndGun, false, nil);
     Gear^.doStep:= @doStepBulletWork
-    end
+    end;
+
+if (Gear^.Ammo^.NumPerTurn < CurrentHedgehog^.AttacksNum) and
+   ((GameFlags and gfArtillery) = 0) then cArtillery:= false;
+
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/hedgewars/HHHandlers.inc	Sun May 03 17:35:10 2009 +0000
+++ b/hedgewars/HHHandlers.inc	Sun May 03 21:12:34 2009 +0000
@@ -348,7 +348,7 @@
          or   TestCollisionYwithGear(Gear, -1)) then
          begin
          Gear^.dY:= -_0_15;
-         Gear^.dX:= SignAs(_0_15, Gear^.dX);
+         if not cArtillery then Gear^.dX:= SignAs(_0_15, Gear^.dX);
          Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
          PlaySound(sndJump1, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
          exit
@@ -632,7 +632,7 @@
 	
 	Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump);
 
-	if wasJumping and
+	if (not cArtillery) and wasJumping and
 		TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then SetLittle(Gear^.dX);
 
 	doStepHedgehogMoving(Gear);