Save textbox state, allow lang switches w/ textbox

This allows switching languages while a text box is on screen by saving
the necessary state for a text box to be retranslated when the language
is switched.

This saves the state of the position and direction of the crewmate that
the text box position is based off of (if applicable), and the text
case of the text box, the script name of the script, and the original
(English) lines of the text box. I did not explicitly label the original
lines as English lines except in a main game context, because
technically, custom levels could have original lines in a different
language.

Unfortunately, this doesn't work for every text box in the game.
Notably, the Level Complete, Game Complete, number of crewmates
remaining, trinket collection, Intermission 1 guides, etc. text boxes
are special and require further fixes, but that will be coming in later
commits.
This commit is contained in:
Misa
2024-01-18 20:21:02 -08:00
committed by Misa Elizabeth Kai
parent 3b0757bd82
commit 8b03fbd9f4
9 changed files with 249 additions and 177 deletions

View File

@@ -385,15 +385,8 @@ static void menurender(void)
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Disable screen effects, enable slowdown modes or invincibility."), tr, tg, tb);
break;
case 5:
{
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Language"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Change the language."), tr, tg, tb);
if (!graphics.textboxes.empty())
{
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Can not change the language while a textbox is displayed in-game."), tr, tg, tb);
}
}
font::print_wrap(PR_CEN, -1, 65, loc::gettext("Change the language."), tr, tg, tb);
}
break;
case Menu::graphicoptions: