Fix spectators spawning at 0, 0 when joining mid game

This commit is contained in:
James R 2022-10-23 15:31:31 -07:00
parent 88bbe8875d
commit 20bfbca029
2 changed files with 12 additions and 1 deletions

View file

@ -2562,7 +2562,9 @@ void G_MovePlayerToSpawnOrStarpost(INT32 playernum)
else
P_MovePlayerToStarpost(playernum);
#else
if (leveltime > starttime)
// Player's first spawn should be at the "map start".
// I.e. level load or join mid game.
if (leveltime > starttime && players[playernum].jointime > 0)
P_MovePlayerToStarpost(playernum);
else
P_MovePlayerToSpawn(playernum, G_FindMapStart(playernum));

View file

@ -11556,6 +11556,15 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
{
K_DoIngameRespawn(p);
}
else
{
// This is important for spectators. If you are
// a spectator now, then when you enter the game,
// respawn back at this point.
p->respawn.pointx = x;
p->respawn.pointy = y;
p->respawn.pointz = z;
}
P_AfterPlayerSpawn(playernum);
}