cvar_t m_filter = {CVAR_SAVE, "m_filter","0", "smoothes mouse movement, less responsive but smoother aiming"};
+cvar_t cl_netinputpacketspersecond = {CVAR_SAVE, "cl_netinputpacketspersecond","50", "how many input packets to send to server each second"};
+
/*
================
CL_SendMove
==============
*/
+extern cvar_t cl_netinputpacketspersecond;
void CL_SendMove(void)
{
int i;
int bits;
sizebuf_t buf;
unsigned char data[128];
+ static double lastsendtime = 0;
#define MOVEAVERAGING 0
#if MOVEAVERAGING
static float forwardmove, sidemove, upmove, total; // accumulation
#endif
if (cls.signon != SIGNONS)
return;
+ if (realtime < lastsendtime + 1.0 / bound(10, cl_netinputpacketspersecond.value, 100))
+ return;
+ // 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 = max(lastsendtime + 1.0 / bound(10, cl_netinputpacketspersecond.value, 100), realtime);
#if MOVEAVERAGING
// average the accumulated changes
total = 1.0f / total;
Cvar_RegisterVariable(&in_pitch_min);
Cvar_RegisterVariable(&in_pitch_max);
Cvar_RegisterVariable(&m_filter);
+
+ Cvar_RegisterVariable(&cl_netinputpacketspersecond);
}
Host_Error("CL_WriteToServer: lost server connection");
SZ_Clear(&cls.netcon->message);
}
+
+ // send a move periodically
+ CL_SendMove();
}
// LordHavoc: pausedemo command
unsigned char cmdlog[32];
char *cmdlogname[32], *temp;
int cmdindex, cmdcount = 0;
- qboolean sendmove = false;
if (cls.demorecording)
CL_WriteDemoMessage ();
case svc_time:
cl.mtime[1] = cl.mtime[0];
cl.mtime[0] = MSG_ReadFloat ();
- sendmove = true;
break;
case svc_clientdata:
EntityFrameQuake_ISeeDeadEntities();
- if (sendmove)
- {
- // send one move per server frame
- CL_SendMove();
- }
-
parsingerror = false;
}