K_StartCeremony: Directly modify spectator status for bots as early as possible

The problem with bots randomly going towards the same spot in podium was...
- If you failed a Sealed Star, K_UpdateGrandPrixBots wouldn't make the puppies non-spectators
- P_SpawnPlayer catches the spectator status...
- ...but it's in a loop that calls K_GetPodiumPosition...
- ...which ignores spectators...
- ...which means this is too late to catch it, so we simply have to do it earlier.
Also short circuits P_SpawnPlayer's and K_UpdateGrandPrixBot's attempts to set so the author of this commit can be certain what is being done is correct
This commit is contained in:
toaster 2023-05-30 00:40:00 +01:00
parent 8240dbe4e6
commit 5e76ea6f8f
3 changed files with 15 additions and 4 deletions

View file

@ -17,6 +17,7 @@
#include "g_game.h"
#include "k_bot.h"
#include "k_kart.h"
#include "k_podium.h"
#include "m_random.h"
#include "p_local.h"
#include "r_things.h"
@ -326,6 +327,9 @@ void K_UpdateGrandPrixBots(void)
UINT16 newrivalscore = 0;
UINT8 i;
if (K_PodiumSequence())
return;
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i] || !players[i].bot)

View file

@ -258,9 +258,13 @@ boolean K_StartCeremony(void)
// and be present for the podium
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i] && !players[i].spectator && !players[i].bot)
if (playeringame[i])
{
players[i].lives = max(1, players[i].lives);
if (players[i].lives < 1)
players[i].lives = 1;
if (players[i].bot)
players[i].spectator = false;
}
}

View file

@ -11645,8 +11645,11 @@ void P_SpawnPlayer(INT32 playernum)
}
else if (p->bot)
{
if (K_PodiumSequence() == false
&& (!(gametyperules & GTR_BOTS) || (grandprixinfo.gp == true && grandprixinfo.eventmode != GPEVENT_NONE)))
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;