mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-23 03:12:38 +00:00
Respawn delay gametype rule
This commit is contained in:
parent
1dac3d174e
commit
51404130af
5 changed files with 22 additions and 17 deletions
|
@ -8928,6 +8928,7 @@ static const char *const GAMETYPERULE_LIST[] = {
|
|||
"OVERTIME",
|
||||
"HURTMESSAGES",
|
||||
"SPAWNINVUL",
|
||||
"RESPAWNDELAY",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
@ -423,6 +423,7 @@ enum GameTypeRules
|
|||
GTR_OVERTIME = 1<<26, // Allow overtime
|
||||
GTR_HURTMESSAGES = 1<<27, // Hit and death messages
|
||||
GTR_SPAWNINVUL = 1<<28, // Babysitting deterrent
|
||||
GTR_RESPAWNDELAY = 1<<29, // Respawn delay
|
||||
};
|
||||
|
||||
// String names for gametypes
|
||||
|
|
10
src/g_game.c
10
src/g_game.c
|
@ -3201,17 +3201,17 @@ UINT32 gametypedefaultrules[NUMGAMETYPES] =
|
|||
GTR_RACE|GTR_SPAWNENEMIES|GTR_SPAWNINVUL|GTR_ALLOWEXIT,
|
||||
|
||||
// Match
|
||||
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_MATCHEMERALDS|GTR_SPAWNINVUL|GTR_PITYSHIELD|GTR_DEATHPENALTY,
|
||||
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_MATCHEMERALDS|GTR_SPAWNINVUL|GTR_RESPAWNDELAY|GTR_PITYSHIELD|GTR_DEATHPENALTY,
|
||||
// Team Match
|
||||
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_SPECTATORS|GTR_TEAMS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_SPAWNINVUL|GTR_PITYSHIELD,
|
||||
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_SPECTATORS|GTR_TEAMS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_SPAWNINVUL|GTR_RESPAWNDELAY|GTR_PITYSHIELD,
|
||||
|
||||
// Tag
|
||||
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_TAG|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_HIDETIME|GTR_BLINDFOLDED|GTR_SPAWNINVUL,
|
||||
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_TAG|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_HIDETIME|GTR_BLINDFOLDED|GTR_SPAWNINVUL|GTR_RESPAWNDELAY,
|
||||
// Hide and Seek
|
||||
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_TAG|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_HIDETIME|GTR_BLINDFOLDED|GTR_SPAWNINVUL,
|
||||
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_TAG|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_HIDETIME|GTR_BLINDFOLDED|GTR_SPAWNINVUL|GTR_RESPAWNDELAY,
|
||||
|
||||
// CTF
|
||||
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_SPECTATORS|GTR_TEAMS|GTR_TEAMFLAGS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_MATCHEMERALDS|GTR_SPAWNINVUL|GTR_PITYSHIELD,
|
||||
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_SPECTATORS|GTR_TEAMS|GTR_TEAMFLAGS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_MATCHEMERALDS|GTR_SPAWNINVUL|GTR_RESPAWNDELAY|GTR_PITYSHIELD,
|
||||
};
|
||||
|
||||
//
|
||||
|
|
25
src/p_user.c
25
src/p_user.c
|
@ -9462,19 +9462,22 @@ static void P_DeathThink(player_t *player)
|
|||
// Respawn with jump button, force respawn time (3 second default, cheat protected) in shooter modes.
|
||||
if (cmd->buttons & BT_JUMP)
|
||||
{
|
||||
// You're a spectator, so respawn right away.
|
||||
if (gametype != GT_COOP && player->spectator)
|
||||
player->playerstate = PST_REBORN;
|
||||
else switch(gametype) {
|
||||
case GT_COOP:
|
||||
case GT_COMPETITION:
|
||||
case GT_RACE:
|
||||
if (player->deadtimer > TICRATE)
|
||||
player->playerstate = PST_REBORN;
|
||||
break;
|
||||
default:
|
||||
if (player->deadtimer > cv_respawntime.value*TICRATE)
|
||||
player->playerstate = PST_REBORN;
|
||||
break;
|
||||
else
|
||||
{
|
||||
// Give me one second.
|
||||
INT32 respawndelay = TICRATE;
|
||||
|
||||
// Non-platform gametypes
|
||||
if (gametyperules & GTR_RESPAWNDELAY)
|
||||
respawndelay = (cv_respawntime.value*TICRATE);
|
||||
|
||||
// You've been dead for enough time.
|
||||
// You may now respawn.
|
||||
if (player->deadtimer > respawndelay)
|
||||
player->playerstate = PST_REBORN;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2202,7 +2202,7 @@ static void ST_drawTextHUD(void)
|
|||
donef12 = true;
|
||||
}
|
||||
}
|
||||
else if (!G_PlatformGametype() && stplyr->playerstate == PST_DEAD && stplyr->lives) // Death overrides spectator text.
|
||||
else if ((gametyperules & GTR_RESPAWNDELAY) && stplyr->playerstate == PST_DEAD && stplyr->lives) // Death overrides spectator text.
|
||||
{
|
||||
INT32 respawntime = cv_respawntime.value - stplyr->deadtimer/TICRATE;
|
||||
|
||||
|
|
Loading…
Reference in a new issue