mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 20:41:25 +00:00
Let spectators decide where they spawn
Also fixes some issues with tag gametypes
This commit is contained in:
parent
678935f26a
commit
b103a792c0
4 changed files with 43 additions and 17 deletions
49
src/g_game.c
49
src/g_game.c
|
@ -2781,6 +2781,26 @@ mapthing_t *G_FindCoopStart(INT32 playernum)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// Find a Co-op start, or fallback into other types of starts.
|
||||
static inline mapthing_t *G_FindCoopStartOrFallback(INT32 playernum)
|
||||
{
|
||||
mapthing_t *spawnpoint = NULL;
|
||||
if (!(spawnpoint = G_FindCoopStart(playernum)) // find a Co-op start
|
||||
&& !(spawnpoint = G_FindMatchStart(playernum))) // find a DM start
|
||||
spawnpoint = G_FindCTFStart(playernum); // fallback
|
||||
return spawnpoint;
|
||||
}
|
||||
|
||||
// Find a Match start, or fallback into other types of starts.
|
||||
static inline mapthing_t *G_FindMatchStartOrFallback(INT32 playernum)
|
||||
{
|
||||
mapthing_t *spawnpoint = NULL;
|
||||
if (!(spawnpoint = G_FindMatchStart(playernum)) // find a DM start
|
||||
&& !(spawnpoint = G_FindCTFStart(playernum))) // find a CTF start
|
||||
spawnpoint = G_FindCoopStart(playernum); // fallback
|
||||
return spawnpoint;
|
||||
}
|
||||
|
||||
mapthing_t *G_FindMapStart(INT32 playernum)
|
||||
{
|
||||
mapthing_t *spawnpoint;
|
||||
|
@ -2788,9 +2808,22 @@ mapthing_t *G_FindMapStart(INT32 playernum)
|
|||
if (!playeringame[playernum])
|
||||
return NULL;
|
||||
|
||||
// -- Spectators --
|
||||
// Order in platform gametypes: Coop->DM->CTF
|
||||
// And, with deathmatch starts: DM->CTF->Coop
|
||||
if (players[playernum].spectator)
|
||||
{
|
||||
// In platform gametypes, spawn in Co-op starts first
|
||||
// Overriden by GTR_DEATHMATCHSTARTS.
|
||||
if (G_PlatformGametype() && !(gametyperules & GTR_DEATHMATCHSTARTS))
|
||||
spawnpoint = G_FindCoopStartOrFallback(playernum);
|
||||
else
|
||||
spawnpoint = G_FindMatchStartOrFallback(playernum);
|
||||
}
|
||||
|
||||
// -- CTF --
|
||||
// Order: CTF->DM->Coop
|
||||
if ((gametyperules & (GTR_TEAMFLAGS|GTR_TEAMS)) && players[playernum].ctfteam)
|
||||
else if ((gametyperules & (GTR_TEAMFLAGS|GTR_TEAMS)) && players[playernum].ctfteam)
|
||||
{
|
||||
if (!(spawnpoint = G_FindCTFStart(playernum)) // find a CTF start
|
||||
&& !(spawnpoint = G_FindMatchStart(playernum))) // find a DM start
|
||||
|
@ -2799,21 +2832,13 @@ mapthing_t *G_FindMapStart(INT32 playernum)
|
|||
|
||||
// -- DM/Tag/CTF-spectator/etc --
|
||||
// Order: DM->CTF->Coop
|
||||
else if ((gametyperules & GTR_DEATHMATCHSTARTS) && !(players[playernum].pflags & PF_TAGIT))
|
||||
{
|
||||
if (!(spawnpoint = G_FindMatchStart(playernum)) // find a DM start
|
||||
&& !(spawnpoint = G_FindCTFStart(playernum))) // find a CTF start
|
||||
spawnpoint = G_FindCoopStart(playernum); // fallback
|
||||
}
|
||||
else if (G_TagGametype() ? (!(players[playernum].pflags & PF_TAGIT)) : (gametyperules & GTR_DEATHMATCHSTARTS))
|
||||
spawnpoint = G_FindMatchStartOrFallback(playernum);
|
||||
|
||||
// -- Other game modes --
|
||||
// Order: Coop->DM->CTF
|
||||
else
|
||||
{
|
||||
if (!(spawnpoint = G_FindCoopStart(playernum)) // find a Co-op start
|
||||
&& !(spawnpoint = G_FindMatchStart(playernum))) // find a DM start
|
||||
spawnpoint = G_FindCTFStart(playernum); // fallback
|
||||
}
|
||||
spawnpoint = G_FindCoopStartOrFallback(playernum);
|
||||
|
||||
//No spawns found. ANYWHERE.
|
||||
if (!spawnpoint)
|
||||
|
|
|
@ -2603,7 +2603,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
// allow them to try again, rather than sitting the whole thing out.
|
||||
if (leveltime >= hidetime * TICRATE)
|
||||
{
|
||||
if (gametype == GT_TAG)//suiciding in survivor makes you IT.
|
||||
if (!(gametyperules & GTR_HIDEFROZEN))//suiciding in survivor makes you IT.
|
||||
{
|
||||
target->player->pflags |= PF_TAGIT;
|
||||
CONS_Printf(M_GetText("%s is now IT!\n"), player_names[target->player-players]); // Tell everyone who is it!
|
||||
|
@ -3097,7 +3097,7 @@ static boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, IN
|
|||
P_AddPlayerScore(source->player, 100); //award points to tagger.
|
||||
P_HitDeathMessages(player, inflictor, source, 0);
|
||||
|
||||
if (gametype == GT_TAG) //survivor
|
||||
if (!(gametyperules & GTR_HIDEFROZEN)) //survivor
|
||||
{
|
||||
player->pflags |= PF_TAGIT; //in survivor, the player becomes IT and helps hunt down the survivors.
|
||||
CONS_Printf(M_GetText("%s is now IT!\n"), player_names[player-players]); // Tell everyone who is it!
|
||||
|
|
|
@ -1048,7 +1048,8 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor)
|
|||
|
||||
// Point penalty for hitting a hazard during tag.
|
||||
// Discourages players from intentionally hurting themselves to avoid being tagged.
|
||||
if (gametype == GT_TAG && (!(player->pflags & PF_GAMETYPEOVER) && !(player->pflags & PF_TAGIT)))
|
||||
if (((gametyperules & (GTR_TAG|GTR_HIDEFROZEN)) == GTR_TAG)
|
||||
&& (!(player->pflags & PF_GAMETYPEOVER) && !(player->pflags & PF_TAGIT)))
|
||||
{
|
||||
if (player->score >= 50)
|
||||
player->score -= 50;
|
||||
|
@ -10681,7 +10682,7 @@ boolean P_SpectatorJoinGame(player_t *player)
|
|||
player->spectator = player->outofcoop = false;
|
||||
player->playerstate = PST_REBORN;
|
||||
|
||||
if (gametype == GT_TAG)
|
||||
if ((gametyperules & (GTR_TAG|GTR_HIDEFROZEN)) == GTR_TAG)
|
||||
{
|
||||
//Make joining players "it" after hidetime.
|
||||
if (leveltime > (hidetime * TICRATE))
|
||||
|
|
|
@ -2368,7 +2368,7 @@ static void ST_drawTextHUD(void)
|
|||
else
|
||||
textHUDdraw(M_GetText("Flee before you are hunted!"))
|
||||
}
|
||||
else if ((gametyperules & GTR_HIDEFROZEN) && !(stplyr->pflags & PF_TAGIT))
|
||||
else if (gametype == GT_HIDEANDSEEK && !(stplyr->pflags & PF_TAGIT))
|
||||
{
|
||||
if (!splitscreen && !donef12)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue