Make activity zone prompts loc::gettext'ed at display time

The translations for the prompts used to be looked up at creation time
(when the room is loaded or the activity zone is otherwise spawned),
which meant they would persist through changing the language while
in-game. This would look especially weird when the languages you switch
between use different fonts, as the prompt would show up in the old
language in the new language's font.

This problem is now fixed by letting the activity zone block keep
around the English prompt instead of the translated prompt, and letting
the prompt be translated at display time. This fixes a big part of the
reason I was going to disable changing the language while in-game; I
might only need to do it while textboxes are active now! :)
This commit is contained in:
Dav999
2023-08-30 20:37:16 +02:00
committed by Misa Elizabeth Kai
parent fd84922a92
commit 700aa4aaa0
6 changed files with 51 additions and 45 deletions

View File

@@ -2388,15 +2388,21 @@ void gamerender(void)
float act_alpha = graphics.lerp(game.prev_act_fade, game.act_fade) / 10.0f;
if(game.act_fade>5 || game.prev_act_fade>5)
{
const char* prompt = game.activity_lastprompt.c_str();
if (game.activity_gettext)
{
prompt = loc::gettext(prompt);
}
char buffer[SCREEN_WIDTH_CHARS + 1];
const char* final_string = interact_prompt(
buffer,
sizeof(buffer),
game.activity_lastprompt.c_str()
prompt
);
uint8_t text_r, text_g, text_b;
uint32_t text_flags = game.activity_print_flags | PR_BRIGHTNESS(act_alpha*255) | PR_CJK_LOW | PR_CEN;
uint32_t text_flags = (game.activity_gettext ? PR_FONT_INTERFACE : PR_FONT_LEVEL)
| PR_BRIGHTNESS(act_alpha*255) | PR_CJK_LOW | PR_CEN;
if (game.activity_r == 0 && game.activity_g == 0 && game.activity_b == 0)
{