Skip to content

Commit

Permalink
Make mouse aim speed resolution-independent
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenithMDC committed Dec 8, 2024
1 parent 05e462b commit badd8f2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/game/bondmove.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit badd8f2

Please sign in to comment.