Add the standard delay (1.25 seconds) between attacks on inf attack mode, as well as checks for damage and win.
authornemo
Sun, 10 Oct 2010 16:51:40 -0400
changeset 3949 4c4c0a2507cc
parent 3948 24daa33a3114
child 3950 296cbdd85e50
child 3951 c9a63db3e603
Add the standard delay (1.25 seconds) between attacks on inf attack mode, as well as checks for damage and win. There is probably some better way to do this. Weapons still need fixing.
hedgewars/HHHandlers.inc
hedgewars/uGears.pas
--- a/hedgewars/HHHandlers.inc	Sun Oct 10 22:32:01 2010 +0200
+++ b/hedgewars/HHHandlers.inc	Sun Oct 10 16:51:40 2010 -0400
@@ -327,9 +327,9 @@
             if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEndHint) = 0) and ((GameFlags and gfInfAttack) = 0) then
                 begin
                 TurnTimeLeft:= Ammoz[CurAmmoType].TimeAfterTurn;
-                State:= State or gstAttacked
                 end
-            else ApplyAmmoChanges(CurrentHedgehog^)
+            else ApplyAmmoChanges(CurrentHedgehog^);
+            if (GameFlags and gfInfAttack) <> 0 then State:= State or gstAttacked;
             end;
         end
     else
--- a/hedgewars/uGears.pas	Sun Oct 10 22:32:01 2010 +0200
+++ b/hedgewars/uGears.pas	Sun Oct 10 16:51:40 2010 -0400
@@ -696,6 +696,7 @@
 
 procedure ProcessGears;
 const delay: LongWord = 0;
+      delay2: LongWord = 0;
     step: (stDelay, stChDmg, stSweep, stTurnReact,
             stAfterDelay, stChWin, stWater, stChWin2, stHealth,
             stSpawn, stNTurn) = stDelay;
@@ -841,6 +842,20 @@
                 end;
             step:= Low(step)
             end;
+    end
+else if ((GameFlags and gfInfAttack) <> 0) then
+    begin
+    if delay2 = 0 then
+        delay2:= cInactDelay 
+    else
+        dec(delay2);
+
+    if delay2 = 0 then
+        begin
+        if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) then CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State and not gstAttacked;
+        CheckNoDamage;
+        CheckForWin
+        end
     end;
 
 if TurnTimeLeft > 0 then