From 9a9b4bd679acaab9c16f977e6749aabd72a40a56 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Mon, 12 Dec 2022 23:40:27 -0500 Subject: [PATCH] fix: set color picker alpha on reset (#2173) * fix: set color picker alpha on reset Fixes a bug where the colour picker enhancement widget without alpha uses a garbage value for alpha on reset Co-authored-by: sonoftunk * formatting Co-authored-by: sonoftunk Co-authored-by: briaguya --- soh/soh/UIWidgets.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/soh/soh/UIWidgets.cpp b/soh/soh/UIWidgets.cpp index ff8c318cb..651487551 100644 --- a/soh/soh/UIWidgets.cpp +++ b/soh/soh/UIWidgets.cpp @@ -528,13 +528,13 @@ namespace UIWidgets { colors->x = defaultcolors.x; colors->y = defaultcolors.y; colors->z = defaultcolors.z; - if (has_alpha) { colors->w = defaultcolors.w; }; + colors->w = has_alpha ? defaultcolors.w : 255.0f; Color_RGBA8 colorsRGBA; colorsRGBA.r = defaultcolors.x; colorsRGBA.g = defaultcolors.y; colorsRGBA.b = defaultcolors.z; - if (has_alpha) { colorsRGBA.a = defaultcolors.w; }; + colorsRGBA.a = has_alpha ? defaultcolors.w : 255.0f; CVar_SetRGBA(cvarName, colorsRGBA); CVar_SetS32(Cvar_RBM.c_str(), 0); //On click disable rainbow mode. @@ -616,7 +616,7 @@ namespace UIWidgets { colors.r = ColorRGBA.x * 255.0; colors.g = ColorRGBA.y * 255.0; colors.b = ColorRGBA.z * 255.0; - colors.a = ColorRGBA.w * 255.0; + colors.a = 255.0; CVar_SetRGBA(cvarName, colors); SohImGui::RequestCvarSaveOnNextTick();