From 858e36c0a6a3bd0983272b8830d8f941fcb7ba6c Mon Sep 17 00:00:00 2001 From: havoc Date: Sat, 23 Apr 2005 07:38:48 +0000 Subject: [PATCH] fixed CL_SendMove packet rate limiting to not have a heartattack when going from singleplayer to multiplayer (this was causing the player to be stuck in place for a very long time) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5206 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_input.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cl_input.c b/cl_input.c index db36a23d..f4bb34f5 100644 --- a/cl_input.c +++ b/cl_input.c @@ -414,7 +414,7 @@ void CL_SendMove(void) int bits; sizebuf_t buf; qbyte data[128]; - static double lastmovetime = 0; + static double nextmovetime = 0; #define MOVEAVERAGING 0 #if MOVEAVERAGING static float forwardmove, sidemove, upmove, total; // accumulation @@ -432,9 +432,10 @@ void CL_SendMove(void) total++; #endif // LordHavoc: cap outgoing movement messages to sys_ticrate - if (!cl.islocalgame && (realtime - lastmovetime < sys_ticrate.value)) + nextmovetime = bound(realtime - sys_ticrate.value, nextmovetime, realtime + sys_ticrate.value); + if (!cl.islocalgame && realtime < nextmovetime) return; - lastmovetime = max(lastmovetime + sys_ticrate.value, realtime); + nextmovetime += sys_ticrate.value; #if MOVEAVERAGING // average the accumulated changes total = 1.0f / total; -- 2.39.2