1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-17 16:39:42 +01:00
VVVVVV/desktop_version/src/BlockV.cpp
Dav999 700aa4aaa0 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! :)
2023-09-20 16:20:24 -07:00

56 lines
1,008 B
C++

#include "BlockV.h"
#include <SDL_stdinc.h>
#include "Script.h"
#include "Font.h"
blockclass::blockclass(void)
{
clear();
}
void blockclass::clear(void)
{
type = 0;
trigger = 0;
xp = 0;
yp = 0;
wp = 0;
hp = 0;
rect.x = xp;
rect.y = yp;
rect.w = wp;
rect.h = hp;
r = 0;
g = 0;
b = 0;
activity_y = 0;
/* std::strings get initialized automatically, but this is
* in case this function gets called again after construction */
script.clear();
prompt.clear();
gettext = true;
}
void blockclass::rectset(const int xi, const int yi, const int wi, const int hi)
{
rect.x = xi;
rect.y = yi;
rect.w = wi;
rect.h = hi;
}
void blockclass::setblockcolour(const char* col)
{
bool exists = ::script.textbox_colours.count(col) != 0;
r = ::script.textbox_colours[exists ? col : "gray"].r;
g = ::script.textbox_colours[exists ? col : "gray"].g;
b = ::script.textbox_colours[exists ? col : "gray"].b;
}