# HG changeset patch # User Adam Kaminski # Date 1613335952 18000 # Sun Feb 14 15:52:32 2021 -0500 # Node ID 9e695e087a27ae86458d37bb90e5455b6dcc99fa # Parent 45943ba832e76337dba40800ba92a8d960ff8b58 Fixed issues with A_SkullPop and if the player spectates while the PlayerChunk actor is still in midair. diff -r 45943ba832e7 -r 9e695e087a27 src/p_interaction.cpp --- a/src/p_interaction.cpp Sun Feb 07 16:31:29 2021 -0500 +++ b/src/p_interaction.cpp Sun Feb 14 15:52:32 2021 -0500 @@ -2544,6 +2544,24 @@ return; } + // [AK] If this player's current mobj doesn't match their player class due to + // A_SkullPop, then we must reset their mobj back to the original body. + else if (( bDeadSpectator == false ) && ( pPlayer->mo != NULL )) + { + APlayerPawn *mo = pPlayer->mo; + + if (( mo->GetClass()->TypeName != pPlayer->cls->TypeName ) && ( mo->target != NULL )) + { + APlayerPawn *pmo = barrier_cast( pPlayer->mo->target ); + mo->player = NULL; + pmo->player = pPlayer; + pPlayer->mo = pmo; + + // [AK] Set the camera back to the original body. + if ( pPlayer->camera == mo ) + pPlayer->camera = pmo; + } + } // [BB] Morphed players need to be unmorphed before being changed to spectators. // [WS] This needs to be done before we turn our player into a spectator. diff -r 45943ba832e7 -r 9e695e087a27 src/p_user.cpp --- a/src/p_user.cpp Sun Feb 07 16:31:29 2021 -0500 +++ b/src/p_user.cpp Sun Feb 14 15:52:32 2021 -0500 @@ -2441,7 +2441,7 @@ self->flags &= ~MF_SOLID; mo = (APlayerPawn *)Spawn (spawntype, self->x, self->y, self->z + 48*FRACUNIT, NO_REPLACE); - //mo->target = self; + mo->target = self; // [AK] We need some way to retrieve the original body, so make it the target. mo->velx = pr_skullpop.Random2() << 9; mo->vely = pr_skullpop.Random2() << 9; mo->velz = 2*FRACUNIT + (pr_skullpop() << 6);