diff --git a/src/game/client/neo/ui/neo_hud_round_state.cpp b/src/game/client/neo/ui/neo_hud_round_state.cpp index 9cea01443..6da8aafd7 100644 --- a/src/game/client/neo/ui/neo_hud_round_state.cpp +++ b/src/game/client/neo/ui/neo_hud_round_state.cpp @@ -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)); @@ -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; @@ -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++; } } @@ -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) @@ -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++) { @@ -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; @@ -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) @@ -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 @@ -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; diff --git a/src/game/client/neo/ui/neo_hud_round_state.h b/src/game/client/neo/ui/neo_hud_round_state.h index e8a2ad75f..859420861 100644 --- a/src/game/client/neo/ui/neo_hud_round_state.h +++ b/src/game/client/neo/ui/neo_hud_round_state.h @@ -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