Fix coloring of team chat. Fixes #648

This commit is contained in:
Learath2 2017-03-06 10:24:00 +01:00
parent de7587b8b5
commit 5317be824e
3 changed files with 8 additions and 2 deletions

View file

@ -763,7 +763,7 @@ void CChat::OnRender()
}
else if (m_aLines[r].m_Team)
{
vec3 rgb = HslToRgb(vec3(g_Config.m_ClMessageTeamHue / 255.0f, g_Config.m_ClMessageTeamSat / 255.0f, g_Config.m_ClMessageTeamLht / 255.0f));
vec3 rgb = CalculateNameColor(vec3(g_Config.m_ClMessageTeamHue / 255.0f, g_Config.m_ClMessageTeamSat / 255.0f, g_Config.m_ClMessageTeamLht / 255.0f));
TextRender()->TextColor(rgb.r, rgb.g, rgb.b, Blend); // team message
}
else if(m_aLines[r].m_NameColor == TEAM_RED)

View file

@ -1313,6 +1313,7 @@ void CMenus::RenderSettings(CUIRect MainView)
else if(m_NeedRestartSkins || m_NeedRestartGraphics || m_NeedRestartSound || m_NeedRestartDDNet)
UI()->DoLabelScaled(&RestartWarning, Localize("You must restart the game for all settings to take effect."), 14.0f, -1);
}
void CMenus::RenderSettingsHUD(CUIRect MainView)
{
static int pIDP1 = 0, pIDP2 = 0;
@ -1543,7 +1544,8 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
Left.HSplitTop(10.0f, &Label, &Left);
TextRender()->TextColor(0.45f, 0.9f, 0.45f, 1.0f);
vec3 rgbn = CalculateNameColor(vec3(g_Config.m_ClMessageTeamHue / 255.0f, g_Config.m_ClMessageTeamSat / 255.0f, g_Config.m_ClMessageTeamLht / 255.0f));
TextRender()->TextColor(rgbn.r, rgbn.g, rgbn.b, 1.0f);
float tw = TextRender()->TextWidth(0, 12.0f, Localize("Player"), -1);
Label.VSplitLeft(tw, &Label, &Button);
UI()->DoLabelScaled(&Label, Localize("Player"), 12.0f, -1);

View file

@ -439,6 +439,10 @@ inline vec3 RgbToHsl(vec3 RGB)
}
inline vec3 CalculateNameColor(vec3 TextColorHSL)
{
return HslToRgb(vec3(TextColorHSL.h, TextColorHSL.s * 0.68f, TextColorHSL.l * 0.81f));
}
extern const char *Localize(const char *Str);