From bc6def77a4f799a4ecdd15da5ef91da57a640b76 Mon Sep 17 00:00:00 2001 From: Baoulettes Date: Thu, 19 May 2022 19:48:49 +0200 Subject: [PATCH 1/8] ComboBox Simplification --- libultraship/libultraship/SohImGuiImpl.cpp | 41 +++++++++++++++------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index d17d6ccee..207adf86d 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -390,6 +390,32 @@ namespace SohImGui { } } + void EnhancementCombobox(const char* cvarname, const char* ComboArray[], s16 FirstTimeValue = -1){ + //The -1 do not force the make to add a default value + if (FirstTimeValue < 0){ + //If there is no default value it will pass this condition + FirstTimeValue = 0; + } + //And now we set the default value to the CVar fallback + //This way we ensure to show the number we want the user to see the first time + s16 selected=CVar_GetS32(cvarname, FirstTimeValue); + //Now we set the fetched value to the drop box. + //This way if a player set something else than the default it will show their selection. + s16 DefaultValue=selected; + if (ImGui::BeginCombo("##cvarname", ComboArray[DefaultValue])) { + s16 ComboxSize = sizeof(&ComboArray) / sizeof(ComboArray[0]); + //Seem like it does not count entry 0 so it end up doing 0, 1, 2 and count 2 not 3 + for (uint8_t i = 0; i <= ComboxSize+1; i++) { + if (ImGui::Selectable(ComboArray[i], i==selected)) { + CVar_SetS32(cvarname, i); + selected=i; + needs_save = true; + } + } + ImGui::EndCombo(); + } + } + void EnhancementRadioButton(std::string text, std::string cvarName, int id) { /*Usage : EnhancementRadioButton("My Visible Name","gMyCVarName", MyID); @@ -634,20 +660,9 @@ namespace SohImGui { EXPERIMENTAL(); ImGui::Text("Texture Filter (Needs reload)"); + EnhancementCombobox("gTextureFilter", filters); GfxRenderingAPI* gapi = gfx_get_current_rendering_api(); - if (ImGui::BeginCombo("##filters", filters[gapi->get_texture_filter()])) { - for (int fId = 0; fId <= FilteringMode::NONE; fId++) { - if (ImGui::Selectable(filters[fId], fId == gapi->get_texture_filter())) { - INFO("New Filter: %s", filters[fId]); - gapi->set_texture_filter((FilteringMode)fId); - - CVar_SetS32("gTextureFilter", (int)fId); - needs_save = true; - } - - } - ImGui::EndCombo(); - } + gapi->set_texture_filter((FilteringMode)CVar_GetS32("gTextureFilter", 0)); overlay->DrawSettings(); ImGui::EndMenu(); } From d36b641bfbe5be5158ff09f27bd7971ac1bcb21d Mon Sep 17 00:00:00 2001 From: Baoulettes Date: Thu, 19 May 2022 19:52:30 +0200 Subject: [PATCH 2/8] few things in comment needed fix --- libultraship/libultraship/SohImGuiImpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 207adf86d..3c92043fa 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -391,9 +391,9 @@ namespace SohImGui { } void EnhancementCombobox(const char* cvarname, const char* ComboArray[], s16 FirstTimeValue = -1){ - //The -1 do not force the make to add a default value + //The -1 do not force the maker to add a default first value if (FirstTimeValue < 0){ - //If there is no default value it will pass this condition + //If there is no default value it will pass this condition and so to prevent crash we set 0 FirstTimeValue = 0; } //And now we set the default value to the CVar fallback From 6229233b5f08b5ecac654be0212cc2c0d5e7a283 Mon Sep 17 00:00:00 2001 From: Baoulettes Date: Thu, 19 May 2022 20:00:36 +0200 Subject: [PATCH 3/8] sizeof fix --- libultraship/libultraship/SohImGuiImpl.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 3c92043fa..86e486066 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -390,7 +390,7 @@ namespace SohImGui { } } - void EnhancementCombobox(const char* cvarname, const char* ComboArray[], s16 FirstTimeValue = -1){ + void EnhancementCombobox(const char* name, const char* ComboArray[], s16 FirstTimeValue = -1){ //The -1 do not force the maker to add a default first value if (FirstTimeValue < 0){ //If there is no default value it will pass this condition and so to prevent crash we set 0 @@ -398,16 +398,17 @@ namespace SohImGui { } //And now we set the default value to the CVar fallback //This way we ensure to show the number we want the user to see the first time - s16 selected=CVar_GetS32(cvarname, FirstTimeValue); + s16 selected=CVar_GetS32(name, FirstTimeValue); //Now we set the fetched value to the drop box. //This way if a player set something else than the default it will show their selection. s16 DefaultValue=selected; - if (ImGui::BeginCombo("##cvarname", ComboArray[DefaultValue])) { - s16 ComboxSize = sizeof(&ComboArray) / sizeof(ComboArray[0]); + if (ImGui::BeginCombo("##name", ComboArray[DefaultValue])) { + //char *[] got two extra : '\123' (begin) '\n' (last) + s16 ComboxSize = sizeof(&ComboArray)-2; //Seem like it does not count entry 0 so it end up doing 0, 1, 2 and count 2 not 3 - for (uint8_t i = 0; i <= ComboxSize+1; i++) { + for (uint8_t i = 0; i <= ComboxSize; i++) { if (ImGui::Selectable(ComboArray[i], i==selected)) { - CVar_SetS32(cvarname, i); + CVar_SetS32(name, i); selected=i; needs_save = true; } From bb44350a8f9524f064fbd0fbf9e9fecf73ee36b4 Mon Sep 17 00:00:00 2001 From: Baoulettes Date: Fri, 20 May 2022 02:42:53 +0200 Subject: [PATCH 4/8] Remove comment and stuff useless --- libultraship/libultraship/SohImGuiImpl.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 86e486066..1986cc889 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -391,26 +391,20 @@ namespace SohImGui { } void EnhancementCombobox(const char* name, const char* ComboArray[], s16 FirstTimeValue = -1){ - //The -1 do not force the maker to add a default first value if (FirstTimeValue < 0){ - //If there is no default value it will pass this condition and so to prevent crash we set 0 FirstTimeValue = 0; } - //And now we set the default value to the CVar fallback - //This way we ensure to show the number we want the user to see the first time s16 selected=CVar_GetS32(name, FirstTimeValue); - //Now we set the fetched value to the drop box. - //This way if a player set something else than the default it will show their selection. s16 DefaultValue=selected; if (ImGui::BeginCombo("##name", ComboArray[DefaultValue])) { - //char *[] got two extra : '\123' (begin) '\n' (last) - s16 ComboxSize = sizeof(&ComboArray)-2; - //Seem like it does not count entry 0 so it end up doing 0, 1, 2 and count 2 not 3 + s16 ComboxSize = sizeof(&ComboArray); for (uint8_t i = 0; i <= ComboxSize; i++) { - if (ImGui::Selectable(ComboArray[i], i==selected)) { + if (strlen(ComboArray[i]) > 1) { + if (ImGui::Selectable(ComboArray[i], i==selected)) { CVar_SetS32(name, i); selected=i; needs_save = true; + } } } ImGui::EndCombo(); From 49e15d342d2cd4f6ba89fff79feff51c21839107 Mon Sep 17 00:00:00 2001 From: Baoulettes Date: Fri, 20 May 2022 02:44:37 +0200 Subject: [PATCH 5/8] Add definition --- libultraship/libultraship/SohImGuiImpl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libultraship/libultraship/SohImGuiImpl.h b/libultraship/libultraship/SohImGuiImpl.h index dd0ec9fd3..665897e82 100644 --- a/libultraship/libultraship/SohImGuiImpl.h +++ b/libultraship/libultraship/SohImGuiImpl.h @@ -68,6 +68,7 @@ namespace SohImGui { void EnhancementCheckbox(std::string text, std::string cvarName); void EnhancementSliderInt(std::string text, std::string id, std::string cvarName, int min, int max, std::string format); void EnhancementSliderFloat(std::string text, std::string id, std::string cvarName, float min, float max, std::string format, float defaultValue); + void EnhancementCombobox(const char* name, const char* ComboArray[], s16 FirstTimeValue = -1); void DrawMainMenuAndCalculateGameSize(void); From c0cd3b54006f63cab7600a6db7779b8958b7064a Mon Sep 17 00:00:00 2001 From: Baoulettes Date: Fri, 20 May 2022 15:07:15 +0200 Subject: [PATCH 6/8] Changing int type --- libultraship/libultraship/SohImGuiImpl.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 1986cc889..de3617334 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -390,14 +390,14 @@ namespace SohImGui { } } - void EnhancementCombobox(const char* name, const char* ComboArray[], s16 FirstTimeValue = -1){ - if (FirstTimeValue < 0){ + void EnhancementCombobox(const char* name, const char* ComboArray[], uint8_t FirstTimeValue = 0){ + if (FirstTimeValue <= 0){ FirstTimeValue = 0; } - s16 selected=CVar_GetS32(name, FirstTimeValue); - s16 DefaultValue=selected; + uint8_t selected=CVar_GetS32(name, FirstTimeValue); + uint8_t DefaultValue=selected; if (ImGui::BeginCombo("##name", ComboArray[DefaultValue])) { - s16 ComboxSize = sizeof(&ComboArray); + uint8_t ComboxSize = sizeof(&ComboArray); for (uint8_t i = 0; i <= ComboxSize; i++) { if (strlen(ComboArray[i]) > 1) { if (ImGui::Selectable(ComboArray[i], i==selected)) { From 2115111ea8b71d36b3df3e1b95092f83bf05eb4e Mon Sep 17 00:00:00 2001 From: Baoulettes Date: Fri, 20 May 2022 15:08:03 +0200 Subject: [PATCH 7/8] fix int type, removing default value, should build --- libultraship/libultraship/SohImGuiImpl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libultraship/libultraship/SohImGuiImpl.h b/libultraship/libultraship/SohImGuiImpl.h index 665897e82..c2f4649df 100644 --- a/libultraship/libultraship/SohImGuiImpl.h +++ b/libultraship/libultraship/SohImGuiImpl.h @@ -68,7 +68,7 @@ namespace SohImGui { void EnhancementCheckbox(std::string text, std::string cvarName); void EnhancementSliderInt(std::string text, std::string id, std::string cvarName, int min, int max, std::string format); void EnhancementSliderFloat(std::string text, std::string id, std::string cvarName, float min, float max, std::string format, float defaultValue); - void EnhancementCombobox(const char* name, const char* ComboArray[], s16 FirstTimeValue = -1); + void EnhancementCombobox(const char* name, const char* ComboArray[], uint8_t FirstTimeValue); void DrawMainMenuAndCalculateGameSize(void); From 902b842bcbb9f39f31c148d4064f8559a215b349 Mon Sep 17 00:00:00 2001 From: PurpleHato Date: Thu, 2 Jun 2022 19:14:14 +0200 Subject: [PATCH 8/8] FIX: Default Navi's colors have been altered recent merged PRs This fix restore Navi's original colors which have been altered with recent merged PRs --- libultraship/libultraship/SohImGuiImpl.cpp | 10 +++++----- soh/src/code/z_actor.c | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 23fa4ffa9..a081862cb 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -1078,22 +1078,22 @@ namespace SohImGui { Tooltip("Enable/Disable custom Navi's colors. \nIf disabled you will have original colors for Navi.\nColors are refreshed when Navi goes back in your pockets."); EnhancementColor("Navi Idle Inner", "gNavi_Idle_Inner_", navi_idle_i_col, ImVec4(255,255,255,255), false); Tooltip("Inner color for Navi (idle flying around)"); - EnhancementColor("Navi Idle Outer", "gNavi_Idle_Outer_", navi_idle_o_col, ImVec4(115,230,255,255), false); + EnhancementColor("Navi Idle Outer", "gNavi_Idle_Outer_", navi_idle_o_col, ImVec4(0,0,255,255), false); Tooltip("Outer color for Navi (idle flying around)"); ImGui::Separator(); - EnhancementColor("Navi NPC Inner", "gNavi_NPC_Inner_", navi_npc_i_col, ImVec4(100,100,255,255), false); + EnhancementColor("Navi NPC Inner", "gNavi_NPC_Inner_", navi_npc_i_col, ImVec4(150,150,255,255), false); Tooltip("Inner color for Navi (when Navi fly around NPCs)"); - EnhancementColor("Navi NPC Outer", "gNavi_NPC_Outer_", navi_npc_o_col, ImVec4(90,90,255,255), false); + EnhancementColor("Navi NPC Outer", "gNavi_NPC_Outer_", navi_npc_o_col, ImVec4(150,150,255,255), false); Tooltip("Outer color for Navi (when Navi fly around NPCs)"); ImGui::Separator(); EnhancementColor("Navi Enemy Inner", "gNavi_Enemy_Inner_", navi_enemy_i_col, ImVec4(255,255,0,255), false); Tooltip("Inner color for Navi (when Navi fly around Enemies or Bosses)"); - EnhancementColor("Navi Enemy Outer", "gNavi_Enemy_Outer_", navi_enemy_o_col, ImVec4(220,220,0,255), false); + EnhancementColor("Navi Enemy Outer", "gNavi_Enemy_Outer_", navi_enemy_o_col, ImVec4(220,155,0,255), false); Tooltip("Outer color for Navi (when Navi fly around Enemies or Bosses)"); ImGui::Separator(); EnhancementColor("Navi Prop Inner", "gNavi_Prop_Inner_", navi_prop_i_col, ImVec4(0,255,0,255), false); Tooltip("Inner color for Navi (when Navi fly around props (signs etc))"); - EnhancementColor("Navi Prop Outer", "gNavi_Prop_Outer_", navi_prop_o_col, ImVec4(0,220,0,255), false); + EnhancementColor("Navi Prop Outer", "gNavi_Prop_Outer_", navi_prop_o_col, ImVec4(0,255,0,255), false); Tooltip("Outer color for Navi (when Navi fly around props (signs etc))"); ImGui::EndTabItem(); } diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index bdb2fe78c..702ab622a 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -339,19 +339,19 @@ void func_8002BF60(TargetContext* targetCtx, Actor* actor, s32 actorCategory, Gl if (CVar_GetS32("gUseNaviCol",0) != 1 ) { if (actorCategory == ACTORCAT_PLAYER) { naviColor->inner.r = 255; naviColor->inner.g = 255; naviColor->inner.b = 255; - naviColor->outer.r = 115; naviColor->outer.g = 230; naviColor->outer.b = 255; + naviColor->outer.r = 0; naviColor->outer.g = 0; naviColor->outer.b = 255; } if (actorCategory == ACTORCAT_NPC) { - naviColor->inner.r = 100; naviColor->inner.g = 100; naviColor->inner.b = 255; - naviColor->outer.r = 90; naviColor->outer.g = 90; naviColor->outer.b = 255; + naviColor->inner.r = 150; naviColor->inner.g = 150; naviColor->inner.b = 255; + naviColor->outer.r = 150; naviColor->outer.g = 150; naviColor->outer.b = 255; } if (actorCategory == ACTORCAT_BOSS || actorCategory == ACTORCAT_ENEMY) { naviColor->inner.r = 255; naviColor->inner.g = 255; naviColor->inner.b = 0; - naviColor->outer.r = 220; naviColor->outer.g = 220; naviColor->outer.b = 0; + naviColor->outer.r = 220; naviColor->outer.g = 155; naviColor->outer.b = 0; } if (actorCategory == ACTORCAT_PROP) { - naviColor->inner.r = 0; naviColor->inner.g = 255; naviColor->inner.b = 90; - naviColor->outer.r = 0; naviColor->outer.g = 220; naviColor->outer.b = 0; + naviColor->inner.r = 0; naviColor->inner.g = 255; naviColor->inner.b = 0; + naviColor->outer.r = 0; naviColor->outer.g = 255; naviColor->outer.b = 0; } } else { if (actorCategory == ACTORCAT_PLAYER) {