add cl_show_chat_team to only show team members' messages

This commit is contained in:
yrrrmmbl 2024-05-10 16:54:31 +02:00 committed by heinrich5991
parent f3bb5feffc
commit a93ad48dce
3 changed files with 15 additions and 8 deletions

View file

@ -62,6 +62,7 @@ MACRO_CONFIG_INT(ClShowNotifications, cl_shownotifications, 1, 0, 1, CFGFLAG_CLI
MACRO_CONFIG_INT(ClShowEmotes, cl_showemotes, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show tee emotes")
MACRO_CONFIG_INT(ClShowChat, cl_showchat, 1, 0, 2, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show chat (2 to always show large chat area)")
MACRO_CONFIG_INT(ClShowChatFriends, cl_show_chat_friends, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show only chat messages from friends")
MACRO_CONFIG_INT(ClShowChatTeamMembersOnly, cl_show_chat_team_members_only, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show only chat messages from team members")
MACRO_CONFIG_INT(ClShowChatSystem, cl_show_chat_system, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show chat messages from the server")
MACRO_CONFIG_INT(ClShowKillMessages, cl_showkillmessages, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show kill messages")
MACRO_CONFIG_INT(ClShowFinishMessages, cl_show_finish_messages, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show finish messages")

View file

@ -630,6 +630,7 @@ void CChat::AddLine(int ClientId, int Team, const char *pLine)
(ClientId >= 0 && (m_pClient->m_aClients[ClientId].m_aName[0] == '\0' || // unknown client
m_pClient->m_aClients[ClientId].m_ChatIgnore ||
(m_pClient->m_Snap.m_LocalClientId != ClientId && g_Config.m_ClShowChatFriends && !m_pClient->m_aClients[ClientId].m_Friend) ||
(m_pClient->m_Snap.m_LocalClientId != ClientId && g_Config.m_ClShowChatTeamMembersOnly && m_pClient->IsOtherTeam(ClientId) && m_pClient->m_Teams.Team(m_pClient->m_Snap.m_LocalClientId) != TEAM_FLOCK) ||
(m_pClient->m_Snap.m_LocalClientId != ClientId && m_pClient->m_aClients[ClientId].m_Foe))))
return;

View file

@ -2612,6 +2612,7 @@ void CMenus::RenderSettingsAppearance(CUIRect MainView)
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClChatTeamColors, Localize("Show names in chat in team colors"), &g_Config.m_ClChatTeamColors, &LeftView, LineSize);
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowChatFriends, Localize("Show only chat messages from friends"), &g_Config.m_ClShowChatFriends, &LeftView, LineSize);
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowChatTeamMembersOnly, Localize("Show only chat messages from team members"), &g_Config.m_ClShowChatTeamMembersOnly, &LeftView, LineSize);
if(DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClChatOld, Localize("Use old chat style"), &g_Config.m_ClChatOld, &LeftView, LineSize))
GameClient()->m_Chat.RebuildChat();
@ -2889,13 +2890,15 @@ void CMenus::RenderSettingsAppearance(CUIRect MainView)
if(!g_Config.m_ClShowChatFriends)
{
TempY += RenderMessageBackground(PREVIEW_HIGHLIGHT);
if(!g_Config.m_ClShowChatTeamMembersOnly)
TempY += RenderMessageBackground(PREVIEW_HIGHLIGHT);
TempY += RenderMessageBackground(PREVIEW_TEAM);
}
TempY += RenderMessageBackground(PREVIEW_FRIEND);
if(!g_Config.m_ClShowChatTeamMembersOnly)
TempY += RenderMessageBackground(PREVIEW_FRIEND);
if(!g_Config.m_ClShowChatFriends)
if(!g_Config.m_ClShowChatFriends && !g_Config.m_ClShowChatTeamMembersOnly)
{
TempY += RenderMessageBackground(PREVIEW_SPAMMER);
}
@ -2914,9 +2917,10 @@ void CMenus::RenderSettingsAppearance(CUIRect MainView)
if(!g_Config.m_ClShowChatFriends)
{
// Highlighted
if(!g_Config.m_ClChatOld)
if(!g_Config.m_ClChatOld && !g_Config.m_ClShowChatTeamMembersOnly)
RenderTools()->RenderTee(pIdleState, &s_vLines[PREVIEW_HIGHLIGHT].m_RenderInfo, EMOTE_NORMAL, vec2(1, 0.1f), vec2(X + RealTeeSizeHalved, Y + OffsetTeeY + FullHeightMinusTee / 2.0f + TWSkinUnreliableOffset));
Y += RenderPreview(PREVIEW_HIGHLIGHT, X, Y).y;
if(!g_Config.m_ClShowChatTeamMembersOnly)
Y += RenderPreview(PREVIEW_HIGHLIGHT, X, Y).y;
// Team
if(!g_Config.m_ClChatOld)
@ -2925,12 +2929,13 @@ void CMenus::RenderSettingsAppearance(CUIRect MainView)
}
// Friend
if(!g_Config.m_ClChatOld)
if(!g_Config.m_ClChatOld && !g_Config.m_ClShowChatTeamMembersOnly)
RenderTools()->RenderTee(pIdleState, &s_vLines[PREVIEW_FRIEND].m_RenderInfo, EMOTE_NORMAL, vec2(1, 0.1f), vec2(X + RealTeeSizeHalved, Y + OffsetTeeY + FullHeightMinusTee / 2.0f + TWSkinUnreliableOffset));
Y += RenderPreview(PREVIEW_FRIEND, X, Y).y;
if(!g_Config.m_ClShowChatTeamMembersOnly)
Y += RenderPreview(PREVIEW_FRIEND, X, Y).y;
// Normal
if(!g_Config.m_ClShowChatFriends)
if(!g_Config.m_ClShowChatFriends && !g_Config.m_ClShowChatTeamMembersOnly)
{
if(!g_Config.m_ClChatOld)
RenderTools()->RenderTee(pIdleState, &s_vLines[PREVIEW_SPAMMER].m_RenderInfo, EMOTE_NORMAL, vec2(1, 0.1f), vec2(X + RealTeeSizeHalved, Y + OffsetTeeY + FullHeightMinusTee / 2.0f + TWSkinUnreliableOffset));