hedgewars/uWorld.pas
changeset 10662 e0d7d499c851
parent 10634 35d059bd0932
child 10672 c2004c3e9c7d
--- a/hedgewars/uWorld.pas	Thu Dec 11 20:46:45 2014 +0100
+++ b/hedgewars/uWorld.pas	Thu Dec 11 22:22:40 2014 +0100
@@ -1867,12 +1867,17 @@
         end
     else
         begin
-        if abs(prevPoint.X - WorldDx - hwRound(FollowGear^.X)) > LongInt(rightX) - leftX - 100 then
+        if (WorldEdge = weWrap) then
+            cameraJump:= LongInt(playWidth) div 2 + 50
+        else
+            cameraJump:= LongInt(rightX) - leftX - 100;
+
+        if abs(prevPoint.X - WorldDx - hwRound(FollowGear^.X)) > cameraJump then
             begin
-            if (prevPoint.X - WorldDx) * 2 < LongInt((rightX + leftX)) then
-                cameraJump:= LongInt(rightX) - leftX
-                else
-                cameraJump:= LongInt(leftX) - rightX;
+            if prevPoint.X - WorldDx < LongInt(playWidth div 2) then
+                cameraJump:= LongInt(playWidth)
+            else
+                cameraJump:= -LongInt(playWidth);
             WorldDx:= WorldDx - cameraJump;
             end;