+ // PROTOCOL_QUAKEWORLD clc_move = 34 bytes total (typically, but can reach 43 bytes, or even 49 bytes with roll)
+ if (cls.protocol == PROTOCOL_QUAKEWORLD)
+ {
+ int checksumindex;
+ double msectime;
+ static double oldmsectime;
+ qw_usercmd_t *cmd, *oldcmd;
+ qw_usercmd_t nullcmd;
+
+ //Con_Printf("code qw_clc_move\n");
+
+ i = cls.netcon->qw.outgoing_sequence & QW_UPDATE_MASK;
+ cmd = &cl.qw_moves[i];
+ memset(&nullcmd, 0, sizeof(nullcmd));
+ memset(cmd, 0, sizeof(*cmd));
+ cmd->buttons = bits;
+ cmd->impulse = impulse;
+ cmd->forwardmove = (short)bound(-32768, forwardmove, 32767);
+ cmd->sidemove = (short)bound(-32768, sidemove, 32767);
+ cmd->upmove = (short)bound(-32768, upmove, 32767);
+ VectorCopy(cl.viewangles, cmd->angles);
+ msectime = realtime * 1000;
+ cmd->msec = (unsigned char)bound(0, msectime - oldmsectime, 255);
+ // ridiculous value rejection (matches qw)
+ if (cmd->msec > 250)
+ cmd->msec = 100;
+ oldmsectime = msectime;
+
+ CL_ClientMovement_InputQW(cmd);
+
+ MSG_WriteByte(&buf, qw_clc_move);
+ // save the position for a checksum byte
+ checksumindex = buf.cursize;
+ MSG_WriteByte(&buf, 0);
+ // packet loss percentage
+ // FIXME: netgraph stuff
+ MSG_WriteByte(&buf, 0);
+ // write most recent 3 moves
+ i = (cls.netcon->qw.outgoing_sequence-2) & QW_UPDATE_MASK;
+ cmd = &cl.qw_moves[i];
+ QW_MSG_WriteDeltaUsercmd(&buf, &nullcmd, cmd);
+ oldcmd = cmd;
+ i = (cls.netcon->qw.outgoing_sequence-1) & QW_UPDATE_MASK;
+ cmd = &cl.qw_moves[i];
+ QW_MSG_WriteDeltaUsercmd(&buf, oldcmd, cmd);
+ oldcmd = cmd;
+ i = cls.netcon->qw.outgoing_sequence & QW_UPDATE_MASK;
+ cmd = &cl.qw_moves[i];
+ QW_MSG_WriteDeltaUsercmd(&buf, oldcmd, cmd);
+ // calculate the checksum
+ buf.data[checksumindex] = COM_BlockSequenceCRCByteQW(buf.data + checksumindex + 1, buf.cursize - checksumindex - 1, cls.netcon->qw.outgoing_sequence);
+ // if delta compression history overflows, request no delta
+ if (cls.netcon->qw.outgoing_sequence - cl.qw_validsequence >= QW_UPDATE_BACKUP-1)
+ cl.qw_validsequence = 0;
+ // request delta compression if appropriate
+ if (cl.qw_validsequence && !cl_nodelta.integer && cls.state == ca_connected && !cls.demorecording)
+ {
+ cl.qw_deltasequence[cls.netcon->qw.outgoing_sequence & QW_UPDATE_MASK] = cl.qw_validsequence;
+ MSG_WriteByte(&buf, qw_clc_delta);
+ MSG_WriteByte(&buf, cl.qw_validsequence & 255);
+ }
+ else
+ cl.qw_deltasequence[cls.netcon->qw.outgoing_sequence & QW_UPDATE_MASK] = -1;
+ }
+ else if (cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE)