Skip to content
Merged
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
70 changes: 31 additions & 39 deletions src/game/client/neo/ui/neo_hud_round_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,36 @@ void CNEOHud_RoundState::UpdateStateForNeoHudElementDraw()
}
else
{
V_sprintf_safe(szPlayersAliveANSI, "%i vs %i", m_iLeftPlayersAlive, m_iRightPlayersAlive);
const int localPlayerTeam = GetLocalPlayerTeam();
const bool localPlayerSpecOrNoTeam = !NEORules()->IsTeamplay() || !(localPlayerTeam == TEAM_JINRAI || localPlayerTeam == TEAM_NSF);
const bool swapTeamSides = cl_neo_hud_team_swap_sides.GetBool();
const int leftTeam = swapTeamSides ? (localPlayerSpecOrNoTeam ? TEAM_JINRAI : localPlayerTeam) : TEAM_JINRAI;

int iLeftPlayersAlive = 0;
int iRightPlayersAlive = 0;
for (int i = 1; i <= gpGlobals->maxClients; i++)
{
if (!g_PR->IsConnected(i))
{
continue;
}
const int playerTeam = g_PR->GetTeam(i);
if (playerTeam != leftTeam)
{
if (g_PR->IsAlive(i))
{
iRightPlayersAlive++;
}
}
else
{
if (g_PR->IsAlive(i))
{
iLeftPlayersAlive++;
}
}
}
V_sprintf_safe(szPlayersAliveANSI, "%i vs %i", iLeftPlayersAlive, iRightPlayersAlive);
}
g_pVGuiLocalize->ConvertANSIToUnicode(szPlayersAliveANSI, m_wszPlayersAliveUnicode, sizeof(m_wszPlayersAliveUnicode));

Expand Down Expand Up @@ -554,7 +583,7 @@ void CNEOHud_RoundState::DrawNeoHudElement()
surface()->DrawPrintText(m_wszRightTeamScore, 2);
}

m_iLeftPlayersAlive = m_iLeftPlayersTotal = m_iRightPlayersAlive = m_iRightPlayersTotal = 0;
m_iLeftPlayersTotal = m_iRightPlayersTotal = 0;

if (!g_PR)
return;
Expand Down Expand Up @@ -607,14 +636,10 @@ void CNEOHud_RoundState::DrawNeoHudElement()

if (playerTeam == TEAM__TOTAL - 1 - (leftTeam - FIRST_GAME_TEAM))
{
if (g_PR->IsAlive(m_nPlayerList[i].playerIndex))
m_iLeftPlayersAlive++;
m_iLeftPlayersTotal++;
}
else if (playerTeam == TEAM__TOTAL - 1 - (rightTeam - FIRST_GAME_TEAM))
{
if (g_PR->IsAlive(m_nPlayerList[i].playerIndex))
m_iRightPlayersAlive++;
m_iRightPlayersTotal++;
}
}
Expand Down Expand Up @@ -725,7 +750,6 @@ void CNEOHud_RoundState::DrawPlayerList()
const int localPlayerTeam = GetLocalPlayerTeam();
const int localPlayerIndex = GetLocalPlayerIndex();
const bool localPlayerSpec = !(localPlayerTeam == TEAM_JINRAI || localPlayerTeam == TEAM_NSF);
const int leftTeam = cl_neo_hud_team_swap_sides.GetBool() ? (localPlayerSpec ? TEAM_JINRAI : localPlayerTeam) : TEAM_JINRAI;

int offset = 52;
if (cl_neo_squad_hud_star_scale.GetFloat() > 0)
Expand Down Expand Up @@ -773,9 +797,6 @@ void CNEOHud_RoundState::DrawPlayerList()
}
}

m_iLeftPlayersAlive = 0;
m_iRightPlayersAlive = 0;

// Draw other team mates
for (int i = 1; i <= gpGlobals->maxClients; i++)
{
Expand All @@ -784,19 +805,6 @@ void CNEOHud_RoundState::DrawPlayerList()
continue;
}
const int playerTeam = g_PR->GetTeam(i);
if (playerTeam != leftTeam)
{
if (g_PR->IsAlive(i))
{
m_iRightPlayersAlive++;
}
}
else {
if (g_PR->IsAlive(i))
{
m_iLeftPlayersAlive++;
}
}
if (playerTeam != localPlayerTeam)
{
continue;
Expand Down Expand Up @@ -827,7 +835,6 @@ void CNEOHud_RoundState::DrawPlayerList_BotCmdr()
const int localPlayerTeam = GetLocalPlayerTeam();
const int localPlayerIndex = GetLocalPlayerIndex();
const bool localPlayerSpec = !(localPlayerTeam == TEAM_JINRAI || localPlayerTeam == TEAM_NSF);
const int leftTeam = cl_neo_hud_team_swap_sides.GetBool() ? (localPlayerSpec ? TEAM_JINRAI : localPlayerTeam) : TEAM_JINRAI;

int offset = 52;
if (cl_neo_squad_hud_star_scale.GetFloat() > 0)
Expand All @@ -845,8 +852,6 @@ void CNEOHud_RoundState::DrawPlayerList_BotCmdr()
m_nonSquadList.RemoveAll();

bool squadMateFound = false;
m_iLeftPlayersAlive = 0;
m_iRightPlayersAlive = 0;
const int localStar = g_PR->GetStar(localPlayerIndex);

// Single pass to collect and categorize players
Expand All @@ -857,19 +862,6 @@ void CNEOHud_RoundState::DrawPlayerList_BotCmdr()
continue;
}
const int playerTeam = g_PR->GetTeam(i);
if (playerTeam != leftTeam)
{
if (g_PR->IsAlive(i))
{
m_iRightPlayersAlive++;
}
}
else {
if (g_PR->IsAlive(i))
{
m_iLeftPlayersAlive++;
}
}
if (playerTeam != localPlayerTeam)
{
continue;
Expand Down
2 changes: 0 additions & 2 deletions src/game/client/neo/ui/neo_hud_round_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ class CNEOHud_RoundState : public CNEOHud_ChildElement, public CHudElement, publ
int m_iStatusUnicodeSize = 0;

// Totals info
int m_iLeftPlayersAlive = 0;
int m_iLeftPlayersTotal = 0;
int m_iRightPlayersAlive = 0;
int m_iRightPlayersTotal = 0;

// Element Positions
Expand Down