From c1f52b1137714231c26b9da8dc7b2fb9ff0ba46f Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 13 Mar 2023 21:30:39 +1100 Subject: [PATCH] - Adjust `PlayerAngles::doViewPitch()` so that view pitch always resets to 0 upon enabling mouse aiming. --- source/core/gameinput.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/source/core/gameinput.cpp b/source/core/gameinput.cpp index a3fc34094..cf45b90d7 100644 --- a/source/core/gameinput.cpp +++ b/source/core/gameinput.cpp @@ -270,22 +270,22 @@ void PlayerAngles::doViewPitch(const bool canslopetilt, const bool climbing) } } } - - if (climbing) - { - // tilt when climbing but you can't even really tell it. - if (ViewAngles.Pitch > PITCH_HORIZOFFCLIMB) - ViewAngles.Pitch += getscaledangle(deltaangle(ViewAngles.Pitch, PITCH_HORIZOFFCLIMB), PITCH_HORIZOFFSPEED, PITCH_HORIZOFFPUSH); - } - else - { - // Make horizoff grow towards 0 since horizoff is not modified when you're not on a slope. - scaletozero(ViewAngles.Pitch, PITCH_HORIZOFFSPEED, PITCH_HORIZOFFPUSH); - } - - // Clamp off against the maximum allowed pitch. - ViewAngles.Pitch = ClampViewPitch(ViewAngles.Pitch); } + + if (cl_slopetilting && climbing) + { + // tilt when climbing but you can't even really tell it. + if (ViewAngles.Pitch > PITCH_HORIZOFFCLIMB) + ViewAngles.Pitch += getscaledangle(deltaangle(ViewAngles.Pitch, PITCH_HORIZOFFCLIMB), PITCH_HORIZOFFSPEED, PITCH_HORIZOFFPUSH); + } + else + { + // Make horizoff grow towards 0 since horizoff is not modified when you're not on a slope. + scaletozero(ViewAngles.Pitch, PITCH_HORIZOFFSPEED, PITCH_HORIZOFFPUSH); + } + + // Clamp off against the maximum allowed pitch. + ViewAngles.Pitch = ClampViewPitch(ViewAngles.Pitch); }