From 1a26e5ca27a10583d0e9fc5e613c3e7888bcaa7c Mon Sep 17 00:00:00 2001 From: Malkierian Date: Fri, 27 Sep 2024 10:46:04 -0700 Subject: [PATCH 1/2] Change tristate off graphic to none instead of X to avoid confusion. Modify Combobox and Slider Options to clamp directly to options.size() - 1 instead of just decrementing if current value is higher than max. --- soh/soh/Enhancements/randomizer/option.cpp | 5 +++-- soh/soh/UIWidgets.cpp | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/option.cpp b/soh/soh/Enhancements/randomizer/option.cpp index 36fdd1f8ba4..9a597726214 100644 --- a/soh/soh/Enhancements/randomizer/option.cpp +++ b/soh/soh/Enhancements/randomizer/option.cpp @@ -240,7 +240,7 @@ bool Option::RenderCombobox() const { ImGui::Text("%s", name.c_str()); uint8_t selected = CVarGetInteger(cvarName.c_str(), defaultOption); if (selected >= options.size()) { - selected--; + selected = options.size(); CVarSetInteger(cvarName.c_str(), selected); changed = true; Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); @@ -272,7 +272,8 @@ bool Option::RenderSlider() const { bool changed = false; int val = CVarGetInteger(cvarName.c_str(), defaultOption); if (val >= options.size()) { - val--; + val = options.size(); + CVarSetInteger(cvarName.c_str(), val); changed = true; } if (disabled) { diff --git a/soh/soh/UIWidgets.cpp b/soh/soh/UIWidgets.cpp index c47ae91f73f..4a8dc0e5a51 100644 --- a/soh/soh/UIWidgets.cpp +++ b/soh/soh/UIWidgets.cpp @@ -170,7 +170,6 @@ namespace UIWidgets { ImGui::RenderCheckMark(window->DrawList, check_bb.Min + ImVec2(pad, pad), check_col, square_sz - pad * 2.0f); } else if ((!disabled && !*v && renderCrossWhenOff) || (disabled && disabledGraphic == CheckboxGraphics::Cross)) { const float pad = ImMax(1.0f, IM_FLOOR(square_sz / 6.0f)); - RenderCross(window->DrawList, check_bb.Min + ImVec2(pad, pad), disabled ? cross_col : check_col, square_sz - pad * 2.0f); } ImVec2 label_pos = ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y); From 4b036398917c6d7ebf36e71e062e34152b1240ed Mon Sep 17 00:00:00 2001 From: Malkierian Date: Fri, 27 Sep 2024 11:32:00 -0700 Subject: [PATCH 2/2] Restore RenderCross line, but commented out. --- soh/soh/UIWidgets.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/soh/soh/UIWidgets.cpp b/soh/soh/UIWidgets.cpp index 4a8dc0e5a51..5a41fe7cd89 100644 --- a/soh/soh/UIWidgets.cpp +++ b/soh/soh/UIWidgets.cpp @@ -170,6 +170,7 @@ namespace UIWidgets { ImGui::RenderCheckMark(window->DrawList, check_bb.Min + ImVec2(pad, pad), check_col, square_sz - pad * 2.0f); } else if ((!disabled && !*v && renderCrossWhenOff) || (disabled && disabledGraphic == CheckboxGraphics::Cross)) { const float pad = ImMax(1.0f, IM_FLOOR(square_sz / 6.0f)); + //RenderCross(window->DrawList, check_bb.Min + ImVec2(pad, pad), disabled ? cross_col : check_col, square_sz - pad * 2.0f); // Caused confusion as to status } ImVec2 label_pos = ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y);