Add a checkbox to disable friend heart

This commit is contained in:
Learath2 2017-02-27 23:56:22 +03:00
parent c783122301
commit fa22425f26
3 changed files with 17 additions and 8 deletions

View file

@ -272,6 +272,7 @@ MACRO_CONFIG_INT(ClMessageHighlightHue, cl_message_highlight_hue, 0, 0, 255, CFG
MACRO_CONFIG_INT(ClMessageHighlightSat, cl_message_highlight_sat, 255, 0, 255, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Highlighted message color saturation") MACRO_CONFIG_INT(ClMessageHighlightSat, cl_message_highlight_sat, 255, 0, 255, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Highlighted message color saturation")
MACRO_CONFIG_INT(ClMessageHighlightLht, cl_message_highlight_lht, 192, 0, 255, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Highlighted message color lightness") MACRO_CONFIG_INT(ClMessageHighlightLht, cl_message_highlight_lht, 192, 0, 255, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Highlighted message color lightness")
MACRO_CONFIG_INT(ClMessageFriend, cl_message_friend, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Enable coloring and the heart for friends")
MACRO_CONFIG_INT(ClMessageFriendHue, cl_message_friend_hue, 0, 0, 255, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Friend message color hue") MACRO_CONFIG_INT(ClMessageFriendHue, cl_message_friend_hue, 0, 0, 255, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Friend message color hue")
MACRO_CONFIG_INT(ClMessageFriendSat, cl_message_friend_sat, 255, 0, 255, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Friend message color saturation") MACRO_CONFIG_INT(ClMessageFriendSat, cl_message_friend_sat, 255, 0, 255, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Friend message color saturation")
MACRO_CONFIG_INT(ClMessageFriendLht, cl_message_friend_lht, 145, 0, 255, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Friend message color lightness") MACRO_CONFIG_INT(ClMessageFriendLht, cl_message_friend_lht, 145, 0, 255, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Friend message color lightness")

View file

@ -540,7 +540,7 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
} }
else else
{ {
if(m_pClient->m_aClients[ClientID].m_Friend) if(g_Config.m_ClMessageFriend && m_pClient->m_aClients[ClientID].m_Friend)
{ {
str_format(m_aLines[m_CurrentLine].m_aName, sizeof(m_aLines[m_CurrentLine].m_aName), "♥ %s", m_pClient->m_aClients[ClientID].m_aName); str_format(m_aLines[m_CurrentLine].m_aName, sizeof(m_aLines[m_CurrentLine].m_aName), "♥ %s", m_pClient->m_aClients[ClientID].m_aName);
m_aLines[m_CurrentLine].m_NameColor = 2; m_aLines[m_CurrentLine].m_NameColor = 2;

View file

@ -1315,9 +1315,9 @@ void CMenus::RenderSettings(CUIRect MainView)
} }
void CMenus::RenderSettingsHUD(CUIRect MainView) void CMenus::RenderSettingsHUD(CUIRect MainView)
{ {
int pIDP1 = 0, pIDP2 = 0; static int pIDP1 = 0, pIDP2 = 0;
static int Page = 1; static int Page = 1;
CUIRect Left, Right, HUD, Messages, Button, Label, Weapon, Laser, Page1Tab, Page2Tab; CUIRect Left, Right, HUD, Messages, Button, Label, Weapon, Laser, Page1Tab, Page2Tab, Enable;
MainView.HSplitTop(150.0f, &HUD, &MainView); MainView.HSplitTop(150.0f, &HUD, &MainView);
@ -1560,16 +1560,24 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
char aBuf[64]; char aBuf[64];
Right.HSplitTop(20.0f, &Label, &Right); Right.HSplitTop(20.0f, &Label, &Right);
Label.VSplitRight(50.0f, &Label, &Button); Label.VSplitRight(50.0f, &Label, &Button);
float twh = TextRender()->TextWidth(0, 16.0f, "Friend message", -1) ;
Label.VSplitLeft(twh + 5.0f, &Label, &Enable);
Enable.VSplitLeft(20.0f, &Enable, 0);
UI()->DoLabelScaled(&Label, "Friend message", 16.0f, -1); UI()->DoLabelScaled(&Label, "Friend message", 16.0f, -1);
{ {
static int s_DefaultButton = 0; static int s_DefaultButton = 0;
if (DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button)){ if (DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button)){
vec3 HSL = RgbToHsl(vec3(1.0f, 0.5f, 0.5f)); // default values g_Config.m_ClMessageFriendHue = 0;
g_Config.m_ClMessageHighlightHue = HSL.h; g_Config.m_ClMessageFriendSat = 255;
g_Config.m_ClMessageHighlightSat = HSL.s; g_Config.m_ClMessageFriendLht = 145;
g_Config.m_ClMessageHighlightLht = HSL.l;
} }
} }
if(DoButton_CheckBox(&g_Config.m_ClMessageFriend, "", g_Config.m_ClMessageFriend, &Enable))
{
g_Config.m_ClMessageFriend ^= 1;
}
Right.HSplitTop(20.0f, &Button, &Right); Right.HSplitTop(20.0f, &Button, &Right);
Button.VSplitLeft(15.0f, 0, &Button); Button.VSplitLeft(15.0f, 0, &Button);
Button.VSplitLeft(100.0f, &Label, &Button); Button.VSplitLeft(100.0f, &Label, &Button);