port: add separate mouse aim sensitivity

Game.MouseAimSpeedX and Game.MouseAimSpeedY
This commit is contained in:
fgsfds committed 2023-08-31 01:21:33 +02:00
1 parent e265482cb4
commit 24ced381de
4 files changed
+13 -9

No files matched your search

+2
View File
@@ -66,6 +66,8 @@ static void gameLoadConfig(void)
g_PlayerCrosshairSway = configGetFloatClamped("Game.CrosshairSway", g_PlayerCrosshairSway, 0.f, 10.f);
g_PlayerDefaultFovY = configGetFloatClamped("Game.FovY", g_PlayerDefaultFovY, 5.f, 175.f);
g_PlayerMouseAimMode = configGetIntClamped("Game.MouseAimMode", g_PlayerMouseAimMode, 0, 1);
g_PlayerMouseAimSpeedX = configGetFloatClamped("Game.MouseAimSpeedX", g_PlayerMouseAimSpeedX, 0.f, 10.f);
g_PlayerMouseAimSpeedY = configGetFloatClamped("Game.MouseAimSpeedY", g_PlayerMouseAimSpeedY, 0.f, 10.f);
}
int main(int argc, const char **argv)
+7 -9
View File
@@ -2019,16 +2019,14 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
x = g_Vars.currentplayer->speedtheta * 0.3f + g_Vars.currentplayer->gunextraaimx;
y = -g_Vars.currentplayer->speedverta * 0.1f + g_Vars.currentplayer->gunextraaimy;
#else
f32 xscale, yscale;
f32 scale;
if (movedata.freelookdx || movedata.freelookdy) {
xscale = 320.f / (f32)videoGetWidth();
yscale = 240.f / (f32)videoGetHeight();
scale = g_PlayerCrosshairSway * 240.f / (f32)videoGetHeight();
} else {
xscale = 1.f;
yscale = 1.f;
scale = g_PlayerCrosshairSway;
}
x = g_Vars.currentplayer->speedtheta * 0.3f * g_PlayerCrosshairSway * xscale + g_Vars.currentplayer->gunextraaimx;
y = -g_Vars.currentplayer->speedverta * 0.1f * g_PlayerCrosshairSway * yscale + g_Vars.currentplayer->gunextraaimy;
x = g_Vars.currentplayer->speedtheta * 0.3f * scale + g_Vars.currentplayer->gunextraaimx;
y = -g_Vars.currentplayer->speedverta * 0.1f * scale + g_Vars.currentplayer->gunextraaimy;
#endif
bgunSwivelWithDamp(x, y, PAL ? 0.955f : 0.963f);
@@ -2040,8 +2038,8 @@ 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 = 320.f / (f32)videoGetWidth();
const f32 yscale = 240.f / (f32)videoGetHeight();
const f32 xscale = g_PlayerMouseAimSpeedX * 320.f / (f32)videoGetWidth();
const f32 yscale = g_PlayerMouseAimSpeedY * 240.f / (f32)videoGetHeight();
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);
+2
View File
@@ -206,6 +206,8 @@ s32 g_NumDeathAnimations = 0;
f32 g_PlayerDefaultFovY = 60.f;
f32 g_PlayerCrosshairSway = 1.f;
s32 g_PlayerMouseAimMode = MOUSEAIM_CLASSIC;
f32 g_PlayerMouseAimSpeedX = 0.75f;
f32 g_PlayerMouseAimSpeedY = 0.75f;
#endif
/**
+2
View File
@@ -532,6 +532,8 @@ extern struct menudialogdef g_HangarListMenuDialog;
extern f32 g_PlayerCrosshairSway;
extern f32 g_PlayerDefaultFovY;
extern s32 g_PlayerMouseAimMode;
extern f32 g_PlayerMouseAimSpeedX;
extern f32 g_PlayerMouseAimSpeedY;
#endif
#endif