doesn't work for what we need but...

implement K_BotDefaultSpectator
This commit is contained in:
minenice55 2026-02-10 23:25:51 -05:00
parent c9755c9712
commit 5fd1955845
4 changed files with 45 additions and 13 deletions

View file

@ -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;

View file

@ -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<skincolornum_t>(skins[skinnum].prefcolor);
const char *realname = skins[skinnum].realname;

View file

@ -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;
}

View file

@ -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