Fix weWrap camera in pas2c (and if applies, 32 bit fpc)
authorunc0rr
Fri, 23 Nov 2018 21:22:26 +0100
changeset 14302 e754b516cc35
parent 14301 3342358bc2c3
child 14303 6015b74eea55
Fix weWrap camera in pas2c (and if applies, 32 bit fpc)
hedgewars/uWorld.pas
--- a/hedgewars/uWorld.pas	Thu Nov 22 22:18:21 2018 +0100
+++ b/hedgewars/uWorld.pas	Fri Nov 23 21:22:26 2018 +0100
@@ -1831,9 +1831,9 @@
 
             if (WorldEdge = weWrap) then
                 begin
-                    if dstX - prevPoint.X < (LongInt(leftX) - rightX) div 2 then
+                    if dstX - prevPoint.X < (LongInt(leftX) - LongInt(rightX)) div 2 then
                         CursorPoint.X:= (prevPoint.X * 7 + dstX - (leftX - rightX)) div 8
-                    else if dstX - prevPoint.X > (LongInt(rightX) - leftX) div 2 then
+                    else if dstX - prevPoint.X > (LongInt(rightX) - LongInt(leftX)) div 2 then
                         CursorPoint.X:= (prevPoint.X * 7 + dstX - (rightX - leftX)) div 8
                     else
                         CursorPoint.X:= (prevPoint.X * 7 + dstX) div 8;
@@ -1851,9 +1851,9 @@
 
 if (WorldEdge = weWrap) then
     begin
-        if -WorldDx < leftX then
+        if -WorldDx < LongInt(leftX) then
             WorldDx:= WorldDx - LongInt(rightX) + leftX
-        else if -WorldDx > rightX then
+        else if -WorldDx > LongInt(rightX) then
             WorldDx:= WorldDx + LongInt(rightX) - leftX;
     end;