Skip to content

Commit

Permalink
Fix: SohImGui behavior and cleanup (HarbourMasters#461)
Browse files Browse the repository at this point in the history
* 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 <briaguya@alice>
  • Loading branch information
2 people authored and th-2021 committed Jun 19, 2022
1 parent b0b640b commit b4076dc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
20 changes: 10 additions & 10 deletions libultraship/libultraship/SohImGuiImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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");
Expand All @@ -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")) {
Expand All @@ -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")) {
Expand Down Expand Up @@ -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")) {
Expand Down Expand Up @@ -1221,7 +1222,6 @@ namespace SohImGui {
}
ImGui::EndTabBar();
}
ImGui::PopStyleColor();
ImGui::End();
}

Expand Down
1 change: 1 addition & 0 deletions soh/soh/Enhancements/debugger/colViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ static std::vector<Vtx> sphereVtx;
// Draws the ImGui window for the collision viewer
void DrawColViewerWindow(bool& open) {
if (!open) {
CVar_SetS32("gCollisionViewerEnabled", 0);
return;
}

Expand Down
2 changes: 2 additions & 0 deletions soh/soh/Enhancements/debugger/debugSaveEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <bit>
#include <map>
#include <string>
#include <Cvar.h>

extern "C" {
#include <z64.h>
Expand Down Expand Up @@ -1544,6 +1545,7 @@ void DrawPlayerTab() {

void DrawSaveEditor(bool& open) {
if (!open) {
CVar_SetS32("gSaveEditorEnabled", 0);
return;
}

Expand Down

0 comments on commit b4076dc

Please sign in to comment.