Fixes missing options and some incorrect disabling logic (#3545)

This commit is contained in:
Christopher Leggett 2023-12-20 16:51:48 -05:00 committed by GitHub
parent bb4fb22188
commit 7f961abd8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 148 additions and 151 deletions

View File

@ -221,7 +221,6 @@ bool Option::RenderCombobox() const {
if (!description.empty()) { if (!description.empty()) {
UIWidgets::InsertHelpHoverText(description.c_str()); UIWidgets::InsertHelpHoverText(description.c_str());
} }
ImGui::BeginGroup();
const std::string comboName = std::string("##") + std::string(cvarName); const std::string comboName = std::string("##") + std::string(cvarName);
if (ImGui::BeginCombo(comboName.c_str(), options[selected].c_str())) { if (ImGui::BeginCombo(comboName.c_str(), options[selected].c_str())) {
for (size_t i = 0; i < options.size(); i++) { for (size_t i = 0; i < options.size(); i++) {
@ -236,7 +235,6 @@ bool Option::RenderCombobox() const {
} }
ImGui::EndCombo(); ImGui::EndCombo();
} }
ImGui::EndGroup();
if (disabled) { if (disabled) {
UIWidgets::ReEnableComponent(disabledText.c_str()); UIWidgets::ReEnableComponent(disabledText.c_str());
} }

View File

@ -92,7 +92,7 @@ void Settings::CreateOptions() {
mOptions[RSK_MQ_GTG] = Option::U8("Gerudo Training Grounds", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, "gRandomizeMqDungeonsGTG", "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); mOptions[RSK_MQ_GTG] = Option::U8("Gerudo Training Grounds", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, "gRandomizeMqDungeonsGTG", "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE);
mOptions[RSK_MQ_GANONS_CASTLE] = Option::U8("Ganon's Castle", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, "gRandomizeMqDungeonsGanonsCastle", "", WidgetType::Combobox, RO_MQ_SET_VANILLA); mOptions[RSK_MQ_GANONS_CASTLE] = Option::U8("Ganon's Castle", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, "gRandomizeMqDungeonsGanonsCastle", "", WidgetType::Combobox, RO_MQ_SET_VANILLA);
mOptions[RSK_SHUFFLE_DUNGEON_REWARDS] = Option::U8("Shuffle Dungeon Rewards", {"End of Dungeons", "Any Dungeon", "Overworld", "Anywhere"}, OptionCategory::Setting, "gRandomizeShuffleDungeonReward", mOptionDescriptions[RSK_SHUFFLE_DUNGEON_REWARDS], WidgetType::Combobox, RO_DUNGEON_REWARDS_END_OF_DUNGEON); mOptions[RSK_SHUFFLE_DUNGEON_REWARDS] = Option::U8("Shuffle Dungeon Rewards", {"End of Dungeons", "Any Dungeon", "Overworld", "Anywhere"}, OptionCategory::Setting, "gRandomizeShuffleDungeonReward", mOptionDescriptions[RSK_SHUFFLE_DUNGEON_REWARDS], WidgetType::Combobox, RO_DUNGEON_REWARDS_END_OF_DUNGEON);
mOptions[RSK_LINKS_POCKET] = Option::U8("Link's Pocket", {"Dungeon Reward", "Advancement", "Anything", "Nothing"}, OptionCategory::Setting, "gRandomizeLinksPocket", "", WidgetType::Combobox, RO_LINKS_POCKET_DUNGEON_REWARD, true); mOptions[RSK_LINKS_POCKET] = Option::U8("Link's Pocket", {"Dungeon Reward", "Advancement", "Anything", "Nothing"}, OptionCategory::Setting, "gRandomizeLinksPocket", "", WidgetType::Combobox, RO_LINKS_POCKET_DUNGEON_REWARD);
mOptions[RSK_SHUFFLE_SONGS] = Option::U8("Shuffle Songs", {"Song Locations", "Dungeon Rewards", "Anywhere"}, OptionCategory::Setting, "gRandomizeShuffleSongs", mOptionDescriptions[RSK_SHUFFLE_SONGS], WidgetType::Combobox, RO_SONG_SHUFFLE_SONG_LOCATIONS); mOptions[RSK_SHUFFLE_SONGS] = Option::U8("Shuffle Songs", {"Song Locations", "Dungeon Rewards", "Anywhere"}, OptionCategory::Setting, "gRandomizeShuffleSongs", mOptionDescriptions[RSK_SHUFFLE_SONGS], WidgetType::Combobox, RO_SONG_SHUFFLE_SONG_LOCATIONS);
mOptions[RSK_SHOPSANITY] = Option::U8("Shopsanity", {"Off", "0 Items", "1 Item", "2 Items", "3 Items", "4 Items", "Random"}, OptionCategory::Setting, "gRandomizeShopsanity", mOptionDescriptions[RSK_SHOPSANITY], WidgetType::Combobox, RO_SHOPSANITY_OFF); mOptions[RSK_SHOPSANITY] = Option::U8("Shopsanity", {"Off", "0 Items", "1 Item", "2 Items", "3 Items", "4 Items", "Random"}, OptionCategory::Setting, "gRandomizeShopsanity", mOptionDescriptions[RSK_SHOPSANITY], WidgetType::Combobox, RO_SHOPSANITY_OFF);
mOptions[RSK_SHOPSANITY_PRICES] = Option::U8("Shopsanity Prices", {"Balanced", "Starting Wallet", "Adult Wallet", "Giant's Wallet", "Tycoon's Wallet"}, OptionCategory::Setting, "gRandomizeShopsanityPrices", mOptionDescriptions[RSK_SHOPSANITY_PRICES], WidgetType::Combobox, RO_SHOPSANITY_PRICE_BALANCED, false, IMFLAG_NONE); mOptions[RSK_SHOPSANITY_PRICES] = Option::U8("Shopsanity Prices", {"Balanced", "Starting Wallet", "Adult Wallet", "Giant's Wallet", "Tycoon's Wallet"}, OptionCategory::Setting, "gRandomizeShopsanityPrices", mOptionDescriptions[RSK_SHOPSANITY_PRICES], WidgetType::Combobox, RO_SHOPSANITY_PRICE_BALANCED, false, IMFLAG_NONE);
@ -629,6 +629,7 @@ void Settings::CreateOptions() {
&mOptions[RSK_SHUFFLE_BOSS_SOULS], &mOptions[RSK_SHUFFLE_BOSS_SOULS],
}, false, WidgetContainerType::COLUMN); }, false, WidgetContainerType::COLUMN);
mOptionGroups[RSG_SHUFFLE_DUNGEON_ITEMS_IMGUI] = OptionGroup::SubGroup("Shuffle Dungeon Items", { mOptionGroups[RSG_SHUFFLE_DUNGEON_ITEMS_IMGUI] = OptionGroup::SubGroup("Shuffle Dungeon Items", {
&mOptions[RSK_SHUFFLE_DUNGEON_REWARDS],
&mOptions[RSK_SHUFFLE_MAPANDCOMPASS], &mOptions[RSK_SHUFFLE_MAPANDCOMPASS],
&mOptions[RSK_KEYSANITY], &mOptions[RSK_KEYSANITY],
&mOptions[RSK_GERUDO_KEYS], &mOptions[RSK_GERUDO_KEYS],
@ -1196,14 +1197,6 @@ void Settings::SetAllFromCVar() {
} }
void Settings::UpdateOptionProperties() { void Settings::UpdateOptionProperties() {
// Starting Age - Disabled when Forest is set to Closed or under very specific conditions
if (CVarGetInteger("gRandomizeForest", RO_FOREST_CLOSED) == RO_FOREST_CLOSED ||
(CVarGetInteger("gRandomizeDoorOfTime", RO_DOOROFTIME_CLOSED) == RO_DOOROFTIME_CLOSED &&
CVarGetInteger("gRandomizeShuffleOcarinas", RO_GENERIC_OFF) == RO_GENERIC_OFF)) /* closed door of time with ocarina shuffle off */ {
mOptions[RSK_STARTING_AGE].Disable("This option is disabled due to other optionos making the game unbeatable");
} else {
mOptions[RSK_STARTING_AGE].Enable();
}
// Default to hiding bridge opts and the extra sliders. // Default to hiding bridge opts and the extra sliders.
mOptions[RSK_RAINBOW_BRIDGE].AddFlag(IMFLAG_SEPARATOR_BOTTOM); mOptions[RSK_RAINBOW_BRIDGE].AddFlag(IMFLAG_SEPARATOR_BOTTOM);
mOptions[RSK_BRIDGE_OPTIONS].Hide(); mOptions[RSK_BRIDGE_OPTIONS].Hide();
@ -1212,6 +1205,44 @@ void Settings::UpdateOptionProperties() {
mOptions[RSK_RAINBOW_BRIDGE_REWARD_COUNT].Hide(); mOptions[RSK_RAINBOW_BRIDGE_REWARD_COUNT].Hide();
mOptions[RSK_RAINBOW_BRIDGE_DUNGEON_COUNT].Hide(); mOptions[RSK_RAINBOW_BRIDGE_DUNGEON_COUNT].Hide();
mOptions[RSK_RAINBOW_BRIDGE_TOKEN_COUNT].Hide(); mOptions[RSK_RAINBOW_BRIDGE_TOKEN_COUNT].Hide();
if (CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA) {
mOptionGroups[RSG_AREA_ACCESS_IMGUI].Disable();
mOptions[RSK_STARTING_AGE].Disable("");
mOptions[RSK_GERUDO_FORTRESS].Disable("");
mOptions[RSK_RAINBOW_BRIDGE].Disable("");
mOptions[RSK_BRIDGE_OPTIONS].Disable("");
mOptions[RSK_RAINBOW_BRIDGE_STONE_COUNT].Disable("");
mOptions[RSK_RAINBOW_BRIDGE_MEDALLION_COUNT].Disable("");
mOptions[RSK_RAINBOW_BRIDGE_REWARD_COUNT].Disable("");
mOptions[RSK_RAINBOW_BRIDGE_DUNGEON_COUNT].Disable("");
mOptions[RSK_RAINBOW_BRIDGE_TOKEN_COUNT].Disable("");
mOptions[RSK_GANONS_TRIALS].Disable("");
mOptions[RSK_TRIAL_COUNT].Disable("");
mOptions[RSK_TRIFORCE_HUNT].Disable("");
mOptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL].Disable("");
mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].Disable("");
mOptionGroups[RSG_ITEMS_IMGUI_TABLE].Disable();
mOptionGroups[RSG_GAMEPLAY_IMGUI_TABLE].Disable();
mOptions[RSK_LINKS_POCKET].Disable("");
mOptions[RSK_STARTING_OCARINA].Disable("");
} else {
mOptionGroups[RSG_AREA_ACCESS_IMGUI].Enable();
// Starting Age - Disabled when Forest is set to Closed or under very specific conditions
if (CVarGetInteger("gRandomizeForest", RO_FOREST_CLOSED) == RO_FOREST_CLOSED ||
(CVarGetInteger("gRandomizeDoorOfTime", RO_DOOROFTIME_CLOSED) == RO_DOOROFTIME_CLOSED &&
CVarGetInteger("gRandomizeShuffleOcarinas", RO_GENERIC_OFF) == RO_GENERIC_OFF)) /* closed door of time with ocarina shuffle off */ {
mOptions[RSK_STARTING_AGE].Disable("This option is disabled due to other optionos making the game unbeatable");
} else {
mOptions[RSK_STARTING_AGE].Enable();
}
mOptions[RSK_GERUDO_FORTRESS].Enable();
mOptions[RSK_RAINBOW_BRIDGE].Enable();
mOptions[RSK_BRIDGE_OPTIONS].Enable();
mOptions[RSK_RAINBOW_BRIDGE_STONE_COUNT].Enable();
mOptions[RSK_RAINBOW_BRIDGE_MEDALLION_COUNT].Enable();
mOptions[RSK_RAINBOW_BRIDGE_REWARD_COUNT].Enable();
mOptions[RSK_RAINBOW_BRIDGE_DUNGEON_COUNT].Enable();
mOptions[RSK_RAINBOW_BRIDGE_TOKEN_COUNT].Enable();
const uint8_t bridgeOpt = CVarGetInteger("gRandomizeBridgeRewardOptions", RO_BRIDGE_STANDARD_REWARD); const uint8_t bridgeOpt = CVarGetInteger("gRandomizeBridgeRewardOptions", RO_BRIDGE_STANDARD_REWARD);
switch (CVarGetInteger("gRandomizeRainbowBridge", RO_BRIDGE_VANILLA)) { switch (CVarGetInteger("gRandomizeRainbowBridge", RO_BRIDGE_VANILLA)) {
case RO_BRIDGE_STONES: case RO_BRIDGE_STONES:
@ -1283,6 +1314,8 @@ void Settings::UpdateOptionProperties() {
default: default:
break; break;
} }
mOptions[RSK_GANONS_TRIALS].Enable();
mOptions[RSK_TRIAL_COUNT].Enable();
// Only show the trial count slider if Trials is set to Set Number // Only show the trial count slider if Trials is set to Set Number
if (CVarGetInteger("gRandomizeGanonTrial", RO_GANONS_TRIALS_SKIP) == RO_GANONS_TRIALS_SET_NUMBER) { if (CVarGetInteger("gRandomizeGanonTrial", RO_GANONS_TRIALS_SKIP) == RO_GANONS_TRIALS_SET_NUMBER) {
mOptions[RSK_GANONS_TRIALS].RemoveFlag(IMFLAG_SEPARATOR_BOTTOM); mOptions[RSK_GANONS_TRIALS].RemoveFlag(IMFLAG_SEPARATOR_BOTTOM);
@ -1291,6 +1324,35 @@ void Settings::UpdateOptionProperties() {
mOptions[RSK_GANONS_TRIALS].AddFlag(IMFLAG_SEPARATOR_BOTTOM); mOptions[RSK_GANONS_TRIALS].AddFlag(IMFLAG_SEPARATOR_BOTTOM);
mOptions[RSK_TRIAL_COUNT].Hide(); mOptions[RSK_TRIAL_COUNT].Hide();
} }
mOptions[RSK_TRIFORCE_HUNT].Enable();
mOptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL].Enable();
mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].Enable();
// Remove the pieces required/total sliders and add a separator after Tirforce Hunt if Triforce Hunt is off
if (CVarGetInteger("gRandomizeTriforceHunt", RO_GENERIC_OFF) == RO_GENERIC_OFF) {
mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].Hide();
mOptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL].Hide();
mOptions[RSK_TRIFORCE_HUNT].AddFlag(IMFLAG_SEPARATOR_BOTTOM);
} else {
mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].Unhide();
mOptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL].Unhide();
mOptions[RSK_TRIFORCE_HUNT].RemoveFlag(IMFLAG_SEPARATOR_BOTTOM);
}
// Update triforce pieces required to be capped at the current value for pieces total.
const uint8_t triforceTotal = CVarGetInteger("gRandomizeTriforceHuntTotalPieces", 30);
if (mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].GetOptionCount() != triforceTotal + 1) {
mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].ChangeOptions(NumOpts(1, triforceTotal + 1));
}
mOptionGroups[RSG_ITEMS_IMGUI_TABLE].Enable();
mOptionGroups[RSG_GAMEPLAY_IMGUI_TABLE].Enable();
// Link's Pocket - Disabled when Dungeon Rewards are shuffled to End of Dungeon
if (CVarGetInteger("gRandomizeShuffleDungeonReward", RO_DUNGEON_REWARDS_END_OF_DUNGEON) == RO_DUNGEON_REWARDS_END_OF_DUNGEON) {
mOptions[RSK_LINKS_POCKET].Disable("This option is disabled because \"Dungeon Rewards\" are shuffled to \"End of Dungeons\".");
} else {
mOptions[RSK_LINKS_POCKET].Enable();
}
mOptions[RSK_STARTING_OCARINA].Enable();
}
// Don't show any MQ options if both quests aren't available // Don't show any MQ options if both quests aren't available
if (!(OTRGlobals::Instance->HasMasterQuest() && OTRGlobals::Instance->HasOriginal())) { if (!(OTRGlobals::Instance->HasMasterQuest() && OTRGlobals::Instance->HasOriginal())) {
mOptions[RSK_MQ_DUNGEON_RANDOM].Hide(); mOptions[RSK_MQ_DUNGEON_RANDOM].Hide();
@ -1377,21 +1439,6 @@ void Settings::UpdateOptionProperties() {
} else { } else {
mOptions[RSK_MQ_DUNGEON_SET].Enable(); mOptions[RSK_MQ_DUNGEON_SET].Enable();
} }
// Remove the pieces required/total sliders and add a separator after Tirforce Hunt if Triforce Hunt is off
if (CVarGetInteger("gRandomizeTriforceHunt", RO_GENERIC_OFF) == RO_GENERIC_OFF) {
mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].Hide();
mOptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL].Hide();
mOptions[RSK_TRIFORCE_HUNT].AddFlag(IMFLAG_SEPARATOR_BOTTOM);
} else {
mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].Unhide();
mOptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL].Unhide();
mOptions[RSK_TRIFORCE_HUNT].RemoveFlag(IMFLAG_SEPARATOR_BOTTOM);
}
// Update triforce pieces required to be capped at the current value for pieces total.
const uint8_t triforceTotal = CVarGetInteger("gRandomizeTriforceHuntTotalPieces", 30);
if (mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].GetOptionCount() != triforceTotal + 1) {
mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].ChangeOptions(NumOpts(1, triforceTotal + 1));
}
// Show mixed entrance pool options if mixed entrance pools are enabled at all. // Show mixed entrance pool options if mixed entrance pools are enabled at all.
if (CVarGetInteger("gRandomizeMixedEntrances", RO_GENERIC_OFF)) { if (CVarGetInteger("gRandomizeMixedEntrances", RO_GENERIC_OFF)) {
mOptions[RSK_MIXED_ENTRANCE_POOLS].RemoveFlag(IMFLAG_SEPARATOR_BOTTOM); mOptions[RSK_MIXED_ENTRANCE_POOLS].RemoveFlag(IMFLAG_SEPARATOR_BOTTOM);
@ -1565,54 +1612,6 @@ void Settings::UpdateOptionProperties() {
mOptions[RSK_HINT_CLARITY].Unhide(); mOptions[RSK_HINT_CLARITY].Unhide();
mOptions[RSK_HINT_DISTRIBUTION].Unhide(); mOptions[RSK_HINT_DISTRIBUTION].Unhide();
} }
// Link's Pocket - Disabled when Dungeon Rewards are shuffled to End of Dungeon
if (CVarGetInteger("gRandomizeShuffleDungeonReward", RO_DUNGEON_REWARDS_END_OF_DUNGEON) == RO_DUNGEON_REWARDS_END_OF_DUNGEON) {
mOptions[RSK_LINKS_POCKET].Disable("This option is disabled because \"Dungeon Rewards\" are shuffled to \"End of Dungeons\".");
} else {
mOptions[RSK_LINKS_POCKET].Enable();
}
if (CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA) {
mOptionGroups[RSG_AREA_ACCESS_IMGUI].Disable();
mOptions[RSK_STARTING_AGE].Disable("");
mOptions[RSK_GERUDO_FORTRESS].Disable("");
mOptions[RSK_RAINBOW_BRIDGE].Disable("");
mOptions[RSK_BRIDGE_OPTIONS].Disable("");
mOptions[RSK_RAINBOW_BRIDGE_STONE_COUNT].Disable("");
mOptions[RSK_RAINBOW_BRIDGE_MEDALLION_COUNT].Disable("");
mOptions[RSK_RAINBOW_BRIDGE_REWARD_COUNT].Disable("");
mOptions[RSK_RAINBOW_BRIDGE_DUNGEON_COUNT].Disable("");
mOptions[RSK_RAINBOW_BRIDGE_TOKEN_COUNT].Disable("");
mOptions[RSK_GANONS_TRIALS].Disable("");
mOptions[RSK_TRIAL_COUNT].Disable("");
mOptions[RSK_TRIFORCE_HUNT].Disable("");
mOptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL].Disable("");
mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].Disable("");
mOptionGroups[RSG_ITEMS_IMGUI_TABLE].Disable();
mOptionGroups[RSG_GAMEPLAY_IMGUI_TABLE].Disable();
mOptions[RSK_LINKS_POCKET].Disable("");
mOptions[RSK_STARTING_OCARINA].Disable("");
} else {
mOptionGroups[RSG_AREA_ACCESS_IMGUI].Enable();
mOptions[RSK_STARTING_AGE].Enable();
mOptions[RSK_GERUDO_FORTRESS].Enable();
mOptions[RSK_RAINBOW_BRIDGE].Enable();
mOptions[RSK_BRIDGE_OPTIONS].Enable();
mOptions[RSK_RAINBOW_BRIDGE_STONE_COUNT].Enable();
mOptions[RSK_RAINBOW_BRIDGE_MEDALLION_COUNT].Enable();
mOptions[RSK_RAINBOW_BRIDGE_REWARD_COUNT].Enable();
mOptions[RSK_RAINBOW_BRIDGE_DUNGEON_COUNT].Enable();
mOptions[RSK_RAINBOW_BRIDGE_TOKEN_COUNT].Enable();
mOptions[RSK_GANONS_TRIALS].Enable();
mOptions[RSK_TRIAL_COUNT].Enable();
mOptions[RSK_TRIFORCE_HUNT].Enable();
mOptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL].Enable();
mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].Enable();
mOptionGroups[RSG_ITEMS_IMGUI_TABLE].Enable();
mOptionGroups[RSG_GAMEPLAY_IMGUI_TABLE].Enable();
mOptions[RSK_LINKS_POCKET].Enable();
mOptions[RSK_STARTING_OCARINA].Enable();
}
} }
void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocations, const std::set<RandomizerTrick>& enabledTricks) { void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocations, const std::set<RandomizerTrick>& enabledTricks) {