# HG changeset patch # User Adam Kaminski # Date 1613196823 18000 # Sat Feb 13 01:13:43 2021 -0500 # Node ID 358c6c5419b60b138d43e7c3128a0f65148e3da9 # Parent 45943ba832e76337dba40800ba92a8d960ff8b58 Fixed issues with A_SkullPop and if the player spectates while the PlayerChunk actor is still in midair. diff -r 45943ba832e7 -r 358c6c5419b6 src/p_interaction.cpp --- a/src/p_interaction.cpp Sun Feb 07 16:31:29 2021 -0500 +++ b/src/p_interaction.cpp Sat Feb 13 01:13:43 2021 -0500 @@ -2544,6 +2544,20 @@ 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->GetClass()->TypeName != pPlayer->cls->TypeName )) + { + APlayerPawn *mo = pPlayer->mo; + 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 358c6c5419b6 src/p_user.cpp --- a/src/p_user.cpp Sun Feb 07 16:31:29 2021 -0500 +++ b/src/p_user.cpp Sat Feb 13 01:13:43 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);