This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
void KeyDown (kbutton_t *b)
{
- int k;
- char *c;
+ int k;
+ const char *c;
c = Cmd_Argv(1);
if (c[0])
Con_Printf ("Three keys down for a button!\n");
return;
}
-
+
if (b->state & 1)
return; // still down
b->state |= 1 + 2; // down + impulse down
void KeyUp (kbutton_t *b)
{
- int k;
- char *c;
-
+ int k;
+ const char *c;
+
c = Cmd_Argv(1);
if (c[0])
k = atoi(c);
{
float val;
qboolean impulsedown, impulseup, down;
-
+
impulsedown = key->state & 2;
impulseup = key->state & 4;
down = key->state & 1;
val = 0;
-
+
if (impulsedown && !impulseup)
{
if (down)
}
key->state &= 1; // clear impulses
-
+
return val;
}
cvar_t cl_anglespeedkey = {CVAR_SAVE, "cl_anglespeedkey","1.5"};
+cvar_t cl_nodelta = {0, "cl_nodelta", "0"};
/*
================
================
*/
void CL_BaseMove (usercmd_t *cmd)
-{
+{
if (cls.signon != SIGNONS)
return;
-
+
CL_AdjustAngles ();
-
+
memset (cmd, 0, sizeof(*cmd));
-
+
if (in_strafe.state & 1)
{
cmd->sidemove += cl_sidespeed.value * CL_KeyState (&in_right);
cmd->upmove -= cl_upspeed.value * CL_KeyState (&in_down);
if (! (in_klook.state & 1) )
- {
+ {
cmd->forwardmove += cl_forwardspeed.value * CL_KeyState (&in_forward);
cmd->forwardmove -= cl_backspeed.value * CL_KeyState (&in_back);
- }
+ }
//
// adjust for speed key
CL_SendMove
==============
*/
-void CL_SendMove (usercmd_t *cmd)
+void CL_SendMove(usercmd_t *cmd)
{
- int i;
- int bits;
- sizebuf_t buf;
- qbyte data[128];
+ int i;
+ int bits;
+ sizebuf_t buf;
+ qbyte data[128];
static double lastmovetime;
static float forwardmove, sidemove, upmove, total; // accumulation
upmove += cmd->upmove;
total++;
// LordHavoc: cap outgoing movement messages to sys_ticrate
- if ((cl.maxclients > 1) && (realtime - lastmovetime < sys_ticrate.value))
+ if (!cl.islocalgame && (realtime - lastmovetime < sys_ticrate.value))
return;
lastmovetime = realtime;
// average what has happened during this time
cl.cmd = *cmd;
-//
-// send the movement message
-//
- MSG_WriteByte (&buf, clc_move);
+ // send the movement message
+ MSG_WriteByte (&buf, clc_move);
MSG_WriteFloat (&buf, cl.mtime[0]); // so server can get ping times
for (i = 0;i < 3;i++)
MSG_WriteFloat (&buf, cl.viewangles[i]);
}
- else if (dpprotocol == DPPROTOCOL_VERSION1)
+ else if (dpprotocol == DPPROTOCOL_VERSION1 || dpprotocol == DPPROTOCOL_VERSION4)
{
for (i=0 ; i<3 ; i++)
MSG_WritePreciseAngle (&buf, cl.viewangles[i]);
MSG_WriteAngle (&buf, cl.viewangles[i]);
}
- MSG_WriteShort (&buf, forwardmove);
- MSG_WriteShort (&buf, sidemove);
- MSG_WriteShort (&buf, upmove);
+ MSG_WriteShort (&buf, forwardmove);
+ MSG_WriteShort (&buf, sidemove);
+ MSG_WriteShort (&buf, upmove);
forwardmove = sidemove = upmove = 0;
-//
-// send button bits
-//
+ // send button bits
bits = 0;
if ( in_attack.state & 3 )
if (in_button7.state & 3) bits |= 64;in_button7.state &= ~2;
if (in_button8.state & 3) bits |= 128;in_button8.state &= ~2;
- MSG_WriteByte (&buf, bits);
+ MSG_WriteByte (&buf, bits);
- MSG_WriteByte (&buf, in_impulse);
+ MSG_WriteByte (&buf, in_impulse);
in_impulse = 0;
- // LordHavoc: should we ack this on receipt instead? would waste net bandwidth though
- i = EntityFrame_MostRecentlyRecievedFrameNum(&cl.entitydatabase);
- if (i > 0)
+ if (dpprotocol == DPPROTOCOL_VERSION1 || dpprotocol == DPPROTOCOL_VERSION2 || dpprotocol == DPPROTOCOL_VERSION3)
+ {
+ // LordHavoc: should we ack this on receipt instead? would waste net bandwidth though
+ i = EntityFrame_MostRecentlyRecievedFrameNum(&cl.entitydatabase);
+ if (i > 0)
+ {
+ MSG_WriteByte(&buf, clc_ackentities);
+ MSG_WriteLong(&buf, i);
+ }
+ }
+ else
{
- MSG_WriteByte (&buf, clc_ackentities);
- MSG_WriteLong (&buf, i);
+ if (cl.entitydatabase4)
+ {
+ MSG_WriteByte(&buf, clc_ackentities);
+ if (cl_nodelta.integer)
+ MSG_WriteLong(&buf, -1);
+ else
+ MSG_WriteLong(&buf, cl.entitydatabase4->ackframenum);
+ }
}
-//
-// deliver the message
-//
+ // deliver the message
if (cls.demoplayback)
return;
-//
-// always dump the first two messages, because they may contain leftover inputs from the last level
-//
+ // always dump the first two messages, because they may contain leftover inputs from the last level
if (++cl.movemessages <= 2)
return;
- if (NET_SendUnreliableMessage (cls.netcon, &buf) == -1)
+ if (NetConn_SendUnreliableMessage(cls.netcon, &buf) == -1)
{
- Con_Printf ("CL_SendMove: lost server connection\n");
- CL_Disconnect ();
+ Con_Printf("CL_SendMove: lost server connection\n");
+ CL_Disconnect();
}
}
Cmd_AddCommand ("-button7", IN_Button7Up);
Cmd_AddCommand ("+button8", IN_Button8Down);
Cmd_AddCommand ("-button8", IN_Button8Up);
+
+ Cvar_RegisterVariable(&cl_nodelta);
}