• R/O
  • SSH

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

This is a fork of Zandronum used on servers hosted by The Sentinels Playground (TSPG).


Commit MetaInfo

Revisionfd6a187669458d52300d9848d3b3c78513648559 (tree)
Zeit2021-07-20 09:48:00
AutorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

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.

Ändern Zusammenfassung

Diff

diff -r b68d78dbbc82 -r fd6a18766945 src/g_shared/st_hud.cpp
--- a/src/g_shared/st_hud.cpp Thu Jul 22 19:54:24 2021 -0400
+++ b/src/g_shared/st_hud.cpp Mon Jul 19 20:48:00 2021 -0400
@@ -88,6 +88,9 @@
8888 // Is this player tied with another?
8989 static bool g_bIsTied = false;
9090
91+// [AK] Does this player's team have other players besides themselves?
92+static bool g_bHasAllies = false;
93+
9194 // How many opponents are left standing in LMS?
9295 static LONG g_lNumOpponentsLeft = 0;
9396
@@ -310,13 +313,18 @@
310313 {
311314 // Survival, Survival Invasion, etc
312315 if ( GAMEMODE_GetCurrentFlags( ) & GMF_COOPERATIVE )
316+ {
317+ g_bHasAllies = g_ulNumPlayers > 1;
313318 g_lNumAlliesLeft = GAME_CountLivingAndRespawnablePlayers( ) - PLAYER_IsAliveOrCanRespawn( player );
319+ }
314320
315321 // Last Man Standing, TLMS, etc
316322 if ( GAMEMODE_GetCurrentFlags( ) & GMF_DEATHMATCH )
317323 {
318324 if ( GAMEMODE_GetCurrentFlags( ) & GMF_PLAYERSONTEAMS )
319325 {
326+ g_bHasAllies = TEAM_CountPlayers( player->Team ) > 1;
327+
320328 unsigned livingAndRespawnableTeammates = TEAM_CountLivingAndRespawnablePlayers( player->Team );
321329 g_lNumOpponentsLeft = GAME_CountLivingAndRespawnablePlayers( ) - livingAndRespawnableTeammates;
322330 g_lNumAlliesLeft = livingAndRespawnableTeammates - PLAYER_IsAliveOrCanRespawn( player );
@@ -478,16 +486,20 @@
478486 bottomString += " - ";
479487
480488 // Survival, Survival Invasion, etc
489+ // [AK] Only print how many allies are left if we had any to begin with.
481490 if ( GAMEMODE_GetCurrentFlags( ) & GMF_COOPERATIVE )
482491 {
483- if ( g_lNumAlliesLeft < 1 )
492+ if ( g_bHasAllies )
484493 {
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+ }
491503 }
492504 }
493505 // Last Man Standing, TLMS, etc
@@ -496,7 +508,8 @@
496508 bottomString.AppendFormat( TEXTCOLOR_GRAY "%d ", static_cast<int>( g_lNumOpponentsLeft ));
497509 bottomString.AppendFormat( TEXTCOLOR_RED "opponent%s", g_lNumOpponentsLeft != 1 ? "s" : "" );
498510
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 ))
500513 {
501514 if ( g_lNumAlliesLeft < 1 )
502515 {