Fix camera zooming out too far in pause mode (
bug #773)
--- a/hedgewars/uWorld.pas Fri Jun 05 00:57:05 2020 +0200
+++ b/hedgewars/uWorld.pas Fri Jun 05 01:30:03 2020 +0200
@@ -877,6 +877,13 @@
end
end;
+// Force the lower camera boundary to never be lower than a few pixels below the water line
+function LowerCameraBound: LongInt;
+begin
+LowerCameraBound:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - (cVisibleWater + trunc(CinematicBarH / (cScaleFactor / 2.0)));
+if WorldDy < LowerCameraBound then
+ WorldDy:= LowerCameraBound;
+end;
procedure DrawWorld(Lag: LongInt);
begin
@@ -897,7 +904,9 @@
ZoomValue:= zoom;
if (not isPaused) and (not isAFK) and (GameType <> gmtRecord) then
- MoveCamera;
+ MoveCamera
+ else if (isPaused) then
+ LowerCameraBound;
if cStereoMode = smNone then
begin
@@ -1941,9 +1950,7 @@
WorldDx:= WorldDx + rightX - leftX;
end;
-wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - (cVisibleWater + trunc(CinematicBarH / (cScaleFactor / 2.0)));
-if WorldDy < wdy then
- WorldDy:= wdy;
+wdy:= LowerCameraBound;
if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then
exit;