From 053f7dc8a5495cf6f671d0e37a935aa9cdb18be0 Mon Sep 17 00:00:00 2001 From: AL2009man <67606569+AL2009man@users.noreply.github.com> Date: Fri, 11 Apr 2025 00:06:02 -0400 Subject: [PATCH 1/2] Mouse Sensitivity follows Quake/id Tech mouse sens this changes mouse sensitiivity scale to mirror id Tech's Mouse Sensitivity Scale. This also makes it easier for Steam Input users (Steam Deck and Steam Controller) to use Gyro To Mouse/Flick Stick's Natural Sensitivity Scale --- port/src/input.c | 12 ++++++------ src/game/player.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/port/src/input.c b/port/src/input.c index 2bacbd646..9cf2e6134 100644 --- a/port/src/input.c +++ b/port/src/input.c @@ -88,8 +88,8 @@ static s32 mouseLockMode = MLOCK_AUTO; static u64 mouseCursorTime = 0; static s32 mouseShowCursor = 1; -static f32 mouseSensX = 1.5f; -static f32 mouseSensY = 1.5f; +static f32 mouseSensX = 2.5f; +static f32 mouseSensY = 2.5f; static s32 lastKey = 0; static char lastChar = 0; @@ -1243,8 +1243,8 @@ void inputMouseGetScaledDelta(f32 *dx, f32 *dy) { f32 mdx, mdy; if (mouseLocked) { - mdx = mouseSensX * (f32)mouseDX / 100.0f; - mdy = mouseSensY * (f32)mouseDY / 100.0f; + mdx = mouseSensX * (f32)mouseDX / 159.2f; + mdy = mouseSensY * (f32)mouseDY / 159.2f; } else { mdx = 0.f; mdy = 0.f; @@ -1257,8 +1257,8 @@ void inputMouseGetAbsScaledDelta(f32 *dx, f32 *dy) { f32 mdx, mdy; if (mouseLocked) { - mdx = fabsf(mouseSensX) * (f32)mouseDX / 100.0f; - mdy = fabsf(mouseSensY) * (f32)mouseDY / 100.0f; + mdx = fabsf(mouseSensX) * (f32)mouseDX / 159.2f; + mdy = fabsf(mouseSensY) * (f32)mouseDY / 159.2f; } else { mdx = 0.f; mdy = 0.f; diff --git a/src/game/player.c b/src/game/player.c index a0983ef36..fa17dc472 100644 --- a/src/game/player.c +++ b/src/game/player.c @@ -3674,8 +3674,8 @@ void playerTick(bool arg0) if (g_Vars.currentplayerstats && !optionsGetForwardPitch(g_Vars.currentplayerstats->mpindex)) { mdy = -mdy; } - sp178 += mdy * 0.00025f; - sp174 -= mdx * 0.00025f; + sp178 += mdy * 0.022f; + sp174 -= mdx * 0.022f; } } #endif From 9695856be6bad02fe4556f22c8c58b56d840442e Mon Sep 17 00:00:00 2001 From: AL2009man <67606569+AL2009man@users.noreply.github.com> Date: Fri, 11 Apr 2025 19:24:25 -0400 Subject: [PATCH 2/2] updated player.c to account for 0.022f scale while also changing input.c delta scale to ensure it has a divider --- port/src/input.c | 40 ++++++++++++++++++---------------------- src/game/player.c | 8 ++++---- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/port/src/input.c b/port/src/input.c index 9cf2e6134..96e37255e 100644 --- a/port/src/input.c +++ b/port/src/input.c @@ -1239,32 +1239,28 @@ void inputMouseGetRawDelta(s32 *dx, s32 *dy) if (dy) *dy = mouseDY; } -void inputMouseGetScaledDelta(f32 *dx, f32 *dy) +void inputMouseGetScaledDelta(f32* dx, f32* dy) { - f32 mdx, mdy; - if (mouseLocked) { - mdx = mouseSensX * (f32)mouseDX / 159.2f; - mdy = mouseSensY * (f32)mouseDY / 159.2f; - } else { - mdx = 0.f; - mdy = 0.f; - } - if (dx) *dx = mdx; - if (dy) *dy = mdy; + f32 mdx = 0.f, mdy = 0.f; + + if (mouseLocked) { + mdx = mouseSensX * ((f32)mouseDX / 3.5f) * 0.022f; + mdy = mouseSensY * ((f32)mouseDY / 3.5f) * 0.022f; + } + if (dx) *dx = mdx; + if (dy) *dy = mdy; } -void inputMouseGetAbsScaledDelta(f32 *dx, f32 *dy) +void inputMouseGetAbsScaledDelta(f32* dx, f32* dy) { - f32 mdx, mdy; - if (mouseLocked) { - mdx = fabsf(mouseSensX) * (f32)mouseDX / 159.2f; - mdy = fabsf(mouseSensY) * (f32)mouseDY / 159.2f; - } else { - mdx = 0.f; - mdy = 0.f; - } - if (dx) *dx = mdx; - if (dy) *dy = mdy; + f32 mdx = 0.f, mdy = 0.f; + + if (mouseLocked) { + mdx = fabsf(mouseSensX) * ((f32)mouseDX / 3.5f) * 0.022f; + mdy = fabsf(mouseSensY) * ((f32)mouseDY / 3.5f) * 0.022f; + } + if (dx) *dx = mdx; + if (dy) *dy = mdy; } void inputMouseGetSpeed(f32 *x, f32 *y) diff --git a/src/game/player.c b/src/game/player.c index fa17dc472..cd5fe4137 100644 --- a/src/game/player.c +++ b/src/game/player.c @@ -3667,15 +3667,15 @@ void playerTick(bool arg0) f32 mdx, mdy; inputMouseGetScaledDelta(&mdx, &mdy); if (mdx || mdy) { - mdx *= 48.f; - mdy *= 48.f; + mdx *= 0.022f; + mdy *= 0.022f; mdx = (mdx < -128.f) ? -128.f : (mdx > 127.f) ? 127.f : mdx; mdy = (mdy < -128.f) ? -128.f : (mdy > 127.f) ? 127.f : mdy; if (g_Vars.currentplayerstats && !optionsGetForwardPitch(g_Vars.currentplayerstats->mpindex)) { mdy = -mdy; } - sp178 += mdy * 0.022f; - sp174 -= mdx * 0.022f; + sp178 += mdy; + sp174 -= mdx; } } #endif