diff --git a/src/k_bot.c b/src/k_bot.c index 2a634c415..09f347339 100644 --- a/src/k_bot.c +++ b/src/k_bot.c @@ -63,6 +63,10 @@ void K_SetBot(UINT8 newplayernum, UINT8 skinnum, UINT8 difficulty, botStyle_e st players[newplayernum].botvars.style = style; players[newplayernum].lives = 9; + // The bot may immediately become a spectator AT THE START of a GP. + // For each subsequent round of GP, K_UpdateGrandPrixBots will handle this. + players[newplayernum].spectator = grandprixinfo.gp && grandprixinfo.initalize && K_BotDefaultSpectator(); + players[newplayernum].skincolor = skins[skinnum].prefcolor; sprintf(player_names[newplayernum], "%s", skins[skinnum].realname); SetPlayerSkinByNum(newplayernum, skinnum); diff --git a/src/k_grandprix.c b/src/k_grandprix.c index b5cf2772b..51f694c43 100644 --- a/src/k_grandprix.c +++ b/src/k_grandprix.c @@ -308,7 +308,7 @@ 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); + players[i].spectator = K_BotDefaultSpectator(); } } @@ -898,3 +898,25 @@ void K_PlayerFinishGrandPrix(player_t *player) P_GivePlayerLives(player, player->xtralife); } + +/*-------------------------------------------------- + boolean K_BotDefaultSpectator(player_t *player); + + See header file for description. +--------------------------------------------------*/ +boolean K_BotDefaultSpectator(void) +{ + if (!(gametyperules & GTR_BOTS)) + { + // This gametype does not support bots. + return true; + } + + if (grandprixinfo.eventmode != GPEVENT_NONE) + { + // This is a special round of GP, so bots must spectate. + return true; + } + + return false; +} diff --git a/src/k_grandprix.h b/src/k_grandprix.h index 34315ba48..8839eff16 100644 --- a/src/k_grandprix.h +++ b/src/k_grandprix.h @@ -206,6 +206,15 @@ boolean K_CanChangeRules(boolean allowdemos); void K_PlayerFinishGrandPrix(player_t *player); +/*-------------------------------------------------- + boolean K_BotDefaultSpectator(void) + + Check whether bots should spectate this round. +--------------------------------------------------*/ + +boolean K_BotDefaultSpectator(void); + + #ifdef __cplusplus } // extern "C" #endif