diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index d919766286..57f6e75bfe 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -1096,6 +1096,50 @@ static void doPlayerPitch(Player* const pPlayer) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +static void doPlayerDeathPitch(Player* const pPlayer) +{ + const auto pPlayerActor = pPlayer->pActor; + pPlayer->nThrust.Zero(); + + if (pPlayerActor->viewzoffset >= -11) + { + pPlayerActor->viewzoffset = -11; + pPlayer->dVertPan = 0; + } + else + { + if (pPlayerActor->spr.Angles.Pitch.Sgn() > 0) + { + pPlayerActor->spr.Angles.Pitch = nullAngle; + pPlayerActor->viewzoffset -= pPlayer->dVertPan; + } + else + { + pPlayerActor->spr.Angles.Pitch -= maphoriz(pPlayer->dVertPan); + + if (pPlayerActor->spr.Angles.Pitch.Degrees() <= -38) + { + pPlayerActor->spr.Angles.Pitch = DAngle::fromDeg(-37.72); + } + else if (pPlayerActor->spr.Angles.Pitch.Sgn() >= 0) + { + if (!(pPlayerActor->sector()->Flag & kSectUnderwater)) + { + SetNewWeapon(pPlayer->nPlayer, pPlayer->nDeathType + 8); + } + } + + pPlayer->dVertPan--; + } + } +} + //--------------------------------------------------------------------------- // // this function is pure spaghetti madness... :( @@ -1635,41 +1679,7 @@ void AIPlayer::Tick(RunListEvent* ev) } if (!pPlayer->nHealth) - { - pPlayer->nThrust.Zero(); - - if (pPlayerActor->viewzoffset >= -11) - { - pPlayerActor->viewzoffset = -11; - pPlayer->dVertPan = 0; - } - else - { - if (pPlayer->pActor->spr.Angles.Pitch.Sgn() > 0) - { - pPlayerActor->spr.Angles.Pitch = nullAngle; - pPlayerActor->viewzoffset -= pPlayer->dVertPan; - } - else - { - pPlayer->pActor->spr.Angles.Pitch -= maphoriz(pPlayer->dVertPan); - - if (pPlayer->pActor->spr.Angles.Pitch.Degrees() <= -38) - { - pPlayer->pActor->spr.Angles.Pitch = DAngle::fromDeg(-37.72); - } - else if (pPlayer->pActor->spr.Angles.Pitch.Sgn() >= 0) - { - if (!(pPlayerActor->sector()->Flag & kSectUnderwater)) - { - SetNewWeapon(nPlayer, pPlayer->nDeathType + 8); - } - } - - pPlayer->dVertPan--; - } - } - } + doPlayerDeathPitch(pPlayer); // loc_1C4E1 pDopple->spr.pos = pPlayerActor->spr.pos;