# HG changeset patch # User Adam Kaminski # Date 1626744880 14400 # Mon Jul 19 21:34:40 2021 -0400 # Node ID de411793dfb9cd695855b41c99a995652f4ff910 # Parent 11a62260ea524211c690b9d2f6c0e710033ad8df Added the function HUD_GetNumSpectators. diff -r 11a62260ea52 -r de411793dfb9 src/g_shared/st_hud.cpp --- a/src/g_shared/st_hud.cpp Mon Jul 19 21:22:27 2021 -0400 +++ b/src/g_shared/st_hud.cpp Mon Jul 19 21:34:40 2021 -0400 @@ -76,6 +76,9 @@ // How many players are currently in the game? static ULONG g_ulNumPlayers = 0; +// [AK] How many true spectators are currently in the game? +static ULONG g_ulNumSpectators = 0; + // What is our current rank? static ULONG g_ulRank = 0; @@ -303,6 +306,7 @@ // [AK] Count how many players are in the game. g_ulNumPlayers = SERVER_CalcNumNonSpectatingPlayers( MAXPLAYERS ); + g_ulNumSpectators = SERVER_CountPlayers( true ) - g_ulNumPlayers; // "x opponents left", "x allies alive", etc if ( GAMEMODE_GetCurrentFlags( ) & GMF_DEADSPECTATORS ) @@ -993,6 +997,13 @@ //***************************************************************************** // +ULONG HUD_GetNumSpectators( void ) +{ + return ( g_ulNumSpectators ); +} + +//***************************************************************************** +// ULONG HUD_GetRank( void ) { return ( g_ulRank ); diff -r 11a62260ea52 -r de411793dfb9 src/g_shared/st_hud.h --- a/src/g_shared/st_hud.h Mon Jul 19 21:22:27 2021 -0400 +++ b/src/g_shared/st_hud.h Mon Jul 19 21:34:40 2021 -0400 @@ -81,6 +81,7 @@ bool HUD_IsTied( void ); ULONG HUD_GetViewPlayer( void ); ULONG HUD_GetNumPlayers( void ); +ULONG HUD_GetNumSpectators( void ); ULONG HUD_GetRank( void ); LONG HUD_GetSpread( void ); FString HUD_SpellOrdinal( int ranknum, bool bColored = false );