From b6f957b36fa43909360e97fad92b0556268a43c2 Mon Sep 17 00:00:00 2001 From: aMannus Date: Thu, 20 Mar 2025 20:19:16 +0100 Subject: [PATCH] More Menu Improvements (#5155) * fix mismatch on default value for notification position * Fix checkbox vertical offset for multiline * Moooore changeees too theee menuuuuuu * capitalization again * Fix controller config & remove test var --- .../controls/SohInputEditorWindow.cpp | 15 ++++-- soh/soh/Notification/Notification.cpp | 2 +- soh/soh/SohGui/Menu.cpp | 7 +++ soh/soh/SohGui/SohMenuEnhancements.cpp | 54 +++++++++++-------- soh/soh/SohGui/SohMenuSettings.cpp | 10 +++- soh/soh/SohGui/UIWidgets.cpp | 3 +- 6 files changed, 61 insertions(+), 30 deletions(-) diff --git a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp index 135cb8a00..7dbc74a75 100644 --- a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp +++ b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp @@ -1501,10 +1501,10 @@ void SohInputEditorWindow::DrawLinkTab() { } if (ImGui::CollapsingHeader("D-Pad", NULL, ImGuiTreeNodeFlags_DefaultOpen)) { - DrawButtonLine(StringHelper::Sprintf("%s", ICON_FA_ARROW_UP).c_str(), portIndex, BTN_DUP); - DrawButtonLine(StringHelper::Sprintf("%s", ICON_FA_ARROW_DOWN).c_str(), portIndex, BTN_DDOWN); - DrawButtonLine(StringHelper::Sprintf("%s", ICON_FA_ARROW_LEFT).c_str(), portIndex, BTN_DLEFT); - DrawButtonLine(StringHelper::Sprintf("%s", ICON_FA_ARROW_RIGHT).c_str(), portIndex, BTN_DRIGHT); + DrawButtonLine(StringHelper::Sprintf("D %s", ICON_FA_ARROW_UP).c_str(), portIndex, BTN_DUP); + DrawButtonLine(StringHelper::Sprintf("D %s", ICON_FA_ARROW_DOWN).c_str(), portIndex, BTN_DDOWN); + DrawButtonLine(StringHelper::Sprintf("D %s", ICON_FA_ARROW_LEFT).c_str(), portIndex, BTN_DLEFT); + DrawButtonLine(StringHelper::Sprintf("D %s", ICON_FA_ARROW_RIGHT).c_str(), portIndex, BTN_DRIGHT); } if (ImGui::CollapsingHeader("Analog Stick", NULL, ImGuiTreeNodeFlags_DefaultOpen)) { @@ -1782,6 +1782,11 @@ void SohInputEditorWindow::DrawSetDefaultsButton(uint8_t portIndex) { } void SohInputEditorWindow::DrawElement() { + ImGui::PushFont(OTRGlobals::Instance->fontMonoLarger); + ImVec4 themeColor = ColorValues.at(THEME_COLOR); + ImGui::PushStyleColor(ImGuiCol_Tab, ImVec4(themeColor.x, themeColor.y, themeColor.z, 0.8f)); + ImGui::PushStyleColor(ImGuiCol_TabHovered, ImVec4(themeColor.x, themeColor.y, themeColor.z, 0.6f)); + ImGui::PushStyleColor(ImGuiCol_TabActive, ImVec4(themeColor.x, themeColor.y, themeColor.z, 0.6f)); ImGui::BeginTabBar("##ControllerConfigPortTabs"); DrawLinkTab(); DrawIvanTab(); @@ -1790,4 +1795,6 @@ void SohInputEditorWindow::DrawElement() { DrawDebugPortTab(3); } ImGui::EndTabBar(); + ImGui::PopStyleColor(3); + ImGui::PopFont(); } diff --git a/soh/soh/Notification/Notification.cpp b/soh/soh/Notification/Notification.cpp index ebc4e168b..5bc0e8974 100644 --- a/soh/soh/Notification/Notification.cpp +++ b/soh/soh/Notification/Notification.cpp @@ -20,7 +20,7 @@ void Window::Draw() { const float margin = 30.0f; const float padding = 10.0f; - int position = CVarGetInteger(CVAR_SETTING("Notifications.Position"), 0); + int position = CVarGetInteger(CVAR_SETTING("Notifications.Position"), 3); // Top Left ImVec2 basePosition; diff --git a/soh/soh/SohGui/Menu.cpp b/soh/soh/SohGui/Menu.cpp index 0e8f8ab51..955b048d6 100644 --- a/soh/soh/SohGui/Menu.cpp +++ b/soh/soh/SohGui/Menu.cpp @@ -519,6 +519,10 @@ void Menu::DrawElement() { ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), windowCond, { 0.5f, 0.5f }); ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f); } + + ImGui::PushStyleColor(ImGuiCol_WindowBg, + ImVec4(0, 0, 0, CVarGetFloat(CVAR_SETTING("Menu.BackgroundOpacity"), 0.85f))); + if (!ImGui::Begin("Main Menu", NULL, windowFlags)) { if (!popout) { ImGui::PopStyleVar(); @@ -526,6 +530,9 @@ void Menu::DrawElement() { ImGui::End(); return; } + + ImGui::PopStyleColor(); + if (popped != popout) { if (!popout) { ImGui::PopStyleVar(); diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index d8368f299..2e0cb55af 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -116,7 +116,7 @@ void SohMenu::AddMenuEnhancements() { AddWidget(path, "Nighttime GS Always Spawn", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("NightGSAlwaysSpawn")) .Options(CheckboxOptions().Tooltip("Nighttime Skulltulas will spawn during both day and night.")); - AddWidget(path, "Pull Grave during the day", WIDGET_CVAR_CHECKBOX) + AddWidget(path, "Pull Grave During the Day", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("DayGravePull")) .Options(CheckboxOptions().Tooltip("Allows graves to be pulled when child during the day.")); AddWidget(path, "Dampe Appears All Night", WIDGET_CVAR_CHECKBOX) @@ -140,7 +140,7 @@ void SohMenu::AddMenuEnhancements() { .DisabledTooltip("This is not compatible with the Locked Overworld Doors Randomizer option.")); AddWidget(path, "Pause Menu", WIDGET_SEPARATOR_TEXT); - AddWidget(path, "Allow the Cursor to be on any slot", WIDGET_CVAR_COMBOBOX) + AddWidget(path, "Allow the Cursor to be on Any Slot", WIDGET_CVAR_COMBOBOX) .CVar(CVAR_ENHANCEMENT("PauseAnyCursor")) .Options( ComboboxOptions() @@ -163,7 +163,7 @@ void SohMenu::AddMenuEnhancements() { .Options(CheckboxOptions().Tooltip( "Removes the Input Requirement on Text boxes after defeating Ganon, allowing the Credits " "Sequence to continue to progress.")); - AddWidget(path, "Include Held Inputs at the Start of Buffer Input Window", WIDGET_CVAR_CHECKBOX) + AddWidget(path, "Include Held Inputs at the Start of Pause Buffer Input Window", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("IncludeHeldInputsBufferWindow")) .Options(CheckboxOptions().Tooltip( "Typically, inputs that are held prior to the buffer window are not included in the buffer. This " @@ -171,7 +171,15 @@ void SohMenu::AddMenuEnhancements() { "undesireably, for instance Z-Targetting something you might not want to.")); AddWidget(path, "Pause Buffer Input Window: %d frames", WIDGET_CVAR_SLIDER_INT) .CVar(CVAR_ENHANCEMENT("PauseBufferWindow")) - .Options(IntSliderOptions().Min(0).Max(40).DefaultValue(0).Format("%d frames")); + .Options(IntSliderOptions() + .Min(0) + .Max(40) + .DefaultValue(0) + .Format("%d frames") + .Tooltip("Adds back in a delay after unpausing before the game resumes playing again, " + "where inputs can be held prematurely to be input immediately after the game resumes. " + "This essentially brings back behaviour from console releases which are lost on default " + "because SoH isn't limited to N64 hardware.")); AddWidget(path, "Simulated Input Lag: %d frames", WIDGET_CVAR_SLIDER_INT) .CVar(CVAR_SIMULATED_INPUT_LAG) .Options(IntSliderOptions() @@ -214,7 +222,7 @@ void SohMenu::AddMenuEnhancements() { "The default response to Kaepora Gaebora is always that you understood what he said.")); AddWidget(path, "Convenience", WIDGET_SEPARATOR_TEXT); - AddWidget(path, "Quit Fishing At Door", WIDGET_CVAR_CHECKBOX) + AddWidget(path, "Quit Fishing at Door", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("QuitFishingAtDoor")) .Options(CheckboxOptions().Tooltip( "Fisherman asks if you want to quit at the door if you try to leave the Fishing Pond " @@ -222,7 +230,7 @@ void SohMenu::AddMenuEnhancements() { AddWidget(path, "Instant Putaway", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("InstantPutaway")) .Options(CheckboxOptions().Tooltip("Allow Link to put items away without having to wait around.")); - AddWidget(path, "Navi Timer Resets", WIDGET_CVAR_CHECKBOX) + AddWidget(path, "Navi Timer Resets on Scene Change", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("ResetNaviTimer")) .Options( CheckboxOptions().Tooltip("Resets the Navi timer on scene change. If you have already talked to her, " @@ -459,11 +467,6 @@ void SohMenu::AddMenuEnhancements() { .CVar(CVAR_ENHANCEMENT("NewDrops")) .Options(CheckboxOptions().Tooltip( "Replaces most 2D items and projectiles on the overworld with their equivalent 3D models.")); - AddWidget(path, "Invisible Bunny Hood", WIDGET_CVAR_CHECKBOX) - .CVar(CVAR_ENHANCEMENT("HideBunnyHood")) - .Options(CheckboxOptions().Tooltip( - "Turns Bunny Hood Invisible while still maintaining its effects." - )); AddWidget(path, "Animated Link in Pause Menu", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("PauseMenuAnimatedLink")) .Options(CheckboxOptions().Tooltip( @@ -523,7 +526,7 @@ void SohMenu::AddMenuEnhancements() { AddWidget(path, "Disable HUD Heart Animations", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("NoHUDHeartAnimation")) .Options(CheckboxOptions().Tooltip("Disables the Beating Animation of the Hearts on the HUD.")); - AddWidget(path, "Glitch line-up tick", WIDGET_CVAR_CHECKBOX) + AddWidget(path, "Glitch Line-up Tick", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("DrawLineupTick")) .Options(CheckboxOptions().Tooltip( "Displays a tick in the top center of the screen to help with glitch line-ups in SoH, since traditional " @@ -549,7 +552,9 @@ void SohMenu::AddMenuEnhancements() { .Options(CheckboxOptions().Tooltip( "Ammo counts in the pause menu will work correctly regardless of the position of items in the Inventory.")); AddWidget(path, "Enable Passage of Time on File Select", WIDGET_CVAR_CHECKBOX) - .CVar(CVAR_ENHANCEMENT("TimeFlowFileSelect")); + .CVar(CVAR_ENHANCEMENT("TimeFlowFileSelect")) + .Options(CheckboxOptions().Tooltip( + "The skybox in the background of the File Select screen will go through the day and night cycle over time.")); path.column = SECTION_COLUMN_3; AddWidget(path, "Misc.", WIDGET_SEPARATOR_TEXT); @@ -690,6 +695,9 @@ void SohMenu::AddMenuEnhancements() { "- When saving and quitting\n" "- When dying\n" "- When traveling thru time (if \"Masks Equippable as Adult\" is activated).")); + AddWidget(path, "Invisible Bunny Hood", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR_ENHANCEMENT("HideBunnyHood")) + .Options(CheckboxOptions().Tooltip("Turns Bunny Hood Invisible while still maintaining its effects.")); AddWidget(path, "Mask Select in Inventory", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("MaskSelect")) .Options(CheckboxOptions().Tooltip( @@ -962,7 +970,7 @@ void SohMenu::AddMenuEnhancements() { "Only relevant for playthroughs involving Master Quest Dungeons.")); AddWidget(path, "Desync Fixes", WIDGET_SEPARATOR_TEXT); - AddWidget(path, "Fix Darunia Dancing Too Fast", WIDGET_CVAR_CHECKBOX) + AddWidget(path, "Fix Darunia Dancing too Fast", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("FixDaruniaDanceSpeed")) .Options(CheckboxOptions().Tooltip( "Fixes Darunia's dancing speed so he dances to the beat of Saria's Song, like in the Original Game.")); @@ -1265,7 +1273,7 @@ void SohMenu::AddMenuEnhancements() { .CVar(CVAR_ENHANCEMENT("FrogsUnlimitedFailTime")) .PreFunc(frogsOcarinaGameDisabledFunc) .Options(CheckboxOptions().Tooltip("Removes the timer to play back the song.")); - AddWidget(path, "Modify note timer: %dx", WIDGET_CVAR_SLIDER_INT) + AddWidget(path, "Modify Note Timer: %dx", WIDGET_CVAR_SLIDER_INT) .CVar(CVAR_ENHANCEMENT("FrogsModifyFailTime")) .PreFunc([](WidgetInfo& info) { info.options->disabled = !CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFrogsOcarinaGame"), 0) || @@ -1353,11 +1361,11 @@ void SohMenu::AddMenuEnhancements() { .CVar(CVAR_ENHANCEMENT("GuaranteeFishingBite")) .PreFunc(fishingDisabledFunc) .Options(CheckboxOptions().Tooltip("When a line is stable, guarantee bite. Otherwise use Default logic.")); - AddWidget(path, "Fish Never Escape", WIDGET_CVAR_CHECKBOX) + AddWidget(path, "Fish never Escape", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("FishNeverEscape")) .PreFunc(fishingDisabledFunc) .Options(CheckboxOptions().Tooltip("Once a hook as been set, Fish will never let go while being reeled in.")); - AddWidget(path, "Loaches Always Appear", WIDGET_CVAR_CHECKBOX) + AddWidget(path, "Loaches always Appear", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("LoachesAlwaysAppear")) .PreFunc(fishingDisabledFunc) .Options( @@ -1416,7 +1424,7 @@ void SohMenu::AddMenuEnhancements() { "Enables Ivan the Fairy upon the next map change. Player 2 can control Ivan and press the C-Buttons to " "use items and mess with Player 1!" )); - AddWidget(path, "Dogs Follow you Everywhere", WIDGET_CVAR_CHECKBOX) + AddWidget(path, "Dogs Follow You Everywhere", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("DogFollowsEverywhere")) .Options(CheckboxOptions().Tooltip("Allows dogs to follow you anywhere you go, even if you leave the Market.")); AddWidget(path, "Rupee Dash Mode", WIDGET_CVAR_CHECKBOX) @@ -1554,7 +1562,7 @@ void SohMenu::AddMenuEnhancements() { .PreFunc([](WidgetInfo& info) { info.isHidden = !CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0); }); - AddWidget(path, "Select All Enemies", WIDGET_CVAR_CHECKBOX) + AddWidget(path, "Select all Enemies", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("RandomizedEnemyList.All")) .PreFunc([](WidgetInfo& info) { info.isHidden = !CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0); @@ -1635,14 +1643,14 @@ void SohMenu::AddMenuEnhancements() { .CVar(CVAR_CHEAT("NoRedeadFreeze")) .Options( CheckboxOptions().Tooltip("Prevents ReDeads and Gibdos from being able to freeze you with their scream.")); - AddWidget(path, "Keese/Guay Don't Target You", WIDGET_CVAR_CHECKBOX) + AddWidget(path, "Keese/Guay don't Target You", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_CHEAT("NoKeeseGuayTarget")) .Options(CheckboxOptions().Tooltip( "Keese and Guay no longer target you and simply ignore you as if you were wearing the " "Skull Mask.")); AddWidget(path, "Glitch Aids", WIDGET_SEPARATOR_TEXT); - AddWidget(path, "Easy Frame Advancing", WIDGET_CVAR_CHECKBOX) + AddWidget(path, "Easy Frame Advancing with Pause", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_CHEAT("EasyFrameAdvance")) .Options(CheckboxOptions().Tooltip( "Continue holding START button when unpausing to only advance a single frame and then re-pause.")); @@ -1664,10 +1672,10 @@ void SohMenu::AddMenuEnhancements() { .CVar(CVAR_CHEAT("DropsDontDie")) .Options( CheckboxOptions().Tooltip("Drops from enemies, grass, etc. don't disappear after a set amount of time.")); - AddWidget(path, "Fish Don't Despawn", WIDGET_CVAR_CHECKBOX) + AddWidget(path, "Fish don't Despawn", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_CHEAT("NoFishDespawn")) .Options(CheckboxOptions().Tooltip("Prevents fish from automatically despawning after a while when dropped.")); - AddWidget(path, "Bugs Don't Despawn", WIDGET_CVAR_CHECKBOX) + AddWidget(path, "Bugs don't Despawn", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_CHEAT("NoBugsDespawn")) .Options(CheckboxOptions().Tooltip("Prevents bugs from automatically despawning after a while when dropped.")); diff --git a/soh/soh/SohGui/SohMenuSettings.cpp b/soh/soh/SohGui/SohMenuSettings.cpp index 093e98618..20ce9ff50 100644 --- a/soh/soh/SohGui/SohMenuSettings.cpp +++ b/soh/soh/SohGui/SohMenuSettings.cpp @@ -55,7 +55,7 @@ void SohMenu::AddMenuSettings() { WidgetPath path = { "Settings", "General", SECTION_COLUMN_1 }; // General - Settings - AddWidget(path, "General Settings", WIDGET_SEPARATOR_TEXT); + AddWidget(path, "Menu Settings", WIDGET_SEPARATOR_TEXT); AddWidget(path, "Menu Theme", WIDGET_CVAR_COMBOBOX) .CVar(CVAR_SETTING("Menu.Theme")) .Options(ComboboxOptions() @@ -69,6 +69,14 @@ void SohMenu::AddMenuSettings() { "Allows controller navigation of the port menu (Settings, Enhancements,...)\nCAUTION: " "This will disable game inputs while the menu is visible.\n\nD-pad to move between " "items, A to select, B to move up in scope.")); + AddWidget(path, "Menu Background Opacity", WIDGET_CVAR_SLIDER_FLOAT) + .CVar(CVAR_SETTING("Menu.BackgroundOpacity")) + .Options(FloatSliderOptions() + .DefaultValue(0.85f) + .IsPercentage() + .Tooltip("Sets the opacity of the background of the port menu.")); + + AddWidget(path, "General Settings", WIDGET_SEPARATOR_TEXT); AddWidget(path, "Cursor Always Visible", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_SETTING("CursorVisibility")) .Callback([](WidgetInfo& info) { diff --git a/soh/soh/SohGui/UIWidgets.cpp b/soh/soh/SohGui/UIWidgets.cpp index 9875cf7b9..e2f7bf2dc 100644 --- a/soh/soh/SohGui/UIWidgets.cpp +++ b/soh/soh/SohGui/UIWidgets.cpp @@ -330,7 +330,8 @@ bool Checkbox(const char* _label, bool* value, const CheckboxOptions& options) { if (options.labelPosition == LabelPositions::Above) { checkPos.y += label_size.y + (style.ItemInnerSpacing.y * 2.0f); } else { - labelPos.y += (square_sz / 2) - (label_size.y / 2); + // Center with checkbox automatically + labelPos.y += ImGui::CalcTextSize("g").y / 8; } if (options.alignment == ComponentAlignments::Right) { checkPos.x = total_bb.Max.x - square_sz;