Skip to content

Commit

Permalink
mute commands
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrc6 committed Jan 3, 2025
1 parent 9eba3f7 commit d0b55de
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/engine/textrender.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ MAYBE_UNUSED static const char *FONT_ICON_FLAG_CHECKERED = "\xEF\x84\x9E";
MAYBE_UNUSED static const char *FONT_ICON_BAN = "\xEF\x81\x9E";
MAYBE_UNUSED static const char *FONT_ICON_CIRCLE_CHEVRON_DOWN = "\xEF\x84\xBA";
MAYBE_UNUSED static const char *FONT_ICON_KEY = "\xEF\x82\x84";
MAYBE_UNUSED static const char *FONT_ICON_COMMENT_SLASH = "\xEF\x92\xB3";
MAYBE_UNUSED static const char *FONT_ICON_USERS = "\xEF\x83\x80";
MAYBE_UNUSED static const char *FONT_ICON_COMMENT = "\xEF\x81\xB5";
MAYBE_UNUSED static const char *FONT_ICON_SQUARE_MINUS = "\xEF\x85\x86";
Expand Down
11 changes: 10 additions & 1 deletion src/game/client/components/nameplates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void CNamePlates::RenderNamePlate(CNamePlate &NamePlate, const CRenderNamePlateD

// TClient
if(Data.m_IsGame && Data.m_RealClientId >= 0)
if((g_Config.m_ClPingNameCircle || (m_pClient->m_Scoreboard.Active() && !m_pClient->m_Snap.m_apPlayerInfos[Data.m_RealClientId]->m_Local)) && !(Client()->State() == IClient::STATE_DEMOPLAYBACK))
if((g_Config.m_ClPingNameCircle || (m_pClient->m_Scoreboard.Active() && !m_pClient->m_Snap.m_apPlayerInfos[Data.m_RealClientId]->m_Local)) && (Client()->State() != IClient::STATE_DEMOPLAYBACK))
{
Graphics()->TextureClear();
Graphics()->QuadsBegin();
Expand All @@ -154,6 +154,15 @@ void CNamePlates::RenderNamePlate(CNamePlate &NamePlate, const CRenderNamePlateD
Graphics()->DrawCircle(Data.m_Position.x - TextRender()->GetBoundingBoxTextContainer(NamePlate.m_Name.m_TextContainerIndex).m_W / 2.0f - CircleSize, YOffset + Data.m_FontSize / 2.0f + 1.4f, CircleSize, 24);
Graphics()->QuadsEnd();
}
if(Data.m_IsGame && Data.m_RealClientId >= 0)
if(Client()->State() != IClient::STATE_DEMOPLAYBACK && (m_pClient->m_aClients[Data.m_RealClientId].m_Foe || m_pClient->m_aClients[Data.m_RealClientId].m_ChatIgnore))
{
TextRender()->TextColor(TextRender()->DefaultTextColor());
TextRender()->SetFontPreset(EFontPreset::ICON_FONT);
TextRender()->Text(Data.m_Position.x + TextRender()->GetBoundingBoxTextContainer(NamePlate.m_Name.m_TextContainerIndex).m_W / 2.0f, YOffset, Data.m_FontSize, FontIcons::FONT_ICON_COMMENT_SLASH);
TextRender()->SetFontPreset(EFontPreset::DEFAULT_FONT);
}

ColorRGBA WarColor = Color;
if(Data.m_IsGame && Data.m_RealClientId >= 0 && !Data.m_ShowClanWarInName && GameClient()->m_WarList.GetWarData(Data.m_RealClientId).IsWarName)
WarColor = GameClient()->m_WarList.GetNameplateColor(Data.m_RealClientId).WithAlpha(Data.m_Alpha);
Expand Down
8 changes: 8 additions & 0 deletions src/game/client/components/scoreboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,11 +544,19 @@ void CScoreboard::RenderScoreboard(CUIRect Scoreboard, int Team, int CountStart,
GameClient()->FormatClientId(pInfo->m_ClientId, aClientId, EClientIdFormat::INDENT_AUTO);
TextRender()->TextEx(&Cursor, aClientId);
}

if(pInfo->m_ClientId >= 0 && (GameClient()->m_aClients[pInfo->m_ClientId].m_Foe || GameClient()->m_aClients[pInfo->m_ClientId].m_ChatIgnore))
{
TextRender()->SetFontPreset(EFontPreset::ICON_FONT);
TextRender()->TextEx(&Cursor, FontIcons::FONT_ICON_COMMENT_SLASH);
TextRender()->SetFontPreset(EFontPreset::DEFAULT_FONT);
}

// TClient
if(pInfo->m_ClientId >= 0 && g_Config.m_ClWarList && g_Config.m_ClWarListScoreboard && GameClient()->m_WarList.GetAnyWar(pInfo->m_ClientId))
TextRender()->TextColor(GameClient()->m_WarList.GetNameplateColor(pInfo->m_ClientId));


TextRender()->TextEx(&Cursor, ClientData.m_aName);

// ready / watching
Expand Down
3 changes: 2 additions & 1 deletion src/game/client/components/tclient/bindchat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ void CBindchat::OnConsoleInit()
Console()->ExecuteFile(BINDCHAT_FILE);
}

// Default Binds
// Default Binds
AddBindDefault(".war", "war_name_index 1");
AddBindDefault(".warclan", "war_clan_index 1");
Expand All @@ -204,6 +203,8 @@ void CBindchat::OnConsoleInit()
AddBindDefault(".delwarclan", "remove_war_clan_index 1");
AddBindDefault(".delteam", "remove_war_name_index 2");
AddBindDefault(".delteamclan", "remove_war_clan_index 2");
AddBindDefault("!mute", "add_foe");
AddBindDefault("!unmute", "remove_foe");
}

