Fix the order of operations so K_TimerInit is ready for P_InitPlayers

Guarantees players in splitscreen GP Prison Break rounds are always deterministically placed (as long as the non-battle spawnpoints exist)
This commit is contained in:
toaster 2023-08-31 19:24:49 +01:00
parent a7b065c4d8
commit 60ce81f00d
4 changed files with 22 additions and 35 deletions

View file

@ -2097,12 +2097,18 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
roundconditions_t roundconditions;
boolean saveroundconditions;
// This needs to be first, to permit it to wipe extra information
jointime = players[player].jointime;
if (jointime <= 1)
{
G_SpectatePlayerOnJoin(player);
betweenmaps = true;
}
score = players[player].score;
lives = players[player].lives;
ctfteam = players[player].ctfteam;
jointime = players[player].jointime;
splitscreenindex = players[player].splitscreenindex;
spectator = players[player].spectator;
@ -2891,7 +2897,7 @@ void G_SpectatePlayerOnJoin(INT32 playernum)
continue;
// Prevent splitscreen hosters/joiners from only adding 1 player at a time in empty servers (this will also catch yourself)
if (!players[i].jointime)
if (players[i].jointime <= 1)
continue;
// A ha! An established player! It's time to spectate

View file

@ -178,30 +178,7 @@ void K_TimerInit(void)
if ((gametyperules & (GTR_ROLLINGSTART|GTR_CIRCUIT)) == (GTR_ROLLINGSTART|GTR_CIRCUIT))
{
S_StartSound(NULL, sfx_s25f);
for (i = 0; i < MAXPLAYERS; i++)
{
player_t *player = NULL;
if (playeringame[i] == false)
{
continue;
}
player = &players[i];
if (player->spectator == true)
{
continue;
}
if (player->mo == NULL || P_MobjWasRemoved(player->mo) == true)
{
continue;
}
// Rolling start? lol
P_InstaThrust(player->mo, player->mo->angle, K_GetKartSpeed(player, false, false));
}
// The actual push occours in P_InitPlayers
}
else if (skipstats != 0)
{

View file

@ -11791,16 +11791,11 @@ void P_SpawnPlayer(INT32 playernum)
player_t *p = &players[playernum];
mobj_t *mobj;
boolean justjoined = (p->jointime <= 1);
if (p->playerstate == PST_REBORN)
{
G_PlayerReborn(playernum, justjoined);
G_PlayerReborn(playernum, false);
}
if (justjoined)
G_SpectatePlayerOnJoin(playernum);
if (G_GametypeHasTeams())
{
// If you're in a team game and you don't have a team assigned yet...

View file

@ -7877,6 +7877,15 @@ static void P_InitPlayers(void)
G_SpawnPlayer(i);
players[i].xtralife = 0; // extra lives do not ever carry over from the previous round
if (P_MobjWasRemoved(players[i].mo) == false && !players[i].spectator)
{
// Rooooooolllling staaaaaaart
if ((gametyperules & (GTR_ROLLINGSTART|GTR_CIRCUIT)) == (GTR_ROLLINGSTART|GTR_CIRCUIT))
{
P_InstaThrust(players[i].mo, players[i].mo->angle, K_GetKartSpeed(&players[i], false, false));
}
}
}
K_UpdateAllPlayerPositions();
@ -8567,6 +8576,8 @@ void P_PostLoadLevel(void)
K_UpdateMatchRaceBots();
}
K_TimerInit();
P_InitPlayers();
if (metalrecording)
@ -8575,8 +8586,6 @@ void P_PostLoadLevel(void)
G_BeginRecording(); // I AM NOW READY TO RECORD.
demo.deferstart = true;
K_TimerInit();
nextmapoverride = 0;
skipstats = 0;