+ if (cls.protocol == PROTOCOL_QUAKEWORLD)
+ {
+ int checksumindex;
+
+ CL_ClientMovement_Input((cl.movecmd[0].buttons & 2) != 0, false);
+
+ MSG_WriteByte(&buf, qw_clc_move);
+ // save the position for a checksum byte
+ checksumindex = buf.cursize;
+ MSG_WriteByte(&buf, 0);
+ // packet loss percentage
+ for (j = 0, packetloss = 0;j < NETGRAPH_PACKETS;j++)
+ if (cls.netcon->incoming_unreliablesize[j] == NETGRAPH_LOSTPACKET)
+ packetloss++;
+ packetloss = packetloss * 100 / NETGRAPH_PACKETS;
+ MSG_WriteByte(&buf, packetloss);
+ // write most recent 3 moves
+ QW_MSG_WriteDeltaUsercmd(&buf, &nullcmd, &cl.movecmd[2]);
+ QW_MSG_WriteDeltaUsercmd(&buf, &cl.movecmd[2], &cl.movecmd[1]);
+ QW_MSG_WriteDeltaUsercmd(&buf, &cl.movecmd[1], &cl.movecmd[0]);
+ // 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.signon == SIGNONS)
+ {
+ if (cls.protocol == PROTOCOL_QUAKE || cls.protocol == PROTOCOL_QUAKEDP || cls.protocol == PROTOCOL_NEHAHRAMOVIE)
+ {
+ // 5 bytes
+ MSG_WriteByte (&buf, clc_move);
+ MSG_WriteFloat (&buf, cl.movecmd[0].time); // last server packet time
+ // 3 bytes
+ for (i = 0;i < 3;i++)
+ MSG_WriteAngle8i (&buf, cl.movecmd[0].viewangles[i]);
+ // 6 bytes
+ MSG_WriteCoord16i (&buf, cl.movecmd[0].forwardmove);
+ MSG_WriteCoord16i (&buf, cl.movecmd[0].sidemove);
+ MSG_WriteCoord16i (&buf, cl.movecmd[0].upmove);
+ // 2 bytes
+ MSG_WriteByte (&buf, cl.movecmd[0].buttons);
+ MSG_WriteByte (&buf, cl.movecmd[0].impulse);
+ }
+ else if (cls.protocol == PROTOCOL_DARKPLACES2 || cls.protocol == PROTOCOL_DARKPLACES3)
+ {
+ // 5 bytes
+ MSG_WriteByte (&buf, clc_move);
+ MSG_WriteFloat (&buf, cl.movecmd[0].time); // last server packet time
+ // 12 bytes
+ for (i = 0;i < 3;i++)
+ MSG_WriteAngle32f (&buf, cl.movecmd[0].viewangles[i]);
+ // 6 bytes
+ MSG_WriteCoord16i (&buf, cl.movecmd[0].forwardmove);
+ MSG_WriteCoord16i (&buf, cl.movecmd[0].sidemove);
+ MSG_WriteCoord16i (&buf, cl.movecmd[0].upmove);
+ // 2 bytes
+ MSG_WriteByte (&buf, cl.movecmd[0].buttons);
+ MSG_WriteByte (&buf, cl.movecmd[0].impulse);
+ }
+ else if (cls.protocol == PROTOCOL_DARKPLACES1 || cls.protocol == PROTOCOL_DARKPLACES4 || cls.protocol == PROTOCOL_DARKPLACES5)
+ {
+ // 5 bytes
+ MSG_WriteByte (&buf, clc_move);
+ MSG_WriteFloat (&buf, cl.movecmd[0].time); // last server packet time
+ // 6 bytes
+ for (i = 0;i < 3;i++)
+ MSG_WriteAngle16i (&buf, cl.movecmd[0].viewangles[i]);
+ // 6 bytes
+ MSG_WriteCoord16i (&buf, cl.movecmd[0].forwardmove);
+ MSG_WriteCoord16i (&buf, cl.movecmd[0].sidemove);
+ MSG_WriteCoord16i (&buf, cl.movecmd[0].upmove);
+ // 2 bytes
+ MSG_WriteByte (&buf, cl.movecmd[0].buttons);
+ MSG_WriteByte (&buf, cl.movecmd[0].impulse);
+ }
+ else if (cls.signon == SIGNONS)