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 <briaguya@alice>
This commit is contained in:
PurpleHato 2022-06-17 02:48:42 +02:00 committed by GitHub
parent f29fb01887
commit 72ebeaad3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 10 deletions

View File

@ -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();
}

View File

@ -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;
}

View File

@ -7,6 +7,7 @@
#include <bit>
#include <map>
#include <string>
#include <Cvar.h>
extern "C" {
#include <z64.h>
@ -1544,6 +1545,7 @@ void DrawPlayerTab() {
void DrawSaveEditor(bool& open) {
if (!open) {
CVar_SetS32("gSaveEditorEnabled", 0);
return;
}