From 2d0375da2e616a4b42c0140e65fd22ddfab4ee8f Mon Sep 17 00:00:00 2001 From: AL2009man <67606569+AL2009man@users.noreply.github.com> Date: Thu, 4 Dec 2025 14:55:31 -0500 Subject: [PATCH] fixed Crosshair Swivel conflicting when using Mixed Input Addresses the issue with Crosshair Swivel conflciting with each other when using both Mouse and Camera at the same time. --- src/game/bondmove.c | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 2c0701668..548ade1b1 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -436,6 +436,38 @@ void bmoveUpdateSpeedThetaControl(f32 value) } } +/** + * Apply crosshair swivel based on camera movement with input detection + */ +static void bmoveApplyCrosshairSwivel(struct movedata *movedata, f32 mlookscale, f32 *x, f32 *y) +{ +#ifdef PLATFORM_N64 + *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; + bool mouse_active = (movedata->freelookdx || movedata->freelookdy); + bool joystick_active = (movedata->c1stickxraw != 0 || movedata->c1stickyraw != 0); + + if ((mouse_active) && joystick_active) { + // Mouse + joystick sway + xscale = PLAYER_EXTCFG().crosshairsway * 0.80f; // 80% for precision+joystick sway + yscale = PLAYER_EXTCFG().crosshairsway * 0.80f; // 80% for precision+joystick sway + } else if (mouse_active) { + // Mouse sway + xscale = PLAYER_EXTCFG().crosshairsway * 0.20f; // 20% for mouse sway + yscale = PLAYER_EXTCFG().crosshairsway * 0.30f; // 30% for mouse sway + } else { + // Joystick only or no input - full sway + xscale = yscale = PLAYER_EXTCFG().crosshairsway; + } + // Joystick x/y scaling + // 0.3f for x, 0.1f for y + *x = g_Vars.currentplayer->speedtheta * 0.3f * xscale + g_Vars.currentplayer->gunextraaimx; + *y = -g_Vars.currentplayer->speedverta * 0.1f * yscale + g_Vars.currentplayer->gunextraaimy; +#endif +} + /** * Calculate the lookahead angle. * @@ -2186,15 +2218,8 @@ 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; - if (movedata.freelookdx || movedata.freelookdy) { - xscale = PLAYER_EXTCFG().crosshairsway * 0.20f; - yscale = PLAYER_EXTCFG().crosshairsway * 0.30f; - } else { - xscale = yscale = PLAYER_EXTCFG().crosshairsway; - } - x = g_Vars.currentplayer->speedtheta * 0.3f * xscale + g_Vars.currentplayer->gunextraaimx; - y = -g_Vars.currentplayer->speedverta * 0.1f * yscale + g_Vars.currentplayer->gunextraaimy; + // Crosshair swivel movement system + bmoveApplyCrosshairSwivel(&movedata, mlookscale, &x, &y); #endif bgunSwivelWithDamp(x, y, PAL ? 0.955f : 0.963f);