From 845d036317e1ae9e46152edcab3352ad300821f3 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Mon, 3 Aug 2026 12:20:25 +0100 Subject: [PATCH 1/2] init --- src/game/client/neo/ui/neo_scoreboard.cpp | 24 +++++++++++++++++------ src/game/client/neo/ui/neo_scoreboard.h | 2 ++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/game/client/neo/ui/neo_scoreboard.cpp b/src/game/client/neo/ui/neo_scoreboard.cpp index 4946f5147..51c2d8b20 100644 --- a/src/game/client/neo/ui/neo_scoreboard.cpp +++ b/src/game/client/neo/ui/neo_scoreboard.cpp @@ -345,6 +345,7 @@ void CNEOScoreBoard::Update() m_iTotalPlayers = 0; V_memset(m_playersInfo, 0, sizeof(m_playersInfo)); + m_bSourceTVEnabled = false; for (int i = 1; i <= gpGlobals->maxClients; ++i) { if (false == g_PR->IsConnected(i)) @@ -352,6 +353,12 @@ void CNEOScoreBoard::Update() continue; } + if (true == g_PR->IsHLTV(i)) + { + m_bSourceTVEnabled = true; + continue; + } + C_NEO_Player *pNeoPlayer = ToNEOPlayer(UTIL_PlayerByIndex(i)); C_NEO_Player *pNeoImpersonator = pNeoPlayer ? ToNEOPlayer(pNeoPlayer->m_hSpectatorTakeoverPlayerImpersonatingMe.Get()) @@ -716,7 +723,7 @@ void CNEOScoreBoard::OnMainLoop(const NeoUI::Mode eMode) // Output all the players in the server for (int iCurTeam = TEAM_UNASSIGNED; iCurTeam < TEAM__TOTAL; ++iCurTeam) { - if (iaTeamTally[iCurTeam] <= 0 && iCurTeam <= TEAM_SPECTATOR) + if (iaTeamTally[iCurTeam] <= 0 && iCurTeam <= TEAM_SPECTATOR && !(iCurTeam == TEAM_SPECTATOR && !m_bSourceTVEnabled)) { continue; } @@ -820,17 +827,22 @@ void CNEOScoreBoard::OnMainLoop(const NeoUI::Mode eMode) } } } - else if (TEAM_SPECTATOR == iCurTeam && m_HLTVSpectators > 0) - { - V_swprintf_safe(wszText, L"%ls + %d HLTV spectators", - SZWSZ_NEO_TEAM_STRS[iCurTeam].wszStr, m_HLTVSpectators); - } else { V_wcscpy_safe(wszText, SZWSZ_NEO_TEAM_STRS[iCurTeam].wszStr); } NeoUI::Label(wszText, true); + if (TEAM_SPECTATOR == iCurTeam && m_bSourceTVEnabled) + { + V_swprintf_safe(wszText,L"SourceTV Enabled (%d Spectators)", m_HLTVSpectators); + int x = 0; + [[maybe_unused]] int y = 0; + vgui::surface()->GetTextSize(m_uiCtx.fonts[m_uiCtx.eFont].hdl, wszText, x, y); + vgui::surface()->DrawSetTextPos(m_uiCtx.rWidgetArea.x0 + m_uiCtx.dPanel.wide - x - m_uiCtx.iMarginX, m_uiCtx.rWidgetArea.y0 + m_uiCtx.fonts[m_uiCtx.eFont].iYFontOffset); + vgui::surface()->DrawPrintText(wszText, V_wcslen(wszText)); + } + NeoUI::Pad(); // Avatar/Dead-indicator NeoUI::Pad(); // Name column if (iCurTeam >= FIRST_GAME_TEAM) diff --git a/src/game/client/neo/ui/neo_scoreboard.h b/src/game/client/neo/ui/neo_scoreboard.h index e9a679119..cadd0ba42 100644 --- a/src/game/client/neo/ui/neo_scoreboard.h +++ b/src/game/client/neo/ui/neo_scoreboard.h @@ -96,7 +96,9 @@ class CNEOScoreBoard : public vgui::Panel, public IViewPortPanel, public CGameEv NeoUI::Context m_uiCtx; + bool m_bSourceTVEnabled = 0; int m_HLTVSpectators = 0; + int m_iTotalPlayers = 0; CNEOScoreBoardPlayer m_playersInfo[MAX_PLAYERS_ARRAY_SAFE] = {}; CNEOScoreBoardPlayer m_playerPopup = {}; From cac7449cd7be222bc8531288a60b9a729237c9b7 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Mon, 3 Aug 2026 14:20:20 +0100 Subject: [PATCH 2/2] oopsie, change spectators to watching for sourcetv spectators, handle singular --- src/game/client/neo/ui/neo_scoreboard.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/game/client/neo/ui/neo_scoreboard.cpp b/src/game/client/neo/ui/neo_scoreboard.cpp index 51c2d8b20..48b2ce793 100644 --- a/src/game/client/neo/ui/neo_scoreboard.cpp +++ b/src/game/client/neo/ui/neo_scoreboard.cpp @@ -723,7 +723,7 @@ void CNEOScoreBoard::OnMainLoop(const NeoUI::Mode eMode) // Output all the players in the server for (int iCurTeam = TEAM_UNASSIGNED; iCurTeam < TEAM__TOTAL; ++iCurTeam) { - if (iaTeamTally[iCurTeam] <= 0 && iCurTeam <= TEAM_SPECTATOR && !(iCurTeam == TEAM_SPECTATOR && !m_bSourceTVEnabled)) + if (iaTeamTally[iCurTeam] <= 0 && iCurTeam <= TEAM_SPECTATOR) { continue; } @@ -802,14 +802,14 @@ void CNEOScoreBoard::OnMainLoop(const NeoUI::Mode eMode) } if (bShowReadyUp) { - V_swprintf_safe(wszText, L"%ls: %d (%d players - %d ready)", - wszTeamtag, pTeam->GetRoundsWon(), iaTeamTally[iCurTeam], + V_swprintf_safe(wszText, L"%ls: %d (%d player%s - %d ready)", + wszTeamtag, pTeam->GetRoundsWon(), iaTeamTally[iCurTeam], iaTeamTally[iCurTeam] == 1 ? "" : "s", iaTeamReadyTally[iCurTeam]); } else { - V_swprintf_safe(wszText, L"%ls: %d (%d players)", - wszTeamtag, pTeam->GetRoundsWon(), iaTeamTally[iCurTeam]); + V_swprintf_safe(wszText, L"%ls: %d (%d player%s)", + wszTeamtag, pTeam->GetRoundsWon(), iaTeamTally[iCurTeam], iaTeamTally[iCurTeam] == 1 ? "" : "s"); } } } @@ -818,8 +818,9 @@ void CNEOScoreBoard::OnMainLoop(const NeoUI::Mode eMode) // DM - Print players total on the left side only if (iCurTeam == TEAM_JINRAI) { - V_swprintf_safe(wszText, L"Players: %d", - iaTeamTally[TEAM_JINRAI] + iaTeamTally[TEAM_NSF]); + const int total = iaTeamTally[TEAM_JINRAI] + iaTeamTally[TEAM_NSF]; + V_swprintf_safe(wszText, L"Player%s: %d", + total == 1 ? "" : "s", total); } else { @@ -829,13 +830,14 @@ void CNEOScoreBoard::OnMainLoop(const NeoUI::Mode eMode) } else { - V_wcscpy_safe(wszText, SZWSZ_NEO_TEAM_STRS[iCurTeam].wszStr); + V_swprintf_safe(wszText, L"%ls (%d player%s)", + SZWSZ_NEO_TEAM_STRS[iCurTeam].wszStr, iaTeamTally[iCurTeam], iaTeamTally[iCurTeam] == 1 ? "" : "s"); } NeoUI::Label(wszText, true); if (TEAM_SPECTATOR == iCurTeam && m_bSourceTVEnabled) { - V_swprintf_safe(wszText,L"SourceTV Enabled (%d Spectators)", m_HLTVSpectators); + V_swprintf_safe(wszText,L"SourceTV Enabled (%d watching)", m_HLTVSpectators); int x = 0; [[maybe_unused]] int y = 0; vgui::surface()->GetTextSize(m_uiCtx.fonts[m_uiCtx.eFont].hdl, wszText, x, y);