diff --git a/soh/soh/Enhancements/Presets/Presets.cpp b/soh/soh/Enhancements/Presets/Presets.cpp index 5ab8813d0..43dbec3ef 100644 --- a/soh/soh/Enhancements/Presets/Presets.cpp +++ b/soh/soh/Enhancements/Presets/Presets.cpp @@ -437,7 +437,8 @@ void PresetsCustomWidget(WidgetInfo& info) { void RegisterPresetsWidgets() { SohGui::mSohMenu->AddSidebarEntry("Settings", "Presets", 1); WidgetPath path = { "Settings", "Presets", SECTION_COLUMN_1 }; - SohGui::mSohMenu->AddWidget(path, "PresetsWidget", WIDGET_CUSTOM).CustomFunction(PresetsCustomWidget) + SohGui::mSohMenu->AddWidget(path, "PresetsWidget", WIDGET_CUSTOM) + .CustomFunction(PresetsCustomWidget) .HideInSearch(true); presetFolder = Ship::Context::GetInstance()->GetPathRelativeToAppDirectory("presets"); std::fill_n(saveSection, PRESET_SECTION_MAX, true); diff --git a/soh/soh/Enhancements/audio/AudioEditor.cpp b/soh/soh/Enhancements/audio/AudioEditor.cpp index 4cf1f389d..631405d28 100644 --- a/soh/soh/Enhancements/audio/AudioEditor.cpp +++ b/soh/soh/Enhancements/audio/AudioEditor.cpp @@ -550,7 +550,7 @@ void AudioEditor::DrawElement() { .DefaultValue(5) .Size(ImVec2(300.0f, 0.0f)) .Color(THEME_COLOR)); - UIWidgets::CVarSliderFloat("Link's voice pitch multiplier", CVAR_AUDIO("LinkVoiceFreqMultiplier"), + UIWidgets::CVarSliderFloat("Link's Voice Pitch Multiplier", CVAR_AUDIO("LinkVoiceFreqMultiplier"), UIWidgets::FloatSliderOptions() .IsPercentage() .Min(0.4f) diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index d6334b6a0..030f2c41a 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -2089,7 +2089,7 @@ void CheckTrackerSettingsWindow::DrawElement() { ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x); - UIWidgets::CVarColorPicker("BG Color", CVAR_TRACKER_CHECK("BgColor"), Color_Bg_Default, true, + UIWidgets::CVarColorPicker("Background Color", CVAR_TRACKER_CHECK("BgColor"), Color_Bg_Default, true, UIWidgets::ColorPickerResetButton | UIWidgets::ColorPickerRandomButton, THEME_COLOR); ImGui::PopItemWidth(); @@ -2103,7 +2103,7 @@ void CheckTrackerSettingsWindow::DrawElement() { if (CVarGetInteger(CVAR_TRACKER_CHECK("WindowType"), TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) { UIWidgets::CVarCheckbox("Enable Dragging", CVAR_TRACKER_CHECK("Draggable"), UIWidgets::CheckboxOptions().Color(THEME_COLOR)); - UIWidgets::CVarCheckbox("Only enable while paused", CVAR_TRACKER_CHECK("ShowOnlyPaused"), + UIWidgets::CVarCheckbox("Only Enable While Paused", CVAR_TRACKER_CHECK("ShowOnlyPaused"), UIWidgets::CheckboxOptions().Color(THEME_COLOR)); UIWidgets::CVarCombobox("Display Mode", CVAR_TRACKER_CHECK("DisplayType"), displayType, UIWidgets::ComboboxOptions() @@ -2135,7 +2135,7 @@ void CheckTrackerSettingsWindow::DrawElement() { .Color(THEME_COLOR)); ImGui::EndDisabled(); if (UIWidgets::CVarCheckbox( - "Hide unshuffled shop item checks", CVAR_TRACKER_CHECK("HideUnshuffledShopChecks"), + "Hide Unshuffled Shop Item Checks", CVAR_TRACKER_CHECK("HideUnshuffledShopChecks"), UIWidgets::CheckboxOptions() .Tooltip("If enabled, will prevent the tracker from displaying slots with non-shop-item shuffles.") .Color(THEME_COLOR))) { @@ -2143,7 +2143,7 @@ void CheckTrackerSettingsWindow::DrawElement() { UpdateFilters(); } if (UIWidgets::CVarCheckbox( - "Always show gold skulltulas", CVAR_TRACKER_CHECK("AlwaysShowGSLocs"), + "Always Show Gold Skulltulas", CVAR_TRACKER_CHECK("AlwaysShowGSLocs"), UIWidgets::CheckboxOptions() .Tooltip("If enabled, will show GS locations in the tracker regardless of tokensanity settings.") .Color(THEME_COLOR))) { diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index fcace1017..4988ae85d 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -1759,7 +1759,7 @@ void ItemTrackerSettingsWindow::DrawElement() { if (CVarCheckbox("Enable Dragging", CVAR_TRACKER_ITEM("Draggable"), CheckboxOptions().Color(THEME_COLOR))) { shouldUpdateVectors = true; } - if (CVarCheckbox("Only enable while paused", CVAR_TRACKER_ITEM("ShowOnlyPaused"), + if (CVarCheckbox("Only Enable While Paused", CVAR_TRACKER_ITEM("ShowOnlyPaused"), CheckboxOptions().Color(THEME_COLOR))) { shouldUpdateVectors = true; } diff --git a/soh/soh/SohGui/Menu.cpp b/soh/soh/SohGui/Menu.cpp index dc74ab7fd..e7f59f38c 100644 --- a/soh/soh/SohGui/Menu.cpp +++ b/soh/soh/SohGui/Menu.cpp @@ -24,11 +24,19 @@ namespace SohGui { extern std::shared_ptr mModalWindow; } +std::vector extraSearches = {}; + namespace Ship { std::string disabledTempTooltip; const char* disabledTooltip; bool disabledValue = false; +bool navigateToWidget = false; +const char* navigateMainEntry = ""; +const char* navigateSidebar = ""; +std::string navigateWidgetName = ""; +bool highlightWidget = false; + bool operator==(Color_RGB8 const& l, Color_RGB8 const& r) noexcept { return l.r == r.r && l.g == r.g && l.b == r.b; } @@ -186,9 +194,12 @@ bool ModernMenuHeaderEntry(std::string label) { uint32_t Menu::DrawSearchResults(std::string& menuSearchText) { int searchCount = 0; - ImGui::SetNextWindowSizeConstraints({ ImGui::GetContentRegionAvail().x / 2, 0}, {ImGui::GetContentRegionAvail().x / 2, ImGui::GetContentRegionAvail().y}); - if (ImGui::BeginChild("Search Results Col 1", { ImGui::GetContentRegionAvail().x / 2, windowHeight * 4 }, ImGuiChildFlags_AutoResizeY, - ImGuiWindowFlags_NoTitleBar)) { + std::transform(menuSearchText.begin(), menuSearchText.end(), menuSearchText.begin(), ::tolower); + menuSearchText.erase(std::remove(menuSearchText.begin(), menuSearchText.end(), ' '), menuSearchText.end()); + ImGui::SetNextWindowSizeConstraints({ ImGui::GetContentRegionAvail().x / 2, 0 }, + { ImGui::GetContentRegionAvail().x / 2, ImGui::GetContentRegionAvail().y }); + if (ImGui::BeginChild("Search Results Col 1", { ImGui::GetContentRegionAvail().x / 2, 0 }, + ImGuiChildFlags_AutoResizeY, ImGuiWindowFlags_NoTitleBar)) { for (auto& menuLabel : menuOrder) { auto& menuEntry = menuEntries.at(menuLabel); for (auto& sidebarLabel : menuEntry.sidebarOrder) { @@ -197,19 +208,15 @@ uint32_t Menu::DrawSearchResults(std::string& menuSearchText) { auto& column = sidebar.columnWidgets.at(i); for (auto& info : column) { if (info.type == WIDGET_SEARCH || info.type == WIDGET_SEPARATOR || - info.type == WIDGET_SEPARATOR_TEXT || info.isHidden || - info.hideInSearch) { + info.type == WIDGET_SEPARATOR_TEXT || info.isHidden || info.hideInSearch) { continue; } const char* tooltip = info.options->tooltip; std::string widgetStr = std::string(info.name) + std::string(tooltip != NULL ? tooltip : ""); - std::transform(menuSearchText.begin(), menuSearchText.end(), menuSearchText.begin(), ::tolower); - menuSearchText.erase(std::remove(menuSearchText.begin(), menuSearchText.end(), ' '), - menuSearchText.end()); std::transform(widgetStr.begin(), widgetStr.end(), widgetStr.begin(), ::tolower); widgetStr.erase(std::remove(widgetStr.begin(), widgetStr.end(), ' '), widgetStr.end()); if (widgetStr.find(menuSearchText) != std::string::npos) { - MenuDrawItem(info, 90 / sidebar.columnCount, menuThemeIndex); + MenuDrawItem(info, 400, menuThemeIndex); ImGui::PushStyleColor(ImGuiCol_Text, UIWidgets::ColorValues.at(UIWidgets::Colors::Gray)); std::string origin = fmt::format(" ({} -> {}, Col {})", menuEntry.label, sidebarLabel, i + 1); @@ -223,6 +230,41 @@ uint32_t Menu::DrawSearchResults(std::string& menuSearchText) { } ImGui::EndChild(); } + ImGui::SameLine(); + ImGui::SetNextWindowSizeConstraints({ ImGui::GetContentRegionAvail().x, 0 }, + { ImGui::GetContentRegionAvail().x, ImGui::GetContentRegionAvail().y }); + if (ImGui::BeginChild("Search Results Col 2", { ImGui::GetContentRegionAvail().x, 0 }, ImGuiChildFlags_AutoResizeY, + ImGuiWindowFlags_NoTitleBar)) { + for (auto& entry : extraSearches) { + std::string widgetStr = entry.widgetName + entry.extraTerms + entry.sidebarName; + std::transform(widgetStr.begin(), widgetStr.end(), widgetStr.begin(), ::tolower); + widgetStr.erase(std::remove(widgetStr.begin(), widgetStr.end(), ' '), widgetStr.end()); + if (widgetStr.find(menuSearchText) != std::string::npos) { + std::string origin = fmt::format(" ({} -> {}, {})", entry.menuName, entry.sidebarName, entry.location); + ImVec2 textSize = ImGui::CalcTextSize(origin.c_str()); + ImVec2 pos = ImGui::GetCurrentWindow()->DC.CursorPos; + ImRect bb = { pos, { pos.x + textSize.x, pos.y + (textSize.y * 2) + ImGui::GetStyle().ItemSpacing.y } }; + const ImGuiID igid = + ImGui::GetCurrentWindow()->GetID(std::string(entry.widgetName + "##" + entry.sidebarName).c_str()); + ImGui::ItemSize(bb, ImGui::GetStyle().FramePadding.y); + ImGui::ItemAdd(bb, igid); + if (ImGui::ButtonBehavior(bb, igid, NULL, NULL)) { + navigateToWidget = true; + navigateMainEntry = entry.menuName.c_str(); + navigateSidebar = entry.sidebarName.c_str(); + navigateWidgetName = entry.widgetName; + break; + } + ImGui::GetCurrentWindow()->DC.CursorPos = pos; + ImGui::Text("%s", entry.widgetName.c_str()); + ImGui::PushStyleColor(ImGuiCol_Text, UIWidgets::ColorValues.at(UIWidgets::Colors::Gray)); + ImGui::Text("%s", origin.c_str()); + ImGui::PopStyleColor(); + searchCount++; + } + } + ImGui::EndChild(); + } return searchCount; } @@ -231,6 +273,10 @@ void Menu::AddMenuEntry(std::string entryName, const char* entryCvar) { menuOrder.push_back(entryName); } +void Menu::AddSearchEntry(SearchEntry entry) { + extraSearches.push_back(entry); +} + std::unordered_map& Menu::GetDisabledMap() { return disabledMap; } @@ -503,6 +549,19 @@ void Menu::DrawElement() { for (auto& [reason, info] : disabledMap) { info.active = info.evaluation(info); } + const char* headerCvar = CVAR_SETTING("Menu.ActiveHeader"); + + if (navigateToWidget) { + if (menuEntries.contains(navigateMainEntry) && + menuEntries.at(navigateMainEntry).sidebars.contains(navigateSidebar)) { + menuSearch.Clear(); + CVarSetString(headerCvar, navigateMainEntry); + const char* sidebarCvar = menuEntries.at(navigateMainEntry).sidebarCvar; + CVarSetString(sidebarCvar, navigateSidebar); + highlightWidget = true; + } + navigateToWidget = false; + } raceDisableActive = CVarGetInteger(CVAR_SETTING("DisableChanges"), 0); @@ -570,7 +629,6 @@ void Menu::DrawElement() { ImGui::PushFont(OTRGlobals::Instance->fontStandardLargest); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(10.0f, 8.0f)); - const char* headerCvar = CVAR_SETTING("Menu.ActiveHeader"); std::string headerIndex = CVarGetString(headerCvar, "Settings"); ImVec2 pos = window->DC.CursorPos; float centerX = pos.x + windowWidth / 2 - (style.ItemSpacing.x * (menuEntries.size() + 1)); diff --git a/soh/soh/SohGui/Menu.h b/soh/soh/SohGui/Menu.h index a7facffd1..a6f030356 100644 --- a/soh/soh/SohGui/Menu.h +++ b/soh/soh/SohGui/Menu.h @@ -26,6 +26,7 @@ class Menu : public GuiWindow { void MenuDrawItem(WidgetInfo& widget, uint32_t width, UIWidgets::Colors menuThemeIndex); void AddMenuEntry(std::string entryName, const char* entryCvar); + void AddSearchEntry(SearchEntry entry); std::unordered_map& GetDisabledMap(); protected: diff --git a/soh/soh/SohGui/MenuTypes.h b/soh/soh/SohGui/MenuTypes.h index 5a22104fa..990d98d36 100644 --- a/soh/soh/SohGui/MenuTypes.h +++ b/soh/soh/SohGui/MenuTypes.h @@ -286,6 +286,15 @@ struct MenuInit { } }; +struct SearchEntry { + // First four required + std::string widgetName; + std::string menuName; + std::string sidebarName; + std::string location; + std::string extraTerms = ""; +}; + struct RegisterMenuInitFunc { RegisterMenuInitFunc(std::function initFunc) { auto& menuInitFuncs = MenuInit::GetInitFuncs(); diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index 4f6d449fe..898f6650a 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -1882,6 +1882,16 @@ void SohMenu::AddMenuEnhancements() { .CVar(timer.timeEnable) .Callback([](WidgetInfo& info) { TimeDisplayUpdateDisplayOptions(); }); } + + AddSearchEntry({ "Mute Low HP Alarm", "Enhancements", "Audio Editor", "Audio Options" }); + AddSearchEntry({ "Disable Navi Audio Call", "Enhancements", "Audio Editor", "Audio Options", "mute" }); + AddSearchEntry({ "Disable Enemy Proximity Music", "Enhancements", "Audio Editor", "Audio Options", "mute" }); + AddSearchEntry({ "Disable Leading Music in Lost Woods", "Enhancements", "Audio Editor", "Audio Options", "mute" }); + AddSearchEntry({ "Overlay Duration", "Enhancements", "Audio Editor", "Audio Options", "sequencetracktitle" }); + AddSearchEntry({ "Link's Voice Pitch Multiplier", "Enhancements", "Audio Editor", "Audio Options" }); + AddSearchEntry( + { "Randomize All Music and Sound Effects on New Scene", "Enhancements", "Audio Editor", "Audio Options" }); + AddSearchEntry({ "Lower Octaves of Unplayable High Notes", "Enhancements", "Audio Editor", "Audio Options" }); } } // namespace SohGui diff --git a/soh/soh/SohGui/SohMenuRandomizer.cpp b/soh/soh/SohGui/SohMenuRandomizer.cpp index ad688740a..31a8a7cbe 100644 --- a/soh/soh/SohGui/SohMenuRandomizer.cpp +++ b/soh/soh/SohGui/SohMenuRandomizer.cpp @@ -167,6 +167,45 @@ void SohMenu::AddMenuRandomizer() { .WindowName("Check Tracker Settings") .HideInSearch(true) .Options(WindowButtonOptions().Tooltip("Enables the separate Check Tracker Settings Window.")); + + AddSearchEntry({ "Background Color", "Randomizer", "Item Tracker", "General Settings" }); + AddSearchEntry({ "Window Type", "Randomizer", "Item Tracker", "General Settings" }); + AddSearchEntry({ "Enable Dragging", "Randomizer", "Item Tracker", "General Settings" }); + AddSearchEntry({ "Only Enable While Paused", "Randomizer", "Item Tracker", "General Settings" }); + AddSearchEntry({ "Ammo/Capacity Tracking", "Randomizer", "Item Tracker", "General Settings" }); + AddSearchEntry({ "Key Count Tracking", "Randomizer", "Item Tracker", "General Settings" }); + AddSearchEntry({ "Triforce Piece Count Tracking", "Randomizer", "Item Tracker", "General Settings" }); + AddSearchEntry({ "Dungeon Items", "Randomizer", "Item Tracker", "General Settings", "keys maps compasses icon" }); + AddSearchEntry({ "Greg", "Randomizer", "Item Tracker", "General Settings", "icon" }); + AddSearchEntry({ "Triforce Pieces", "Randomizer", "Item Tracker", "General Settings", "icon" }); + AddSearchEntry({ "Boss Souls", "Randomizer", "Item Tracker", "General Settings", "icon" }); + AddSearchEntry({ "Ocarina Buttons", "Randomizer", "Item Tracker", "General Settings", "icon" }); + AddSearchEntry({ "Overworld Keys", "Randomizer", "Item Tracker", "General Settings", "icon" }); + AddSearchEntry({ "Fishing Pole", "Randomizer", "Item Tracker", "General Settings", "icon" }); + AddSearchEntry({ "Personal Notes", "Randomizer", "Item Tracker", "General Settings", "icon" }); + AddSearchEntry({ "Show Hookshot Identifiers", "Randomizer", "Item Tracker", "General Settings", "longshot icon" }); + + AddSearchEntry({ "Sort By", "Randomizer", "Entrance Tracker", "(Col 1)" }); + AddSearchEntry({ "Auto Scroll", "Randomizer", "Entrance Tracker", "(Col 1)" }); + AddSearchEntry({ "Highlight Previous", "Randomizer", "Entrance Tracker", "(Col 1)" }); + AddSearchEntry({ "Highlight Available", "Randomizer", "Entrance Tracker", "(Col 1)" }); + AddSearchEntry({ "Hide Undiscovered", "Randomizer", "Entrance Tracker", "(Col 1)" }); + AddSearchEntry({ "Hide Reverse", "Randomizer", "Entrance Tracker", "(Col 1)" }); + AddSearchEntry({ "Group By", "Randomizer", "Entrance Tracker", "(Col 2)" }); + AddSearchEntry({ "Show Source", "Randomizer", "Entrance Tracker", "(Col 2)", "spoil" }); + AddSearchEntry({ "Show Destination", "Randomizer", "Entrance Tracker", "(Col 2)", "spoil" }); + + AddSearchEntry({ "Background Color", "Randomizer", "Check Tracker", "General Settings" }); + AddSearchEntry({ "Window Type", "Randomizer", "Check Tracker", "General Settings" }); + AddSearchEntry({ "Vanilla/MQ Dungeon Spoilers", "Randomizer", "Check Tracker", "General Settings" }); + AddSearchEntry({ "Hide Unshuffled Shop Item Checks", "Randomizer", "Check Tracker", "General Settings" }); + AddSearchEntry({ "Always Show Gold Skulltulas", "Randomizer", "Check Tracker", "General Settings" }); + AddSearchEntry({ "Show Logic", "Randomizer", "Check Tracker", "General Settings" }); + AddSearchEntry({ "Display Check Availability", "Randomizer", "Check Tracker", "General Settings" }); + AddSearchEntry({ "Area Complete", "Randomizer", "Check Tracker", "Section Settings", "hide" }); + AddSearchEntry({ "Skipped", "Randomizer", "Check Tracker", "Section Settings", "hide" }); + AddSearchEntry({ "Scummed", "Randomizer", "Check Tracker", "Section Settings", "hide" }); + AddSearchEntry({ "Saved", "Randomizer", "Check Tracker", "Section Settings", "hide" }); } } // namespace SohGui diff --git a/soh/soh/SohGui/SohMenuSettings.cpp b/soh/soh/SohGui/SohMenuSettings.cpp index 52d1a53c4..cdd8435fd 100644 --- a/soh/soh/SohGui/SohMenuSettings.cpp +++ b/soh/soh/SohGui/SohMenuSettings.cpp @@ -487,6 +487,13 @@ void SohMenu::AddMenuSettings() { }); }) .Options(ButtonOptions().Tooltip("Displays a test notification.")); + + AddSearchEntry({ "Free Look", "Settings", "Controls", "Camera Controls" }); + AddSearchEntry({ "Enable Mouse Controls", "Settings", "Controls", "Camera Controls" }); + AddSearchEntry({ "Right Stick Ocarina Playback", "Settings", "Controls", "Ocarina Controls" }); + AddSearchEntry({ "Dpad Ocarina Playback", "Settings", "Controls", "Ocarina Controls" }); + AddSearchEntry({ "Dpad Support on Pause Menu", "Settings", "Controls", "Dpad Controls" }); + AddSearchEntry({ "Dpad Support in Text Boxes", "Settings", "Controls", "Dpad Controls" }); } } // namespace SohGui