Animate baseball bat attack
authorunc0rr
Mon, 21 Apr 2008 16:51:14 +0000
changeset 854 fef7f2d908bf
parent 853 0b4a23795530
child 855 8842c71d16bf
Animate baseball bat attack
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/uGears.pas
--- a/hedgewars/GSHandlers.inc	Sun Apr 20 10:39:08 2008 +0000
+++ b/hedgewars/GSHandlers.inc	Mon Apr 21 16:51:14 2008 +0000
@@ -935,6 +935,17 @@
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
+procedure doStepIdle(Gear: PGear);
+begin
+AllInactive:= false;
+dec(Gear^.Timer);addfilelog(inttostr(Gear^.Timer));
+if Gear^.Timer = 0 then
+	begin
+	DeleteGear(Gear);
+	AfterAttack
+	end
+end;
+
 procedure doStepShover(Gear: PGear);
 var HHGear: PGear;
 begin
@@ -942,7 +953,8 @@
 HHGear^.State:= HHGear^.State or gstNoDamage;
 AmmoShove(Gear, 30, 115);
 HHGear^.State:= HHGear^.State and not gstNoDamage;
-DeleteGear(Gear)
+Gear^.Timer:= 250;
+Gear^.doStep:= @doStepIdle
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/hedgewars/HHHandlers.inc	Sun Apr 20 10:39:08 2008 +0000
+++ b/hedgewars/HHHandlers.inc	Mon Apr 21 16:51:14 2008 +0000
@@ -115,7 +115,7 @@
                                  end;
                        amDEagle: AddGear(hwRound(X + xx * cHHRadius), hwRound(Y + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
                      amDynamite: AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtDynamite, 0, SignAs(_0_03, dX), _0, 5000);
-                  amBaseballBat: AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtShover, 0, xx * _0_5, yy * _0_5, 0)^.Radius:= 20;
+                  amBaseballBat: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtShover, 0, xx * _0_5, yy * _0_5, 0);
                     amFirePunch: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtFirePunch, 0, _0, _0, 0);
                     amParachute: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtParachute, 0, _0, _0, 0);
                     amAirAttack: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 0, _0, _0, 0);
--- a/hedgewars/uGears.pas	Sun Apr 20 10:39:08 2008 +0000
+++ b/hedgewars/uGears.pas	Mon Apr 21 16:51:14 2008 +0000
@@ -503,6 +503,7 @@
 						3,
 						0);
 				end;
+			gtShover: DrawRotated(sprHandBaseball, hx, hy, hwSign(Gear^.dX), aangle + 180);
 			gtPickHammer,
 			gtTeleport: defaultPos:= false;
 		end