diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp index 90b21e975..dc9d00f59 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp @@ -639,6 +639,89 @@ void InitEntranceTrackingData() { SortEntranceListByType(destListSortedByType, 1); } +void EntranceTrackerSettingsWindow::DrawElement() { + ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver); + + if (!ImGui::Begin("Entrance Tracker Settings", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) { + ImGui::End(); + return; + } + + if (ImGui::BeginTable("entranceTrackerSettings", 1, ImGuiTableFlags_BordersInnerH)) { + + ImGui::TableNextColumn(); + + UIWidgets::Spacer(0); + ImGui::TextWrapped("The entrance tracker will only track shuffled entrances"); + UIWidgets::Spacer(0); + + ImGui::TableNextColumn(); + + if (ImGui::BeginTable("entranceTrackerSubSettings", 2, ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_SizingStretchProp)) { + + ImGui::TableNextColumn(); + + ImGui::Text("Sort By"); + UIWidgets::EnhancementRadioButton("To", "gEntranceTrackerSortBy", 0); + UIWidgets::Tooltip("Sort entrances by the original source entrance"); + UIWidgets::EnhancementRadioButton("From", "gEntranceTrackerSortBy", 1); + UIWidgets::Tooltip("Sort entrances by the overrided destination"); + + UIWidgets::Spacer(2.0f); + + ImGui::Text("List Items"); + UIWidgets::PaddedEnhancementCheckbox("Auto scroll", "gEntranceTrackerAutoScroll", true, false); + UIWidgets::Tooltip("Automatically scroll to the first aviable entrance in the current scene"); + UIWidgets::PaddedEnhancementCheckbox("Highlight previous", "gEntranceTrackerHighlightPrevious", true, false); + UIWidgets::Tooltip("Highlight the previous entrance that Link came from"); + UIWidgets::PaddedEnhancementCheckbox("Highlight available", "gEntranceTrackerHighlightAvailable", true, false); + UIWidgets::Tooltip("Highlight available entrances in the current scene"); + UIWidgets::PaddedEnhancementCheckbox("Hide undiscovered", "gEntranceTrackerCollapseUndiscovered", true, false); + UIWidgets::Tooltip("Collapse undiscovered entrances towards the bottom of each group"); + bool disableHideReverseEntrances = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_DECOUPLED_ENTRANCES) == RO_GENERIC_ON; + static const char* disableHideReverseEntrancesText = "This option is disabled because \"Decouple Entrances\" is enabled."; + UIWidgets::PaddedEnhancementCheckbox("Hide reverse", "gEntranceTrackerHideReverseEntrances", true, false, + disableHideReverseEntrances, disableHideReverseEntrancesText, UIWidgets::CheckboxGraphics::Cross, true); + UIWidgets::Tooltip("Hide reverse entrance transitions when Decouple Entrances is off"); + UIWidgets::Spacer(0); + + ImGui::TableNextColumn(); + + ImGui::Text("Group By"); + UIWidgets::EnhancementRadioButton("Area", "gEntranceTrackerGroupBy", 0); + UIWidgets::Tooltip("Group entrances by their area"); + UIWidgets::EnhancementRadioButton("Type", "gEntranceTrackerGroupBy", 1); + UIWidgets::Tooltip("Group entrances by their entrance type"); + + UIWidgets::Spacer(2.0f); + + ImGui::Text("Spoiler Reveal"); + UIWidgets::PaddedEnhancementCheckbox("Show \"To\"", "gEntranceTrackerShowTo", true, false); + UIWidgets::Tooltip("Reveal the \"To\" entrance for undiscovered entrances"); + UIWidgets::PaddedEnhancementCheckbox("Show \"From\"", "gEntranceTrackerShowFrom", true, false); + UIWidgets::Tooltip("Reveal the \"From\" entrance for undiscovered entrances"); + + ImGui::EndTable(); + } + + ImGui::TableNextColumn(); + + ImGui::SetNextItemOpen(false, ImGuiCond_Once); + if (ImGui::TreeNode("Legend")) { + ImGui::TextColored(ImColor(COLOR_ORANGE), "Last Entrance"); + ImGui::TextColored(ImColor(COLOR_GREEN), "Available Entrances"); + ImGui::TextColored(ImColor(COLOR_GRAY), "Undiscovered Entrances"); + ImGui::TreePop(); + } + + UIWidgets::Spacer(0); + + ImGui::EndTable(); + } + + ImGui::End(); +} + void EntranceTrackerWindow::DrawElement() { ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver); @@ -647,89 +730,6 @@ void EntranceTrackerWindow::DrawElement() { return; } - // Begin tracker settings - ImGui::SetNextItemOpen(false, ImGuiCond_Once); - if (ImGui::TreeNode("Tracker Settings")) { - // Reduce indentation from the tree node for the table - ImGui::SetCursorPosX((ImGui::GetCursorPosX() / 2) + 4.0f); - - if (ImGui::BeginTable("entranceTrackerSettings", 1, ImGuiTableFlags_BordersInnerH)) { - - ImGui::TableNextColumn(); - - UIWidgets::Spacer(0); - ImGui::TextWrapped("The entrance tracker will only track shuffled entrances"); - UIWidgets::Spacer(0); - - ImGui::TableNextColumn(); - - if (ImGui::BeginTable("entranceTrackerSubSettings", 2, ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_SizingStretchProp)) { - - ImGui::TableNextColumn(); - - ImGui::Text("Sort By"); - UIWidgets::EnhancementRadioButton("To", "gEntranceTrackerSortBy", 0); - UIWidgets::Tooltip("Sort entrances by the original source entrance"); - UIWidgets::EnhancementRadioButton("From", "gEntranceTrackerSortBy", 1); - UIWidgets::Tooltip("Sort entrances by the overrided destination"); - - UIWidgets::Spacer(2.0f); - - ImGui::Text("List Items"); - UIWidgets::PaddedEnhancementCheckbox("Auto scroll", "gEntranceTrackerAutoScroll", true, false); - UIWidgets::Tooltip("Automatically scroll to the first aviable entrance in the current scene"); - UIWidgets::PaddedEnhancementCheckbox("Highlight previous", "gEntranceTrackerHighlightPrevious", true, false); - UIWidgets::Tooltip("Highlight the previous entrance that Link came from"); - UIWidgets::PaddedEnhancementCheckbox("Highlight available", "gEntranceTrackerHighlightAvailable", true, false); - UIWidgets::Tooltip("Highlight available entrances in the current scene"); - UIWidgets::PaddedEnhancementCheckbox("Hide undiscovered", "gEntranceTrackerCollapseUndiscovered", true, false); - UIWidgets::Tooltip("Collapse undiscovered entrances towards the bottom of each group"); - bool disableHideReverseEntrances = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_DECOUPLED_ENTRANCES) == RO_GENERIC_ON; - static const char* disableHideReverseEntrancesText = "This option is disabled because \"Decouple Entrances\" is enabled."; - UIWidgets::PaddedEnhancementCheckbox("Hide reverse", "gEntranceTrackerHideReverseEntrances", true, false, - disableHideReverseEntrances, disableHideReverseEntrancesText, UIWidgets::CheckboxGraphics::Cross, true); - UIWidgets::Tooltip("Hide reverse entrance transitions when Decouple Entrances is off"); - UIWidgets::Spacer(0); - - ImGui::TableNextColumn(); - - ImGui::Text("Group By"); - UIWidgets::EnhancementRadioButton("Area", "gEntranceTrackerGroupBy", 0); - UIWidgets::Tooltip("Group entrances by their area"); - UIWidgets::EnhancementRadioButton("Type", "gEntranceTrackerGroupBy", 1); - UIWidgets::Tooltip("Group entrances by their entrance type"); - - UIWidgets::Spacer(2.0f); - - ImGui::Text("Spoiler Reveal"); - UIWidgets::PaddedEnhancementCheckbox("Show \"To\"", "gEntranceTrackerShowTo", true, false); - UIWidgets::Tooltip("Reveal the \"To\" entrance for undiscovered entrances"); - UIWidgets::PaddedEnhancementCheckbox("Show \"From\"", "gEntranceTrackerShowFrom", true, false); - UIWidgets::Tooltip("Reveal the \"From\" entrance for undiscovered entrances"); - - ImGui::EndTable(); - } - - ImGui::TableNextColumn(); - - ImGui::SetNextItemOpen(false, ImGuiCond_Once); - if (ImGui::TreeNode("Legend")) { - ImGui::TextColored(ImColor(COLOR_ORANGE), "Last Entrance"); - ImGui::TextColored(ImColor(COLOR_GREEN), "Available Entrances"); - ImGui::TextColored(ImColor(COLOR_GRAY), "Undiscovered Entrances"); - ImGui::TreePop(); - } - - UIWidgets::Spacer(0); - - ImGui::EndTable(); - } - - ImGui::TreePop(); - } else { - UIWidgets::PaddedSeparator(); - } - static ImGuiTextFilter locationSearch; uint8_t nextTreeState = 0; diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h index fc5346aa3..8b8dc66fe 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h @@ -85,6 +85,16 @@ s16 GetLastEntranceOverride(); s16 GetCurrentGrottoId(); const EntranceData* GetEntranceData(s16); +class EntranceTrackerSettingsWindow : public LUS::GuiWindow { + public: + using GuiWindow::GuiWindow; + + protected: + void InitElement() override {}; + void DrawElement() override; + void UpdateElement() override {}; +}; + class EntranceTrackerWindow : public LUS::GuiWindow { public: using GuiWindow::GuiWindow; diff --git a/soh/soh/SohGui.cpp b/soh/soh/SohGui.cpp index bbc12b1a1..daa5859cb 100644 --- a/soh/soh/SohGui.cpp +++ b/soh/soh/SohGui.cpp @@ -129,6 +129,7 @@ namespace SohGui { std::shared_ptr mGameplayStatsWindow; std::shared_ptr mCheckTrackerSettingsWindow; std::shared_ptr mCheckTrackerWindow; + std::shared_ptr mEntranceTrackerSettingsWindow; std::shared_ptr mEntranceTrackerWindow; std::shared_ptr mItemTrackerSettingsWindow; std::shared_ptr mItemTrackerWindow; @@ -191,8 +192,10 @@ namespace SohGui { gui->AddGuiWindow(mCheckTrackerWindow); mCheckTrackerSettingsWindow = std::make_shared("gCheckTrackerSettingsEnabled", "Check Tracker Settings"); gui->AddGuiWindow(mCheckTrackerSettingsWindow); - mEntranceTrackerWindow = std::make_shared("gEntranceTrackerEnabled","Entrance Tracker"); + mEntranceTrackerWindow = std::make_shared("gEntranceTrackerEnabled", "Entrance Tracker"); gui->AddGuiWindow(mEntranceTrackerWindow); + mEntranceTrackerSettingsWindow = std::make_shared("gEntranceTrackerSettingsEnabled", "Entrance Tracker Settings"); + gui->AddGuiWindow(mEntranceTrackerSettingsWindow); mItemTrackerWindow = std::make_shared("gItemTrackerEnabled", "Item Tracker"); gui->AddGuiWindow(mItemTrackerWindow); mItemTrackerSettingsWindow = std::make_shared("gItemTrackerSettingsEnabled", "Item Tracker Settings"); @@ -209,6 +212,7 @@ namespace SohGui { mItemTrackerWindow = nullptr; mItemTrackerSettingsWindow = nullptr; mEntranceTrackerWindow = nullptr; + mEntranceTrackerSettingsWindow = nullptr; mCheckTrackerWindow = nullptr; mCheckTrackerSettingsWindow = nullptr; mGameplayStatsWindow = nullptr; diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 2a343d632..0de28fb58 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -1882,6 +1882,7 @@ extern std::shared_ptr mRandomizerSettingsWindow; extern std::shared_ptr mItemTrackerWindow; extern std::shared_ptr mItemTrackerSettingsWindow; extern std::shared_ptr mEntranceTrackerWindow; +extern std::shared_ptr mEntranceTrackerSettingsWindow; extern std::shared_ptr mCheckTrackerWindow; extern std::shared_ptr mCheckTrackerSettingsWindow; extern "C" u8 Randomizer_GetSettingValue(RandomizerSettingKey randoSettingKey); @@ -1900,11 +1901,19 @@ void DrawRandomizerMenu() { ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0, 0)); ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f)); + #ifdef __WIIU__ static ImVec2 buttonSize(200.0f * 2.0f, 0.0f); + static ImVec2 buttonWithOptionsSize(170.0f * 2.0f, 0.0f); + static ImVec2 optionsButtonSize(25.0f * 2.0f, 0.0f); + static float separationToOptionsButton = 5.0f * 2.0f; #else static ImVec2 buttonSize(200.0f, 0.0f); + static ImVec2 buttonWithOptionsSize(170.0f, 0.0f); + static ImVec2 optionsButtonSize(25.0f, 0.0f); + static float separationToOptionsButton = 5.0f; #endif + if (mRandomizerSettingsWindow) { if (ImGui::Button(GetWindowButtonText("Randomizer Settings", CVarGetInteger("gRandomizerSettingsEnabled", 0)).c_str(), buttonSize)) { mRandomizerSettingsWindow->ToggleVisibility(); @@ -1912,36 +1921,58 @@ void DrawRandomizerMenu() { } UIWidgets::Spacer(0); + if (mItemTrackerWindow) { - if (ImGui::Button(GetWindowButtonText("Item Tracker", CVarGetInteger("gItemTrackerEnabled", 0)).c_str(), buttonSize)) { + if (ImGui::Button(GetWindowButtonText("Item Tracker", CVarGetInteger("gItemTrackerEnabled", 0)).c_str(), buttonWithOptionsSize)) { mItemTrackerWindow->ToggleVisibility(); } } - UIWidgets::Spacer(0); + ImGui::SameLine(0, 0); + ImVec2 cursor = ImGui::GetCursorPos(); + ImGui::SetCursorPos(ImVec2(cursor.x + separationToOptionsButton, cursor.y)); + if (mItemTrackerSettingsWindow) { - if (ImGui::Button(GetWindowButtonText("Item Tracker Settings", CVarGetInteger("gItemTrackerSettingsEnabled", 0)).c_str(), buttonSize)) { + if (ImGui::Button(ICON_FA_COG "##ItemTrackerSettings", optionsButtonSize)) { mItemTrackerSettingsWindow->ToggleVisibility(); } } + UIWidgets::Spacer(0); if (mEntranceTrackerWindow) { - if (ImGui::Button(GetWindowButtonText("Entrance Tracker", CVarGetInteger("gEntranceTrackerEnabled", 0)).c_str(), buttonSize)) { + if (ImGui::Button(GetWindowButtonText("Entrance Tracker", CVarGetInteger("gEntranceTrackerEnabled", 0)).c_str(), buttonWithOptionsSize)) { mEntranceTrackerWindow->ToggleVisibility(); } } + + ImGui::SameLine(0, 0); + cursor = ImGui::GetCursorPos(); + ImGui::SetCursorPos(ImVec2(cursor.x + separationToOptionsButton, cursor.y)); + + if (mEntranceTrackerSettingsWindow) { + if (ImGui::Button(ICON_FA_COG "##EntranceTrackerSettings", optionsButtonSize)) { + mEntranceTrackerSettingsWindow->ToggleVisibility(); + } + } + UIWidgets::Spacer(0); + if (mCheckTrackerWindow) { - if (ImGui::Button(GetWindowButtonText("Check Tracker", CVarGetInteger("gCheckTrackerEnabled", 0)).c_str(), buttonSize)) { + if (ImGui::Button(GetWindowButtonText("Check Tracker", CVarGetInteger("gCheckTrackerEnabled", 0)).c_str(), buttonWithOptionsSize)) { mCheckTrackerWindow->ToggleVisibility(); } } - UIWidgets::Spacer(0); + + ImGui::SameLine(0, 0); + cursor = ImGui::GetCursorPos(); + ImGui::SetCursorPos(ImVec2(cursor.x + separationToOptionsButton, cursor.y)); + if (mCheckTrackerSettingsWindow) { - if (ImGui::Button(GetWindowButtonText("Check Tracker Settings", CVarGetInteger("gCheckTrackerSettingsEnabled", 0)).c_str(), buttonSize)) { + if (ImGui::Button(ICON_FA_COG "##CheckTrackerSettings", optionsButtonSize)) { mCheckTrackerSettingsWindow->ToggleVisibility(); } } + ImGui::PopStyleVar(3); ImGui::PopStyleColor(1);