From 67c2ae021bff62709b16e58ff20cd6e24fed32aa Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 27 Aug 2023 16:00:39 -0700 Subject: [PATCH] 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. --- src/k_grandprix.c | 12 ------------ src/p_mobj.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/k_grandprix.c b/src/k_grandprix.c index 65a8e3acd..f65e7aec3 100644 --- a/src/k_grandprix.c +++ b/src/k_grandprix.c @@ -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++) { diff --git a/src/p_mobj.c b/src/p_mobj.c index e1090bf33..81ebeb814 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -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...