n = cl.movement_numqueue;
cl.movement_numqueue = 0;
for (i = 0;i < n;i++)
+ {
if (cl.movement_queue[i].sequence > cls.netcon->qw.incoming_sequence)
cl.movement_queue[cl.movement_numqueue++] = cl.movement_queue[i];
+ else if (i == 0)
+ cl.movement_replay_canjump = !cl.movement_queue[i].jump;
+ }
// add to input queue if there is room
if (cl.movement_numqueue < (int)(sizeof(cl.movement_queue)/sizeof(cl.movement_queue[0])))
{
if (cl.servermovesequence)
{
for (i = 0;i < n;i++)
+ {
if (cl.movement_queue[i].sequence > cl.servermovesequence)
cl.movement_queue[cl.movement_numqueue++] = cl.movement_queue[i];
+ else if (i == 0)
+ cl.movement_replay_canjump = !cl.movement_queue[i].jump;
+ }
}
else
{
for (i = 0;i < n;i++)
+ {
if (cl.movement_queue[i].time >= cl.mtime[0] - cl_movement_latency.value / 1000.0 && cl.movement_queue[i].time <= cl.mtime[0])
cl.movement_queue[cl.movement_numqueue++] = cl.movement_queue[i];
+ else if (i == 0)
+ cl.movement_replay_canjump = !cl.movement_queue[i].jump;
+ }
}
// add to input queue if there is room
if (cl.movement_numqueue < (int)(sizeof(cl.movement_queue)/sizeof(cl.movement_queue[0])) && cl.mtime[0] > cl.mtime[1])
VectorCopy(cl.entities[cl.playerentity].state_current.origin, s.origin);
VectorCopy(cl.mvelocity[0], s.velocity);
s.crouched = true; // will be updated on first move
- s.canjump = true;
+ s.canjump = cl.movement_replay_canjump;
// set up movement variables
if (cls.protocol == PROTOCOL_QUAKEWORLD)
return;
}
InfoString_SetValue(cls.userinfo, sizeof(cls.userinfo), key, value);
- if (cls.state == ca_connected)
+ if (cls.state == ca_connected && cls.netcon)
{
if (cls.protocol == PROTOCOL_QUAKEWORLD)
{
// check memory integrity
Mem_CheckSentinelsGlobal();
- MSG_WriteByte(&cls.netcon->message, qw_clc_stringcmd);
- MSG_WriteString(&cls.netcon->message, va("soundlist %i %i", cl.qw_servercount, 0));
+ if (cls.netcon)
+ {
+ MSG_WriteByte(&cls.netcon->message, qw_clc_stringcmd);
+ MSG_WriteString(&cls.netcon->message, va("soundlist %i %i", cl.qw_servercount, 0));
+ }
cls.state = ca_connected;
cls.signon = 1;
// value of "qport" cvar at time of connection
int qw_qport;
+ // copied from cls.netcon->qw. variables every time they change, or set by demos (which have no cls.netcon)
+ int qw_incoming_sequence;
+ int qw_outgoing_sequence;
// current file download buffer (only saved when file is completed)
char qw_downloadname[MAX_QPATH];
client_movementqueue_t movement_queue[64];
int movesequence;
int servermovesequence;
+ // whether the replay should allow a jump at the first sequence
+ qboolean movement_replay_canjump;
// pitch drifting vars
float idealpitch;
{
*((short *)(sendbuffer + 8)) = LittleShort(cls.qw_qport);
packetLen += 2;
+ // also update cls.qw_outgoing_sequence
+ cls.qw_outgoing_sequence = conn->qw.outgoing_sequence;
}
if (packetLen + (sendreliable ? conn->sendMessageLength : 0) > 1400)
{
reliableMessagesReceived++;
}
conn->qw.incoming_sequence = sequence;
+ if (conn == cls.netcon)
+ cls.qw_incoming_sequence = conn->qw.incoming_sequence;
conn->qw.incoming_acknowledged = sequence_ack;
conn->qw.incoming_reliable_acknowledged = reliable_ack;
if (reliable_message)
cl.entitydatabaseqw = EntityFrameQW_AllocDatabase(cls.levelmempool);
d = cl.entitydatabaseqw;
- newsnapindex = cls.netcon->qw.incoming_sequence & QW_UPDATE_MASK;
+ // there is no cls.netcon in demos, so this reading code can't access
+ // cls.netcon-> at all... so cls.qw_incoming_sequence and
+ // cls.qw_outgoing_sequence are updated every time the corresponding
+ // cls.netcon->qw. variables are updated
+ // read the number of this frame to echo back in next input packet
+ cl.qw_validsequence = cls.qw_incoming_sequence;
+ newsnapindex = cl.qw_validsequence & QW_UPDATE_MASK;
newsnap = d->snapshot + newsnapindex;
memset(newsnap, 0, sizeof(*newsnap));
oldsnapindex = -1;
Con_DPrintf("WARNING: from mismatch\n");
if (oldsnapindex != -1)
{
- if (cls.netcon->qw.outgoing_sequence - oldsnapindex >= QW_UPDATE_BACKUP-1)
+ if (cls.qw_outgoing_sequence - oldsnapindex >= QW_UPDATE_BACKUP-1)
{
Con_DPrintf("delta update too old\n");
newsnap->invalid = invalid = true; // too old
delta = false;
}
- // read the number of this frame to echo back in next input packet
- cl.qw_validsequence = cls.netcon->qw.incoming_sequence;
+ // if we can't decode this frame properly, report that to the server
if (invalid)
cl.qw_validsequence = 0;