From badd8f293b0c89476fad07523ed85e0b8011256d Mon Sep 17 00:00:00 2001 From: Matthew Coppola Date: Fri, 6 Dec 2024 20:23:58 -0500 Subject: [PATCH] Make mouse aim speed resolution-independent --- src/game/bondmove.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/game/bondmove.c b/src/game/bondmove.c index f82e88dee..0fbaf224b 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -2204,8 +2204,11 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i #ifndef PLATFORM_N64 if (allowmcross) { // joystick is inactive, move crosshair using the mouse - const f32 xscale = PLAYER_EXTCFG().mouseaimspeedx * 320.f / (f32)videoGetWidth(); - const f32 yscale = PLAYER_EXTCFG().mouseaimspeedy * 240.f / (f32)videoGetHeight(); + const f32 ar = (f32)videoGetWidth() / (f32)videoGetHeight(); + const f32 xcoeff = 320.f / 1080.f; + const f32 ycoeff = 240.f / 1080.f; + const f32 xscale = (PLAYER_EXTCFG().mouseaimspeedx * xcoeff) / ar; + const f32 yscale = PLAYER_EXTCFG().mouseaimspeedy * ycoeff; f32 x = g_Vars.currentplayer->swivelpos[0] + movedata.freelookdx * xscale; f32 y = g_Vars.currentplayer->swivelpos[1] + movedata.freelookdy * yscale; x = (x < -1.f) ? -1.f : ((x > 1.f) ? 1.f : x);