diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 7e4ca265c..c6ece0ae0 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3892,8 +3892,6 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) if (grandprixinfo.gp) { - boolean caughtretry = (gametype == lastgametype - && mapnumber == gamemap); if (gametype != GT_RACE) { grandprixinfo.eventmode = GPEVENT_CHALLENGE; diff --git a/src/k_bot.cpp b/src/k_bot.cpp index 56f6c9ad6..c8a717da0 100644 --- a/src/k_bot.cpp +++ b/src/k_bot.cpp @@ -176,7 +176,7 @@ void K_SetBot(UINT8 newplayernum, UINT16 skinnum, UINT8 difficulty, botStyle_e s // 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; + players[newplayernum].spectator = grandprixinfo.gp && grandprixinfo.initalize && K_BotDefaultSpectator(); skincolornum_t color = static_cast(skins[skinnum].prefcolor); const char *realname = skins[skinnum].realname; diff --git a/src/k_grandprix.c b/src/k_grandprix.c index f83d15263..8d7ef9056 100644 --- a/src/k_grandprix.c +++ b/src/k_grandprix.c @@ -335,7 +335,6 @@ void K_UpdateGrandPrixBots(void) player_t *oldrival = NULL; player_t *newrival = NULL; UINT16 newrivalscore = 0; - boolean validbots = (K_UsingLegacyCheckpoints() == false); UINT8 i; for (i = 0; i < MAXGPPLAYERS; i++) @@ -344,13 +343,8 @@ void K_UpdateGrandPrixBots(void) { continue; } - - players[i].spectator = (grandprixinfo.eventmode != GPEVENT_NONE); - - if (!validbots || itembreaker) - { - players[i].spectator = true; - } + + players[i].spectator = K_BotDefaultSpectator(); } // Find the rival. @@ -430,11 +424,10 @@ void K_UpdateGrandPrixBots(void) newrival->botvars.rival = true; } - if (!validbots) + if (K_UsingLegacyCheckpoints() && !K_BotDefaultSpectator()) { CONS_Alert(CONS_ERROR, "This map does not use waypoints so bot functionality will not work.\nConsider adding new waypoints directly or via map patching for bot support.\n"); } - } /*-------------------------------------------------- @@ -783,3 +776,35 @@ boolean K_CanChangeRules(boolean allowdemos) return true; } + +/*-------------------------------------------------- + boolean K_BotDefaultSpectator(player_t *player); + + See header file for description. +--------------------------------------------------*/ +boolean K_BotDefaultSpectator(void) +{ + if (cv_forcebots.value) + { + return false; + } + + 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; + } + + if (K_UsingLegacyCheckpoints()) + { + return true; + } + + return false; +} diff --git a/src/k_grandprix.h b/src/k_grandprix.h index 560bf7f6c..5dba53aec 100644 --- a/src/k_grandprix.h +++ b/src/k_grandprix.h @@ -186,6 +186,15 @@ void K_PlayerLoseLife(player_t *player); boolean K_CanChangeRules(boolean allowdemos); +/*-------------------------------------------------- + boolean K_BotDefaultSpectator(void) + + Check whether bots should spectate this round. +--------------------------------------------------*/ + +boolean K_BotDefaultSpectator(void); + + #ifdef __cplusplus } // extern "C" #endif