From 7dbce81bbf48c9629550f04ef91f4f6524062e07 Mon Sep 17 00:00:00 2001 From: def Date: Tue, 8 Oct 2013 16:32:27 +0200 Subject: [PATCH] Allow more colors --- src/engine/client/client.cpp | 4 +-- src/engine/shared/config_variables.h | 8 ++++-- src/game/client/components/menus_settings.cpp | 27 +++++++++---------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 232509bc5..43698af21 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -772,12 +772,12 @@ void CClient::Render() { if(g_Config.m_ClShowEntities && g_Config.m_ClDDRaceCheats) { - vec3 bg = GetColorV3(g_Config.m_ClBackgroundEntities); + vec3 bg = HslToRgb(vec3(g_Config.m_ClBackgroundEntitiesHue/255.0f, g_Config.m_ClBackgroundEntitiesSat/255.0f, g_Config.m_ClBackgroundEntitiesLht/255.0f)); Graphics()->Clear(bg.r, bg.g, bg.b); } else if(g_Config.m_GfxClear) { - vec3 bg = GetColorV3(g_Config.m_ClBackground); + vec3 bg = HslToRgb(vec3(g_Config.m_ClBackgroundHue/255.0f, g_Config.m_ClBackgroundSat/255.0f, g_Config.m_ClBackgroundLht/255.0f)); Graphics()->Clear(bg.r, bg.g, bg.b); } diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index f5d5d7099..0de3b3206 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -196,8 +196,12 @@ MACRO_CONFIG_INT(SvResetPickus, sv_reset_pickups, 0, 0, 1, CFGFLAG_SERVER, "Whet MACRO_CONFIG_INT(ClShowOthers, cl_show_others, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show players in other teams") MACRO_CONFIG_INT(ClShowEntities, cl_show_entities, 0, 0, 1, CFGFLAG_CLIENT, "Cheat to show game tiles") MACRO_CONFIG_INT(ClShowQuads, cl_show_quads, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show quads") -MACRO_CONFIG_INT(ClBackground, cl_background, 0, 0, 0xFFFFFF, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Background color") -MACRO_CONFIG_INT(ClBackgroundEntities, cl_background_entities, 0x905473, 0, 0xFFFFFF, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Background color for entities") +MACRO_CONFIG_INT(ClBackgroundHue, cl_background_hue, 0, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Background color hue") +MACRO_CONFIG_INT(ClBackgroundSat, cl_background_sat, 0, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Background color saturation") +MACRO_CONFIG_INT(ClBackgroundLht, cl_background_lht, 128, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Background color lightness") +MACRO_CONFIG_INT(ClBackgroundEntitiesHue, cl_background_entities_hue, 0, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Background (entities) color hue") +MACRO_CONFIG_INT(ClBackgroundEntitiesSat, cl_background_entities_sat, 0, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Background (entities) color saturation") +MACRO_CONFIG_INT(ClBackgroundEntitiesLht, cl_background_entities_lht, 128, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Background (entities) color lightness") MACRO_CONFIG_INT(SvShowOthers, sv_show_others, 1, 0, 1, CFGFLAG_SERVER, "Whether players can user the command showothers or not") MACRO_CONFIG_INT(SvMaxAfkTime, sv_max_afk_time, 0, 0, 9999, CFGFLAG_SERVER, "The time in seconds a player is allowed to be afk (0 = disabled)") MACRO_CONFIG_INT(SvMaxAfkVoteTime, sv_max_afk_vote_time, 300, 0, 9999, CFGFLAG_SERVER, "The time in seconds a player can be afk and his votes still count (0 = disabled)") diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index c320f6051..d2bdd0eb9 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -1088,9 +1088,7 @@ void CMenus::RenderSettingsDDRace(CUIRect MainView) aRects[0].VSplitRight(10.0f, &aRects[0], 0); aRects[1].VSplitLeft(10.0f, 0, &aRects[1]); - int *paColors[2]; - paColors[0] = &g_Config.m_ClBackground; - paColors[1] = &g_Config.m_ClBackgroundEntities; + int *pColorSlider[2][3] = {{&g_Config.m_ClBackgroundHue, &g_Config.m_ClBackgroundSat, &g_Config.m_ClBackgroundLht}, {&g_Config.m_ClBackgroundEntitiesHue, &g_Config.m_ClBackgroundEntitiesSat, &g_Config.m_ClBackgroundEntitiesLht}}; const char *paParts[] = { Localize("Background (when quads disabled or zoomed out)"), @@ -1108,24 +1106,23 @@ void CMenus::RenderSettingsDDRace(CUIRect MainView) aRects[i].VSplitLeft(20.0f, 0, &aRects[i]); aRects[i].HSplitTop(2.5f, 0, &aRects[i]); - int PrevColor = *paColors[i]; - int Color = 0; for(int s = 0; s < 3; s++) { + //CUIRect Text; + //MainView.HSplitTop(19.0f, &Button, &MainView); + //Button.VMargin(15.0f, &Button); + //Button.VSplitLeft(100.0f, &Text, &Button); + ////Button.VSplitRight(5.0f, &Button, 0); + //Button.HSplitTop(4.0f, 0, &Button); + aRects[i].HSplitTop(20.0f, &Label, &aRects[i]); Label.VSplitLeft(100.0f, &Label, &Button); Button.HMargin(2.0f, &Button); - float k = ((PrevColor>>((2-s)*8))&0xff) / 255.0f; - k = DoScrollbarH(&s_aColorSlider[i][s], &Button, k); - Color <<= 8; - Color += clamp((int)(k*255), 0, 255); - UI()->DoLabelScaled(&Label, paLabels[s], 14.0f, -1); + float k = (*pColorSlider[i][s]) / 255.0f; + k = DoScrollbarH(pColorSlider[i][s], &Button, k); + *pColorSlider[i][s] = (int)(k*255.0f); + UI()->DoLabelScaled(&Label, paLabels[s], 15.0f, -1); } - - if(PrevColor != Color) - m_NeedSendinfo = true; - - *paColors[i] = Color; } }