hedgewars/GSHandlers.inc
changeset 3710 411f5c2b5292
parent 3706 a79784328c03
child 3712 de2026031833
--- a/hedgewars/GSHandlers.inc	Mon Aug 02 18:13:29 2010 +0200
+++ b/hedgewars/GSHandlers.inc	Mon Aug 02 18:19:55 2010 +0200
@@ -1436,6 +1436,55 @@
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
+procedure doStepSMine(Gear: PGear);
+begin
+    if (Gear^.State and gstMoving) <> 0 then
+    begin
+        if ((Gear^.State and gstCollision) <> 0) and (Gear^.dX < _0_2) and (Gear^.dY < _0_2) then
+        begin
+            Gear^.dX := _0;
+            Gear^.dY := _0
+            // TODO: calc attach dir
+        end
+        else
+            CalcRotationDirAngle(Gear);
+
+        DeleteCI(Gear);
+        doStepFallingGear(Gear);
+        if (Gear^.State and gstMoving) = 0 then
+            AddGearCI(Gear);
+        AllInactive := false
+    end
+    else
+    begin
+        if ((GameTicks and $3F) = 25) then
+            doStepFallingGear(Gear);
+    end;
+
+    if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then
+        if ((Gear^.State and gstAttacking) = 0) then
+        begin
+            if ((GameTicks and $1F) = 0) then
+                if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then Gear^.State := Gear^.State or
+                                                                                      gstAttacking
+        end
+    else // gstAttacking <> 0
+    begin
+        AllInactive := false;
+        if (Gear^.Timer and $FF) = 0 then PlaySound(sndMineTick);
+        if Gear^.Timer = 0 then
+        begin
+            doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound);
+            DeleteGear(Gear);
+            exit
+        end;
+        dec(Gear^.Timer);
+    end
+    else // gsttmpFlag = 0
+        if TurnTimeLeft = 0 then Gear^.State := Gear^.State or gsttmpFlag;
+end;
+
+////////////////////////////////////////////////////////////////////////////////
 procedure doStepDynamite(Gear: PGear);
 begin
     doStepFallingGear(Gear);