Some fixes on camera broken by zoom code (ammo menu should work now)
authorunc0rr
Sun, 21 Jun 2009 15:36:13 +0000
changeset 2178 d8b3417b2704
parent 2177 c045698e044f
child 2179 839472821b4d
Some fixes on camera broken by zoom code (ammo menu should work now)
hedgewars/uWorld.pas
--- a/hedgewars/uWorld.pas	Sun Jun 21 15:31:09 2009 +0000
+++ b/hedgewars/uWorld.pas	Sun Jun 21 15:36:13 2009 +0000
@@ -98,7 +98,7 @@
       CursorPoint.X:= cScreenWidth div 2;
       CursorPoint.Y:= cScreenHeight div 2;
       prevPoint:= CursorPoint;
-      SDL_WarpMouse(CursorPoint.X, CursorPoint.Y)
+      SDL_WarpMouse(CursorPoint.X  + cScreenWidth div 2, CursorPoint.Y)
       end;
    if cReducedQuality then
        AMxShift:= 210
@@ -494,20 +494,21 @@
 		exit
 		end
 		else begin
-		CursorPoint.x:= (prevPoint.x * 7 + (hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * 100) + WorldDx) div 8;
-		CursorPoint.y:= (prevPoint.y * 7 + (hwRound(FollowGear^.Y) + WorldDy)) div 8
+		//CursorPoint.x:= (prevPoint.x * 7 + (hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * 100) + WorldDx) div 8;
+		//CursorPoint.y:= (prevPoint.y * 7 + (hwRound(FollowGear^.Y) + WorldDy)) div 8
+		CursorPoint.x:= (hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * 100) + WorldDx;
 		end;
 
 if ((CursorPoint.X = prevPoint.X)and(CursorPoint.Y = prevpoint.Y)) then exit;
 
 if AMxShift < 210 then
 	begin
-	if CursorPoint.X < cScreenWidth + AMxShift - 175 then CursorPoint.X:= cScreenWidth + AMxShift - 175;
-	if CursorPoint.X > cScreenWidth + AMxShift - 10 then CursorPoint.X:= cScreenWidth + AMxShift - 10;
+	if CursorPoint.X < cScreenWidth div 2 + AMxShift - 175 then CursorPoint.X:= cScreenWidth div 2 + AMxShift - 175;
+	if CursorPoint.X > cScreenWidth div 2 + AMxShift - 10 then CursorPoint.X:= cScreenWidth div 2 + AMxShift - 10;
 	if CursorPoint.Y < cScreenHeight - 75 - SlotsNum * 33 then CursorPoint.Y:= cScreenHeight - 75 - SlotsNum * 33;
 	if CursorPoint.Y > cScreenHeight - 76 then CursorPoint.Y:= cScreenHeight - 76;
 	prevPoint:= CursorPoint;
-	if cHasFocus then SDL_WarpMouse(CursorPoint.X, CursorPoint.Y);
+	if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, CursorPoint.Y);
 	exit
 	end;