Merge pull request #552 from ZenithMDC/resolution-independent-mouse-aim

Make mouse aim speed resolution-independent
This commit is contained in:
fgsfds authored and GitHub committed 2024-12-19 18:26:59 +01:00
commit 26b3b91433
1 file changed
+4 -2
+4 -2
View File
@@ -2204,8 +2204,10 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
#ifndef PLATFORM_N64 #ifndef PLATFORM_N64
if (allowmcross) { if (allowmcross) {
// joystick is inactive, move crosshair using the mouse // joystick is inactive, move crosshair using the mouse
const f32 xscale = PLAYER_EXTCFG().mouseaimspeedx * 320.f / (f32)videoGetWidth(); const f32 xcoeff = 320.f / 1080.f;
const f32 yscale = PLAYER_EXTCFG().mouseaimspeedy * 240.f / (f32)videoGetHeight(); const f32 ycoeff = 240.f / 1080.f;
const f32 xscale = (PLAYER_EXTCFG().mouseaimspeedx * xcoeff) / videoGetAspect();
const f32 yscale = PLAYER_EXTCFG().mouseaimspeedy * ycoeff;
f32 x = g_Vars.currentplayer->swivelpos[0] + movedata.freelookdx * xscale; f32 x = g_Vars.currentplayer->swivelpos[0] + movedata.freelookdx * xscale;
f32 y = g_Vars.currentplayer->swivelpos[1] + movedata.freelookdy * yscale; f32 y = g_Vars.currentplayer->swivelpos[1] + movedata.freelookdy * yscale;
x = (x < -1.f) ? -1.f : ((x > 1.f) ? 1.f : x); x = (x < -1.f) ? -1.f : ((x > 1.f) ? 1.f : x);