From 97c37eb46a724314ff448ed505765b7c77b93a3b Mon Sep 17 00:00:00 2001 From: aMannus Date: Fri, 22 Jul 2022 09:48:30 +0200 Subject: [PATCH 01/12] Changed default values Shuffle/open settings now align with the first option which makes it the option closest to vanilla. Also added default values for rainbow bridge settings so they align with the max value instead of 0. --- .../Enhancements/randomizer/randomizer.cpp | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index e4a00138a9..783e180c2e 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3768,7 +3768,7 @@ void DrawRandoEditor(bool& open) { "\n" "Open - Mido no longer blocks the path to the Deku Tree. Kokiri\n" "boy no longer blocks the path out of the forest."); - SohImGui::EnhancementCombobox("gRandomizeForest", randoForest, 3, 1); + SohImGui::EnhancementCombobox("gRandomizeForest", randoForest, 3, 0); ImGui::Separator(); // Kakariko Gate ImGui::Text(Settings::OpenKakariko.GetName().c_str()); @@ -3779,7 +3779,7 @@ void DrawRandoEditor(bool& open) { "Open - The gate is always open. The happy mask shop\n" "will open immediately after obtaining Zelda's letter." ); - SohImGui::EnhancementCombobox("gRandomizeKakarikoGate", randoKakarikoGate, 2, 1); + SohImGui::EnhancementCombobox("gRandomizeKakarikoGate", randoKakarikoGate, 2, 0); ImGui::Separator(); // Door of Time @@ -3825,7 +3825,7 @@ void DrawRandoEditor(bool& open) { "\n" "Open - The bridge is repaired from the start." ); - SohImGui::EnhancementCombobox("gRandomizeGerudoFortress", randoGerudoFortress, 3, 1); + SohImGui::EnhancementCombobox("gRandomizeGerudoFortress", randoGerudoFortress, 3, 0); ImGui::Separator(); // Rainbow Bridge @@ -3851,13 +3851,15 @@ void DrawRandoEditor(bool& open) { "\n" "Tokens - Obtain the specified amount of Skulltula tokens." ); - SohImGui::EnhancementCombobox("gRandomizeRainbowBridge", randoRainbowBridge, 7, 3); - switch (CVar_GetS32("gRandomizeRainbowBridge", 3)) { + SohImGui::EnhancementCombobox("gRandomizeRainbowBridge", randoRainbowBridge, 7, 0); + switch (CVar_GetS32("gRandomizeRainbowBridge", 0)) { + case 0: + break; case 1: break; case 2: SohImGui::EnhancementSliderInt("Stone Count: %d", "##RandoStoneCount", - "gRandomizeStoneCount", 0, 3, ""); + "gRandomizeStoneCount", 0, 3, "", 3); break; case 3: SohImGui::EnhancementSliderInt("Medallion Count: %d", "##RandoMedallionCount", @@ -3865,15 +3867,15 @@ void DrawRandoEditor(bool& open) { break; case 4: SohImGui::EnhancementSliderInt("Reward Count: %d", "##RandoRewardCount", - "gRandomizeRewardCount", 0, 9, ""); + "gRandomizeRewardCount", 0, 9, "", 9); break; case 5: SohImGui::EnhancementSliderInt("Dungeon Count: %d", "##RandoDungeonCount", - "gRandomizeDungeonCount", 0, 8, ""); + "gRandomizeDungeonCount", 0, 8, "", 8); break; case 6: SohImGui::EnhancementSliderInt("Token Count: %d", "##RandoTokenCount", - "gRandomizeTokenCount", 0, 100, ""); + "gRandomizeTokenCount", 0, 100, "", 100); break; } ImGui::Separator(); From 0ee898bd562b372a25f052038ca089de569546f5 Mon Sep 17 00:00:00 2001 From: aMannus Date: Fri, 22 Jul 2022 12:21:12 +0200 Subject: [PATCH 02/12] Improved disabling of settings For Skip Child Zelda (and possibly other options in the future) --- .../Enhancements/randomizer/randomizer.cpp | 57 ++++++++++++------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 783e180c2e..bada66dcbd 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3966,22 +3966,28 @@ void DrawRandoEditor(bool& open) { ImGui::Separator(); } - // hide this option if we're skipping child zelda - if(CVar_GetS32("gRandomizeSkipChildZelda", 0) == 0) { - // Shuffle Weird Egg - SohImGui::EnhancementCheckbox(Settings::ShuffleWeirdEgg.GetName().c_str(), "gRandomizeShuffleWeirdEgg"); - InsertHelpHoverText( - "Shuffles the Weird Egg from Malon in to the item pool.\n" - "\n" - "The Weird Egg is required to unlock several events:\n" - " - Zelda's Lullaby from Impa\n" - " - Saria's song in Sacred Forest Meadow\n" - " - Epona's song and chicken minigame at Lon Lon Ranch\n" - " - Zelda's letter for Kakariko gate (if set to closed)\n" - " - Happy Mask Shop sidequest\n" - ); - ImGui::Separator(); + // Shuffle Weird Egg + // Disabled when Skip Child Zelda is active + if (CVar_GetS32("gRandomizeSkipChildZelda", 0) != 0) { + ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(130, 130, 130, 255)); + CVar_SetS32("gRandomizeShuffleWeirdEgg", 0); + } else { + ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 255, 255, 255)); } + SohImGui::EnhancementCheckbox(Settings::ShuffleWeirdEgg.GetName().c_str(), "gRandomizeShuffleWeirdEgg"); + ImGui::PopStyleColor(); + InsertHelpHoverText( + "Shuffles the Weird Egg from Malon in to the item pool. Enabling Skip\n" + "Child Zelda disables this feature.\n" + "\n" + "The Weird Egg is required to unlock several events:\n" + " - Zelda's Lullaby from Impa\n" + " - Saria's song in Sacred Forest Meadow\n" + " - Epona's song and chicken minigame at Lon Lon Ranch\n" + " - Zelda's letter for Kakariko gate (if set to closed)\n" + " - Happy Mask Shop sidequest\n" + ); + ImGui::Separator(); // Shuffle Gerudo Membership Card SohImGui::EnhancementCheckbox(Settings::ShuffleGerudoToken.GetName().c_str(), "gRandomizeShuffleGerudoToken"); @@ -4072,12 +4078,23 @@ void DrawRandoEditor(bool& open) { ImGui::Separator(); // Skip child stealth - SohImGui::EnhancementCheckbox(Settings::SkipChildStealth.GetName().c_str(), "gRandomizeSkipChildStealth"); - InsertHelpHoverText( - "The crawlspace into Hyrule Castle goes straight to Zelda, skipping\n" - "the guards." - ); + // Disabled when Skip Child Zelda is active + if (CVar_GetS32("gRandomizeSkipChildZelda", 0) != 0) { + ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(130, 130, 130, 255)); + CVar_SetS32("gRandomizeSkipChildStealth", 0); + // Also disable Weird Egg because it's on a different tab and wouldn't be updated otherwise + CVar_SetS32("gRandomizeShuffleWeirdEgg", 0); + } else { + ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 255, 255, 255)); + } + SohImGui::EnhancementCheckbox(Settings::SkipChildStealth.GetName().c_str(), + "gRandomizeSkipChildStealth"); + ImGui::PopStyleColor(); + InsertHelpHoverText("The crawlspace into Hyrule Castle goes straight to Zelda, skipping\n" + "the guards."); ImGui::Separator(); + + // Skip child zelda SohImGui::EnhancementCheckbox("Skip Child Zelda", "gRandomizeSkipChildZelda"); InsertHelpHoverText( "Start with Zelda's Letter in your inventory and skip the sequence up\n" From cbf4a9267f4f54cc27cf3e63720c325dad2365e2 Mon Sep 17 00:00:00 2001 From: aMannus Date: Fri, 22 Jul 2022 18:44:46 +0200 Subject: [PATCH 03/12] Irmproved handling incompatibilities --- .../Enhancements/randomizer/randomizer.cpp | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index bada66dcbd..f0eb769a62 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3711,6 +3711,8 @@ void DrawRandoEditor(bool& open) { "Timer", "Zelda Gasp (Adult)" }; + bool disableZeldaRelatedOptions = CVar_GetS32("gRandomizeSkipChildZelda", 0); + ImGui::SetNextWindowSize(ImVec2(750, 530), ImGuiCond_FirstUseEver); if (!ImGui::Begin("Randomizer Editor", &open, ImGuiWindowFlags_NoFocusOnAppearing)) { ImGui::End(); @@ -3968,17 +3970,21 @@ void DrawRandoEditor(bool& open) { // Shuffle Weird Egg // Disabled when Skip Child Zelda is active - if (CVar_GetS32("gRandomizeSkipChildZelda", 0) != 0) { - ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(130, 130, 130, 255)); + if (disableZeldaRelatedOptions) { CVar_SetS32("gRandomizeShuffleWeirdEgg", 0); - } else { - ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 255, 255, 255)); } + ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableZeldaRelatedOptions); + ImGui::PushStyleVar(ImGuiStyleVar_Alpha, + ImGui::GetStyle().Alpha * disableZeldaRelatedOptions ? 0.5f : 1.0f); SohImGui::EnhancementCheckbox(Settings::ShuffleWeirdEgg.GetName().c_str(), "gRandomizeShuffleWeirdEgg"); - ImGui::PopStyleColor(); + ImGui::PopStyleVar(); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && disableZeldaRelatedOptions) { + ImGui::SetTooltip("%s", "This option is disabled because \"Skip Child Zelda\" is enabled"); + } + ImGui::PopItemFlag(); InsertHelpHoverText( - "Shuffles the Weird Egg from Malon in to the item pool. Enabling Skip\n" - "Child Zelda disables this feature.\n" + "Shuffles the Weird Egg from Malon in to the item pool. Enabling\n" + "\"Skip Child Zelda\" disables this feature.\n" "\n" "The Weird Egg is required to unlock several events:\n" " - Zelda's Lullaby from Impa\n" @@ -4079,17 +4085,21 @@ void DrawRandoEditor(bool& open) { // Skip child stealth // Disabled when Skip Child Zelda is active - if (CVar_GetS32("gRandomizeSkipChildZelda", 0) != 0) { - ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(130, 130, 130, 255)); + if (disableZeldaRelatedOptions) { CVar_SetS32("gRandomizeSkipChildStealth", 0); // Also disable Weird Egg because it's on a different tab and wouldn't be updated otherwise CVar_SetS32("gRandomizeShuffleWeirdEgg", 0); - } else { - ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 255, 255, 255)); } + ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableZeldaRelatedOptions); + ImGui::PushStyleVar(ImGuiStyleVar_Alpha, + ImGui::GetStyle().Alpha * disableZeldaRelatedOptions ? 0.5f : 1.0f); SohImGui::EnhancementCheckbox(Settings::SkipChildStealth.GetName().c_str(), - "gRandomizeSkipChildStealth"); - ImGui::PopStyleColor(); + "gRandomizeSkipChildStealth"); + ImGui::PopStyleVar(); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && disableZeldaRelatedOptions) { + ImGui::SetTooltip("%s", "This option is disabled because \"Skip Child Zelda\" is enabled"); + } + ImGui::PopItemFlag(); InsertHelpHoverText("The crawlspace into Hyrule Castle goes straight to Zelda, skipping\n" "the guards."); ImGui::Separator(); From 0f4e65eb46b7afe28eb92a7b5b515c236177903e Mon Sep 17 00:00:00 2001 From: aMannus Date: Fri, 22 Jul 2022 19:58:27 +0200 Subject: [PATCH 04/12] Removed unneeded check after UI changes --- soh/soh/Enhancements/randomizer/randomizer.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index f0eb769a62..0c27da3913 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3439,11 +3439,7 @@ void GenerateRandomizerImgui() { cvarSettings[RSK_SHUFFLE_SONGS] = CVar_GetS32("gRandomizeShuffleSongs", 0); cvarSettings[RSK_SHUFFLE_TOKENS] = CVar_GetS32("gRandomizeShuffleTokens", 0); cvarSettings[RSK_SKIP_CHILD_ZELDA] = CVar_GetS32("gRandomizeSkipChildZelda", 0); - - // if we skip child zelda, we start with zelda's letter, and malon starts - // at the ranch, so we should *not* shuffle the weird egg - cvarSettings[RSK_SHUFFLE_WEIRD_EGG] = ((CVar_GetS32("gRandomizeSkipChildZelda", 0) == 0) && - CVar_GetS32("gRandomizeShuffleWeirdEgg", 0)); + cvarSettings[RSK_SHUFFLE_WEIRD_EGG] = CVar_GetS32("gRandomizeShuffleWeirdEgg", 0); cvarSettings[RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD] = CVar_GetS32("gRandomizeShuffleGerudoToken", 0); cvarSettings[RSK_ITEM_POOL] = CVar_GetS32("gRandomizeItemPool", 1); From af877a4cc6f3da3a979ab3450439c9c152e845f1 Mon Sep 17 00:00:00 2001 From: aMannus Date: Fri, 22 Jul 2022 21:22:04 +0200 Subject: [PATCH 05/12] Added +- buttons to sliders --- soh/soh/Enhancements/randomizer/randomizer.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 0c27da3913..a2f1cf1fd1 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3850,6 +3850,7 @@ void DrawRandoEditor(bool& open) { "Tokens - Obtain the specified amount of Skulltula tokens." ); SohImGui::EnhancementCombobox("gRandomizeRainbowBridge", randoRainbowBridge, 7, 0); + ImGui::PopItemWidth(); switch (CVar_GetS32("gRandomizeRainbowBridge", 0)) { case 0: break; @@ -3857,23 +3858,23 @@ void DrawRandoEditor(bool& open) { break; case 2: SohImGui::EnhancementSliderInt("Stone Count: %d", "##RandoStoneCount", - "gRandomizeStoneCount", 0, 3, "", 3); + "gRandomizeStoneCount", 0, 3, "", 3, true); break; case 3: SohImGui::EnhancementSliderInt("Medallion Count: %d", "##RandoMedallionCount", - "gRandomizeMedallionCount", 0, 6, "", 6); + "gRandomizeMedallionCount", 0, 6, "", 6, true); break; case 4: SohImGui::EnhancementSliderInt("Reward Count: %d", "##RandoRewardCount", - "gRandomizeRewardCount", 0, 9, "", 9); + "gRandomizeRewardCount", 0, 9, "", 9, true); break; case 5: SohImGui::EnhancementSliderInt("Dungeon Count: %d", "##RandoDungeonCount", - "gRandomizeDungeonCount", 0, 8, "", 8); + "gRandomizeDungeonCount", 0, 8, "", 8, true); break; case 6: SohImGui::EnhancementSliderInt("Token Count: %d", "##RandoTokenCount", - "gRandomizeTokenCount", 0, 100, "", 100); + "gRandomizeTokenCount", 0, 100, "", 100, true); break; } ImGui::Separator(); @@ -4065,7 +4066,7 @@ void DrawRandoEditor(bool& open) { // Cuccos to return SohImGui::EnhancementSliderInt("Cuccos to return: %d", "##RandoCuccosToReturn", - "gRandomizeCuccosToReturn", 0, 7, "", 7); + "gRandomizeCuccosToReturn", 0, 7, "", 7, true); InsertHelpHoverText( "The amount of cuccos needed to claim the reward from Anju the cucco lady" ); @@ -4073,7 +4074,7 @@ void DrawRandoEditor(bool& open) { // Big Poe Target Count SohImGui::EnhancementSliderInt("Big Poe Target Count: %d", "##RandoBigPoeTargetCount", - "gRandomizeBigPoeTargetCount", 1, 10, "", 10); + "gRandomizeBigPoeTargetCount", 1, 10, "", 10, true); InsertHelpHoverText( "The Poe collector will give a reward for turning in this many Big Poes." ); From 330b0254538c4177ad5683e4718fe6b5168fcc2a Mon Sep 17 00:00:00 2001 From: aMannus Date: Fri, 22 Jul 2022 21:35:18 +0200 Subject: [PATCH 06/12] Fixed minimum amounts rainbow bridge --- .../Enhancements/randomizer/randomizer.cpp | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index a2f1cf1fd1..538738e9ad 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3414,17 +3414,17 @@ void GenerateRandomizerImgui() { Game::SaveSettings(); std::unordered_map cvarSettings; - cvarSettings[RSK_FOREST] = CVar_GetS32("gRandomizeForest", 1); - cvarSettings[RSK_KAK_GATE] = CVar_GetS32("gRandomizeKakarikoGate", 1); + cvarSettings[RSK_FOREST] = CVar_GetS32("gRandomizeForest", 0); + cvarSettings[RSK_KAK_GATE] = CVar_GetS32("gRandomizeKakarikoGate", 0); cvarSettings[RSK_DOOR_OF_TIME] = CVar_GetS32("gRandomizeDoorOfTime", 0); cvarSettings[RSK_ZORAS_FOUNTAIN] = CVar_GetS32("gRandomizeZorasFountain", 0); - cvarSettings[RSK_GERUDO_FORTRESS] = CVar_GetS32("gRandomizeGerudoFortress", 1); - cvarSettings[RSK_RAINBOW_BRIDGE] = CVar_GetS32("gRandomizeRainbowBridge", 3); - cvarSettings[RSK_RAINBOW_BRIDGE_STONE_COUNT] = CVar_GetS32("gRandomizeStoneCount", 1); - cvarSettings[RSK_RAINBOW_BRIDGE_MEDALLION_COUNT] = CVar_GetS32("gRandomizeMedallionCount", 6); - cvarSettings[RSK_RAINBOW_BRIDGE_REWARD_COUNT] = CVar_GetS32("gRandomizeRewardCount", 1); - cvarSettings[RSK_RAINBOW_BRIDGE_DUNGEON_COUNT] = CVar_GetS32("gRandomizeDungeonCount", 1); - cvarSettings[RSK_RAINBOW_BRIDGE_TOKEN_COUNT] = CVar_GetS32("gRandomizeTokenCount", 1); + cvarSettings[RSK_GERUDO_FORTRESS] = CVar_GetS32("gRandomizeGerudoFortress", 0); + cvarSettings[RSK_RAINBOW_BRIDGE] = CVar_GetS32("gRandomizeRainbowBridge", 0); + cvarSettings[RSK_RAINBOW_BRIDGE_STONE_COUNT] = CVar_GetS32("gRandomizeStoneCount", 0); + cvarSettings[RSK_RAINBOW_BRIDGE_MEDALLION_COUNT] = CVar_GetS32("gRandomizeMedallionCount", 0); + cvarSettings[RSK_RAINBOW_BRIDGE_REWARD_COUNT] = CVar_GetS32("gRandomizeRewardCount", 0); + cvarSettings[RSK_RAINBOW_BRIDGE_DUNGEON_COUNT] = CVar_GetS32("gRandomizeDungeonCount", 0); + cvarSettings[RSK_RAINBOW_BRIDGE_TOKEN_COUNT] = CVar_GetS32("gRandomizeTokenCount", 0); cvarSettings[RSK_RANDOM_TRIALS] = CVar_GetS32("gRandomizeGanonTrial", 0); cvarSettings[RSK_TRIAL_COUNT] = CVar_GetS32("gRandomizeGanonTrialCount", 0); cvarSettings[RSK_STARTING_OCARINA] = CVar_GetS32("gRandomizeStartingOcarina", 0); @@ -3858,23 +3858,23 @@ void DrawRandoEditor(bool& open) { break; case 2: SohImGui::EnhancementSliderInt("Stone Count: %d", "##RandoStoneCount", - "gRandomizeStoneCount", 0, 3, "", 3, true); + "gRandomizeStoneCount", 1, 3, "", 3, true); break; case 3: SohImGui::EnhancementSliderInt("Medallion Count: %d", "##RandoMedallionCount", - "gRandomizeMedallionCount", 0, 6, "", 6, true); + "gRandomizeMedallionCount", 1, 6, "", 6, true); break; case 4: SohImGui::EnhancementSliderInt("Reward Count: %d", "##RandoRewardCount", - "gRandomizeRewardCount", 0, 9, "", 9, true); + "gRandomizeRewardCount", 1, 9, "", 9, true); break; case 5: SohImGui::EnhancementSliderInt("Dungeon Count: %d", "##RandoDungeonCount", - "gRandomizeDungeonCount", 0, 8, "", 8, true); + "gRandomizeDungeonCount", 1, 8, "", 8, true); break; case 6: SohImGui::EnhancementSliderInt("Token Count: %d", "##RandoTokenCount", - "gRandomizeTokenCount", 0, 100, "", 100, true); + "gRandomizeTokenCount", 1, 100, "", 100, true); break; } ImGui::Separator(); From 061c8c9fffd021838bc3924648c37cdd81b70fa0 Mon Sep 17 00:00:00 2001 From: aMannus Date: Fri, 22 Jul 2022 21:59:09 +0200 Subject: [PATCH 07/12] Small fix handling incompatible options --- soh/soh/Enhancements/randomizer/randomizer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 538738e9ad..b72243e567 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3707,7 +3707,6 @@ void DrawRandoEditor(bool& open) { "Timer", "Zelda Gasp (Adult)" }; - bool disableZeldaRelatedOptions = CVar_GetS32("gRandomizeSkipChildZelda", 0); ImGui::SetNextWindowSize(ImVec2(750, 530), ImGuiCond_FirstUseEver); if (!ImGui::Begin("Randomizer Editor", &open, ImGuiWindowFlags_NoFocusOnAppearing)) { @@ -3717,6 +3716,10 @@ void DrawRandoEditor(bool& open) { bool disableEditingRandoSettings = CVar_GetS32("gRandoGenerating", 0) || CVar_GetS32("gOnFileSelectNameEntry", 0); + bool disableZeldaRelatedOptions = CVar_GetS32("gRandomizeSkipChildZelda", 0); + if (disableEditingRandoSettings) { + disableZeldaRelatedOptions = true; + } ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableEditingRandoSettings); ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * disableEditingRandoSettings ? 0.5f : 1.0f); From 59531f89b1e4c4098ad3509e326cccc53d0092d4 Mon Sep 17 00:00:00 2001 From: aMannus Date: Sat, 23 Jul 2022 11:28:07 +0200 Subject: [PATCH 08/12] Adressed first comments --- soh/soh/Enhancements/randomizer/randomizer.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index b72243e567..71e57ed53f 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3714,16 +3714,11 @@ void DrawRandoEditor(bool& open) { return; } - bool disableEditingRandoSettings = CVar_GetS32("gRandoGenerating", 0) || - CVar_GetS32("gOnFileSelectNameEntry", 0); - bool disableZeldaRelatedOptions = CVar_GetS32("gRandomizeSkipChildZelda", 0); - if (disableEditingRandoSettings) { - disableZeldaRelatedOptions = true; - } + bool disableEditingRandoSettings = CVar_GetS32("gRandoGenerating", 0) || CVar_GetS32("gOnFileSelectNameEntry", 0); + bool disableZeldaRelatedOptions = CVar_GetS32("gRandomizeSkipChildZelda", 0) || disableEditingRandoSettings; ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableEditingRandoSettings); ImGui::PushStyleVar(ImGuiStyleVar_Alpha, - ImGui::GetStyle().Alpha * disableEditingRandoSettings ? 0.5f : 1.0f); - + ImGui::GetStyle().Alpha * (disableEditingRandoSettings ? 0.5f : 1.0f)); SohImGui::EnhancementCheckbox("Enable Randomizer", "gRandomizer"); if (CVar_GetS32("gRandomizer", 0) == 1) { @@ -3975,7 +3970,7 @@ void DrawRandoEditor(bool& open) { } ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableZeldaRelatedOptions); ImGui::PushStyleVar(ImGuiStyleVar_Alpha, - ImGui::GetStyle().Alpha * disableZeldaRelatedOptions ? 0.5f : 1.0f); + ImGui::GetStyle().Alpha * (disableZeldaRelatedOptions ? 0.5f : 1.0f)); SohImGui::EnhancementCheckbox(Settings::ShuffleWeirdEgg.GetName().c_str(), "gRandomizeShuffleWeirdEgg"); ImGui::PopStyleVar(); if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && disableZeldaRelatedOptions) { @@ -4092,7 +4087,7 @@ void DrawRandoEditor(bool& open) { } ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableZeldaRelatedOptions); ImGui::PushStyleVar(ImGuiStyleVar_Alpha, - ImGui::GetStyle().Alpha * disableZeldaRelatedOptions ? 0.5f : 1.0f); + ImGui::GetStyle().Alpha * (disableZeldaRelatedOptions ? 0.5f : 1.0f)); SohImGui::EnhancementCheckbox(Settings::SkipChildStealth.GetName().c_str(), "gRandomizeSkipChildStealth"); ImGui::PopStyleVar(); From 2d2d558657ca5b6f5586c65c67942acfd9aa0713 Mon Sep 17 00:00:00 2001 From: aMannus Date: Sat, 23 Jul 2022 18:44:15 +0200 Subject: [PATCH 09/12] Removed CVar updating in UI --- soh/soh/Enhancements/randomizer/randomizer.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 71e57ed53f..0448b6c726 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3439,7 +3439,10 @@ void GenerateRandomizerImgui() { cvarSettings[RSK_SHUFFLE_SONGS] = CVar_GetS32("gRandomizeShuffleSongs", 0); cvarSettings[RSK_SHUFFLE_TOKENS] = CVar_GetS32("gRandomizeShuffleTokens", 0); cvarSettings[RSK_SKIP_CHILD_ZELDA] = CVar_GetS32("gRandomizeSkipChildZelda", 0); - cvarSettings[RSK_SHUFFLE_WEIRD_EGG] = CVar_GetS32("gRandomizeShuffleWeirdEgg", 0); + + // if we skip child zelda, we start with zelda's letter, and malon starts + // at the ranch, so we should *not* shuffle the weird egg + cvarSettings[RSK_SHUFFLE_WEIRD_EGG] = ((CVar_GetS32("gRandomizeSkipChildZelda", 0) == 0) && CVar_GetS32("gRandomizeShuffleWeirdEgg", 0)); cvarSettings[RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD] = CVar_GetS32("gRandomizeShuffleGerudoToken", 0); cvarSettings[RSK_ITEM_POOL] = CVar_GetS32("gRandomizeItemPool", 1); @@ -3965,9 +3968,6 @@ void DrawRandoEditor(bool& open) { // Shuffle Weird Egg // Disabled when Skip Child Zelda is active - if (disableZeldaRelatedOptions) { - CVar_SetS32("gRandomizeShuffleWeirdEgg", 0); - } ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableZeldaRelatedOptions); ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * (disableZeldaRelatedOptions ? 0.5f : 1.0f)); @@ -4080,11 +4080,6 @@ void DrawRandoEditor(bool& open) { // Skip child stealth // Disabled when Skip Child Zelda is active - if (disableZeldaRelatedOptions) { - CVar_SetS32("gRandomizeSkipChildStealth", 0); - // Also disable Weird Egg because it's on a different tab and wouldn't be updated otherwise - CVar_SetS32("gRandomizeShuffleWeirdEgg", 0); - } ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableZeldaRelatedOptions); ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * (disableZeldaRelatedOptions ? 0.5f : 1.0f)); From f49d3975817b80f9a99de9b285ff62c75359b2f3 Mon Sep 17 00:00:00 2001 From: aMannus Date: Sat, 23 Jul 2022 19:22:22 +0200 Subject: [PATCH 10/12] Removed unneccesary line --- soh/soh/Enhancements/randomizer/randomizer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 0448b6c726..097f1de1ef 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3710,7 +3710,6 @@ void DrawRandoEditor(bool& open) { "Timer", "Zelda Gasp (Adult)" }; - ImGui::SetNextWindowSize(ImVec2(750, 530), ImGuiCond_FirstUseEver); if (!ImGui::Begin("Randomizer Editor", &open, ImGuiWindowFlags_NoFocusOnAppearing)) { ImGui::End(); From 29b944df92339fe4c79f9b71c14a50535a674da4 Mon Sep 17 00:00:00 2001 From: aMannus Date: Sat, 23 Jul 2022 20:00:32 +0200 Subject: [PATCH 11/12] Fixed incompabitility options (again) --- .../Enhancements/randomizer/randomizer.cpp | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 097f1de1ef..043ba23b08 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3717,7 +3717,7 @@ void DrawRandoEditor(bool& open) { } bool disableEditingRandoSettings = CVar_GetS32("gRandoGenerating", 0) || CVar_GetS32("gOnFileSelectNameEntry", 0); - bool disableZeldaRelatedOptions = CVar_GetS32("gRandomizeSkipChildZelda", 0) || disableEditingRandoSettings; + bool disableZeldaRelatedOptions = CVar_GetS32("gRandomizeSkipChildZelda", 0); ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableEditingRandoSettings); ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * (disableEditingRandoSettings ? 0.5f : 1.0f)); @@ -3967,15 +3967,21 @@ void DrawRandoEditor(bool& open) { // Shuffle Weird Egg // Disabled when Skip Child Zelda is active - ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableZeldaRelatedOptions); - ImGui::PushStyleVar(ImGuiStyleVar_Alpha, - ImGui::GetStyle().Alpha * (disableZeldaRelatedOptions ? 0.5f : 1.0f)); - SohImGui::EnhancementCheckbox(Settings::ShuffleWeirdEgg.GetName().c_str(), "gRandomizeShuffleWeirdEgg"); - ImGui::PopStyleVar(); - if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && disableZeldaRelatedOptions) { - ImGui::SetTooltip("%s", "This option is disabled because \"Skip Child Zelda\" is enabled"); + if (!disableEditingRandoSettings) { + ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableZeldaRelatedOptions); + ImGui::PushStyleVar(ImGuiStyleVar_Alpha, + ImGui::GetStyle().Alpha * (disableZeldaRelatedOptions ? 0.5f : 1.0f)); + } + SohImGui::EnhancementCheckbox(Settings::ShuffleWeirdEgg.GetName().c_str(), "gRandomizeShuffleWeirdEgg"); + if (!disableEditingRandoSettings) { + ImGui::PopStyleVar(); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && + disableZeldaRelatedOptions) { + ImGui::SetTooltip("%s", + "This option is disabled because \"Skip Child Zelda\" is enabled"); + } + ImGui::PopItemFlag(); } - ImGui::PopItemFlag(); InsertHelpHoverText( "Shuffles the Weird Egg from Malon in to the item pool. Enabling\n" "\"Skip Child Zelda\" disables this feature.\n" @@ -4079,16 +4085,20 @@ void DrawRandoEditor(bool& open) { // Skip child stealth // Disabled when Skip Child Zelda is active - ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableZeldaRelatedOptions); - ImGui::PushStyleVar(ImGuiStyleVar_Alpha, - ImGui::GetStyle().Alpha * (disableZeldaRelatedOptions ? 0.5f : 1.0f)); + if (!disableEditingRandoSettings) { + ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableZeldaRelatedOptions); + ImGui::PushStyleVar(ImGuiStyleVar_Alpha, + ImGui::GetStyle().Alpha * (disableZeldaRelatedOptions ? 0.5f : 1.0f)); + } SohImGui::EnhancementCheckbox(Settings::SkipChildStealth.GetName().c_str(), "gRandomizeSkipChildStealth"); - ImGui::PopStyleVar(); - if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && disableZeldaRelatedOptions) { - ImGui::SetTooltip("%s", "This option is disabled because \"Skip Child Zelda\" is enabled"); + if (!disableEditingRandoSettings) { + ImGui::PopStyleVar(); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && disableZeldaRelatedOptions) { + ImGui::SetTooltip("%s", "This option is disabled because \"Skip Child Zelda\" is enabled"); + } + ImGui::PopItemFlag(); } - ImGui::PopItemFlag(); InsertHelpHoverText("The crawlspace into Hyrule Castle goes straight to Zelda, skipping\n" "the guards."); ImGui::Separator(); From 3758d8bb8d85e1ebb241909154fe0f3598edd18d Mon Sep 17 00:00:00 2001 From: aMannus Date: Sat, 23 Jul 2022 20:36:46 +0200 Subject: [PATCH 12/12] Removed bool declaration --- soh/soh/Enhancements/randomizer/randomizer.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 043ba23b08..8deb4b5499 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3717,7 +3717,6 @@ void DrawRandoEditor(bool& open) { } bool disableEditingRandoSettings = CVar_GetS32("gRandoGenerating", 0) || CVar_GetS32("gOnFileSelectNameEntry", 0); - bool disableZeldaRelatedOptions = CVar_GetS32("gRandomizeSkipChildZelda", 0); ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableEditingRandoSettings); ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * (disableEditingRandoSettings ? 0.5f : 1.0f)); @@ -3968,15 +3967,16 @@ void DrawRandoEditor(bool& open) { // Shuffle Weird Egg // Disabled when Skip Child Zelda is active if (!disableEditingRandoSettings) { - ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableZeldaRelatedOptions); + ImGui::PushItemFlag(ImGuiItemFlags_Disabled, CVar_GetS32("gRandomizeSkipChildZelda", 0)); ImGui::PushStyleVar(ImGuiStyleVar_Alpha, - ImGui::GetStyle().Alpha * (disableZeldaRelatedOptions ? 0.5f : 1.0f)); + ImGui::GetStyle().Alpha * + (CVar_GetS32("gRandomizeSkipChildZelda", 0) ? 0.5f : 1.0f)); } SohImGui::EnhancementCheckbox(Settings::ShuffleWeirdEgg.GetName().c_str(), "gRandomizeShuffleWeirdEgg"); if (!disableEditingRandoSettings) { ImGui::PopStyleVar(); if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && - disableZeldaRelatedOptions) { + CVar_GetS32("gRandomizeSkipChildZelda", 0)) { ImGui::SetTooltip("%s", "This option is disabled because \"Skip Child Zelda\" is enabled"); } @@ -4086,15 +4086,17 @@ void DrawRandoEditor(bool& open) { // Skip child stealth // Disabled when Skip Child Zelda is active if (!disableEditingRandoSettings) { - ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableZeldaRelatedOptions); + ImGui::PushItemFlag(ImGuiItemFlags_Disabled, CVar_GetS32("gRandomizeSkipChildZelda", 0)); ImGui::PushStyleVar(ImGuiStyleVar_Alpha, - ImGui::GetStyle().Alpha * (disableZeldaRelatedOptions ? 0.5f : 1.0f)); + ImGui::GetStyle().Alpha * + (CVar_GetS32("gRandomizeSkipChildZelda", 0) ? 0.5f : 1.0f)); } SohImGui::EnhancementCheckbox(Settings::SkipChildStealth.GetName().c_str(), "gRandomizeSkipChildStealth"); if (!disableEditingRandoSettings) { ImGui::PopStyleVar(); - if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && disableZeldaRelatedOptions) { + if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && + CVar_GetS32("gRandomizeSkipChildZelda", 0)) { ImGui::SetTooltip("%s", "This option is disabled because \"Skip Child Zelda\" is enabled"); } ImGui::PopItemFlag();