]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added cl_nettimesyncmode 5 (now the default), this is very similar to
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 13 Apr 2007 22:08:32 +0000 (22:08 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 13 Apr 2007 22:08:32 +0000 (22:08 +0000)
cl_nettimesyncmode 1 but allows up to 1 millisecond fluctuations

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7089 d7cf8633-e32d-0410-b094-e92efae38249

cl_parse.c

index 76b1f80626583633db59a30a4da5f8714c792160..432852aaf4b500d91ac2d9db8e06c6f76d6527d9 100644 (file)
@@ -167,7 +167,7 @@ cvar_t cl_sound_ric3 = {0, "cl_sound_ric3", "weapons/ric3.wav", "sound to play w
 cvar_t cl_sound_r_exp3 = {0, "cl_sound_r_exp3", "weapons/r_exp3.wav", "sound to play during TE_EXPLOSION and related effects (empty cvar disables sound)"};
 cvar_t cl_serverextension_download = {0, "cl_serverextension_download", "0", "indicates whether the server supports the download command"};
 cvar_t cl_joinbeforedownloadsfinish = {0, "cl_joinbeforedownloadsfinish", "1", "if non-zero the game will begin after the map is loaded before other downloads finish"};
-cvar_t cl_nettimesyncmode = {0, "cl_nettimesyncmode", "2", "selects method of time synchronization in client with regard to server packets, values are: 0 = no sync, 1 = exact sync (reset timing each packet), 2 = loose sync (reset timing only if it is out of bounds), 3 = tight sync and bounding, 4 = bounded loose sync (reset if significantly wrong, otherwise bound)"};
+cvar_t cl_nettimesyncmode = {0, "cl_nettimesyncmode", "5", "selects method of time synchronization in client with regard to server packets, values are: 0 = no sync, 1 = exact sync (reset timing each packet), 2 = loose sync (reset timing only if it is out of bounds), 3 = tight sync and bounding, 4 = bounded loose sync (reset if significantly wrong, otherwise bound), 5 = nearly-exact sync (if time is deviating by more than a millisecond it uses exact sync, otherwise no sync)"};
 cvar_t cl_iplog_name = {CVAR_SAVE, "cl_iplog_name", "darkplaces_iplog.txt", "name of iplog file containing player addresses for iplog_list command and automatic ip logging when parsing status command"};
 
 static qboolean QW_CL_CheckOrDownloadFile(const char *filename);
@@ -2793,6 +2793,12 @@ static void CL_NetworkTimeReceived(double newtime)
                        // clamp it to the valid range
                        cl.time = bound(cl.mtime[1], cl.time, cl.mtime[0]);
                }
+               else if (cl_nettimesyncmode.integer == 5)
+               {
+                       // if it's more than one millisecond off, fix it
+                       if (fabs(cl.time - cl.mtime[1]) > 0.001)
+                               cl.time = cl.mtime[1];
+               }
                else if (cl_nettimesyncmode.integer)
                        cl.time = cl.mtime[1];
        }