This is a fork of Zandronum used on servers hosted by The Sentinels Playground (TSPG).
Revision | fd6a187669458d52300d9848d3b3c78513648559 (tree) |
---|---|
Zeit | 2021-07-20 09:48:00 |
Autor | Adam Kaminski <kaminskiadam9@gmai...> |
Commiter | Adam Kaminski |
Don't print how many allies are left (or if they're all dead) on the bottom of the screen if the player never had any to begin with.
@@ -88,6 +88,9 @@ | ||
88 | 88 | // Is this player tied with another? |
89 | 89 | static bool g_bIsTied = false; |
90 | 90 | |
91 | +// [AK] Does this player's team have other players besides themselves? | |
92 | +static bool g_bHasAllies = false; | |
93 | + | |
91 | 94 | // How many opponents are left standing in LMS? |
92 | 95 | static LONG g_lNumOpponentsLeft = 0; |
93 | 96 |
@@ -310,13 +313,18 @@ | ||
310 | 313 | { |
311 | 314 | // Survival, Survival Invasion, etc |
312 | 315 | if ( GAMEMODE_GetCurrentFlags( ) & GMF_COOPERATIVE ) |
316 | + { | |
317 | + g_bHasAllies = g_ulNumPlayers > 1; | |
313 | 318 | g_lNumAlliesLeft = GAME_CountLivingAndRespawnablePlayers( ) - PLAYER_IsAliveOrCanRespawn( player ); |
319 | + } | |
314 | 320 | |
315 | 321 | // Last Man Standing, TLMS, etc |
316 | 322 | if ( GAMEMODE_GetCurrentFlags( ) & GMF_DEATHMATCH ) |
317 | 323 | { |
318 | 324 | if ( GAMEMODE_GetCurrentFlags( ) & GMF_PLAYERSONTEAMS ) |
319 | 325 | { |
326 | + g_bHasAllies = TEAM_CountPlayers( player->Team ) > 1; | |
327 | + | |
320 | 328 | unsigned livingAndRespawnableTeammates = TEAM_CountLivingAndRespawnablePlayers( player->Team ); |
321 | 329 | g_lNumOpponentsLeft = GAME_CountLivingAndRespawnablePlayers( ) - livingAndRespawnableTeammates; |
322 | 330 | g_lNumAlliesLeft = livingAndRespawnableTeammates - PLAYER_IsAliveOrCanRespawn( player ); |
@@ -478,16 +486,20 @@ | ||
478 | 486 | bottomString += " - "; |
479 | 487 | |
480 | 488 | // Survival, Survival Invasion, etc |
489 | + // [AK] Only print how many allies are left if we had any to begin with. | |
481 | 490 | if ( GAMEMODE_GetCurrentFlags( ) & GMF_COOPERATIVE ) |
482 | 491 | { |
483 | - if ( g_lNumAlliesLeft < 1 ) | |
492 | + if ( g_bHasAllies ) | |
484 | 493 | { |
485 | - bottomString += TEXTCOLOR_RED "Last Player Alive"; // Uh-oh. | |
486 | - } | |
487 | - else | |
488 | - { | |
489 | - bottomString.AppendFormat( TEXTCOLOR_GRAY "%d ", static_cast<int>( g_lNumAlliesLeft )); | |
490 | - bottomString.AppendFormat( TEXTCOLOR_RED "all%s left", g_lNumAlliesLeft != 1 ? "ies" : "y" ); | |
494 | + if ( g_lNumAlliesLeft < 1 ) | |
495 | + { | |
496 | + bottomString += TEXTCOLOR_RED "Last Player Alive"; // Uh-oh. | |
497 | + } | |
498 | + else | |
499 | + { | |
500 | + bottomString.AppendFormat( TEXTCOLOR_GRAY "%d ", static_cast<int>( g_lNumAlliesLeft )); | |
501 | + bottomString.AppendFormat( TEXTCOLOR_RED "all%s left", g_lNumAlliesLeft != 1 ? "ies" : "y" ); | |
502 | + } | |
491 | 503 | } |
492 | 504 | } |
493 | 505 | // Last Man Standing, TLMS, etc |
@@ -496,7 +508,8 @@ | ||
496 | 508 | bottomString.AppendFormat( TEXTCOLOR_GRAY "%d ", static_cast<int>( g_lNumOpponentsLeft )); |
497 | 509 | bottomString.AppendFormat( TEXTCOLOR_RED "opponent%s", g_lNumOpponentsLeft != 1 ? "s" : "" ); |
498 | 510 | |
499 | - if ( GAMEMODE_GetCurrentFlags( ) & GMF_PLAYERSONTEAMS ) | |
511 | + // [AK] Only print how many teammates are left if we actually have any. | |
512 | + if (( GAMEMODE_GetCurrentFlags( ) & GMF_PLAYERSONTEAMS ) && ( g_bHasAllies )) | |
500 | 513 | { |
501 | 514 | if ( g_lNumAlliesLeft < 1 ) |
502 | 515 | { |