Try to allow cursor to reach water when zooming out cursor_issues
authorunc0rr
Sun, 17 Apr 2011 22:16:36 +0400
branchcursor_issues
changeset 5149 9aa840fdf922
parent 5148 73b3b4b8359c
child 5189 dc1fe432b293
Try to allow cursor to reach water when zooming out
hedgewars/uWorld.pas
--- a/hedgewars/uWorld.pas	Sat Apr 16 23:21:15 2011 +0400
+++ b/hedgewars/uWorld.pas	Sun Apr 17 22:16:36 2011 +0400
@@ -1156,7 +1156,7 @@
 end;
 
 procedure MoveCamera;
-var EdgesDist,  wdy: LongInt;
+var EdgesDist, wdy, shs: LongInt;
     PrevSentPointTime: LongWord = 0;
 begin
 {$IFNDEF IPHONEOS}
@@ -1230,10 +1230,12 @@
             WorldDx:= WorldDx - CursorPoint.X + cScreenWidth div 2 - EdgesDist;
             CursorPoint.X:= cScreenWidth div 2 - EdgesDist
         end;
-    if CursorPoint.Y < EdgesDist then
+
+    shs:= cScreenHeight div 2 - trunc(cScreenHeight / cScaleFactor) + EdgesDist;
+    if CursorPoint.Y < shs then
     begin
-        WorldDy:= WorldDy + CursorPoint.Y - EdgesDist;
-        CursorPoint.Y:= EdgesDist
+        WorldDy:= WorldDy + CursorPoint.Y - shs;
+        CursorPoint.Y:= shs;
     end
     else
         if CursorPoint.Y > cScreenHeight - EdgesDist then