hedgewars/uGears.pas
changeset 2991 142ea64ce8a2
parent 2990 b62e567f17b9
child 2993 d83edb74e92d
--- a/hedgewars/uGears.pas	Sun Mar 14 20:22:00 2010 +0000
+++ b/hedgewars/uGears.pas	Sun Mar 14 20:23:11 2010 +0000
@@ -589,11 +589,12 @@
     step: (stDelay, stChDmg, stSweep, stTurnReact,
             stAfterDelay, stChWin, stWater, stChWin2, stHealth,
             stSpawn, stNTurn) = stDelay;
-
+var StoppedSteps: boolean;
 var Gear, t: PGear;
 begin
 PrvInactive:= AllInactive;
 AllInactive:= true;
+StoppedSteps:= false;
 
 if (StepSoundTimer > 0) and (StepSoundChannel < 0) then
     StepSoundChannel:= LoopSound(sndSteps)
@@ -601,6 +602,7 @@
     begin
     StopSound(StepSoundChannel);
     StepSoundChannel:= -1;
+    StoppedSteps:= true
     end;
 
 if StepSoundTimer > 0 then
@@ -611,6 +613,7 @@
     begin
     Gear:= t;
     t:= Gear^.NextGear;
+    if (Gear = CurrentHedgehog^.Gear) and (StoppedSteps) then Gear^.Timer:= 10;
     if Gear^.Active then
         begin
         if Gear^.RenderTimer and (Gear^.Timer > 500) and ((Gear^.Timer mod 1000) = 0) then
@@ -1181,10 +1184,17 @@
         end
     else
     if ((Gear^.State and gstAttacked) = 0) then
-    begin
+        begin
+        if Gear^.Timer > 0 then
+            begin
+            // There must be a tidier way to do this. Anyone?
+            if aangle <= 90 then aangle:= aangle+360;
+            if Gear^.dX > _0 then aangle:= aangle-((aangle-240)*Gear^.Timer/10)
+            else aangle:= aangle+((240-aangle)*Gear^.Timer/10);
+            dec(Gear^.Timer)
+            end;
         amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType;
         case amt of
-//, sprHandCake, sprHandConstruction, sprHandGrenade, sprHandMelon, sprHandMortar, sprHandSkip, sprHandCluster, sprHandDynamite, sprHandHellish, sprHandMine, sprHandSeduction, sprHandVamp
             amBazooka: DrawRotated(sprHandBazooka, hx, hy, hwSign(Gear^.dX), aangle);
             amMortar: DrawRotated(sprHandMortar, hx, hy, hwSign(Gear^.dX), aangle);
             amMolotov: DrawRotated(sprHandMolotov, hx, hy, hwSign(Gear^.dX), aangle);