mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-23 15:52:41 +02:00
Merge pull request #552 from ZenithMDC/resolution-independent-mouse-aim
Make mouse aim speed resolution-independent
This commit is contained in:
1 file changed
+4
-2
+4
-2
@@ -2204,8 +2204,10 @@ 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 xcoeff = 320.f / 1080.f;
|
||||
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 y = g_Vars.currentplayer->swivelpos[1] + movedata.freelookdy * yscale;
|
||||
x = (x < -1.f) ? -1.f : ((x > 1.f) ? 1.f : x);
|
||||
|
||||
Reference in new issue
Block a user