Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0374e2a
Overhauled Camera system + Decoupled Mouse Crosshair
AL2009man Aug 22, 2025
dedfee0
Normalized Mouse Crosshair Swivel
AL2009man Aug 23, 2025
18206c2
moved `inputMouseGetScaledDeltaCrosshair` to `bondmove.c` directly
AL2009man Aug 23, 2025
d32b82d
Merge branch 'fgsfdsfgs:port' into PerfectQuakeDark3
AL2009man Aug 24, 2025
9f680d2
fixed regression on CamSpy and Hoverbike
AL2009man Aug 24, 2025
fdbc9c0
re-move MouseGetScaledDeltaCrosshair scaling back to bmove
AL2009man Aug 24, 2025
9e2f436
fixed regression in Crosshair Swivel.
AL2009man Aug 31, 2025
938171b
fixed regression on Crosshair Sway while using Mixed Input and clampe…
AL2009man Aug 31, 2025
48a24f5
cleaned up AngleCamera, attempt to address netplay/demo compatibility
AL2009man Oct 13, 2025
e223727
fixed reverse whitespace
AL2009man Oct 13, 2025
db7b94b
Merge branch 'fgsfdsfgs:port' into PerfectQuakeDark3
AL2009man Oct 13, 2025
f856865
fixed regression with Mouse Crosshair Aiming always being active rega…
AL2009man Oct 13, 2025
610f8f1
remove decoupled crosshair infavor with `mouseaimspeedx/y`
AL2009man Dec 4, 2025
ea0704b
Merge branch 'port' into PerfectQuakeDark3
AL2009man Dec 5, 2025
2348fff
replaced temp movedata with actual camera yaw/pitch
AL2009man Dec 8, 2025
44f6a61
Revert "replaced temp movedata with actual camera yaw/pitch"
AL2009man Dec 8, 2025
908de2a
Reworked Angle-based Camera system to directly use the engine camera …
AL2009man Jan 23, 2026
08e739b
Merge branch 'port' into PerfectQuakeDark3
AL2009man Mar 23, 2026
c27ad50
Fix missing newline at end of `optionsmenu.c`
AL2009man Mar 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions port/src/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "utils.h"
#include "system.h"
#include "fs.h"
#include "data.h"

