From da6c524db5447f66b96e9b64f2200ce2ee3ab1b8 Mon Sep 17 00:00:00 2001 From: Misa <infoteddy@infoteddy.info> Date: Fri, 3 Sep 2021 17:13:03 -0700 Subject: [PATCH] Don't use `map.extrarow` for menu animations This fixes all the headaches about map.extrarow having to be the correct value and which way it should be and whatnot. The latest headache was the detection that prevent user-initiated menu animations while an animation was already happening being tripped because graphics.menuoffset would be 230 (due to closing the menu while being in a room without a room name), but then going to a room with a room name would check for 240 instead, and 230 is less than 240. (The numbers are the wrong way round because I got the ternaries the wrong way round, but even if the numbers are the correct way round, the bug would still happen, but it would just be reversed.) So instead, I've just made it 240 for both. This doesn't change the duration of the menu animation (because the animation moves in increments of 25, and 230 / 25 == 240 / 25 under integer division). It might change the animation slightly, but it was already inconsistent anyway because map.extrarow was always set to be 1 in custom levels, and I legitimately would not be able to tell the difference without recording the animations and nitpicking it frame-by-frame. Fixes #841. --- desktop_version/src/Game.cpp | 2 +- desktop_version/src/RenderFixed.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 0c2a648b..2ad3d694 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -6865,7 +6865,7 @@ void Game::mapmenuchange(const int newgamestate, const bool user_initiated) { if (user_initiated && graphics.menuoffset > 0 - && graphics.menuoffset < (map.extrarow ? 230 : 240)) + && graphics.menuoffset < 240) { return; } diff --git a/desktop_version/src/RenderFixed.cpp b/desktop_version/src/RenderFixed.cpp index 08d25962..8966724e 100644 --- a/desktop_version/src/RenderFixed.cpp +++ b/desktop_version/src/RenderFixed.cpp @@ -206,7 +206,7 @@ void maprenderfixed(void) || !script.running) { graphics.menuoffset += 25; - int threshold = map.extrarow ? 230 : 240; + int threshold = 240; if (graphics.menuoffset >= threshold) { graphics.menuoffset = threshold;