P_SpawnPlayer: add back explicit spectator handling for bots; also remove it from k_grandprix.c

Not needed in K_UpdateGrandPrixBots or
K_LoadGrandPrixSaveGame because P_SpawnPlayer takes
priority.
This commit is contained in:
James R 2023-08-27 16:00:39 -07:00
parent e123ed7480
commit 67c2ae021b
2 changed files with 18 additions and 12 deletions

View file

@ -307,8 +307,6 @@ void K_LoadGrandPrixSaveGame(void)
players[i].botvars.rival = savedata.bots[i].rival;
players[i].score = savedata.bots[i].score;
players[i].spectator = !(gametyperules & GTR_BOTS) || (grandprixinfo.eventmode != GPEVENT_NONE);
}
}
@ -381,16 +379,6 @@ void K_UpdateGrandPrixBots(void)
return;
}
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i] || !players[i].bot)
{
continue;
}
players[i].spectator = !(gametyperules & GTR_BOTS) || (grandprixinfo.eventmode != GPEVENT_NONE);
}
// Find the rival.
for (i = 0; i < MAXPLAYERS; i++)
{

View file

@ -11784,6 +11784,24 @@ void P_SpawnPlayer(INT32 playernum)
if (justjoined)
G_SpectatePlayerOnJoin(playernum);
if (p->bot && !demo.playback) // Don't mess with spectator values since the demo setup handles them already.
{
if (K_PodiumSequence() == true)
; // This is too late to correct spectator status. Whatever state we're in at this point, our (dog) bed is made.
else if (!(gametyperules & GTR_BOTS)
|| (grandprixinfo.gp == true
&& grandprixinfo.eventmode != GPEVENT_NONE))
{
// Bots aren't supposed to be here.
p->spectator = true;
}
else
{
// No point in a spectating bot!
p->spectator = false;
}
}
if (G_GametypeHasTeams())
{
// If you're in a team game and you don't have a team assigned yet...