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.
This commit is contained in:
Misa 2024-01-20 21:39:22 -08:00 committed by Misa Elizabeth Kai
parent 94b9722b7b
commit d989c232af
1 changed files with 17 additions and 6 deletions

View File

@ -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) static void toggleflipmode(void)
{ {
graphics.setflipmode = !graphics.setflipmode; graphics.setflipmode = !graphics.setflipmode;
@ -283,6 +293,12 @@ static void toggleflipmode(void)
{ {
music.playef(Sound_VIRIDIAN); 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; static bool fadetomode = false;
@ -1131,12 +1147,7 @@ static void menuactionpress(void)
if (prev_lang != loc::lang) if (prev_lang != loc::lang)
{ {
/* Retranslate and reposition all text boxes. */ recomputetextboxes();
for (size_t i = 0; i < graphics.textboxes.size(); i++)
{
graphics.textboxes[i].updatetext();
graphics.textboxes[i].applyposition();
}
} }
game.returnmenu(); game.returnmenu();