From ed97e374f85b78243fa711c3b695a49b284eb66a Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 20 Feb 2020 13:11:39 +0000 Subject: [PATCH] Fix screen centering in wide/tallscreen Previously, it would misbehave if the screen is slightly wider than the level (because it wasn't accounting for the fact that the game hides half of the border tiles) --- src/Frame.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Frame.cpp b/src/Frame.cpp index 7d8b5339..c14d66e0 100644 --- a/src/Frame.cpp +++ b/src/Frame.cpp @@ -37,7 +37,7 @@ void MoveFrame3(void) else { // Widescreen/tallscreen-safe behaviour - if (map_w * 16 < WINDOW_WIDTH) + if ((map_w - 1) * 16 < WINDOW_WIDTH) { gFrame.x = -(((WINDOW_WIDTH - ((map_w - 1) * 16)) * 0x200) / 2); } @@ -52,7 +52,7 @@ void MoveFrame3(void) gFrame.x = (((map_w - 1) * 16) - WINDOW_WIDTH) * 0x200; } - if (map_l * 16 < WINDOW_HEIGHT) + if ((map_l - 1) * 16 < WINDOW_HEIGHT) { gFrame.y = -(((WINDOW_HEIGHT - ((map_l - 1) * 16)) * 0x200) / 2); }