]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fixed CL_SendMove packet rate limiting to not have a heartattack when going from...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 23 Apr 2005 07:38:48 +0000 (07:38 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 23 Apr 2005 07:38:48 +0000 (07:38 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5206 d7cf8633-e32d-0410-b094-e92efae38249

cl_input.c

index db36a23d997ee09b222a49a04421b8ec8c1f2c02..f4bb34f5c2cad8ba30b28da6341d33a09ac8e420 100644 (file)
@@ -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;