add G_CompetitionGametype(void)

This commit is contained in:
Jaime Passos 2019-12-27 12:28:00 -03:00
parent 5c023739e6
commit f8eed7171a
4 changed files with 13 additions and 2 deletions

View file

@ -3492,6 +3492,16 @@ boolean G_TagGametype(void)
return (gametyperules & GTR_TAG);
}
//
// G_CompetitionGametype
//
// For gametypes that are race gametypes, and have lives.
//
boolean G_CompetitionGametype(void)
{
return ((gametyperules & GTR_RACE) && (gametyperules & GTR_LIVES));
}
/** Get the typeoflevel flag needed to indicate support of a gametype.
* In single-player, this always returns TOL_SP.
* \param gametype The gametype for which support is desired.

View file

@ -223,6 +223,7 @@ boolean G_GametypeHasSpectators(void);
boolean G_RingSlingerGametype(void);
boolean G_PlatformGametype(void);
boolean G_TagGametype(void);
boolean G_CompetitionGametype(void);
boolean G_EnoughPlayersFinished(void);
void G_ExitLevel(void);
void G_NextLevel(void);

View file

@ -2159,7 +2159,7 @@ static void P_LevelInitStuff(void)
{
G_PlayerReborn(i, true);
if (canresetlives && (netgame || multiplayer) && playeringame[i] && (gametype == GT_COMPETITION || players[i].lives <= 0))
if (canresetlives && (netgame || multiplayer) && playeringame[i] && (G_CompetitionGametype() || players[i].lives <= 0))
{
// In Co-Op, replenish a user's lives if they are depleted.
players[i].lives = cv_startinglives.value;

View file

@ -9491,7 +9491,7 @@ static void P_DeathThink(player_t *player)
INT32 i, deadtimercheck = INT32_MAX;
// In a net/multiplayer game, and out of lives
if (gametype == GT_COMPETITION)
if (G_CompetitionGametype())
{
for (i = 0; i < MAXPLAYERS; i++)
{