Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 26 additions & 12 deletions src/game/client/neo/ui/neo_scoreboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,20 @@ 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))
{
continue;
}

if (true == g_PR->IsHLTV(i))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true == g_PR->IsHLTV(i) -> 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())
Expand Down Expand Up @@ -795,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");
}
}
}
Expand All @@ -811,26 +818,33 @@ 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
{
wszText[0] = L'\0';
}
}
}
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);
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 watching)", m_HLTVSpectators);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...wszText,L"SourceTV... -> ...wszText, L"SourceTV...

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)
Expand Down
2 changes: 2 additions & 0 deletions src/game/client/neo/ui/neo_scoreboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ class CNEOScoreBoard : public vgui::Panel, public IViewPortPanel, public CGameEv

NeoUI::Context m_uiCtx;

bool m_bSourceTVEnabled = 0;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bool m_bSourceTVEnabled = 0; -> bool m_bSourceTVEnabled = false;

int m_HLTVSpectators = 0;

int m_iTotalPlayers = 0;
CNEOScoreBoardPlayer m_playersInfo[MAX_PLAYERS_ARRAY_SAFE] = {};
CNEOScoreBoardPlayer m_playerPopup = {};
Expand Down