hedgewars/GSHandlers.inc
changeset 520 e83dfb7ffead
parent 519 981df6f6e2a9
child 521 bc8fd78d7598
--- a/hedgewars/GSHandlers.inc	Thu May 24 18:48:35 2007 +0000
+++ b/hedgewars/GSHandlers.inc	Thu May 24 19:41:51 2007 +0000
@@ -1087,7 +1087,7 @@
 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
 if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprAmGirder].Width div 2,
                       TargetPoint.Y - SpritesData[sprAmGirder].Height div 2,
-                      sprAmGirder, Gear^.State) then
+                      sprAmGirder, Gear^.State, true) then
         begin
         HHGear^.Message:= HHGear^.Message and not gm_Attack;
         HHGear^.State:= HHGear^.State and not gstAttacking;
@@ -1101,3 +1101,31 @@
         end;
 TargetPoint.X:= NoPointX
 end;
+
+////////////////////////////////////////////////////////////////////////////////
+
+procedure doStepTeleport(Gear: PGear);
+var HHGear: PGear;
+begin
+AllInactive:= false;
+
+HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
+if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprHHTelepMask].Width div 2,
+                      TargetPoint.Y - SpritesData[sprHHTelepMask].Height div 2,
+                      sprHHTelepMask, 0, false) then
+        begin
+        HHGear^.Message:= HHGear^.Message and not gm_Attack;
+        HHGear^.State:= HHGear^.State and not gstAttacking;
+        HHGear^.State:= HHGear^.State or gstHHChooseTarget;
+        DeleteGear(Gear);
+        isCursorVisible:= true
+        end
+   else begin
+        DeleteCI(HHGear);
+        HHGear^.X:= int2hwFloat(TargetPoint.X);
+        HHGear^.Y:= int2hwFloat(TargetPoint.Y);
+        DeleteGear(Gear);
+        AfterAttack
+        end;
+TargetPoint.X:= NoPointX
+end;