Fixes saving isMasterQuest and fixes default values for rando sliders. (#1833)

* Fixes saving `isMasterQuest` and fixes default values for rando sliders.

* Changed slider default values

* Fixes default dropdown values for Ganon Trials and MQ Dungeons.

* Ensure's consistent default values are used for all `CVar_GetS32`'s
This commit is contained in:
Christopher Leggett 2022-10-23 14:32:35 -04:00 committed by GitHub
parent 60c9e869e3
commit e2a9461005
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View File

@ -2419,7 +2419,7 @@ void GenerateRandomizerImgui() {
cvarSettings[RSK_RAINBOW_BRIDGE_REWARD_COUNT] = CVar_GetS32("gRandomizeRewardCount", 9);
cvarSettings[RSK_RAINBOW_BRIDGE_DUNGEON_COUNT] = CVar_GetS32("gRandomizeDungeonCount", 8);
cvarSettings[RSK_RAINBOW_BRIDGE_TOKEN_COUNT] = CVar_GetS32("gRandomizeTokenCount", 100);
cvarSettings[RSK_RANDOM_TRIALS] = CVar_GetS32("gRandomizeGanonTrial", 1);
cvarSettings[RSK_RANDOM_TRIALS] = CVar_GetS32("gRandomizeGanonTrial", 0);
cvarSettings[RSK_TRIAL_COUNT] = CVar_GetS32("gRandomizeGanonTrialCount", 6);
cvarSettings[RSK_STARTING_OCARINA] = CVar_GetS32("gRandomizeStartingOcarina", 0);
cvarSettings[RSK_SHUFFLE_OCARINA] = CVar_GetS32("gRandomizeShuffleOcarinas", 0) ||
@ -2492,7 +2492,7 @@ void GenerateRandomizerImgui() {
if (OTRGlobals::Instance->HasMasterQuest() && OTRGlobals::Instance->HasOriginal()) {
// If both OTRs are loaded.
cvarSettings[RSK_RANDOM_MQ_DUNGEONS] = CVar_GetS32("gRandomizeMqDungeons", 0);
cvarSettings[RSK_MQ_DUNGEON_COUNT] = CVar_GetS32("gRandomizeMqDungeonCount", 0);
cvarSettings[RSK_MQ_DUNGEON_COUNT] = CVar_GetS32("gRandomizeMqDungeonCount", 12);
} else if (OTRGlobals::Instance->HasMasterQuest()) {
// If only Master Quest is loaded.
cvarSettings[RSK_RANDOM_MQ_DUNGEONS] = 1;
@ -2839,12 +2839,13 @@ void DrawRandoEditor(bool& open) {
"\n"
"Random Number - A Random number and set of trials will be required."
);
UIWidgets::EnhancementCombobox("gRandomizeGanonTrial", randoGanonsTrial, 3, 1);
UIWidgets::EnhancementCombobox("gRandomizeGanonTrial", randoGanonsTrial, 3, CVar_GetS32("gRandomizeGanonTrial", 0));
ImGui::PopItemWidth();
if (CVar_GetS32("gRandomizeGanonTrial", 1) == 1) {
if (CVar_GetS32("gRandomizeGanonTrial", 0) == 1) {
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::EnhancementSliderInt("Ganon's Trial Count: %d", "##RandoTrialCount",
"gRandomizeGanonTrialCount", 1, 6, "", 6, true);
"gRandomizeGanonTrialCount", 1, 6, "",
CVar_GetS32("gRandomizeGanonTrialCount", 6), true);
UIWidgets::InsertHelpHoverText("Set the number of trials required to enter Ganon's Tower.");
}
@ -2863,12 +2864,12 @@ void DrawRandoEditor(bool& open) {
"\n"
"Random Number - A Random number and set of dungeons will be their Master Quest varieties."
);
UIWidgets::EnhancementCombobox("gRandomizeMqDungeons", randoMqDungeons, 3, 1);
UIWidgets::EnhancementCombobox("gRandomizeMqDungeons", randoMqDungeons, 3, CVar_GetS32("gRandomizeMqDungeons", 0));
ImGui::PopItemWidth();
if (CVar_GetS32("gRandomizeMqDungeons", 1) == 1) {
if (CVar_GetS32("gRandomizeMqDungeons", 0) == 1) {
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::EnhancementSliderInt("Master Quest Dungeon Count: %d", "##RandoMqDungeonCount",
"gRandomizeMqDungeonCount", 1, 12, "", 12, true);
"gRandomizeMqDungeonCount", 1, 12, "", CVar_GetS32("gRandomizeMqDungeonCount", 12), true);
}
}

View File

@ -1197,7 +1197,7 @@ void SaveManager::SaveBase() {
SaveManager::Instance->SaveArray("randomizerInf", ARRAY_COUNT(gSaveContext.randomizerInf), [](size_t i) {
SaveManager::Instance->SaveData("", gSaveContext.randomizerInf[i]);
});
SaveManager::Instance->SaveData("isMasterQuest", ResourceMgr_IsGameMasterQuest());
SaveManager::Instance->SaveData("isMasterQuest", gSaveContext.isMasterQuest);
}
void SaveManager::SaveArray(const std::string& name, const size_t size, SaveArrayFunc func) {