- Exhumed: Reset view pitch back to 0 when doing Ramses, using game's formula.

* Ensure's a smooth return to 0 so the player's actual pitch can be targeted towards Ramses.
* In situations where the player had their view pitch changed in the ticker, this would have never reset.
This commit is contained in:
Mitchell Richters 2023-03-27 17:10:07 +11:00
parent 0594a5cb91
commit ebedf46434
3 changed files with 8 additions and 2 deletions

View file

@ -1573,14 +1573,13 @@ static void doPlayerGravity(DExhumedActor* const pPlayerActor)
static void doPlayerPitch(Player* const pPlayer, const double nDestVertPan)
{
const auto pInput = &pPlayer->input;
const auto nVertPan = (nDestVertPan * cl_slopetilting - pPlayer->Angles.ViewAngles.Pitch.Tan() * 128) * 0.25;
if (SyncInput())
{
pPlayer->pActor->spr.Angles.Pitch += DAngle::fromDeg(pInput->horz);
}
pPlayer->Angles.ViewAngles.Pitch += maphoriz(abs(nVertPan) >= 4 ? Sgn(nVertPan) * 4. : nVertPan * 2.);
doPlayerVertPanning(pPlayer, nDestVertPan * cl_slopetilting);
pPlayer->Angles.doPitchKeys(pInput);
}

View file

@ -125,5 +125,11 @@ void SetPlayerMummified(int nPlayer, int bIsMummified);
int AddAmmo(int nPlayer, int nWeapon, int nAmmoAmount);
void ShootStaff(int nPlayer);
inline void doPlayerVertPanning(Player* const pPlayer, const double nDestVertPan)
{
const auto nVertPan = (nDestVertPan - pPlayer->Angles.ViewAngles.Pitch.Tan() * 128) * 0.25;
pPlayer->Angles.ViewAngles.Pitch += maphoriz(abs(nVertPan) >= 4 ? Sgn(nVertPan) * 4. : nVertPan * 2.);
}
END_PS_NS

View file

@ -200,6 +200,7 @@ void DoSpiritHead()
const auto nSpiritAngle = (pSpiritSprite->spr.pos.XY() - pPlayerActor->spr.pos.XY()).Angle();
pPlayerActor->spr.Angles.Yaw += deltaangle(pPlayerActor->spr.Angles.Yaw, nSpiritAngle) * 0.25;
pPlayerActor->spr.Angles.Pitch += deltaangle(pPlayerActor->spr.Angles.Pitch, currentLevel->ex_ramses_horiz) * 0.25;
doPlayerVertPanning(pPlayer, 0);
switch (nHeadStage)
{