From 9afe3ca746a11f75e95c4dbacf6d98334310cf16 Mon Sep 17 00:00:00 2001 From: aMannus Date: Mon, 5 Sep 2022 16:48:59 +0200 Subject: [PATCH] Fix gerudo keys, add disabled checkbox --- soh/soh/Enhancements/randomizer/randomizer.cpp | 1 + soh/soh/GameMenuBar.cpp | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 0187d5486..8a619801d 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -907,6 +907,7 @@ void Randomizer::ParseRandomizerSettingsFile(const char* spoilerFileName) { } else if (it.value() == "Anywhere") { gSaveContext.randoSettings[index].value = 3; } + break; case RSK_KEYSANITY: if(it.value() == "Start With") { gSaveContext.randoSettings[index].value = 0; diff --git a/soh/soh/GameMenuBar.cpp b/soh/soh/GameMenuBar.cpp index b202b6a05..8fede76b8 100644 --- a/soh/soh/GameMenuBar.cpp +++ b/soh/soh/GameMenuBar.cpp @@ -1392,7 +1392,22 @@ namespace GameMenuBar { UIWidgets::Tooltip( "When obtaining rupees, randomize what the rupee is called in the textbox." ); - UIWidgets::PaddedEnhancementCheckbox("Key Colors Match Dungeon", "gRandoMatchKeyColors", true, false); + + // Only disable the key colors checkbox when none of the keysanity settings are set to "Any Dungeon", "Overworld" or "Anywhere" + bool disableKeyColors = true; + + if (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_KEYSANITY) > 2 || + OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GERUDO_KEYS) > 0 || + OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_BOSS_KEYSANITY) > 2 || + OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_GANONS_BOSS_KEY) > 2 || + !gSaveContext.n64ddFlag) { + disableKeyColors = false; + } + + const char* disableKeyColorsText = "This setting is disabled because a savefile is loaded without any key shuffle settings set to \"Any Dungeon\", \"Overworld\" or \"Anywhere\""; + + UIWidgets::PaddedEnhancementCheckbox("Key Colors Match Dungeon", "gRandoMatchKeyColors", true, false, + disableKeyColors, disableKeyColorsText); UIWidgets::Tooltip( "Matches the color of small keys and boss keys to the dungeon they belong to. " "This helps identify keys from afar and adds a little bit of flair.\n\nThis only "