From 30de9c1922fd76fb2c384fd17b25fe5f30274bd7 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sat, 4 Feb 2023 16:10:38 +1100 Subject: [PATCH] - Factor in view pitch when clamping player's actor pitch. --- source/core/gameinput.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/core/gameinput.cpp b/source/core/gameinput.cpp index 152c6ae0e..207ce5f2e 100644 --- a/source/core/gameinput.cpp +++ b/source/core/gameinput.cpp @@ -190,8 +190,10 @@ void PlayerAngles::doPitchKeys(ESyncBits* actions, const bool stopcentering) if (!pActor->spr.Angles.Pitch.Sgn()) *actions &= ~SB_CENTERVIEW; } - // clamp before we finish, even if it's clamped in the drawer. - pActor->spr.Angles.Pitch = ClampViewPitch(pActor->spr.Angles.Pitch); + // clamp before we finish, factoring in the player's view pitch offset. + const auto maximum = GetMaxPitch() - ViewAngles.Pitch * (ViewAngles.Pitch < nullAngle); + const auto minimum = GetMinPitch() - ViewAngles.Pitch * (ViewAngles.Pitch > nullAngle); + pActor->spr.Angles.Pitch = clamp(pActor->spr.Angles.Pitch, maximum, minimum); }