From e03e7ca8394cc7757f0450bf6c89254ee31a85f1 Mon Sep 17 00:00:00 2001 From: Andrei Drexler Date: Thu, 28 Dec 2023 18:24:20 +0100 Subject: [PATCH] Use natural gyro sensitivity scale instead of multiplying m_yaw/m_pitch with cl_yawspeed/cl_pitchspeed and a hardcoded value of 1/60. Note: in practice with default cvar values the end result was quite close (184 vs 180 for yaw, 198 vs 180 for pitch). --- Quake/in_sdl.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Quake/in_sdl.c b/Quake/in_sdl.c index dd4d0f62e..2196a6643 100644 --- a/Quake/in_sdl.c +++ b/Quake/in_sdl.c @@ -810,6 +810,7 @@ void IN_JoyMove (usercmd_t *cmd) void IN_GyroMove(usercmd_t *cmd) { + float scale; if (!joy_enable.value) return; @@ -822,17 +823,9 @@ void IN_GyroMove(usercmd_t *cmd) if (CL_InCutscene ()) return; - float gyroViewFactor = (1.0f / M_PI) * host_frametime/0.01666f; - - if (gyro_yaw) - { - cl.viewangles[YAW] += m_yaw.value * gyro_yawsensitivity.value * cl_yawspeed.value * gyro_yaw * gyroViewFactor * gyro_dir; - } - - if (gyro_pitch) - { - cl.viewangles[PITCH] -= m_pitch.value * gyro_pitchsensitivity.value * cl_pitchspeed.value * gyro_pitch * gyroViewFactor * gyro_dir; - } + scale = (180.f / M_PI) * gyro_dir * host_frametime; + cl.viewangles[YAW] += scale * gyro_yaw * gyro_yawsensitivity.value; + cl.viewangles[PITCH] -= scale * gyro_pitch * gyro_pitchsensitivity.value; /* johnfitz -- variable pitch clamping */ if (cl.viewangles[PITCH] > cl_maxpitch.value)