From da464c596ea4a6802c2f0e2804d255fc2738f6e2 Mon Sep 17 00:00:00 2001 From: aMannus Date: Sun, 31 Jul 2022 17:59:51 +0200 Subject: [PATCH 1/7] Added padding to rando settings menu --- .../Enhancements/debugger/ImGuiHelpers.cpp | 12 +++ soh/soh/Enhancements/debugger/ImGuiHelpers.h | 2 + .../Enhancements/randomizer/randomizer.cpp | 88 ++++++++----------- 3 files changed, 53 insertions(+), 49 deletions(-) diff --git a/soh/soh/Enhancements/debugger/ImGuiHelpers.cpp b/soh/soh/Enhancements/debugger/ImGuiHelpers.cpp index 6f4f006372..03d872a368 100644 --- a/soh/soh/Enhancements/debugger/ImGuiHelpers.cpp +++ b/soh/soh/Enhancements/debugger/ImGuiHelpers.cpp @@ -1,4 +1,5 @@ #include "ImGuiHelpers.h" +#include "Lib/ImGui/imgui_internal.h" // Adds a text tooltip for the previous ImGui item void SetLastItemHoverText(const std::string& text) { @@ -19,3 +20,14 @@ void InsertHelpHoverText(const std::string& text) { ImGui::EndTooltip(); } } + +void PaddedSeparator(bool topPadding, bool bottomPadding, float x, float y) { + ImGuiWindow* window = ImGui::GetCurrentWindow(); + if (topPadding) { + ImGui::Dummy(ImVec2(x, y)); + } + ImGui::Separator(); + if (bottomPadding) { + ImGui::Dummy(ImVec2(x, y)); + } +} \ No newline at end of file diff --git a/soh/soh/Enhancements/debugger/ImGuiHelpers.h b/soh/soh/Enhancements/debugger/ImGuiHelpers.h index 7f01e45807..fd60a5120d 100644 --- a/soh/soh/Enhancements/debugger/ImGuiHelpers.h +++ b/soh/soh/Enhancements/debugger/ImGuiHelpers.h @@ -6,3 +6,5 @@ void SetLastItemHoverText(const std::string& text); void InsertHelpHoverText(const std::string& text); + +void PaddedSeparator(bool topPadding = true, bool bottomPadding = true, float x = 0.0f, float y = 0.0f); \ No newline at end of file diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 38ac4a306b..0385bec78a 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3737,6 +3737,10 @@ void DrawRandoEditor(bool& open) { } ImGui::Separator(); + ImGuiWindow* window = ImGui::GetCurrentWindow(); + static ImVec2 cellPadding(8.0f, 8.0f); + ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); + if (CVar_GetS32("gRandomizer", 0) == 1 && ImGui::BeginTabBar("Randomizer Settings", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabItem("Main Rules")) { if (ImGui::BeginTable("tableRandoMainRules", 3, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { @@ -3748,10 +3752,10 @@ void DrawRandoEditor(bool& open) { // COLUMN 1 - OPEN SETTINGS ImGui::TableNextColumn(); + window->DC.CurrLineTextBaseOffset = 0.0f; ImGui::PushItemWidth(-FLT_MIN); if (CVar_GetS32("gRandomizeAllOpenSettings", 0) != 1) { - ImGui::Separator(); // Forest ImGui::Text(Settings::OpenForest.GetName().c_str()); InsertHelpHoverText( @@ -3766,7 +3770,7 @@ void DrawRandoEditor(bool& open) { "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, 0); - ImGui::Separator(); + PaddedSeparator(); // Kakariko Gate ImGui::Text(Settings::OpenKakariko.GetName().c_str()); InsertHelpHoverText( @@ -3777,7 +3781,7 @@ void DrawRandoEditor(bool& open) { "will open immediately after obtaining Zelda's letter." ); SohImGui::EnhancementCombobox("gRandomizeKakarikoGate", randoKakarikoGate, 2, 0); - ImGui::Separator(); + PaddedSeparator(); // Door of Time ImGui::Text(Settings::OpenDoorOfTime.GetName().c_str()); @@ -3792,7 +3796,7 @@ void DrawRandoEditor(bool& open) { "requirements." ); SohImGui::EnhancementCombobox("gRandomizeDoorOfTime", randoDoorOfTime, 3, 0); - ImGui::Separator(); + PaddedSeparator(); // Zora's Fountain ImGui::Text(Settings::ZorasFountain.GetName().c_str()); @@ -3808,7 +3812,7 @@ void DrawRandoEditor(bool& open) { "time periods. Ruto's Letter is removed from the item pool." ); SohImGui::EnhancementCombobox("gRandomizeZorasFountain", randoZorasFountain, 3, 0); - ImGui::Separator(); + PaddedSeparator(); // Gerudo Fortress ImGui::Text(Settings::GerudoFortress.GetName().c_str()); @@ -3823,7 +3827,7 @@ void DrawRandoEditor(bool& open) { "Open - The bridge is repaired from the start." ); SohImGui::EnhancementCombobox("gRandomizeGerudoFortress", randoGerudoFortress, 3, 0); - ImGui::Separator(); + PaddedSeparator(); // Rainbow Bridge ImGui::Text(Settings::Bridge.GetName().c_str()); @@ -3876,7 +3880,7 @@ void DrawRandoEditor(bool& open) { "gRandomizeTokenCount", 1, 100, "", 100, true); break; } - ImGui::Separator(); + PaddedSeparator(); // Random Ganon's Trials /* @@ -3894,14 +3898,13 @@ void DrawRandoEditor(bool& open) { SohImGui::EnhancementCheckbox("Skip Ganon's Trials", "gRandomizeGanonTrialCount"); InsertHelpHoverText( "Sets whether or not Ganon's Castle Trials are required to enter Ganon's Tower."); - ImGui::Separator(); } // COLUMN 2 - Shuffle Settings ImGui::TableNextColumn(); + window->DC.CurrLineTextBaseOffset = 0.0f; ImGui::PushItemWidth(-FLT_MIN); if (CVar_GetS32("gRandomizeAllShuffleSettings", 0) != 1) { - ImGui::Separator(); // Shuffle Songs ImGui::Text(Settings::ShuffleSongs.GetName().c_str()); @@ -3920,7 +3923,7 @@ void DrawRandoEditor(bool& open) { ); SohImGui::EnhancementCombobox("gRandomizeShuffleSongs", randoShuffleSongs, 3, 0); - ImGui::Separator(); + PaddedSeparator(); // Shuffle Tokens ImGui::Text(Settings::Tokensanity.GetName().c_str()); @@ -3937,7 +3940,7 @@ void DrawRandoEditor(bool& open) { "All Tokens - Shuffle all 100 GS tokens." ); SohImGui::EnhancementCombobox("gRandomizeShuffleTokens", randoShuffleTokens, 4, 0); - ImGui::Separator(); + PaddedSeparator(); if(CVar_GetS32("gRandomizeStartingKokiriSword", 0) == 0) { // Shuffle Kokiri Sword @@ -3948,7 +3951,7 @@ void DrawRandoEditor(bool& open) { "This will require the use of sticks until the Kokiri\n" "Sword is found." ); - ImGui::Separator(); + PaddedSeparator(); } if(CVar_GetS32("gRandomizeStartingOcarina", 0) == 0) { @@ -3960,7 +3963,7 @@ void DrawRandoEditor(bool& open) { "\n" "This will require finding an Ocarina before being able to play songs." ); - ImGui::Separator(); + PaddedSeparator(); } // Shuffle Weird Egg @@ -3992,7 +3995,7 @@ void DrawRandoEditor(bool& open) { " - Zelda's letter for Kakariko gate (if set to closed)\n" " - Happy Mask Shop sidequest\n" ); - ImGui::Separator(); + PaddedSeparator(); // Shuffle Gerudo Membership Card SohImGui::EnhancementCheckbox(Settings::ShuffleGerudoToken.GetName().c_str(), "gRandomizeShuffleGerudoToken"); @@ -4002,15 +4005,12 @@ void DrawRandoEditor(bool& open) { "The Gerudo Card is required to enter the Gerudo Training Grounds, opening\n" "the gate to Haunted Wasteland and the Horseback Archery minigame." ); - ImGui::Separator(); } ImGui::PopItemWidth(); // COLUMN 3 - Shuffle Dungeon Items ImGui::TableNextColumn(); - ImGui::Separator(); - - // RANDOTODO implement ganon's boss key outside of ganon's castle + window->DC.CurrLineTextBaseOffset = 0.0f; ImGui::PushItemWidth(-FLT_MIN); // Shuffle Dungeon Rewards @@ -4028,9 +4028,9 @@ void DrawRandoEditor(bool& open) { "Anywhere - Spiritual stones and medallions can appear anywhere." ); SohImGui::EnhancementCombobox("gRandomizeShuffleDungeonReward", randoShuffleDungeonRewards, 4, 0); + PaddedSeparator(); - ImGui::Separator(); - + // RANDOTODO implement ganon's boss key outside of ganon's castle // Ganon's Boss Key ImGui::Text(Settings::GanonsBossKey.GetName().c_str()); InsertHelpHoverText( @@ -4042,11 +4042,10 @@ void DrawRandoEditor(bool& open) { ); SohImGui::EnhancementCombobox("gRandomizeShuffleGanonBossKey", randoShuffleGanonsBossKey, 3, 0); - ImGui::Separator(); + PaddedSeparator(); // Start with Maps & Compasses SohImGui::EnhancementCheckbox(Settings::MapsAndCompasses.GetName().c_str(), "gRandomizeStartingMapsCompasses"); - ImGui::Separator(); ImGui::PopItemWidth(); ImGui::EndTable(); @@ -4064,7 +4063,7 @@ void DrawRandoEditor(bool& open) { // COLUMN 1 - TIME SAVERS ImGui::TableNextColumn(); - ImGui::Separator(); + window->DC.CurrLineTextBaseOffset = 0.0f; // Cuccos to return SohImGui::EnhancementSliderInt("Cuccos to return: %d", "##RandoCuccosToReturn", @@ -4072,7 +4071,7 @@ void DrawRandoEditor(bool& open) { InsertHelpHoverText( "The amount of cuccos needed to claim the reward from Anju the cucco lady" ); - ImGui::Separator(); + PaddedSeparator(); // Big Poe Target Count SohImGui::EnhancementSliderInt("Big Poe Target Count: %d", "##RandoBigPoeTargetCount", @@ -4080,7 +4079,7 @@ void DrawRandoEditor(bool& open) { InsertHelpHoverText( "The Poe collector will give a reward for turning in this many Big Poes." ); - ImGui::Separator(); + PaddedSeparator(); // Skip child stealth // Disabled when Skip Child Zelda is active @@ -4102,7 +4101,7 @@ void DrawRandoEditor(bool& open) { } InsertHelpHoverText("The crawlspace into Hyrule Castle goes straight to Zelda, skipping\n" "the guards."); - ImGui::Separator(); + PaddedSeparator(); // Skip child zelda SohImGui::EnhancementCheckbox("Skip Child Zelda", "gRandomizeSkipChildZelda"); @@ -4110,26 +4109,25 @@ void DrawRandoEditor(bool& open) { "Start with Zelda's Letter in your inventory and skip the sequence up\n" "until after meeting Zelda. Disables the ability to shuffle Weird Egg." ); - ImGui::Separator(); + PaddedSeparator(); // Skip Epona race SohImGui::EnhancementCheckbox(Settings::SkipEponaRace.GetName().c_str(), "gRandomizeSkipEponaRace"); InsertHelpHoverText( "Epona can be summoned with Epona's Song without needing to race Ingo." ); - ImGui::Separator(); + PaddedSeparator(); // Skip tower escape SohImGui::EnhancementCheckbox(Settings::SkipTowerEscape.GetName().c_str(), "gRandomizeSkipTowerEscape"); InsertHelpHoverText( "The tower escape sequence between Ganondorf and Ganon will be skipped." ); - ImGui::Separator(); // COLUMN 2 - HINT SETTINGS ImGui::TableNextColumn(); + window->DC.CurrLineTextBaseOffset = 0.0f; ImGui::PushItemWidth(-FLT_MIN); - ImGui::Separator(); // Gossip Stone Hints ImGui::Text(Settings::GossipStoneHints.GetName().c_str()); @@ -4182,13 +4180,12 @@ void DrawRandoEditor(bool& open) { SohImGui::EnhancementCombobox("gRandomizeHintDistribution", randoHintDistribution, 4, 1); ImGui::Unindent(); } - ImGui::Separator(); ImGui::PopItemWidth(); // COLUMN 3 - ITEM POOL SETTINGS ImGui::TableNextColumn(); + window->DC.CurrLineTextBaseOffset = 0.0f; ImGui::PushItemWidth(-FLT_MIN); - ImGui::Separator(); ImGui::Text(Settings::ItemPoolValue.GetName().c_str()); InsertHelpHoverText( "Sets how many major items appear in the item pool.\n" @@ -4202,7 +4199,7 @@ void DrawRandoEditor(bool& open) { "Minimal - Most excess items are removed." ); SohImGui::EnhancementCombobox("gRandomizeItemPool", randoItemPool, 4, 1); - ImGui::Separator(); + PaddedSeparator(); // Ice Traps ImGui::Text(Settings::IceTrapValue.GetName().c_str()); @@ -4221,7 +4218,6 @@ void DrawRandoEditor(bool& open) { "in the base pool." ); SohImGui::EnhancementCombobox("gRandomizeIceTraps", randoIceTraps, 5, 1); - ImGui::Separator(); ImGui::PopItemWidth(); ImGui::EndTable(); } @@ -4240,29 +4236,25 @@ void DrawRandoEditor(bool& open) { // COLUMN 1 - EXCLUDE LOCATIONS ImGui::TableNextColumn(); - ImGui::Separator(); SohImGui::EnhancementCheckbox("Deku Theater Mask of Truth", "gRandomizeExcludeDekuTheaterMaskOfTruth"); - ImGui::Separator(); + PaddedSeparator(); SohImGui::EnhancementCheckbox("10 Skulltula Reward", "gRandomizeExcludeKak10SkullReward"); - ImGui::Separator(); + PaddedSeparator(); SohImGui::EnhancementCheckbox("20 Skulltula Reward", "gRandomizeExcludeKak20SkullReward"); - ImGui::Separator(); + PaddedSeparator(); SohImGui::EnhancementCheckbox("30 Skulltula Reward", "gRandomizeExcludeKak30SkullReward"); - ImGui::Separator(); + PaddedSeparator(); SohImGui::EnhancementCheckbox("40 Skulltula Reward", "gRandomizeExcludeKak40SkullReward"); - ImGui::Separator(); + PaddedSeparator(); SohImGui::EnhancementCheckbox("50 Skulltula Reward", "gRandomizeExcludeKak50SkullReward"); - ImGui::Separator(); // COLUMN 2 - MISC OPTIONS ImGui::TableNextColumn(); - ImGui::Separator(); SohImGui::EnhancementCheckbox("Nighttime GS expect Sun's Song", "gRandomizeGsExpectSunsSong"); InsertHelpHoverText( "All Golden Skulltulas that require nighttime to appear will only be\n" "expected to be collected after getting Sun's Song." ); - ImGui::Separator(); // Add empty column to keep them 1/3rd of the width ImGui::TableNextColumn(); @@ -4284,18 +4276,16 @@ void DrawRandoEditor(bool& open) { ImGui::TableNextColumn(); // COLUMN 1 - STARTING INVENTORY - ImGui::Separator(); SohImGui::EnhancementCheckbox(Settings::StartingOcarina.GetName().c_str(), "gRandomizeStartingOcarina"); - ImGui::Separator(); + PaddedSeparator(); SohImGui::EnhancementCheckbox(Settings::StartingKokiriSword.GetName().c_str(), "gRandomizeStartingKokiriSword"); - ImGui::Separator(); + PaddedSeparator(); SohImGui::EnhancementCheckbox(Settings::StartingDekuShield.GetName().c_str(), "gRandomizeStartingDekuShield"); - ImGui::Separator(); + PaddedSeparator(); SohImGui::EnhancementCheckbox(Settings::StartingConsumables.GetName().c_str(), "gRandomizeStartingConsumables"); - ImGui::Separator(); + PaddedSeparator(); SohImGui::EnhancementCheckbox("Full Wallets", "gRandomizeFullWallets"); InsertHelpHoverText("Start with a full wallet. All wallet upgrades come filled with rupees."); - ImGui::Separator(); // Add empty columns to keep them 1/3rd of the width ImGui::TableNextColumn(); From 8b023188a09186a64aa1e8eefeb0bc0362b2a39e Mon Sep 17 00:00:00 2001 From: aMannus Date: Sun, 31 Jul 2022 18:15:37 +0200 Subject: [PATCH 2/7] Updated default window size to accomodate padding --- soh/soh/Enhancements/randomizer/randomizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 0385bec78a..4356d38956 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3710,7 +3710,7 @@ void DrawRandoEditor(bool& open) { "Timer", "Zelda Gasp (Adult)" }; - ImGui::SetNextWindowSize(ImVec2(750, 530), ImGuiCond_FirstUseEver); + ImGui::SetNextWindowSize(ImVec2(830, 600), ImGuiCond_FirstUseEver); if (!ImGui::Begin("Randomizer Editor", &open, ImGuiWindowFlags_NoFocusOnAppearing)) { ImGui::End(); return; From 83d8e1caf42b07b45da81b4a5e9e70831446a985 Mon Sep 17 00:00:00 2001 From: aMannus Date: Sun, 31 Jul 2022 18:26:18 +0200 Subject: [PATCH 3/7] Code cleanup --- soh/soh/Enhancements/debugger/ImGuiHelpers.cpp | 4 +--- soh/soh/Enhancements/debugger/ImGuiHelpers.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/debugger/ImGuiHelpers.cpp b/soh/soh/Enhancements/debugger/ImGuiHelpers.cpp index 03d872a368..c5af1dc299 100644 --- a/soh/soh/Enhancements/debugger/ImGuiHelpers.cpp +++ b/soh/soh/Enhancements/debugger/ImGuiHelpers.cpp @@ -1,5 +1,4 @@ #include "ImGuiHelpers.h" -#include "Lib/ImGui/imgui_internal.h" // Adds a text tooltip for the previous ImGui item void SetLastItemHoverText(const std::string& text) { @@ -22,7 +21,6 @@ void InsertHelpHoverText(const std::string& text) { } void PaddedSeparator(bool topPadding, bool bottomPadding, float x, float y) { - ImGuiWindow* window = ImGui::GetCurrentWindow(); if (topPadding) { ImGui::Dummy(ImVec2(x, y)); } @@ -30,4 +28,4 @@ void PaddedSeparator(bool topPadding, bool bottomPadding, float x, float y) { if (bottomPadding) { ImGui::Dummy(ImVec2(x, y)); } -} \ No newline at end of file +} diff --git a/soh/soh/Enhancements/debugger/ImGuiHelpers.h b/soh/soh/Enhancements/debugger/ImGuiHelpers.h index fd60a5120d..617e874d1c 100644 --- a/soh/soh/Enhancements/debugger/ImGuiHelpers.h +++ b/soh/soh/Enhancements/debugger/ImGuiHelpers.h @@ -7,4 +7,4 @@ void SetLastItemHoverText(const std::string& text); void InsertHelpHoverText(const std::string& text); -void PaddedSeparator(bool topPadding = true, bool bottomPadding = true, float x = 0.0f, float y = 0.0f); \ No newline at end of file +void PaddedSeparator(bool topPadding = true, bool bottomPadding = true, float x = 0.0f, float y = 0.0f); From f7b8ad7eee9f61a3cc78dce7d9a4720751da8a93 Mon Sep 17 00:00:00 2001 From: aMannus Date: Mon, 1 Aug 2022 08:50:11 +0200 Subject: [PATCH 4/7] Some more padding --- soh/soh/Enhancements/randomizer/randomizer.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 4356d38956..2800b7be57 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3723,11 +3723,13 @@ void DrawRandoEditor(bool& open) { SohImGui::EnhancementCheckbox("Enable Randomizer", "gRandomizer"); if (CVar_GetS32("gRandomizer", 0) == 1) { + ImGui::Dummy(ImVec2(0.0f, 0.0f)); if (ImGui::Button("Generate Seed")) { if (CVar_GetS32("gRandoGenerating", 0) == 0) { randoThread = std::thread(&GenerateRandomizerImgui); } } + ImGui::Dummy(ImVec2(0.0f, 0.0f)); std::string spoilerfilepath = CVar_GetString("gSpoilerLog", ""); ImGui::Text("Spoiler File: %s", spoilerfilepath.c_str()); @@ -3735,7 +3737,7 @@ void DrawRandoEditor(bool& open) { // std::string presetfilepath = CVar_GetString("gLoadedPreset", ""); // ImGui::Text("Settings File: %s", presetfilepath.c_str()); } - ImGui::Separator(); + PaddedSeparator(); ImGuiWindow* window = ImGui::GetCurrentWindow(); static ImVec2 cellPadding(8.0f, 8.0f); @@ -3860,22 +3862,27 @@ void DrawRandoEditor(bool& open) { case 1: break; case 2: + ImGui::Dummy(ImVec2(0.0f, 0.0f)); SohImGui::EnhancementSliderInt("Stone Count: %d", "##RandoStoneCount", "gRandomizeStoneCount", 1, 3, "", 3, true); break; case 3: + ImGui::Dummy(ImVec2(0.0f, 0.0f)); SohImGui::EnhancementSliderInt("Medallion Count: %d", "##RandoMedallionCount", "gRandomizeMedallionCount", 1, 6, "", 6, true); break; case 4: + ImGui::Dummy(ImVec2(0.0f, 0.0f)); SohImGui::EnhancementSliderInt("Reward Count: %d", "##RandoRewardCount", "gRandomizeRewardCount", 1, 9, "", 9, true); break; case 5: + ImGui::Dummy(ImVec2(0.0f, 0.0f)); SohImGui::EnhancementSliderInt("Dungeon Count: %d", "##RandoDungeonCount", "gRandomizeDungeonCount", 1, 8, "", 8, true); break; case 6: + ImGui::Dummy(ImVec2(0.0f, 0.0f)); SohImGui::EnhancementSliderInt("Token Count: %d", "##RandoTokenCount", "gRandomizeTokenCount", 1, 100, "", 100, true); break; From 7b1b362e5a310f4d2c972542fe01d3d768395fa7 Mon Sep 17 00:00:00 2001 From: aMannus Date: Mon, 1 Aug 2022 13:23:21 +0200 Subject: [PATCH 5/7] More styling & layout changes --- soh/soh/Enhancements/debugger/ImGuiHelpers.h | 2 +- .../Enhancements/randomizer/randomizer.cpp | 126 ++++++++++-------- 2 files changed, 73 insertions(+), 55 deletions(-) diff --git a/soh/soh/Enhancements/debugger/ImGuiHelpers.h b/soh/soh/Enhancements/debugger/ImGuiHelpers.h index 617e874d1c..b9b6c68f82 100644 --- a/soh/soh/Enhancements/debugger/ImGuiHelpers.h +++ b/soh/soh/Enhancements/debugger/ImGuiHelpers.h @@ -7,4 +7,4 @@ void SetLastItemHoverText(const std::string& text); void InsertHelpHoverText(const std::string& text); -void PaddedSeparator(bool topPadding = true, bool bottomPadding = true, float x = 0.0f, float y = 0.0f); +void PaddedSeparator(bool topPadding = true, bool bottomPadding = true, float x = 0, float y = 0); diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 2800b7be57..3b035b6ae4 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3741,15 +3741,17 @@ void DrawRandoEditor(bool& open) { ImGuiWindow* window = ImGui::GetCurrentWindow(); static ImVec2 cellPadding(8.0f, 8.0f); - ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); if (CVar_GetS32("gRandomizer", 0) == 1 && ImGui::BeginTabBar("Randomizer Settings", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabItem("Main Rules")) { + ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); if (ImGui::BeginTable("tableRandoMainRules", 3, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { ImGui::TableSetupColumn("Open Settings", ImGuiTableColumnFlags_WidthStretch, 200.0f); ImGui::TableSetupColumn("Shuffle Settings", ImGuiTableColumnFlags_WidthStretch, 200.0f); ImGui::TableSetupColumn("Shuffle Dungeon Items", ImGuiTableColumnFlags_WidthStretch, 200.0f); + ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true); ImGui::TableHeadersRow(); + ImGui::PopItemFlag(); ImGui::TableNextRow(); // COLUMN 1 - OPEN SETTINGS @@ -3949,6 +3951,11 @@ void DrawRandoEditor(bool& open) { SohImGui::EnhancementCombobox("gRandomizeShuffleTokens", randoShuffleTokens, 4, 0); PaddedSeparator(); + SohImGui::EnhancementCheckbox("Nighttime GS expect Sun's Song", "gRandomizeGsExpectSunsSong"); + InsertHelpHoverText("All Golden Skulltulas that require nighttime to appear will only be\n" + "expected to be collected after getting Sun's Song."); + PaddedSeparator(); + if(CVar_GetS32("gRandomizeStartingKokiriSword", 0) == 0) { // Shuffle Kokiri Sword SohImGui::EnhancementCheckbox(Settings::ShuffleKokiriSword.GetName().c_str(), "gRandomizeShuffleKokiriSword"); @@ -4057,15 +4064,19 @@ void DrawRandoEditor(bool& open) { ImGui::PopItemWidth(); ImGui::EndTable(); } + ImGui::PopStyleVar(1); ImGui::EndTabItem(); } if (ImGui::BeginTabItem("Other")) { + ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); if (ImGui::BeginTable("tableRandoOther", 3, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { ImGui::TableSetupColumn("Timesavers", ImGuiTableColumnFlags_WidthStretch, 200.0f); ImGui::TableSetupColumn("Hint Settings", ImGuiTableColumnFlags_WidthStretch, 200.0f); ImGui::TableSetupColumn("Item Pool Settings", ImGuiTableColumnFlags_WidthStretch, 200.0f); + ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true); ImGui::TableHeadersRow(); + ImGui::PopItemFlag(); ImGui::TableNextRow(); // COLUMN 1 - TIME SAVERS @@ -4155,6 +4166,7 @@ void DrawRandoEditor(bool& open) { SohImGui::EnhancementCombobox("gRandomizeGossipStoneHints", randoGossipStoneHints, 4, 1); if (CVar_GetS32("gRandomizeGossipStoneHints", 1) != 0) { // Hint Clarity + ImGui::Dummy(ImVec2(0.0f, 0.0f)); ImGui::Indent(); ImGui::Text(Settings::ClearerHints.GetName().c_str()); InsertHelpHoverText( @@ -4172,6 +4184,7 @@ void DrawRandoEditor(bool& open) { SohImGui::EnhancementCombobox("gRandomizeHintClarity", randoHintClarity, 3, 2); // Hint Distribution + ImGui::Dummy(ImVec2(0.0f, 0.0f)); ImGui::Text(Settings::HintDistribution.GetName().c_str()); InsertHelpHoverText( "Sets how many hints will be useful.\n" @@ -4228,21 +4241,24 @@ void DrawRandoEditor(bool& open) { ImGui::PopItemWidth(); ImGui::EndTable(); } + ImGui::PopStyleVar(1); ImGui::EndTabItem(); } - if (ImGui::BeginTabItem("Detailed Logic")) { - if (ImGui::BeginTable("tableRandoDetailedLogic", 3, + if (ImGui::BeginTabItem("Location Logic")) { + ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); + if (ImGui::BeginTable("tableRandoLocationLogic", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { + ImGui::TableSetupColumn("Exclude Item Checks", ImGuiTableColumnFlags_WidthStretch, 200.0f); ImGui::TableSetupColumn("Exclude Locations", ImGuiTableColumnFlags_WidthStretch, 200.0f); - ImGui::TableSetupColumn("Misc Options", ImGuiTableColumnFlags_WidthStretch, 200.0f); - // Add empty column to keep them 1/3rd of the width - ImGui::TableSetupColumn(" ", ImGuiTableColumnFlags_WidthStretch, 200.0f); + ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true); ImGui::TableHeadersRow(); + ImGui::PopItemFlag(); ImGui::TableNextRow(); - // COLUMN 1 - EXCLUDE LOCATIONS + // COLUMN 1 - EXCLUDE ITEM CHECKS ImGui::TableNextColumn(); + window->DC.CurrLineTextBaseOffset = 0.0f; SohImGui::EnhancementCheckbox("Deku Theater Mask of Truth", "gRandomizeExcludeDekuTheaterMaskOfTruth"); PaddedSeparator(); SohImGui::EnhancementCheckbox("10 Skulltula Reward", "gRandomizeExcludeKak10SkullReward"); @@ -4255,51 +4271,81 @@ void DrawRandoEditor(bool& open) { PaddedSeparator(); SohImGui::EnhancementCheckbox("50 Skulltula Reward", "gRandomizeExcludeKak50SkullReward"); - // COLUMN 2 - MISC OPTIONS - ImGui::TableNextColumn(); - SohImGui::EnhancementCheckbox("Nighttime GS expect Sun's Song", "gRandomizeGsExpectSunsSong"); - InsertHelpHoverText( - "All Golden Skulltulas that require nighttime to appear will only be\n" - "expected to be collected after getting Sun's Song." - ); - - // Add empty column to keep them 1/3rd of the width + // COLUMN 2 - EXCLUDE LOCATIONS ImGui::TableNextColumn(); + window->DC.CurrLineTextBaseOffset = 0.0f; + ImGui::Text("Coming soon"); ImGui::EndTable(); } + ImGui::PopStyleVar(1); + ImGui::EndTabItem(); + } + + if (ImGui::BeginTabItem("Tricks/Glitches")) { + ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); + if (ImGui::BeginTable("tableRandoTricksGlitches", 2, + ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { + ImGui::TableSetupColumn("Enable Tricks", ImGuiTableColumnFlags_WidthStretch, 200.0f); + ImGui::TableSetupColumn("Enable Glitches", ImGuiTableColumnFlags_WidthStretch, 200.0f); + ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true); + ImGui::TableHeadersRow(); + ImGui::PopItemFlag(); + ImGui::TableNextRow(); + + // COLUMN 1 - ENABLE TRICKS + ImGui::TableNextColumn(); + window->DC.CurrLineTextBaseOffset = 0.0f; + ImGui::Text("Coming soon"); + + // COLUMN 2 - ENABLE GLITCHES + ImGui::TableNextColumn(); + window->DC.CurrLineTextBaseOffset = 0.0f; + ImGui::Text("Coming soon"); + + ImGui::EndTable(); + } + ImGui::PopStyleVar(1); ImGui::EndTabItem(); } if (ImGui::BeginTabItem("Starting Inventory")) { + ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); if (ImGui::BeginTable("tableRandoStartingInventory", 3, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn(" ", ImGuiTableColumnFlags_WidthStretch, 200.0f); - // Add empty columns to keep them 1/3rd of the width - ImGui::TableSetupColumn(" ", ImGuiTableColumnFlags_WidthStretch, 200.0f); - ImGui::TableSetupColumn(" ", ImGuiTableColumnFlags_WidthStretch, 200.0f); + ImGui::TableSetupColumn("Starting Equipment", ImGuiTableColumnFlags_WidthStretch, 200.0f); + ImGui::TableSetupColumn("Starting Items", ImGuiTableColumnFlags_WidthStretch, 200.0f); + ImGui::TableSetupColumn("Starting Songs", ImGuiTableColumnFlags_WidthStretch, 200.0f); + ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true); ImGui::TableHeadersRow(); + ImGui::PopItemFlag(); ImGui::TableNextRow(); - ImGui::TableNextColumn(); - // COLUMN 1 - STARTING INVENTORY - SohImGui::EnhancementCheckbox(Settings::StartingOcarina.GetName().c_str(), "gRandomizeStartingOcarina"); - PaddedSeparator(); + // COLUMN 1 - STARTING EQUIPMENT + ImGui::TableNextColumn(); + window->DC.CurrLineTextBaseOffset = 0.0f; SohImGui::EnhancementCheckbox(Settings::StartingKokiriSword.GetName().c_str(), "gRandomizeStartingKokiriSword"); PaddedSeparator(); SohImGui::EnhancementCheckbox(Settings::StartingDekuShield.GetName().c_str(), "gRandomizeStartingDekuShield"); + + // COLUMN 2 - STARTING ITEMS + ImGui::TableNextColumn(); + window->DC.CurrLineTextBaseOffset = 0.0f; + SohImGui::EnhancementCheckbox(Settings::StartingOcarina.GetName().c_str(), "gRandomizeStartingOcarina"); PaddedSeparator(); SohImGui::EnhancementCheckbox(Settings::StartingConsumables.GetName().c_str(), "gRandomizeStartingConsumables"); PaddedSeparator(); SohImGui::EnhancementCheckbox("Full Wallets", "gRandomizeFullWallets"); InsertHelpHoverText("Start with a full wallet. All wallet upgrades come filled with rupees."); - // Add empty columns to keep them 1/3rd of the width - ImGui::TableNextColumn(); + // COLUMN 3 - STARTING SONGS ImGui::TableNextColumn(); + window->DC.CurrLineTextBaseOffset = 0.0f; + ImGui::Text("Coming soon"); ImGui::EndTable(); } + ImGui::PopStyleVar(1); ImGui::EndTabItem(); } @@ -4310,34 +4356,6 @@ void DrawRandoEditor(bool& open) { ImGui::End(); } - /* - if (ImGui::BeginTabBar("Randomizer Settings", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { - - if (ImGui::BeginTabItem("Starting Inventory")) { - - ImGui::EndTabItem(); - } - - if (ImGui::BeginTabItem("Item Usability Settings")) { - - ImGui::EndTabItem(); - } - - if (ImGui::BeginTabItem("Cosmetic Settings")) { - - ImGui::EndTabItem(); - } - - if (ImGui::BeginTabItem("Settings Presets")) { - - ImGui::EndTabItem(); - } - ImGui::EndTabBar(); - } - ImGui::End(); - }*/ - - void InitRando() { SohImGui::AddWindow("Randomizer", "Randomizer Settings", DrawRandoEditor); } From e479cb424b03199a85502ee5210a73230e089a5a Mon Sep 17 00:00:00 2001 From: aMannus Date: Tue, 2 Aug 2022 12:35:52 +0200 Subject: [PATCH 6/7] Moved logic rules dropdown --- .../Enhancements/randomizer/randomizer.cpp | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 2fbe577850..6e88fff48b 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3749,20 +3749,6 @@ void DrawRandoEditor(bool& open) { if (CVar_GetS32("gRandomizer", 0) == 1 && ImGui::BeginTabBar("Randomizer Settings", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabItem("Main Rules")) { ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); - if (ImGui::BeginTable("tableRandoLogic", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthStretch, 200.0f); - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::PushItemWidth(170.0); - ImGui::Text("Logic Rules"); - InsertHelpHoverText("Glitchless - No glitches are required, but may require some minor tricks.\n" - "\n" - "No logic - Item placement is completely random. MAY BE IMPOSSIBLE TO BEAT." - ); - SohImGui::EnhancementCombobox("gRandomizeLogicRules", randoLogicRules, 2, 0); - ImGui::PopItemWidth(); - ImGui::EndTable(); - } if (ImGui::BeginTable("tableRandoMainRules", 3, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { ImGui::TableSetupColumn("Open Settings", ImGuiTableColumnFlags_WidthStretch, 200.0f); ImGui::TableSetupColumn("Shuffle Settings", ImGuiTableColumnFlags_WidthStretch, 200.0f); @@ -4302,6 +4288,19 @@ void DrawRandoEditor(bool& open) { if (ImGui::BeginTabItem("Tricks/Glitches")) { ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); + if (ImGui::BeginTable("tableRandoLogic", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { + ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthStretch, 200.0f); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::PushItemWidth(170.0); + ImGui::Text("Logic Rules"); + InsertHelpHoverText("Glitchless - No glitches are required, but may require some minor tricks.\n" + "\n" + "No logic - Item placement is completely random. MAY BE IMPOSSIBLE TO BEAT."); + SohImGui::EnhancementCombobox("gRandomizeLogicRules", randoLogicRules, 2, 0); + ImGui::PopItemWidth(); + ImGui::EndTable(); + } if (ImGui::BeginTable("tableRandoTricksGlitches", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { ImGui::TableSetupColumn("Enable Tricks", ImGuiTableColumnFlags_WidthStretch, 200.0f); From c404d95b677291e43e88f3b1fed12245cd6e7530 Mon Sep 17 00:00:00 2001 From: aMannus Date: Tue, 2 Aug 2022 13:38:17 +0200 Subject: [PATCH 7/7] Adressed review comments --- soh/soh/Enhancements/debugger/ImGuiHelpers.cpp | 10 +++++----- soh/soh/Enhancements/debugger/ImGuiHelpers.h | 2 +- soh/soh/Enhancements/randomizer/randomizer.cpp | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/soh/soh/Enhancements/debugger/ImGuiHelpers.cpp b/soh/soh/Enhancements/debugger/ImGuiHelpers.cpp index c5af1dc299..629da69b6a 100644 --- a/soh/soh/Enhancements/debugger/ImGuiHelpers.cpp +++ b/soh/soh/Enhancements/debugger/ImGuiHelpers.cpp @@ -20,12 +20,12 @@ void InsertHelpHoverText(const std::string& text) { } } -void PaddedSeparator(bool topPadding, bool bottomPadding, float x, float y) { - if (topPadding) { - ImGui::Dummy(ImVec2(x, y)); +void PaddedSeparator(bool padTop, bool padBottom, float extraVerticalPadding) { + if (padTop) { + ImGui::Dummy(ImVec2(0.0f, extraVerticalPadding)); } ImGui::Separator(); - if (bottomPadding) { - ImGui::Dummy(ImVec2(x, y)); + if (padBottom) { + ImGui::Dummy(ImVec2(0.0f, extraVerticalPadding)); } } diff --git a/soh/soh/Enhancements/debugger/ImGuiHelpers.h b/soh/soh/Enhancements/debugger/ImGuiHelpers.h index b9b6c68f82..91df059aa8 100644 --- a/soh/soh/Enhancements/debugger/ImGuiHelpers.h +++ b/soh/soh/Enhancements/debugger/ImGuiHelpers.h @@ -7,4 +7,4 @@ void SetLastItemHoverText(const std::string& text); void InsertHelpHoverText(const std::string& text); -void PaddedSeparator(bool topPadding = true, bool bottomPadding = true, float x = 0, float y = 0); +void PaddedSeparator(bool padTop = true, bool padBottom = true, float extraVerticalPadding = 0); diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 6e88fff48b..2ea2415356 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -4249,18 +4249,18 @@ void DrawRandoEditor(bool& open) { ImGui::EndTabItem(); } - if (ImGui::BeginTabItem("Location Logic")) { + if (ImGui::BeginTabItem("Locations")) { ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); - if (ImGui::BeginTable("tableRandoLocationLogic", 2, + if (ImGui::BeginTable("tableRandoLocations", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Exclude Item Checks", ImGuiTableColumnFlags_WidthStretch, 200.0f); ImGui::TableSetupColumn("Exclude Locations", ImGuiTableColumnFlags_WidthStretch, 200.0f); + ImGui::TableSetupColumn(" ", ImGuiTableColumnFlags_WidthStretch, 200.0f); ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true); ImGui::TableHeadersRow(); ImGui::PopItemFlag(); ImGui::TableNextRow(); - // COLUMN 1 - EXCLUDE ITEM CHECKS + // COLUMN 1 - EXCLUDE LOCATIONS ImGui::TableNextColumn(); window->DC.CurrLineTextBaseOffset = 0.0f; SohImGui::EnhancementCheckbox("Deku Theater Mask of Truth", "gRandomizeExcludeDekuTheaterMaskOfTruth"); @@ -4278,7 +4278,7 @@ void DrawRandoEditor(bool& open) { // COLUMN 2 - EXCLUDE LOCATIONS ImGui::TableNextColumn(); window->DC.CurrLineTextBaseOffset = 0.0f; - ImGui::Text("Coming soon"); + ImGui::EndTable(); }