Reimplements ImGui Disable of options with Vanilla logic selected.

This commit is contained in:
Christopher Leggett 2023-12-10 21:25:59 -05:00
parent 2ef978c792
commit bc49998e55
No known key found for this signature in database
GPG Key ID: 7093AE5FF7037D79
3 changed files with 55 additions and 0 deletions

View File

@ -355,9 +355,18 @@ const std::string& OptionGroup::GetDescription() const {
return mDescription;
}
void OptionGroup::Enable() {
mDisabled = false;
}
void OptionGroup::Disable() {
mDisabled = true;
}
bool OptionGroup::RenderImGui() const { // NOLINT(*-no-recursion)
ImGuiWindow* window = ImGui::GetCurrentWindow();
bool changed = false;
ImGui::BeginDisabled(mDisabled);
if (mContainerType == WidgetContainerType::TABLE) {
if (ImGui::BeginTable(mName.c_str(), static_cast<int>(mSubGroups.size()), ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) {
for (const auto column : mSubGroups) {
@ -424,6 +433,7 @@ bool OptionGroup::RenderImGui() const { // NOLINT(*-no-recursion)
if (mContainerType == WidgetContainerType::TABLE) {
ImGui::EndTable();
}
ImGui::EndDisabled();
return changed;
}
} // namespace Rando

View File

@ -462,6 +462,8 @@ class OptionGroup {
* @brief Renders all of the options contained within this `OptionGroup` in the ImGui menu.
*/
bool RenderImGui() const;
void Disable();
void Enable();
private:
std::string mName;
@ -472,5 +474,6 @@ class OptionGroup {
OptionGroupType mContainsType = OptionGroupType::DEFAULT;
WidgetContainerType mContainerType = WidgetContainerType::BASIC;
std::string mDescription;
bool mDisabled = false;
};
} // namespace Rando

View File

@ -1589,6 +1589,48 @@ void Settings::UpdateOptionProperties() {
} 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) {