hedgewars/uGearsHandlersMess.pas
changeset 9526 2fd51591b260
parent 9505 56e0cca99e20
child 9539 ab44d44a6177
--- a/hedgewars/uGearsHandlersMess.pas	Fri Oct 11 13:06:04 2013 -0400
+++ b/hedgewars/uGearsHandlersMess.pas	Sun Oct 13 13:14:32 2013 -0400
@@ -280,11 +280,17 @@
 var
     isFalling: boolean;
     //tmp: QWord;
-    tdX, tdY: hwFloat;
+    tX, tdX, tdY: hwFloat;
     collV, collH: LongInt;
     land: word;
 begin
-    WorldWrap(Gear);
+    tX:= Gear^.X;
+    if WorldWrap(Gear) and (WorldEdge = weWrap) and (Gear^.AdvBounce <> 0) and
+      (TestCollisionXwithGear(Gear, 1) or TestCollisionXwithGear(Gear, -1))  then
+        begin
+        Gear^.X:= tX;
+        Gear^.dX.isNegative:= (hwRound(tX) > leftX+Gear^.Radius*2)
+        end;
 
     // clip velocity at 2 - over 1 per pixel, but really shouldn't cause many actual problems.
     if Gear^.dX.Round > 2 then