mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 09:39:43 +01:00
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:
parent
fd84922a92
commit
700aa4aaa0
6 changed files with 51 additions and 45 deletions
|
@ -35,7 +35,7 @@ void blockclass::clear(void)
|
|||
script.clear();
|
||||
prompt.clear();
|
||||
|
||||
print_flags = PR_FONT_INTERFACE;
|
||||
gettext = true;
|
||||
}
|
||||
|
||||
void blockclass::rectset(const int xi, const int yi, const int wi, const int hi)
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
std::string script, prompt;
|
||||
int r, g, b;
|
||||
int activity_y;
|
||||
uint32_t print_flags;
|
||||
bool gettext;
|
||||
};
|
||||
|
||||
#endif /* BLOCKV_H */
|
||||
|
|
|
@ -858,211 +858,211 @@ void entityclass::createblock( int t, int xp, int yp, int w, int h, int trig /*=
|
|||
switch(trig)
|
||||
{
|
||||
case 0: //testing zone
|
||||
block.prompt = loc::gettext("Press {button} to explode");
|
||||
block.prompt = "Press {button} to explode";
|
||||
block.script = "intro";
|
||||
block.setblockcolour("orange");
|
||||
trig=1;
|
||||
break;
|
||||
case 1:
|
||||
block.prompt = loc::gettext("Press {button} to talk to Violet");
|
||||
block.prompt = "Press {button} to talk to Violet";
|
||||
block.script = "talkpurple";
|
||||
block.setblockcolour("purple");
|
||||
trig=0;
|
||||
break;
|
||||
case 2:
|
||||
block.prompt = loc::gettext("Press {button} to talk to Vitellary");
|
||||
block.prompt = "Press {button} to talk to Vitellary";
|
||||
block.script = "talkyellow";
|
||||
block.setblockcolour("yellow");
|
||||
trig=0;
|
||||
break;
|
||||
case 3:
|
||||
block.prompt = loc::gettext("Press {button} to talk to Vermilion");
|
||||
block.prompt = "Press {button} to talk to Vermilion";
|
||||
block.script = "talkred";
|
||||
block.setblockcolour("red");
|
||||
trig=0;
|
||||
break;
|
||||
case 4:
|
||||
block.prompt = loc::gettext("Press {button} to talk to Verdigris");
|
||||
block.prompt = "Press {button} to talk to Verdigris";
|
||||
block.script = "talkgreen";
|
||||
block.setblockcolour("green");
|
||||
trig=0;
|
||||
break;
|
||||
case 5:
|
||||
block.prompt = loc::gettext("Press {button} to talk to Victoria");
|
||||
block.prompt = "Press {button} to talk to Victoria";
|
||||
block.script = "talkblue";
|
||||
block.setblockcolour("blue");
|
||||
trig=0;
|
||||
break;
|
||||
case 6:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
block.script = "terminal_station_1";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 7:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
block.script = "terminal_outside_1";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 8:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
block.script = "terminal_outside_2";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 9:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
block.script = "terminal_outside_3";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 10:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
block.script = "terminal_outside_4";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 11:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
block.script = "terminal_outside_5";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 12:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
block.script = "terminal_outside_6";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 13:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
block.script = "terminal_finallevel";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 14:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
block.script = "terminal_station_2";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 15:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
block.script = "terminal_station_3";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 16:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
block.script = "terminal_station_4";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 17:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
block.script = "terminal_warp_1";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 18:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
block.script = "terminal_warp_2";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 19:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
block.script = "terminal_lab_1";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 20:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
block.script = "terminal_lab_2";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 21:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
block.script = "terminal_secretlab";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 22:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
block.script = "terminal_shipcomputer";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 23:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminals");
|
||||
block.prompt = "Press {button} to activate terminals";
|
||||
block.script = "terminal_radio";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 24:
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
block.script = "terminal_jukebox";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 25:
|
||||
block.prompt = loc::gettext("Passion for Exploring");
|
||||
block.prompt = "Passion for Exploring";
|
||||
block.script = "terminal_juke1";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 26:
|
||||
block.prompt = loc::gettext("Pushing Onwards");
|
||||
block.prompt = "Pushing Onwards";
|
||||
block.script = "terminal_juke2";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 27:
|
||||
block.prompt = loc::gettext("Positive Force");
|
||||
block.prompt = "Positive Force";
|
||||
block.script = "terminal_juke3";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 28:
|
||||
block.prompt = loc::gettext("Presenting VVVVVV");
|
||||
block.prompt = "Presenting VVVVVV";
|
||||
block.script = "terminal_juke4";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 29:
|
||||
block.prompt = loc::gettext("Potential for Anything");
|
||||
block.prompt = "Potential for Anything";
|
||||
block.script = "terminal_juke5";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 30:
|
||||
block.prompt = loc::gettext("Predestined Fate");
|
||||
block.prompt = "Predestined Fate";
|
||||
block.script = "terminal_juke6";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 31:
|
||||
block.prompt = loc::gettext("Pipe Dream");
|
||||
block.prompt = "Pipe Dream";
|
||||
block.script = "terminal_juke7";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 32:
|
||||
block.prompt = loc::gettext("Popular Potpourri");
|
||||
block.prompt = "Popular Potpourri";
|
||||
block.script = "terminal_juke8";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 33:
|
||||
block.prompt = loc::gettext("Pressure Cooker");
|
||||
block.prompt = "Pressure Cooker";
|
||||
block.script = "terminal_juke9";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 34:
|
||||
block.prompt = loc::gettext("ecroF evitisoP");
|
||||
block.prompt = "ecroF evitisoP";
|
||||
block.script = "terminal_juke10";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
|
@ -1070,11 +1070,11 @@ void entityclass::createblock( int t, int xp, int yp, int w, int h, int trig /*=
|
|||
case 35:
|
||||
if (custom)
|
||||
{
|
||||
block.prompt = loc::gettext("Press {button} to interact");
|
||||
block.prompt = "Press {button} to interact";
|
||||
}
|
||||
else
|
||||
{
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.prompt = "Press {button} to activate terminal";
|
||||
}
|
||||
block.script = "custom_"+customscript;
|
||||
block.setblockcolour("orange");
|
||||
|
@ -1087,12 +1087,12 @@ void entityclass::createblock( int t, int xp, int yp, int w, int h, int trig /*=
|
|||
if (customactivitytext != "")
|
||||
{
|
||||
block.prompt = customactivitytext;
|
||||
block.print_flags = PR_FONT_LEVEL;
|
||||
block.gettext = false;
|
||||
customactivitytext = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
block.print_flags = PR_FONT_INTERFACE;
|
||||
block.gettext = true;
|
||||
}
|
||||
|
||||
if (customactivitycolour != "")
|
||||
|
|
|
@ -489,7 +489,7 @@ public:
|
|||
int oldreadytotele;
|
||||
int activity_r, activity_g, activity_b, activity_y;
|
||||
std::string activity_lastprompt;
|
||||
uint32_t activity_print_flags;
|
||||
bool activity_gettext;
|
||||
|
||||
std::string telesummary, quicksummary, customquicksummary;
|
||||
bool save_exists(void);
|
||||
|
|
|
@ -1431,7 +1431,7 @@ void gamelogic(void)
|
|||
&& INBOUNDS_VEC(game.activeactivity, obj.blocks))
|
||||
{
|
||||
game.activity_lastprompt = obj.blocks[game.activeactivity].prompt;
|
||||
game.activity_print_flags = obj.blocks[game.activeactivity].print_flags;
|
||||
game.activity_gettext = obj.blocks[game.activeactivity].gettext;
|
||||
game.activity_r = obj.blocks[game.activeactivity].r;
|
||||
game.activity_g = obj.blocks[game.activeactivity].g;
|
||||
game.activity_b = obj.blocks[game.activeactivity].b;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue