From d989c232af8757a69c623f423f4ad124cf90107b Mon Sep 17 00:00:00 2001 From: Misa Date: Sat, 20 Jan 2024 21:39:22 -0800 Subject: [PATCH] Recompute text boxes in Flip Mode With the new system of retranslating text boxes on-the-fly, this also enables us to retranslate them whenever the player toggles Flip Mode. This is relevant because the Intermission 1 instructional text boxes refer to a floor when Flip Mode is off, but when it is on, it talks about the ceiling. --- desktop_version/src/Input.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index 725c2dc7..3e775d7c 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -269,6 +269,16 @@ static void updatebuttonmappings(int bind) } } +static void recomputetextboxes(void) +{ + /* Retranslate and reposition all text boxes. */ + for (size_t i = 0; i < graphics.textboxes.size(); i++) + { + graphics.textboxes[i].updatetext(); + graphics.textboxes[i].applyposition(); + } +} + static void toggleflipmode(void) { graphics.setflipmode = !graphics.setflipmode; @@ -283,6 +293,12 @@ static void toggleflipmode(void) { music.playef(Sound_VIRIDIAN); } + + /* Some text boxes change depending on Flip Mode, so update text boxes. */ + const bool temp = graphics.flipmode; + graphics.flipmode = graphics.setflipmode; + recomputetextboxes(); + graphics.flipmode = temp; } static bool fadetomode = false; @@ -1131,12 +1147,7 @@ static void menuactionpress(void) if (prev_lang != loc::lang) { - /* Retranslate and reposition all text boxes. */ - for (size_t i = 0; i < graphics.textboxes.size(); i++) - { - graphics.textboxes[i].updatetext(); - graphics.textboxes[i].applyposition(); - } + recomputetextboxes(); } game.returnmenu();