hedgewars/GSHandlers.inc
changeset 7659 a5cf49dc993e
parent 7658 70a874a26414
child 7661 3046ad5b361e
--- a/hedgewars/GSHandlers.inc	Mon Sep 03 13:52:35 2012 -0400
+++ b/hedgewars/GSHandlers.inc	Mon Sep 03 20:04:42 2012 +0200
@@ -2267,14 +2267,13 @@
 var 
     HHGear: PGear;
 begin
-    Gear^.Hedgehog^.Unplaced := false;
     HHGear := Gear^.Hedgehog^.Gear;
-    HHGear^.Y := HHGear^.Y + HHGear^.dY;
-    HHGear^.X := HHGear^.X + HHGear^.dX;
-    // hedgehog falling to collect cases
-    HHGear^.dY := HHGear^.dY + cGravity;
-    if (TestCollisionYwithGear(HHGear, 1) <> 0)
-    or CheckGearDrowning(HHGear) then
+    doStepHedgehogMoving(HHGear);
+    // if not infattack mode wait for hedgehog finish falling to collect cases
+    if ((GameFlags and gfInfAttack) <> 0)
+    or ((HHGear^.State and gstMoving) = 0)
+    or (Gear^.Hedgehog^.Gear^.Damage > 0)
+    or ((HHGear^.State and gstDrowning) = 1) then
         begin
         DeleteGear(Gear);
         AfterAttack
@@ -2283,6 +2282,11 @@
 
 procedure doStepTeleportAnim(Gear: PGear);
 begin
+    if (Gear^.Hedgehog^.Gear^.Damage > 0) then
+        begin
+        DeleteGear(Gear);
+        AfterAttack;
+        end;
     inc(Gear^.Timer);
     if Gear^.Timer = 65 then
         begin
@@ -2326,6 +2330,8 @@
         HHGear^.X := int2hwFloat(Gear^.Target.X);
         HHGear^.Y := int2hwFloat(Gear^.Target.Y);
         HHGear^.State := HHGear^.State or gstMoving;
+        Gear^.Hedgehog^.Unplaced := false;
+        isCursorVisible := false;
         playSound(sndWarp)
         end;
     Gear^.Target.X:= NoPointX