void CBindchat::ExecuteBind(int Bind, const char *pArgs)
Expand Down
14 changes: 11 additions & 3 deletions src/game/client/components/tclient/menus_tclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,17 @@ void CMenus::RenderSettingsTClient(CUIRect MainView)
static CLineInput s_KaomojiUnflip;
DoBindchat(s_KaomojiUnflip, Localize("Unflip:"), "!unflip", "say ┬─┬ノ( º _ ºノ)");

Column.HSplitTop(MarginSmall, nullptr, &Column);
Column.HSplitTop(HeadlineHeight, &Label, &Column);
Ui()->DoLabel(&Label, Localize("Mute Commands"), HeadlineFontSize, TEXTALIGN_ML);
Column.HSplitTop(MarginSmall, nullptr, &Column);

static CLineInput s_Mute, s_UnMute;
Column.HSplitTop(MarginSmall, nullptr, &Column);
DoBindchat(s_Mute, Localize("Mute:"), "!mute", "add_foe");
Column.HSplitTop(MarginSmall, nullptr, &Column);
DoBindchat(s_UnMute, Localize("Un-Mute:"), "!unmute", "remove_foe");

Column = RightView;

Column.HSplitTop(HeadlineHeight, &Label, &Column);
Expand Down Expand Up @@ -955,15 +966,13 @@ void CMenus::RenderSettingsTClientSettngs(CUIRect MainView)
s_SectionBoxes.back().h = Column.y - s_SectionBoxes.back().y;
Column.HSplitTop(MarginSmall, nullptr, &Column);


// ***** Tee Trails ***** //
Column.HSplitTop(MarginBetweenSections, nullptr, &Column);
s_SectionBoxes.push_back(Column);
Column.HSplitTop(HeadlineHeight, &Label, &Column);
Ui()->DoLabel(&Label, Localize("Tee Trails"), HeadlineFontSize, TEXTALIGN_ML);
Column.HSplitTop(MarginSmall, nullptr, &Column);


DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClTeeTrail, Localize("Enable tee trails"), &g_Config.m_ClTeeTrail, &Column, LineSize);
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClTeeTrailOthers, Localize("Tee trail others"), &g_Config.m_ClTeeTrailOthers, &Column, LineSize);
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClTeeTrailRainbow, Localize("Rainbow tee trail"), &g_Config.m_ClTeeTrailRainbow, &Column, LineSize);
Expand All @@ -980,7 +989,6 @@ void CMenus::RenderSettingsTClientSettngs(CUIRect MainView)
static CButtonContainer s_TeeTrailColor;
DoLine_ColorPicker(&s_TeeTrailColor, ColorPickerLineSize, ColorPickerLabelSize, ColorPickerLineSpacing, &Column, Localize("Tee trail color"), &g_Config.m_ClTeeTrailColor, ColorRGBA(1.0f, 1.0f, 1.0f), false);


s_SectionBoxes.back().h = Column.y - s_SectionBoxes.back().y;
Column.HSplitTop(MarginSmall, nullptr, &Column);

Expand Down

0 comments on commit d0b55de

Please sign in to comment.