+ // 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();
+
+ // set button bits
+ // LordHavoc: added 6 new buttons and use and chat buttons, and prydon cursor active button
+ bits = 0;
+ if (in_attack.state & 3) bits |= 1;in_attack.state &= ~2;
+ if (in_jump.state & 3) bits |= 2;in_jump.state &= ~2;
+ if (in_button3.state & 3) bits |= 4;in_button3.state &= ~2;
+ if (in_button4.state & 3) bits |= 8;in_button4.state &= ~2;
+ if (in_button5.state & 3) bits |= 16;in_button5.state &= ~2;
+ if (in_button6.state & 3) bits |= 32;in_button6.state &= ~2;
+ if (in_button7.state & 3) bits |= 64;in_button7.state &= ~2;
+ if (in_button8.state & 3) bits |= 128;in_button8.state &= ~2;
+ if (in_use.state & 3) bits |= 256;in_use.state &= ~2;
+ if (key_dest != key_game || key_consoleactive) bits |= 512;
+ if (cl_prydoncursor.integer) bits |= 1024;
+ if (in_button9.state & 3) bits |= 2048;in_button9.state &= ~2;
+ if (in_button10.state & 3) bits |= 4096;in_button10.state &= ~2;
+ if (in_button11.state & 3) bits |= 8192;in_button11.state &= ~2;
+ if (in_button12.state & 3) bits |= 16384;in_button12.state &= ~2;
+ if (in_button13.state & 3) bits |= 32768;in_button13.state &= ~2;
+ if (in_button14.state & 3) bits |= 65536;in_button14.state &= ~2;
+ if (in_button15.state & 3) bits |= 131072;in_button15.state &= ~2;
+ if (in_button16.state & 3) bits |= 262144;in_button16.state &= ~2;
+ // button bits 19-31 unused currently
+ // rotate/zoom view serverside if PRYDON_CLIENTCURSOR cursor is at edge of screen
+ if (cl.cmd.cursor_screen[0] <= -1) bits |= 8;
+ if (cl.cmd.cursor_screen[0] >= 1) bits |= 16;
+ if (cl.cmd.cursor_screen[1] <= -1) bits |= 32;
+ if (cl.cmd.cursor_screen[1] >= 1) bits |= 64;
+ cl.cmd.buttons = bits;
+
+ // set impulse
+ cl.cmd.impulse = in_impulse;
+ in_impulse = 0;
+
+ // movement is set by input code (forwardmove/sidemove/upmove)
+
+ // set viewangles
+ VectorCopy(cl.viewangles, cl.cmd.viewangles);
+
+ msecdelta = (int)(floor(cl.cmd.time * 1000) - floor(cl.movecmd[0].time * 1000));
+ cl.cmd.msec = (unsigned char)bound(0, msecdelta, 255);
+ // ridiculous value rejection (matches qw)
+ if (cl.cmd.msec > 250)
+ cl.cmd.msec = 100;
+
+ cl.cmd.predicted = cl_movement.integer;
+
+ // always dump the first two messages, because they may contain leftover inputs from the last level
+ if (cl.cmd.sequence <= 2)
+ cl.cmd.forwardmove = cl.cmd.sidemove = cl.cmd.upmove = cl.cmd.impulse = cl.cmd.buttons = 0;
+
+ // update the cl.movecmd array which holds the most recent moves
+ for (i = CL_MAX_USERCMDS - 1;i >= 1;i--)
+ cl.movecmd[i] = cl.movecmd[i-1];
+ cl.movecmd[0] = cl.cmd;