Disable switching languages during cutscene tests

Not gonna lie, I am a bit disappointed at having to do this, because it
actually worked pretty well despite a few bugs depending on which
language you entered with. But that's only because I'm working with
the official translation files, which are in sync with each other.

With translation files that are completely arbitrary, it would be
apparent that switching languages during the cutscene test doesn't
really make sense. Like, at all. That's because the list of cutscenes is
populated entirely from language-specific XML and the cutscenes in them
are also from language-specific XML. So keeping the same position in the
menu doesn't really make sense, and keeping the same position in a
cutscene definitely doesn't make sense.
This commit is contained in:
Misa 2024-01-21 23:43:03 -08:00 committed by Misa Elizabeth Kai
parent 3d61f9067b
commit ad6e31aa12
3 changed files with 68 additions and 35 deletions

View File

@ -6809,7 +6809,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
option(loc::gettext("audio"));
option(loc::gettext("game pad"));
option(loc::gettext("accessibility"));
option(loc::gettext("language"));
option(loc::gettext("language"), !translator_cutscene_test);
option(loc::gettext("return"));
menuyoff = 0;
maxspacing = 15;

View File

@ -1062,6 +1062,12 @@ static void menuactionpress(void)
break;
case 5:
//language options
if (game.translator_cutscene_test)
{
music.playef(Sound_CRY);
break;
}
music.playef(Sound_VIRIDIAN);
loc::loadlanguagelist();
loc::pre_title_lang_menu = false;

View File

@ -142,6 +142,66 @@ static int changemousestate(
/* Also used in Input.cpp. */
void recomputetextboxes(void);
bool cycle_language(bool should_recompute_textboxes)
{
extern KeyPoll key;
if (game.gamestate == TITLEMODE
&& game.currentmenuname == Menu::translator_options_cutscenetest)
{
/* Unfortunately, despite how it may appear to be working, the options
* are actually language-specific, and the order could be totally
* different between languages too. So we can't cycle in this menu. */
music.playef(Sound_CRY);
return should_recompute_textboxes;
}
if (game.translator_cutscene_test)
{
/* Refuse cycling here for similar reasons, even if it seems like it's
* working. The text boxes are based off of the language XML and
* could be completely different between languages. */
music.playef(Sound_CRY);
return should_recompute_textboxes;
}
int i = loc::languagelist_curlang;
if (key.keymap[SDLK_LSHIFT])
{
/* Backwards */
i--;
}
else
{
/* Forwards */
i++;
}
if (!loc::languagelist.empty())
{
i = POS_MOD(i, (int) loc::languagelist.size());
loc::languagelist_curlang = i;
loc::lang = loc::languagelist[i].code;
loc::loadtext(false);
graphics.grphx.init_translations();
should_recompute_textboxes = true;
}
if (game.gamestate == TITLEMODE)
{
int temp = game.menucountdown;
game.createmenu(game.currentmenuname, true);
game.menucountdown = temp;
if (game.currentmenuname == Menu::language)
{
game.currentmenuoption = i;
}
}
return should_recompute_textboxes;
}
void KeyPoll::Poll(void)
{
static int raw_mousex = 0;
@ -188,40 +248,7 @@ void KeyPoll::Poll(void)
if (keymap[SDLK_LCTRL])
{
/* Debug keybind to cycle language. */
int i = loc::languagelist_curlang;
if (keymap[SDLK_LSHIFT])
{
/* Backwards */
i--;
}
else
{
/* Forwards */
i++;
}
if (!loc::languagelist.empty())
{
i = POS_MOD(i, (int) loc::languagelist.size());
loc::languagelist_curlang = i;
loc::lang = loc::languagelist[i].code;
loc::loadtext(false);
graphics.grphx.init_translations();
should_recompute_textboxes = true;
}
if (game.gamestate == TITLEMODE)
{
int temp = game.menucountdown;
game.createmenu(game.currentmenuname, true);
game.menucountdown = temp;
if (game.currentmenuname == Menu::language)
{
game.currentmenuoption = i;
}
}
should_recompute_textboxes = cycle_language(should_recompute_textboxes);
}
else
{