mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-22 00:39:46 +01:00
Entity.cpp: make all activity prompts translatable
This adds loc::gettext for all "Press {button} to explode" and friends, and also changes the interact_prompt function in Render.cpp to expect {button} instead of %s. This commit is part of rewritten history of the localization branch. The original (unsquashed) commit history can be found here: https://github.com/Dav999-v/VVVVVV/tree/localization-orig
This commit is contained in:
parent
2210863e73
commit
c142b3bb3b
2 changed files with 43 additions and 52 deletions
|
@ -7,6 +7,7 @@
|
|||
#include "Game.h"
|
||||
#include "GlitchrunnerMode.h"
|
||||
#include "Graphics.h"
|
||||
#include "Localization.h"
|
||||
#include "Map.h"
|
||||
#include "Music.h"
|
||||
#include "Script.h"
|
||||
|
@ -856,211 +857,211 @@ void entityclass::createblock( int t, int xp, int yp, int w, int h, int trig /*=
|
|||
switch(trig)
|
||||
{
|
||||
case 0: //testing zone
|
||||
block.prompt = "Press %s to explode";
|
||||
block.prompt = loc::gettext("Press {button} to explode");
|
||||
block.script = "intro";
|
||||
block.setblockcolour("orange");
|
||||
trig=1;
|
||||
break;
|
||||
case 1:
|
||||
block.prompt = "Press %s to talk to Violet";
|
||||
block.prompt = loc::gettext("Press {button} to talk to Violet");
|
||||
block.script = "talkpurple";
|
||||
block.setblockcolour("purple");
|
||||
trig=0;
|
||||
break;
|
||||
case 2:
|
||||
block.prompt = "Press %s to talk to Vitellary";
|
||||
block.prompt = loc::gettext("Press {button} to talk to Vitellary");
|
||||
block.script = "talkyellow";
|
||||
block.setblockcolour("yellow");
|
||||
trig=0;
|
||||
break;
|
||||
case 3:
|
||||
block.prompt = "Press %s to talk to Vermilion";
|
||||
block.prompt = loc::gettext("Press {button} to talk to Vermilion");
|
||||
block.script = "talkred";
|
||||
block.setblockcolour("red");
|
||||
trig=0;
|
||||
break;
|
||||
case 4:
|
||||
block.prompt = "Press %s to talk to Verdigris";
|
||||
block.prompt = loc::gettext("Press {button} to talk to Verdigris");
|
||||
block.script = "talkgreen";
|
||||
block.setblockcolour("green");
|
||||
trig=0;
|
||||
break;
|
||||
case 5:
|
||||
block.prompt = "Press %s to talk to Victoria";
|
||||
block.prompt = loc::gettext("Press {button} to talk to Victoria");
|
||||
block.script = "talkblue";
|
||||
block.setblockcolour("blue");
|
||||
trig=0;
|
||||
break;
|
||||
case 6:
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.script = "terminal_station_1";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 7:
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.script = "terminal_outside_1";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 8:
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.script = "terminal_outside_2";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 9:
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.script = "terminal_outside_3";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 10:
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.script = "terminal_outside_4";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 11:
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.script = "terminal_outside_5";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 12:
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.script = "terminal_outside_6";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 13:
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.script = "terminal_finallevel";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 14:
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.script = "terminal_station_2";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 15:
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.script = "terminal_station_3";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 16:
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.script = "terminal_station_4";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 17:
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.script = "terminal_warp_1";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 18:
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.script = "terminal_warp_2";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 19:
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.script = "terminal_lab_1";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 20:
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.script = "terminal_lab_2";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 21:
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.script = "terminal_secretlab";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 22:
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.script = "terminal_shipcomputer";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 23:
|
||||
block.prompt = "Press %s to activate terminals";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminals");
|
||||
block.script = "terminal_radio";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 24:
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
block.script = "terminal_jukebox";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 25:
|
||||
block.prompt = "Passion for Exploring";
|
||||
block.prompt = loc::gettext("Passion for Exploring");
|
||||
block.script = "terminal_juke1";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 26:
|
||||
block.prompt = "Pushing Onwards";
|
||||
block.prompt = loc::gettext("Pushing Onwards");
|
||||
block.script = "terminal_juke2";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 27:
|
||||
block.prompt = "Positive Force";
|
||||
block.prompt = loc::gettext("Positive Force");
|
||||
block.script = "terminal_juke3";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 28:
|
||||
block.prompt = "Presenting VVVVVV";
|
||||
block.prompt = loc::gettext("Presenting VVVVVV");
|
||||
block.script = "terminal_juke4";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 29:
|
||||
block.prompt = "Potential for Anything";
|
||||
block.prompt = loc::gettext("Potential for Anything");
|
||||
block.script = "terminal_juke5";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 30:
|
||||
block.prompt = "Predestined Fate";
|
||||
block.prompt = loc::gettext("Predestined Fate");
|
||||
block.script = "terminal_juke6";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 31:
|
||||
block.prompt = "Pipe Dream";
|
||||
block.prompt = loc::gettext("Pipe Dream");
|
||||
block.script = "terminal_juke7";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 32:
|
||||
block.prompt = "Popular Potpourri";
|
||||
block.prompt = loc::gettext("Popular Potpourri");
|
||||
block.script = "terminal_juke8";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 33:
|
||||
block.prompt = "Pressure Cooker";
|
||||
block.prompt = loc::gettext("Pressure Cooker");
|
||||
block.script = "terminal_juke9";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
break;
|
||||
case 34:
|
||||
block.prompt = "ecroF evitisoP";
|
||||
block.prompt = loc::gettext("ecroF evitisoP");
|
||||
block.script = "terminal_juke10";
|
||||
block.setblockcolour("orange");
|
||||
trig=0;
|
||||
|
@ -1068,11 +1069,11 @@ void entityclass::createblock( int t, int xp, int yp, int w, int h, int trig /*=
|
|||
case 35:
|
||||
if (custom)
|
||||
{
|
||||
block.prompt = "Press %s to interact";
|
||||
block.prompt = loc::gettext("Press {button} to interact");
|
||||
}
|
||||
else
|
||||
{
|
||||
block.prompt = "Press %s to activate terminal";
|
||||
block.prompt = loc::gettext("Press {button} to activate terminal");
|
||||
}
|
||||
block.script = "custom_"+customscript;
|
||||
block.setblockcolour("orange");
|
||||
|
|
|
@ -1839,26 +1839,18 @@ static const char* interact_prompt(
|
|||
const size_t buffer_size,
|
||||
const char* raw
|
||||
) {
|
||||
const char* string_fmt_loc = SDL_strstr(raw, "%s");
|
||||
const char* button;
|
||||
|
||||
if (string_fmt_loc == NULL /* No "%s". */
|
||||
|| string_fmt_loc != SDL_strchr(raw, '%') /* First "%" found is not "%s". */
|
||||
|| SDL_strchr(&string_fmt_loc[1], '%') != NULL) /* Other "%" after "%s". */
|
||||
{
|
||||
return raw;
|
||||
}
|
||||
|
||||
if (game.separate_interact)
|
||||
{
|
||||
button = "E";
|
||||
button = loc::gettext("E");
|
||||
}
|
||||
else
|
||||
{
|
||||
button = "ENTER";
|
||||
button = loc::gettext("ENTER");
|
||||
}
|
||||
|
||||
SDL_snprintf(buffer, buffer_size, raw, button);
|
||||
vformat_buf(buffer, buffer_size, raw, "button:str", button);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
@ -1985,11 +1977,10 @@ void gamerender(void)
|
|||
if (game.readytotele > 100 || game.oldreadytotele > 100)
|
||||
{
|
||||
char buffer[SCREEN_WIDTH_CHARS + 1];
|
||||
static const char raw[] = "- Press %s to Teleport -";
|
||||
const char* final_string = interact_prompt(
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
raw
|
||||
loc::gettext("- Press {button} to Teleport -")
|
||||
);
|
||||
int alpha = graphics.lerp(game.oldreadytotele, game.readytotele);
|
||||
|
||||
|
@ -2905,11 +2896,10 @@ void teleporterrender(void)
|
|||
if (game.useteleporter)
|
||||
{
|
||||
char buffer[SCREEN_WIDTH_CHARS + 1];
|
||||
static const char raw[] = "Press %s to Teleport";
|
||||
const char* final_string = interact_prompt(
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
raw
|
||||
loc::gettext("Press {button} to Teleport")
|
||||
);
|
||||
|
||||
//Instructions!
|
||||
|
|
Loading…
Reference in a new issue