cl.movement_queue[cl.movement_numqueue++] = cl.movement_queue[i];
}
// add to input queue if there is room
- if (cl_movement.integer && cl.movement_numqueue < (int)(sizeof(cl.movement_queue)/sizeof(cl.movement_queue[0])) && cl.mtime[0] > cl.mtime[1])
+ if (cl.movement_numqueue < (int)(sizeof(cl.movement_queue)/sizeof(cl.movement_queue[0])) && cl.mtime[0] > cl.mtime[1])
{
// add to input queue
cl.movement_queue[cl.movement_numqueue].sequence = cl.movesequence;
cl.movement_queue[cl.movement_numqueue].crouch = buttoncrouch;
cl.movement_numqueue++;
}
- cl.movement = cl_movement.integer && cl.stats[STAT_HEALTH] > 0 && !cls.demoplayback && !cl.intermission;
- // clear queue if client movement is disabled
- if (!cl.movement)
- cl.movement_numqueue = 0;
cl.movement_replay = true;
}
trace_t trace;
trace_t trace2;
trace_t trace3;
+
if (!cl.movement_replay)
return;
cl.movement_replay = false;
// replay the input queue to predict current location
// note: this relies on the fact there's always one queue item at the end
- for (i = 0;i < cl.movement_numqueue;i++)
+ for (i = 0;cl.movement && i < cl.movement_numqueue;i++)
{
client_movementqueue_t *q = cl.movement_queue + bound(0, i, cl.movement_numqueue - 1);
frametime = q->frametime;
upmove += cl.cmd.upmove;
total++;
#endif
- if (cls.signon != SIGNONS)
- return;
- if (realtime < lastsendtime + 1.0 / bound(10, cl_netinputpacketspersecond.value, 100))
- return;
- // don't let it fall behind if CL_SendMove hasn't been called recently
- // (such is the case when framerate is too low for instance)
- lastsendtime = max(lastsendtime + 1.0 / bound(10, cl_netinputpacketspersecond.value, 100), realtime);
+
+ if (cl_movement.integer)
+ {
+ if (!cl.movement_needupdate)
+ return;
+ cl.movement_needupdate = false;
+ cl.movement = cl.stats[STAT_HEALTH] > 0 && !cls.demoplayback && !cl.intermission;
+ }
+ else
+ {
+ cl.movement = false;
+ if (realtime < lastsendtime + 1.0 / bound(10, cl_netinputpacketspersecond.value, 100))
+ return;
+ // don't let it fall behind if CL_SendMove hasn't been called recently
+ // (such is the case when framerate is too low for instance)
+ lastsendtime = max(lastsendtime + 1.0 / bound(10, cl_netinputpacketspersecond.value, 100), realtime);
+ }
#if MOVEAVERAGING
// average the accumulated changes
total = 1.0f / total;
// nothing to send
if (!buf.cursize)
return;
+ if (cls.signon != SIGNONS)
+ return;
// FIXME: bits & 16 is +button5, Nexuiz specific
CL_ClientMovement_Input((bits & 2) != 0, (bits & 16) != 0);
// client movement simulation
// these fields are only updated by CL_ClientMovement (called by CL_SendMove after parsing each network packet)
qboolean movement;
+ // this is set true by svc_time parsing and causes a new movement to be
+ // queued for prediction purposes
+ qboolean movement_needupdate;
// indicates the queue has been updated and should be replayed
qboolean movement_replay;
// simulated data (this is valid even if cl.movement is false)