1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 09:39:43 +01:00

Fix "no language files found" title screen bug

If you've never set a language before (<lang_set> is not 1), then the
language screen will show up before the title screen. Selecting the
language will then make the title screen show up.

If no language files are present, the old logic for handling this was
to simply show the language screen at startup anyway, and let it
display the error message that language files are missing, as a warning
that the game is not packaged correctly. However, this logic has two
flaws:

- If the user has ever had language files and set a language before
  (in a VVVVVV on that computer), the warning element is gone because
  the language screen is not shown in that case - the game is simply in
  English

- If the user has never set a language before, and then goes to the
  language screen later via the menu, they will be sent to the title
  screen, even if they were in-game. The main menu will also be broken.

The new way is to not show the language screen at startup if language
files are missing, and to change the logic so that you will only be
sent to the title screen if you actually haven't seen the title screen
yet.

I will also add a proper warning that fonts or language files are
missing by adding a message in the bottom left corner (in place of the
MMMMMM installed message).
This commit is contained in:
Dav999 2023-08-29 23:03:08 +02:00 committed by Misa Elizabeth Kai
parent 365ac514a6
commit da13f39f5d
4 changed files with 9 additions and 5 deletions

View file

@ -1098,8 +1098,6 @@ static void menuactionpress(void)
{
music.playef(Sound_VIRIDIAN);
bool show_title = !loc::lang_set;
if (loc::languagelist.size() != 0 && (unsigned)game.currentmenuoption < loc::languagelist.size())
{
loc::lang = loc::languagelist[game.currentmenuoption].code;
@ -1107,12 +1105,13 @@ static void menuactionpress(void)
loc::lang_set = true;
}
if (show_title)
if (loc::pre_title_lang_menu)
{
/* Make the title screen appear, we haven't seen it yet */
game.menustart = false;
game.createmenu(Menu::mainmenu);
game.currentmenuoption = 0;
loc::pre_title_lang_menu = false;
}
else
{
@ -2226,7 +2225,7 @@ void titleinput(void)
&& game.menucountdown <= 0
&& (key.isDown(27) || key.isDown(game.controllerButton_esc)))
{
if (game.currentmenuname == Menu::language && !loc::lang_set)
if (game.currentmenuname == Menu::language && loc::pre_title_lang_menu)
{
/* Don't exit from the initial language screen,
* you can't do this on the loading/title screen either. */

View file

@ -12,6 +12,8 @@ namespace loc
{
bool lang_set = false;
bool pre_title_lang_menu = false;
std::string lang = "en";
std::string lang_custom = "";
std::string new_level_font = "";

View file

@ -45,6 +45,8 @@ struct TextboxFormat
};
extern bool lang_set;
extern bool pre_title_lang_menu;
extern std::string lang;
extern std::string lang_custom;
extern std::string new_level_font;

View file

@ -661,8 +661,9 @@ int main(int argc, char *argv[])
game.gamestate = TITLEMODE;
if (game.slowdown == 0) game.slowdown = 30;
if (!loc::lang_set)
if (!loc::lang_set && !loc::languagelist.empty())
{
loc::pre_title_lang_menu = true;
game.gamestate = TITLEMODE;
game.menustart = true;
game.createmenu(Menu::language);