mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 09:54:10 +03: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:
committed by
Misa Elizabeth Kai
parent
2210863e73
commit
c142b3bb3b
@@ -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!
|
||||
|
||||
Reference in New Issue
Block a user