Reorganize P_DoPlayerExit

I tried to fix the GP ending weirdness a long time ago by recalculating all player positions at time of exit... and then K_IsPlayerLosing gets to a variable before the recalculation and a bunch of crap uses it and completely undoes anything this might've fixed. DON'T DO THAT!
This commit is contained in:
Sally Coolatta 2024-01-16 20:08:37 -05:00
parent e22ed7fd1c
commit 3b755b7153
2 changed files with 25 additions and 22 deletions

View file

@ -845,7 +845,7 @@ void K_PlayerLoseLife(player_t *player)
return;
}
if (player->spectator || (player->exiting && !(player->pflags & PF_NOCONTEST)) || player->bot || player->lives <= 0 || (player->pflags & PF_LOSTLIFE))
if (player->spectator || player->bot || player->lives <= 0 || (player->pflags & PF_LOSTLIFE))
{
return;
}

View file

@ -1270,9 +1270,6 @@ void P_DoPlayerExit(player_t *player, pflags_t flags)
player->pflags |= flags;
const boolean losing = K_IsPlayerLosing(player);
const boolean specialout = (specialstageinfo.valid == true && losing == true);
if (P_IsLocalPlayer(player) && (!player->spectator && !demo.playback))
{
legitimateexit = true;
@ -1280,6 +1277,30 @@ void P_DoPlayerExit(player_t *player, pflags_t flags)
gamedata->deferredconditioncheck = true;
}
player->exiting = 1;
if (!player->spectator)
{
ClearFakePlayerSkin(player);
if ((gametyperules & GTR_CIRCUIT)) // Special Race-like handling
{
K_UpdateAllPlayerPositions();
if (P_CheckRacers() && !exitcountdown)
{
G_BeginLevelExit();
}
}
else if (!exitcountdown) // All other gametypes
{
G_BeginLevelExit();
}
}
const boolean losing = K_IsPlayerLosing(player); // HEY!!!! Set it AFTER K_UpdateAllPlayerPositions!!!!
const boolean specialout = (specialstageinfo.valid == true && losing == true);
if (G_GametypeUsesLives() && losing)
{
// Remove a life from the losing player
@ -1292,12 +1313,8 @@ void P_DoPlayerExit(player_t *player, pflags_t flags)
musiccountdown = MUSIC_COUNTDOWN_MAX;
}
player->exiting = 1;
if (!player->spectator)
{
ClearFakePlayerSkin(player);
if (!(gametyperules & GTR_SPHERES))
{
player->hudrings = RINGTOTAL(player);
@ -1320,20 +1337,6 @@ void P_DoPlayerExit(player_t *player, pflags_t flags)
}
}
if ((gametyperules & GTR_CIRCUIT)) // Special Race-like handling
{
K_UpdateAllPlayerPositions();
if (P_CheckRacers() && !exitcountdown)
{
G_BeginLevelExit();
}
}
else if (!exitcountdown) // All other gametypes
{
G_BeginLevelExit();
}
if (specialstageinfo.valid == true && losing == false && P_MobjWasRemoved(player->mo) == false)
{
K_MakeObjectReappear(player->mo);