hedgewars/uGearsHandlersMess.pas
changeset 12794 28782e03b8f0
parent 12769 272fcd3833d2
child 12809 a889cb350930
--- a/hedgewars/uGearsHandlersMess.pas	Fri Oct 27 19:54:27 2017 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Sat Oct 28 04:53:21 2017 +0200
@@ -2872,7 +2872,8 @@
     valid:= false;
 
     lx:= Gear^.Target.X - SpritesData[sprHHTelepMask].Width  div 2; // left
-    lx:= CalcWorldWrap(lx, SpritesData[sprHHTelepMask].Width); // Take world edge into account
+    if WorldEdge <> weBounce then
+        lx:= CalcWorldWrap(lx, SpritesData[sprHHTelepMask].Width div 2); // Take world edge into account
     ty:= Gear^.Target.Y - SpritesData[sprHHTelepMask].Height div 2; // top
 
     // remember original target location
@@ -2888,6 +2889,9 @@
         dec(Gear^.Target.Y);
         end;
 
+    if (WorldEdge = weBounce) and ((Gear^.Target.X < LeftX) or (Gear^.Target.X > RightX)) then
+        valid:= false;
+
     if not valid then
         begin
         HHGear^.Message := HHGear^.Message and (not gmAttack);