- // don't send too often or else network connections can get clogged by a high renderer framerate
- packettime = cl.movevars_ticrate;
- // quakeworld servers take only frametimes
- // predicted dp7 servers take current interpolation time
- // unpredicted servers take an echo of the latest server timestamp
- if (cls.protocol == PROTOCOL_QUAKEWORLD)
- {
- if (realtime < lastsendtime + packettime)
- return;
- cl.cmd.time = realtime;
- cl.cmd.sequence = cls.netcon->qw.outgoing_sequence;
- }
- else if (cl.movement_predicted)
- {
- if (realtime < lastsendtime + packettime)
- return;
- cl.cmd.time = cl.time;
- cl.cmd.sequence = cls.movesequence;
- }
- else
- {
- // unpredicted movement should be sent immediately whenever a server
- // packet is received, to minimize ping times
- if (!cl.movement_needupdate && realtime < lastsendtime + packettime)
- return;
- if (cl.mtime[0] == cl.movecmd[0].time && cl.mtime[1] != cl.mtime[0])
- return;
- cl.cmd.time = cl.mtime[0];
- cl.cmd.sequence = cls.movesequence;
- }
-
- // 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 = bound(realtime, lastsendtime + packettime, realtime + packettime);
- // set the flag indicating that we sent a packet recently
- cl.movement_needupdate = false;
-
- buf.maxsize = sizeof(data);
- buf.cursize = 0;
- buf.data = data;
-
- // conditions for sending a move:
- // if the move advances time or if the game is paused (in which case time
- // is not advancing)
- // don't send a new input packet if the connection is still saturated from
- // the last one (or chat messages, etc)
- // note: this behavior comes from QW
- if ((cls.protocol == PROTOCOL_QUAKEWORLD || cls.signon == SIGNONS) && !NetConn_CanSend(cls.netcon))
- return;
-
- // increase the move counter since we intend to send a move
- cls.movesequence++;
-
- // send the movement message
- // PROTOCOL_QUAKE clc_move = 16 bytes total
- // PROTOCOL_QUAKEDP clc_move = 16 bytes total
- // PROTOCOL_NEHAHRAMOVIE clc_move = 16 bytes total
- // PROTOCOL_DARKPLACES1 clc_move = 19 bytes total
- // PROTOCOL_DARKPLACES2 clc_move = 25 bytes total
- // PROTOCOL_DARKPLACES3 clc_move = 25 bytes total
- // PROTOCOL_DARKPLACES4 clc_move = 19 bytes total
- // PROTOCOL_DARKPLACES5 clc_move = 19 bytes total
- // PROTOCOL_DARKPLACES6 clc_move = 52 bytes total
- // PROTOCOL_DARKPLACES7 clc_move = 56 bytes total per move (can be up to 16 moves)
- // PROTOCOL_QUAKEWORLD clc_move = 34 bytes total (typically, but can reach 43 bytes, or even 49 bytes with roll)
-
- // set prydon cursor info
- CL_UpdatePrydonCursor();