Allow more colors

This commit is contained in:
def 2013-10-08 16:32:27 +02:00
parent 845ca5ec7c
commit 7dbce81bbf
3 changed files with 20 additions and 19 deletions

View file

@ -772,12 +772,12 @@ void CClient::Render()
{ {
if(g_Config.m_ClShowEntities && g_Config.m_ClDDRaceCheats) 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); Graphics()->Clear(bg.r, bg.g, bg.b);
} }
else if(g_Config.m_GfxClear) 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); Graphics()->Clear(bg.r, bg.g, bg.b);
} }

View file

@ -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(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(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(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(ClBackgroundHue, cl_background_hue, 0, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Background color hue")
MACRO_CONFIG_INT(ClBackgroundEntities, cl_background_entities, 0x905473, 0, 0xFFFFFF, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Background color for entities") 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(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(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)") 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)")

View file

@ -1088,9 +1088,7 @@ void CMenus::RenderSettingsDDRace(CUIRect MainView)
aRects[0].VSplitRight(10.0f, &aRects[0], 0); aRects[0].VSplitRight(10.0f, &aRects[0], 0);
aRects[1].VSplitLeft(10.0f, 0, &aRects[1]); aRects[1].VSplitLeft(10.0f, 0, &aRects[1]);
int *paColors[2]; 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}};
paColors[0] = &g_Config.m_ClBackground;
paColors[1] = &g_Config.m_ClBackgroundEntities;
const char *paParts[] = { const char *paParts[] = {
Localize("Background (when quads disabled or zoomed out)"), 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].VSplitLeft(20.0f, 0, &aRects[i]);
aRects[i].HSplitTop(2.5f, 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++) 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]); aRects[i].HSplitTop(20.0f, &Label, &aRects[i]);
Label.VSplitLeft(100.0f, &Label, &Button); Label.VSplitLeft(100.0f, &Label, &Button);
Button.HMargin(2.0f, &Button); Button.HMargin(2.0f, &Button);
float k = ((PrevColor>>((2-s)*8))&0xff) / 255.0f; float k = (*pColorSlider[i][s]) / 255.0f;
k = DoScrollbarH(&s_aColorSlider[i][s], &Button, k); k = DoScrollbarH(pColorSlider[i][s], &Button, k);
Color <<= 8; *pColorSlider[i][s] = (int)(k*255.0f);
Color += clamp((int)(k*255), 0, 255); UI()->DoLabelScaled(&Label, paLabels[s], 15.0f, -1);
UI()->DoLabelScaled(&Label, paLabels[s], 14.0f, -1);
} }
if(PrevColor != Color)
m_NeedSendinfo = true;
*paColors[i] = Color;
} }
} }