From 72ebeaad3bcbaaebb30ba408086d1867097a94b1 Mon Sep 17 00:00:00 2001 From: PurpleHato Date: Fri, 17 Jun 2022 02:48:42 +0200 Subject: [PATCH] Fix: SohImGui behavior and cleanup (#461) * Fix: SohImGui behavior and cleanup - FIX: Once Save Editor / Collision Viewer are closed, set their values back to 0 so they don't automatically open once we click on Developer Tools - FIX: Same kind of fixes for every cosmetics editor - FIX: Typo "gCosmticsEditor" to "gCosmeticEditor" - TWEAK: Cleanup of useless stylizing options on Cosmetics * TWEAK: Reset a pointer that I edited for some testing * FIX: Typo from Assignable tunic / boots tooltip * move cvar.h includes out of extern c block * remove extra line Co-authored-by: briaguya --- libultraship/libultraship/SohImGuiImpl.cpp | 20 +++++++++---------- soh/soh/Enhancements/debugger/colViewer.cpp | 1 + .../Enhancements/debugger/debugSaveEditor.cpp | 2 ++ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 65fdc1b2e..a037e35b6 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -878,7 +878,7 @@ namespace SohImGui { Tooltip("Displays an icon and plays a sound when Stone of Agony should be activated, for those without rumble"); EnhancementCheckbox("Faster Block Push", "gFasterBlockPush"); EnhancementCheckbox("Assignable Tunics and Boots", "gAssignableTunicsAndBoots"); - Tooltip("Allows equiping the tunic and boots to c-buttons"); + Tooltip("Allows equipping the tunic and boots to c-buttons"); EnhancementCheckbox("MM Bunny Hood", "gMMBunnyHood"); Tooltip("Wearing the Bunny Hood grants a speed increase like in Majora's Mask"); EnhancementCheckbox("No Skulltula Freeze", "gSkulltulaFreeze"); @@ -1036,7 +1036,7 @@ namespace SohImGui { } if (ImGui::BeginMenu("Cosmetics")) { - EnhancementCheckbox("Cosmetics editor", "gCosmticsEditor"); + EnhancementCheckbox("Cosmetics editor", "gCosmeticEditor"); Tooltip("Edit Navi and Link's Tunics color."); EnhancementCheckbox("HUD Margins editor", "gUseMargins"); EnhancementRadioButton("N64 interface", "gHudColors", 0); @@ -1095,7 +1095,7 @@ namespace SohImGui { if (CVar_GetS32("gSkipLogoTitle",0)) { EnhancementSliderInt("Loading %d", "##SaveFileID", "gSaveFileID", 0, 4, ""); } - ImGui::Separator(); + ImGui::Separator(); EnhancementCheckbox("Stats", "gStatsEnabled"); Tooltip("Shows the stats window, with your FPS and frametimes, and the OS you're playing on"); EnhancementCheckbox("Console", "gConsoleEnabled"); @@ -1106,14 +1106,15 @@ namespace SohImGui { } bool Margins_isOpen = CVar_GetS32("gUseMargins", 0); - bool Cosmetics_isOpen = CVar_GetS32("gCosmticsEditor", 0); + bool Cosmetics_isOpen = CVar_GetS32("gCosmeticEditor", 0); bool Interface_isOpen = CVar_GetS32("gColorsEditor", 0); if (Margins_isOpen) { if (!Margins_isOpen) { + CVar_SetS32("gHUDMargins", 0); return; } - ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); + ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver); ImGui::Begin("Margins Editor", nullptr, ImGuiWindowFlags_NoFocusOnAppearing); if (ImGui::BeginTabBar("Margins Editor", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabItem("Interface margins")) { @@ -1127,14 +1128,14 @@ namespace SohImGui { } ImGui::EndTabBar(); } - ImGui::PopStyleColor(); ImGui::End(); } if (Cosmetics_isOpen) { if (!Cosmetics_isOpen) { + CVar_SetS32("gCosmeticEditor", 0); return; } - ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); + ImGui::SetNextWindowSize(ImVec2(500, 627), ImGuiCond_FirstUseEver); ImGui::Begin("Cosmetics Editor", nullptr, ImGuiWindowFlags_NoFocusOnAppearing); if (ImGui::BeginTabBar("Cosmetics Editor", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabItem("Navi")) { @@ -1173,14 +1174,14 @@ namespace SohImGui { } ImGui::EndTabBar(); } - ImGui::PopStyleColor(); ImGui::End(); } if (Interface_isOpen) { if (!Interface_isOpen) { + CVar_SetS32("gColorsEditor", 0); return; } - ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); + ImGui::SetNextWindowSize(ImVec2(215, 627), ImGuiCond_FirstUseEver); ImGui::Begin("Interface Editor", nullptr, ImGuiWindowFlags_NoFocusOnAppearing); if (ImGui::BeginTabBar("Interface Editor", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabItem("Hearts")) { @@ -1221,7 +1222,6 @@ namespace SohImGui { } ImGui::EndTabBar(); } - ImGui::PopStyleColor(); ImGui::End(); } diff --git a/soh/soh/Enhancements/debugger/colViewer.cpp b/soh/soh/Enhancements/debugger/colViewer.cpp index 91ea1f4b3..1a7c60ba8 100644 --- a/soh/soh/Enhancements/debugger/colViewer.cpp +++ b/soh/soh/Enhancements/debugger/colViewer.cpp @@ -53,6 +53,7 @@ static std::vector sphereVtx; // Draws the ImGui window for the collision viewer void DrawColViewerWindow(bool& open) { if (!open) { + CVar_SetS32("gCollisionViewerEnabled", 0); return; } diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp index a0d27f70f..d243ce49a 100644 --- a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp +++ b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp @@ -7,6 +7,7 @@ #include #include #include +#include extern "C" { #include @@ -1544,6 +1545,7 @@ void DrawPlayerTab() { void DrawSaveEditor(bool& open) { if (!open) { + CVar_SetS32("gSaveEditorEnabled", 0); return; }