mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-15 08:31:03 +00:00
Fix joystick movement being framerate-dependent
When host_maxfps > 72, the joystick movement would be summed together over multiple client frames. We only want that to happen to mouse-based movement, not joystick-based movement.
This commit is contained in:
parent
e9822ae936
commit
64c9176f0c
3 changed files with 16 additions and 6 deletions
|
@ -1268,9 +1268,9 @@ void CL_SendCmd (void)
|
||||||
CL_BaseMove (&cmd);
|
CL_BaseMove (&cmd);
|
||||||
|
|
||||||
// allow mice or other external controllers to add to the move
|
// allow mice or other external controllers to add to the move
|
||||||
cmd.forwardmove += cl.pendingcmd.forwardmove;
|
cmd.forwardmove += cl.pendingcmd.forwardmove + cl.pendingcmd.forwardmove_accumulator;
|
||||||
cmd.sidemove += cl.pendingcmd.sidemove;
|
cmd.sidemove += cl.pendingcmd.sidemove + cl.pendingcmd.sidemove_accumulator;
|
||||||
cmd.upmove += cl.pendingcmd.upmove;
|
cmd.upmove += cl.pendingcmd.upmove + cl.pendingcmd.upmove_accumulator;
|
||||||
cmd.sequence = cl.movemessages;
|
cmd.sequence = cl.movemessages;
|
||||||
cmd.servertime = cl.time;
|
cmd.servertime = cl.time;
|
||||||
cmd.seconds = cmd.servertime - cl.pendingcmd.servertime;
|
cmd.seconds = cmd.servertime - cl.pendingcmd.servertime;
|
||||||
|
|
|
@ -864,7 +864,7 @@ void IN_MouseMove(usercmd_t *cmd)
|
||||||
total_dy = 0;
|
total_dy = 0;
|
||||||
|
|
||||||
if ( (in_strafe.state & 1) || (lookstrafe.value && (in_mlook.state & 1) ))
|
if ( (in_strafe.state & 1) || (lookstrafe.value && (in_mlook.state & 1) ))
|
||||||
cmd->sidemove += m_side.value * dmx;
|
cmd->sidemove_accumulator += m_side.value * dmx;
|
||||||
else
|
else
|
||||||
cl.viewangles[YAW] -= m_yaw.value * dmx * cl.csqc_sensitivity;
|
cl.viewangles[YAW] -= m_yaw.value * dmx * cl.csqc_sensitivity;
|
||||||
|
|
||||||
|
@ -886,14 +886,19 @@ void IN_MouseMove(usercmd_t *cmd)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((in_strafe.state & 1) && noclip_anglehack)
|
if ((in_strafe.state & 1) && noclip_anglehack)
|
||||||
cmd->upmove -= m_forward.value * dmy;
|
cmd->upmove_accumulator -= m_forward.value * dmy;
|
||||||
else
|
else
|
||||||
cmd->forwardmove -= m_forward.value * dmy;
|
cmd->forwardmove_accumulator -= m_forward.value * dmy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IN_Move(usercmd_t *cmd)
|
void IN_Move(usercmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
// We only want the latest joystick movements
|
||||||
|
cmd->forwardmove = 0;
|
||||||
|
cmd->sidemove = 0;
|
||||||
|
cmd->upmove = 0;
|
||||||
|
|
||||||
IN_JoyMove(cmd);
|
IN_JoyMove(cmd);
|
||||||
IN_MouseMove(cmd);
|
IN_MouseMove(cmd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -512,6 +512,11 @@ typedef struct
|
||||||
float sidemove;
|
float sidemove;
|
||||||
float upmove;
|
float upmove;
|
||||||
|
|
||||||
|
// used by client for mouse-based movements that should accumulate over multiple client frames
|
||||||
|
float forwardmove_accumulator;
|
||||||
|
float sidemove_accumulator;
|
||||||
|
float upmove_accumulator;
|
||||||
|
|
||||||
unsigned int buttons;
|
unsigned int buttons;
|
||||||
unsigned int impulse;
|
unsigned int impulse;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue