From 97d454118a25f7f01ef2688e9606d4dc2113683a Mon Sep 17 00:00:00 2001 From: Malkierian Date: Thu, 10 Apr 2025 19:49:47 -0700 Subject: [PATCH] Cal's requests. --- .../cosmetics/CosmeticsEditor.cpp | 10 +++++++ soh/soh/Enhancements/randomizer/option.cpp | 4 ++- .../Enhancements/randomizer/randomizer.cpp | 30 ++++++++----------- .../randomizer/randomizer_check_tracker.cpp | 4 +++ .../randomizer_entrance_tracker.cpp | 5 +++- soh/soh/SohGui/SohMenuEnhancements.cpp | 1 - soh/soh/SohGui/SohMenuNetwork.cpp | 12 +++----- soh/soh/SohGui/SohMenuRandomizer.cpp | 2 -- 8 files changed, 37 insertions(+), 31 deletions(-) diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index e0f530bc2..d68ebb182 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -2376,10 +2376,12 @@ void CosmeticsEditorWindow::DrawElement() { .Step(0.01f) .Size(ImVec2(300.0f, 0.0f)) .Color(THEME_COLOR)); + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); UIWidgets::CVarCheckbox("Randomize All on New Scene", CVAR_COSMETIC("RandomizeAllOnNewScene"), UIWidgets::CheckboxOptions() .Color(THEME_COLOR) .Tooltip("Enables randomizing all unlocked cosmetics when you enter a new scene.")); + ImGui::EndDisabled(); UIWidgets::CVarCheckbox( "Advanced Mode", CVAR_COSMETIC("AdvancedMode"), UIWidgets::CheckboxOptions() @@ -2408,9 +2410,12 @@ void CosmeticsEditorWindow::DrawElement() { } } } + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); if (UIWidgets::Button("Randomize All", UIWidgets::ButtonOptions().Size(ImVec2(250.0f, 0.0f)).Color(THEME_COLOR))) { CosmeticsEditor_RandomizeAll(); } + ImGui::EndDisabled(); + ImGui::SameLine(); if (UIWidgets::Button("Reset All", UIWidgets::ButtonOptions().Size(ImVec2(250.0f, 0.0f)).Color(THEME_COLOR))) { CVarClearBlock("gCosmetics"); @@ -2432,6 +2437,7 @@ void CosmeticsEditorWindow::DrawElement() { } } + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); if (UIWidgets::Button("Rainbow All", UIWidgets::ButtonOptions().Size(ImVec2(250.0f, 0.0f)).Color(THEME_COLOR))) { for (auto& [id, cosmeticOption] : cosmeticOptions) { if (!CVarGetInteger(cosmeticOption.lockedCvar, 0) && @@ -2441,6 +2447,8 @@ void CosmeticsEditorWindow::DrawElement() { } } } + ImGui::EndDisabled(); + ImGui::SameLine(); if (UIWidgets::Button("Un-Rainbow All", UIWidgets::ButtonOptions().Size(ImVec2(250.0f, 0.0f)).Color(THEME_COLOR))) { for (auto& [id, cosmeticOption] : cosmeticOptions) { @@ -2470,6 +2478,7 @@ void CosmeticsEditorWindow::DrawElement() { if (ImGui::BeginTabItem("Keys")) { + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); UIWidgets::Separator(true, true, 2.0f, 2.0f); if (UIWidgets::Button("Give all keys dungeon-specific colors", @@ -2483,6 +2492,7 @@ void CosmeticsEditorWindow::DrawElement() { DrawCosmeticGroup(COSMETICS_GROUP_SMALL_KEYS); DrawCosmeticGroup(COSMETICS_GROUP_BOSS_KEYS); + ImGui::EndDisabled(); ImGui::EndTabItem(); } diff --git a/soh/soh/Enhancements/randomizer/option.cpp b/soh/soh/Enhancements/randomizer/option.cpp index 43fcc2f65..bec719d4b 100644 --- a/soh/soh/Enhancements/randomizer/option.cpp +++ b/soh/soh/Enhancements/randomizer/option.cpp @@ -368,7 +368,9 @@ void OptionGroup::Disable() { bool OptionGroup::RenderImGui() const { // NOLINT(*-no-recursion) ImGuiWindow* window = ImGui::GetCurrentWindow(); bool changed = false; - ImGui::BeginDisabled(mDisabled); + ImGui::BeginDisabled(mDisabled || CVarGetInteger(CVAR_SETTING("DisableChanges"), 0) || + CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) || + CVarGetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0)); if (mContainerType == WidgetContainerType::TABLE) { if (ImGui::BeginTable(mName.c_str(), static_cast(mSubGroups.size()), ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 7a5f8dd69..f1ecd608c 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3690,6 +3690,7 @@ void RandomizerSettingsWindow::DrawElement() { locationsTabOpen = false; tricksTabOpen = false; } + ImGui::EndDisabled(); UIWidgets::Spacer(0); UIWidgets::CVarCheckbox("Manual seed entry", CVAR_RANDOMIZER_SETTING("ManualSeedEntry"), @@ -3725,9 +3726,7 @@ void RandomizerSettingsWindow::DrawElement() { } UIWidgets::Spacer(0); - ImGui::BeginDisabled((CVarGetInteger(CVAR_RANDOMIZER_SETTING("DontGenerateSpoiler"), 0) && - gSaveContext.gameMode != GAMEMODE_FILE_SELECT) || - GameInteractor::IsSaveLoaded()); + ImGui::BeginDisabled((gSaveContext.gameMode != GAMEMODE_FILE_SELECT) || GameInteractor::IsSaveLoaded()); if (UIWidgets::Button("Generate Randomizer", UIWidgets::ButtonOptions().Size(ImVec2(250.f, 0.f)).Color(THEME_COLOR))) { ctx->SetSpoilerLoaded(false); @@ -3746,7 +3745,6 @@ void RandomizerSettingsWindow::DrawElement() { // ImGui::Text("Settings File: %s", presetfilepath.c_str()); UIWidgets::Separator(true, true, 0.f, 0.f); - ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); ImGuiWindow* window = ImGui::GetCurrentWindow(); static ImVec2 cellPadding(8.0f, 8.0f); @@ -3762,8 +3760,6 @@ void RandomizerSettingsWindow::DrawElement() { ImGui::EndTabItem(); } - ImGui::BeginDisabled(CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == - RO_LOGIC_VANILLA); if (ImGui::BeginTabItem("Items")) { ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); ImGui::BeginDisabled(CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == @@ -3775,23 +3771,23 @@ void RandomizerSettingsWindow::DrawElement() { ImGui::PopStyleVar(1); ImGui::EndTabItem(); } - ImGui::EndDisabled(); - ImGui::BeginDisabled(CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == - RO_LOGIC_VANILLA); if (ImGui::BeginTabItem("Gameplay")) { + ImGui::BeginDisabled(CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == + RO_LOGIC_VANILLA); ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); if (mSettings->GetOptionGroup(RSG_GAMEPLAY_IMGUI_TABLE).RenderImGui()) { mNeedsUpdate = true; } + ImGui::EndDisabled(); ImGui::PopStyleVar(1); ImGui::EndTabItem(); } - ImGui::EndDisabled(); - ImGui::BeginDisabled(CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == - RO_LOGIC_VANILLA); if (ImGui::BeginTabItem("Locations")) { + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0) || disableEditingRandoSettings || + CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == + RO_LOGIC_VANILLA); ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); if (!locationsTabOpen) { locationsTabOpen = true; @@ -3924,10 +3920,10 @@ void RandomizerSettingsWindow::DrawElement() { } ImGui::PopStyleVar(1); ImGui::EndTabItem(); + ImGui::EndDisabled(); } else { locationsTabOpen = false; } - ImGui::EndDisabled(); if (ImGui::BeginTabItem("Tricks/Glitches")) { if (!tricksTabOpen) { @@ -3975,8 +3971,9 @@ void RandomizerSettingsWindow::DrawElement() { ImGui::EndTable(); } - ImGui::BeginDisabled(CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == - RO_LOGIC_VANILLA); + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0) || disableEditingRandoSettings || + CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == + RO_LOGIC_VANILLA); // Tricks static std::unordered_map areaTreeDisabled{ @@ -4354,9 +4351,6 @@ void RandomizerSettingsWindow::DrawElement() { ImGui::EndTabBar(); } UIWidgets::PopStyleTabs(); - - ImGui::EndDisabled(); - ImGui::EndDisabled(); } void RandomizerSettingsWindow::UpdateElement() { diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index 93798fea5..f55b1700d 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -2075,11 +2075,13 @@ void CheckTrackerSettingsWindow::DrawElement() { .DefaultIndex(TRACKER_COMBO_BUTTON_L)); } } + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); UIWidgets::CVarCheckbox("Vanilla/MQ Dungeon Spoilers", CVAR_TRACKER_CHECK("MQSpoilers"), UIWidgets::CheckboxOptions() .Tooltip("If enabled, Vanilla/MQ dungeons will show on the tracker immediately. " "Otherwise, Vanilla/MQ dungeon locations must be unlocked.") .Color(THEME_COLOR)); + ImGui::EndDisabled(); if (UIWidgets::CVarCheckbox( "Hide unshuffled shop item checks", CVAR_TRACKER_CHECK("HideUnshuffledShopChecks"), UIWidgets::CheckboxOptions() @@ -2100,6 +2102,7 @@ void CheckTrackerSettingsWindow::DrawElement() { UIWidgets::CheckboxOptions() .Tooltip("If enabled, will show a check's logic when hovering over it.") .Color(THEME_COLOR)); + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); if (UIWidgets::CVarCheckbox("Enable Available Checks", CVAR_TRACKER_CHECK("EnableAvailableChecks"), UIWidgets::CheckboxOptions() .Tooltip("If enabled, will show the checks that are available to be collected " @@ -2108,6 +2111,7 @@ void CheckTrackerSettingsWindow::DrawElement() { enableAvailableChecks = CVarGetInteger(CVAR_TRACKER_CHECK("EnableAvailableChecks"), 0); RecalculateAvailableChecks(); } + ImGui::EndDisabled(); // Filtering settings UIWidgets::PaddedSeparator(); diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp index f93172647..b71bae5b3 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp @@ -690,6 +690,7 @@ void EntranceTrackerSettingsWindow::DrawElement() { UIWidgets::CheckboxOptions() .Tooltip("Automatically scroll to the first available entrance in the current scene") .Color(THEME_COLOR)); + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); UIWidgets::CVarCheckbox("Highlight previous", CVAR_TRACKER_ENTRANCE("HighlightPrevious"), UIWidgets::CheckboxOptions() .Tooltip("Highlight the previous entrance that Link came from") @@ -698,6 +699,7 @@ void EntranceTrackerSettingsWindow::DrawElement() { UIWidgets::CheckboxOptions() .Tooltip("Highlight available entrances in the current scene") .Color(THEME_COLOR)); + ImGui::EndDisabled(); UIWidgets::CVarCheckbox("Hide undiscovered", CVAR_TRACKER_ENTRANCE("CollapseUndiscovered"), UIWidgets::CheckboxOptions() .Tooltip("Collapse undiscovered entrances towards the bottom of each group") @@ -724,6 +726,7 @@ void EntranceTrackerSettingsWindow::DrawElement() { UIWidgets::RadioButtonsOptions().Color(THEME_COLOR).Tooltip("Group entrances by their entrance type")); ImGui::Text("Spoiler Reveal"); + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); UIWidgets::CVarCheckbox( "Show Source", CVAR_TRACKER_ENTRANCE("ShowFrom"), UIWidgets::CheckboxOptions().Tooltip("Reveal the sourcefor undiscovered entrances").Color(THEME_COLOR)); @@ -731,7 +734,7 @@ void EntranceTrackerSettingsWindow::DrawElement() { UIWidgets::CheckboxOptions() .Tooltip("Reveal the destination for undiscovered entrances") .Color(THEME_COLOR)); - + ImGui::EndDisabled(); ImGui::EndTable(); } diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index 85a675a90..e6f77eafa 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -222,7 +222,6 @@ void SohMenu::AddMenuEnhancements() { .Options(CheckboxOptions().Tooltip("Disable Random Camera Wiggle at Low Health.")); AddWidget(path, "Better Owl", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("BetterOwl")) - .RaceDisable(false) .Options(CheckboxOptions().Tooltip( "The default response to Kaepora Gaebora is always that you understood what he said.")); diff --git a/soh/soh/SohGui/SohMenuNetwork.cpp b/soh/soh/SohGui/SohMenuNetwork.cpp index 190012d75..637c78285 100644 --- a/soh/soh/SohGui/SohMenuNetwork.cpp +++ b/soh/soh/SohGui/SohMenuNetwork.cpp @@ -31,7 +31,6 @@ void SohMenu::AddMenuNetwork() { "page to your clipboard.", WIDGET_TEXT); AddWidget(path, ICON_FA_CLIPBOARD "##Sail", WIDGET_BUTTON) - .RaceDisable(false) .Callback([](WidgetInfo& info) { ImGui::SetClipboardText("https://github.com/HarbourMasters/sail"); Notification::Emit({ @@ -39,8 +38,8 @@ void SohMenu::AddMenuNetwork() { }); }) .Options(ButtonOptions().Tooltip("https://github.com/HarbourMasters/sail")); - AddWidget(path, "Host & Port", WIDGET_CUSTOM).RaceDisable(false).CustomFunction([](WidgetInfo& info) { - ImGui::BeginDisabled(Sail::Instance->isEnabled); + AddWidget(path, "Host & Port", WIDGET_CUSTOM).CustomFunction([](WidgetInfo& info) { + ImGui::BeginDisabled(Sail::Instance->isEnabled || CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); ImGui::Text("%s", info.name.c_str()); CVarInputString("##HostSail", CVAR_REMOTE_SAIL("Host"), InputOptions() @@ -62,7 +61,6 @@ void SohMenu::AddMenuNetwork() { ImGui::EndDisabled(); }); AddWidget(path, "Enable##Sail", WIDGET_BUTTON) - .RaceDisable(false) .PreFunc([](WidgetInfo& info) { std::string host = CVarGetString(CVAR_REMOTE_SAIL("Host"), "127.0.0.1"); uint16_t port = CVarGetInteger(CVAR_REMOTE_SAIL("Port"), 43384); @@ -105,7 +103,6 @@ void SohMenu::AddMenuNetwork() { "website to your clipboard.", WIDGET_TEXT); AddWidget(path, ICON_FA_CLIPBOARD "##CrowdControl", WIDGET_BUTTON) - .RaceDisable(false) .Callback([](WidgetInfo& info) { ImGui::SetClipboardText("https://crowdcontrol.live"); Notification::Emit({ @@ -113,8 +110,8 @@ void SohMenu::AddMenuNetwork() { }); }) .Options(ButtonOptions().Tooltip("https://crowdcontrol.live")); - AddWidget(path, "Host & Port", WIDGET_CUSTOM).RaceDisable(false).CustomFunction([](WidgetInfo& info) { - ImGui::BeginDisabled(CrowdControl::Instance->isEnabled); + AddWidget(path, "Host & Port", WIDGET_CUSTOM).CustomFunction([](WidgetInfo& info) { + ImGui::BeginDisabled(CrowdControl::Instance->isEnabled || CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); ImGui::Text("%s", info.name.c_str()); CVarInputString("##HostCrowdControl", CVAR_REMOTE_CROWD_CONTROL("Host"), InputOptions() @@ -136,7 +133,6 @@ void SohMenu::AddMenuNetwork() { ImGui::EndDisabled(); }); AddWidget(path, "Enable##CrowdControl", WIDGET_BUTTON) - .RaceDisable(false) .PreFunc([](WidgetInfo& info) { std::string host = CVarGetString(CVAR_REMOTE_CROWD_CONTROL("Host"), "127.0.0.1"); uint16_t port = CVarGetInteger(CVAR_REMOTE_CROWD_CONTROL("Port"), 43384); diff --git a/soh/soh/SohGui/SohMenuRandomizer.cpp b/soh/soh/SohGui/SohMenuRandomizer.cpp index 4a61f44a3..8f4e6e43b 100644 --- a/soh/soh/SohGui/SohMenuRandomizer.cpp +++ b/soh/soh/SohGui/SohMenuRandomizer.cpp @@ -35,7 +35,6 @@ void SohMenu::AddMenuRandomizer() { .DefaultValue(true)); AddWidget(path, "Use Custom Key Models", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_RANDOMIZER_ENHANCEMENT("CustomKeyModels")) - .RaceDisable(false) .Options( CheckboxOptions() .Tooltip("Use Custom graphics for Dungeon Keys, Big and Small, so that they can be easily told apart.") @@ -80,7 +79,6 @@ void SohMenu::AddMenuRandomizer() { "This might make boss souls more distinguishable from a distance, and can help with performance.")); AddWidget(path, "Skip Get Item Animations", WIDGET_CVAR_COMBOBOX) .CVar(CVAR_RANDOMIZER_ENHANCEMENT("TimeSavers.SkipGetItemAnimation")) - .RaceDisable(false) .Options(ComboboxOptions().ComboMap(skipGetItemAnimationOptions).DefaultIndex(SGIA_JUNK)); AddWidget(path, "Item Scale: %.2f", WIDGET_CVAR_SLIDER_FLOAT) .CVar(CVAR_RANDOMIZER_ENHANCEMENT("TimeSavers.SkipGetItemAnimationScale"))