#if !SDL_VERSION_ATLEAST(2, 0, 14)
// this was added in 2.0.14
Expand Down Expand Up @@ -1254,8 +1255,8 @@ void inputMouseGetScaledDelta(f32* dx, f32* dy)
{
f32 mdx = 0.f, mdy = 0.f;
if (mouseLocked) {
mdx = mouseDX * (0.022f / 3.5f) * mouseSensX;
mdy = mouseDY * (0.022f / 3.5f) * mouseSensY;
mdx = mouseDX * 0.022f * mouseSensX;
mdy = mouseDY * 0.022f * mouseSensY;
}
if (dx) *dx = mdx;
if (dy) *dy = mdy;
Expand Down
78 changes: 67 additions & 11 deletions src/game/bondmove.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,43 @@ static void bmoveApplyCrosshairSwivel(struct movedata *movedata, f32 mlookscale,
#endif
}

#ifndef PLATFORM_N64
/**
* Apply precision-based input to speed values for crosshair sway detection
*/
static void bmovePrecisionInputToCrosshairSwaySpeed(struct movedata *movedata, f32 mlookscale, bool vertical)
{
if (vertical) { // Vertical sway movement
if (movedata->freelookdy != 0.0f) {
g_Vars.currentplayer->speedverta += -movedata->freelookdy * mlookscale;
}
} else { // Horizontal sway movement
if (movedata->freelookdx != 0.0f) {
g_Vars.currentplayer->speedthetacontrol += movedata->freelookdx * mlookscale;
}
}
}

/**
* Apply camera movement
* Supports angle-based camera movement for precision-based inputs
*/
static void bmoveApplyCameraMovement(struct movedata *movedata, f32 mlookscale, bool vertical)
{
f32 timescale = g_Vars.lvupdate60freal * 3.5f;

if (vertical) { // Camera vertical movement
if (movedata->freelookdy != 0.0f) {
g_Vars.currentplayer->vv_verta += -movedata->freelookdy * (1.0f - mlookscale * timescale);
}
} else { // Camera horizontal movement
if (movedata->freelookdx != 0.0f) {
g_Vars.currentplayer->vv_theta += movedata->freelookdx * (1.0f - mlookscale * timescale);
}
}
}
#endif

/**
* Calculate the lookahead angle.
*
Expand Down Expand Up @@ -744,7 +781,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
f32 increment2;
f32 newverta;
#ifndef PLATFORM_N64
const f32 mlookscale = g_Vars.lvupdate240 ? (4.f / (f32)g_Vars.lvupdate240) : 4.f;
const f32 mlookscale = g_Vars.lvupdate240 ? (1.f / (f32)g_Vars.lvupdate240) : 1.f;
const bool allowmlook = (g_Vars.currentplayernum == 0) && (allowc1x || allowc1y);
bool allowmcross = false;
#endif
Expand Down Expand Up @@ -805,9 +842,11 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i

#ifndef PLATFORM_N64
if (allowmlook) {
s32 mousedx, mousedy;
inputMouseGetScaledDelta(&movedata.freelookdx, &movedata.freelookdy);
inputMouseGetRawDelta(&mousedx, &mousedy);
allowmcross = (PLAYER_EXTCFG().mouseaimmode == MOUSEAIM_CLASSIC) &&
(movedata.freelookdx || movedata.freelookdy || g_Vars.currentplayer->swivelpos[0] || g_Vars.currentplayer->swivelpos[1]);
(mousedx || mousedy || g_Vars.currentplayer->swivelpos[0] || g_Vars.currentplayer->swivelpos[1]);
if (movedata.invertpitch) {
movedata.freelookdy = -movedata.freelookdy;
}
Expand Down Expand Up @@ -2079,11 +2118,12 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
fVar25 *= -fVar25;
}

g_Vars.currentplayer->speedverta = -fVar25 * tmp;

#ifndef PLATFORM_N64
fVar25 += movedata.freelookdy * mlookscale;
// Add mouse to speedverta for crosshair sway detection
bmovePrecisionInputToCrosshairSwaySpeed(&movedata, mlookscale, true);
#endif

g_Vars.currentplayer->speedverta = -fVar25 * tmp;
} else if (movedata.speedvertadown > 0) {
bmoveUpdateSpeedVerta(movedata.speedvertadown);

Expand All @@ -2101,6 +2141,13 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
}

g_Vars.currentplayer->vv_verta += g_Vars.currentplayer->speedverta * g_Vars.lvupdate60freal * 3.5f;

#ifndef PLATFORM_N64
// Apply mouse 1:1 vertical rotation
if (movedata.cannaturalpitch) {
bmoveApplyCameraMovement(&movedata, mlookscale, true);
}
#endif
}
}

Expand All @@ -2120,11 +2167,12 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
fVar25 *= -fVar25;
}

g_Vars.currentplayer->speedthetacontrol = fVar25 * tmp;

#ifndef PLATFORM_N64
fVar25 += movedata.freelookdx * mlookscale;
// Add mouse to speedthetacontrol for crosshair sway detection
bmovePrecisionInputToCrosshairSwaySpeed(&movedata, mlookscale, false);
#endif

g_Vars.currentplayer->speedthetacontrol = fVar25 * tmp;
} else if (movedata.aimturnleftspeed > 0) {
bmoveUpdateSpeedThetaControl(movedata.aimturnleftspeed);
} else if (movedata.aimturnrightspeed > 0) {
Expand All @@ -2136,6 +2184,13 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
g_Vars.currentplayer->speedtheta = g_Vars.currentplayer->speedthetacontrol;
bmoveUpdateSpeedTheta();

#ifndef PLATFORM_N64
// Apply mouse 1:1 horizontal rotation
if (movedata.cannaturalturn) {
bmoveApplyCameraMovement(&movedata, mlookscale, false);
}
#endif

if (movedata.detonating) {
g_Vars.currentplayer->hands[HAND_RIGHT].mode = HANDMODE_NONE;
g_Vars.currentplayer->hands[HAND_RIGHT].modenext = HANDMODE_NONE;
Expand Down Expand Up @@ -2233,8 +2288,9 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
// joystick is inactive, move crosshair using the mouse
const f32 xcoeff = 320.f / 1080.f;
const f32 ycoeff = 240.f / 1080.f;
const f32 xscale = (PLAYER_EXTCFG().mouseaimspeedx * xcoeff) / g_Vars.currentplayer->aspect;
const f32 yscale = PLAYER_EXTCFG().mouseaimspeedy * ycoeff;
// TODO: until crosshair decouple is fully implemented, we'll reduce mouseaimspeed's scaling
const f32 xscale = (PLAYER_EXTCFG().mouseaimspeedx * 0.20f * xcoeff) / g_Vars.currentplayer->aspect;
const f32 yscale = PLAYER_EXTCFG().mouseaimspeedy * 0.20f * 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 Expand Up @@ -2582,4 +2638,4 @@ s32 bmoveGetCrouchPosByPlayer(s32 playernum)
return (g_Vars.players[playernum]->crouchpos < g_Vars.players[playernum]->autocrouchpos)
? g_Vars.players[playernum]->crouchpos
: g_Vars.players[playernum]->autocrouchpos;
}
}
Loading