use enum for language (#2097)

Co-authored-by: briaguya <briaguya@alice>
This commit is contained in:
briaguya 2022-12-06 00:36:53 -05:00 committed by GitHub
parent 1e0e80f580
commit 4ee0ddaa15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 9 deletions

View File

@ -23,7 +23,7 @@ static BootCommand sCommands[] = { { "--skiplogo", BootCommands_Command_SkipLogo
void BootCommands_Init() void BootCommands_Init()
{ {
CVar_RegisterS32("gDebugEnabled", 0); CVar_RegisterS32("gDebugEnabled", 0);
CVar_RegisterS32("gLanguages", 0); //0 = English / 1 = German / 2 = French CVar_RegisterS32("gLanguages", LANGUAGE_ENG);
CVar_RegisterS32("gHudColors", 0); //0 = N64 / 1 = NGC / 2 = Custom CVar_RegisterS32("gHudColors", 0); //0 = N64 / 1 = NGC / 2 = Custom
CVar_RegisterS32("gInvertYAxis", 1); CVar_RegisterS32("gInvertYAxis", 1);
CVar_RegisterS32("gTrailDuration", 4); // 4 = Default trail duration CVar_RegisterS32("gTrailDuration", 4); // 4 = Default trail duration

View File

@ -291,9 +291,9 @@ namespace GameMenuBar {
UIWidgets::Spacer(0); UIWidgets::Spacer(0);
if (ImGui::BeginMenu("Languages")) { if (ImGui::BeginMenu("Languages")) {
UIWidgets::EnhancementRadioButton("English", "gLanguages", 0); UIWidgets::EnhancementRadioButton("English", "gLanguages", LANGUAGE_ENG);
UIWidgets::EnhancementRadioButton("German", "gLanguages", 1); UIWidgets::EnhancementRadioButton("German", "gLanguages", LANGUAGE_GER);
UIWidgets::EnhancementRadioButton("French", "gLanguages", 2); UIWidgets::EnhancementRadioButton("French", "gLanguages", LANGUAGE_FRA);
ImGui::EndMenu(); ImGui::EndMenu();
} }
ImGui::EndMenu(); ImGui::EndMenu();

View File

@ -465,9 +465,9 @@ namespace UIWidgets {
Second is the cvar name where MyID will be saved. Second is the cvar name where MyID will be saved.
Note: the CVar name should be the same to each Buddies. Note: the CVar name should be the same to each Buddies.
Example : Example :
EnhancementRadioButton("English", "gLanguages", 0); EnhancementRadioButton("English", "gLanguages", LANGUAGE_ENG);
EnhancementRadioButton("German", "gLanguages", 1); EnhancementRadioButton("German", "gLanguages", LANGUAGE_GER);
EnhancementRadioButton("French", "gLanguages", 2); EnhancementRadioButton("French", "gLanguages", LANGUAGE_FRA);
*/ */
std::string make_invisible = "##"; std::string make_invisible = "##";
make_invisible += text; make_invisible += text;

View File

@ -458,8 +458,7 @@ void GameState_Update(GameState* gameState) {
} }
} }
//since our CVar is same value and properly default to 0 there is not problems doing this in single line. gSaveContext.language = CVar_GetS32("gLanguages", LANGUAGE_ENG);
gSaveContext.language = CVar_GetS32("gLanguages", 0);
gameState->frames++; gameState->frames++;
} }