Move Waypoint check code to P_DeathThink

This commit is contained in:
NepDisk 2025-03-09 09:30:21 -04:00
parent da01a91852
commit 033b65a70b
2 changed files with 18 additions and 21 deletions

View file

@ -6323,27 +6323,6 @@ static boolean P_MobjDeadThink(mobj_t *mobj)
case MT_PLAYER:
/// \todo Have the player's dead body completely finish its animation even if they've already respawned.
if (mobj->player)
{
// Set players next respawn point to the next waypoint
// If they die while still in respawn state for extra safety.
if (mobj->player->nextwaypoint && mobj->player->respawn > 0)
{
mobj_t *currentwaypoint = mobj->player->currentwaypoint->mobj;
mobj_t *safewaypoint = mobj->player->nextwaypoint->mobj;
angle_t respawnangle = R_PointToAngle2(currentwaypoint->x, currentwaypoint->y, safewaypoint->x, safewaypoint->y);
mobj->player->starposttime = mobj->player->realtime;
mobj->player->starpostz = safewaypoint->spawnpoint->z >> FRACBITS;
mobj->player->starpostflip = (safewaypoint->flags2 & MF2_OBJECTFLIP);
mobj->player->starpostangle = respawnangle;
// Then do x and y
mobj->player->starpostx = safewaypoint->x >> FRACBITS;
mobj->player->starposty = safewaypoint->y >> FRACBITS;
}
}
if (!mobj->fuse)
{ // Go away.
/// \todo Actually go ahead and remove mobj completely, and fix any bugs and crashes doing this creates. Chasecam should stop moving, and F12 should never return to it.

View file

@ -2597,6 +2597,24 @@ static void P_DeathThink(player_t *player)
else
player->karthud[khud_timeovercam] = 0;
// Set players next respawn point to the next waypoint
// If they die while still in respawn state for extra safety.
if (player->nextwaypoint && player->respawn > 0)
{
mobj_t *currentwaypoint = player->currentwaypoint->mobj;
mobj_t *safewaypoint = player->nextwaypoint->mobj;
angle_t respawnangle = R_PointToAngle2(currentwaypoint->x, currentwaypoint->y, safewaypoint->x, safewaypoint->y);
player->starposttime = player->realtime;
player->starpostz = safewaypoint->spawnpoint->z >> FRACBITS;
player->starpostflip = (safewaypoint->flags2 & MF2_OBJECTFLIP);
player->starpostangle = respawnangle;
// Then do x and y
player->starpostx = safewaypoint->x >> FRACBITS;
player->starposty = safewaypoint->y >> FRACBITS;
}
K_KartPlayerHUDUpdate(player);
if (player->pflags & PF_NOCONTEST)