From 992f235f0550e89a1293161742580ddcf01eecfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sun, 18 Aug 2024 15:12:24 +0200 Subject: [PATCH] Use HSLA scrollbar color picker for 0.7 tee settings Use the same HSLA scrollbar color picker for the 0.7 tee settings as for the 0.6 tee settings. Use the correct darkest lighting value for 0.7 skin color pickers instead of not clamping the lighting value in the color picker. --- .../client/components/menus_settings7.cpp | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/game/client/components/menus_settings7.cpp b/src/game/client/components/menus_settings7.cpp index d076d9ff7..71025cc9f 100644 --- a/src/game/client/components/menus_settings7.cpp +++ b/src/game/client/components/menus_settings7.cpp @@ -312,7 +312,7 @@ void CMenus::RenderSettingsTeeBasic7(CUIRect MainView) void CMenus::RenderSettingsTeeCustom7(CUIRect MainView) { - CUIRect Label, Patterns, Button, Left, Right, Picker, Palette; + CUIRect Label, Patterns, Button, Left, Right; // render skin preview background float SpacingH = 2.0f; @@ -344,33 +344,31 @@ void CMenus::RenderSettingsTeeCustom7(CUIRect MainView) MainView.HSplitTop(SpacingH, 0, &MainView); MainView.VSplitMid(&Left, &Right, SpacingW); + Right.Margin(5.0f, &Right); - // part selection RenderSkinPartSelection7(Left); - // use custom color checkbox - Right.HSplitTop(ButtonHeight, &Button, &Right); - Right.HSplitBottom(45.0f, &Picker, &Palette); - static CButtonContainer s_ColorPicker; - DoLine_ColorPicker( - &s_ColorPicker, - 25.0f, // LineSize - 13.0f, // LabelSize - 5.0f, // BottomMargin - &Right, - Localize("Custom colors"), - CSkins7::ms_apColorVariables[(int)m_Dummy][m_TeePartSelected], - ColorRGBA(1.0f, 1.0f, 0.5f), // DefaultColor - true, // CheckBoxSpacing - CSkins7::ms_apUCCVariables[(int)m_Dummy][m_TeePartSelected], // CheckBoxValue - m_TeePartSelected == protocol7::SKINPART_MARKING); // use alpha - static int s_OldColor = *CSkins7::ms_apColorVariables[(int)m_Dummy][m_TeePartSelected]; - int NewColor = *CSkins7::ms_apColorVariables[(int)m_Dummy][m_TeePartSelected]; - if(s_OldColor != NewColor) + CUIRect CustomColorsButton; + Right.HSplitTop(20.0f, &CustomColorsButton, &Right); + + int *pUseCustomColor = CSkins7::ms_apUCCVariables[(int)m_Dummy][m_TeePartSelected]; + if(DoButton_CheckBox(pUseCustomColor, Localize("Custom colors"), *pUseCustomColor, &CustomColorsButton)) { - s_OldColor = NewColor; + *pUseCustomColor = !*pUseCustomColor; SetNeedSendInfo(); } + + if(*pUseCustomColor) + { + CUIRect CustomColors; + Right.HSplitTop(5.0f, nullptr, &Right); + Right.HSplitTop(95.0f, &CustomColors, &Right); + + if(RenderHslaScrollbars(&CustomColors, CSkins7::ms_apColorVariables[(int)m_Dummy][m_TeePartSelected], m_TeePartSelected == protocol7::SKINPART_MARKING, CSkins7::DARKEST_COLOR_LGT)) + { + SetNeedSendInfo(); + } + } } void CMenus::RenderSkinSelection7(CUIRect MainView)