]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_parse.c
EF_LOWPRECISION is now default on all entities except the player, this
[xonotic/darkplaces.git] / cl_parse.c
index eb33a388fdf413e19ef9e24485bd8ea5f7032b21..c234fb740b4b4ef85e12c1df22a2a4055ac2a63e 100644 (file)
@@ -166,8 +166,8 @@ cvar_t cl_sound_ric2 = {0, "cl_sound_ric2", "weapons/ric2.wav", "sound to play w
 cvar_t cl_sound_ric3 = {0, "cl_sound_ric3", "weapons/ric3.wav", "sound to play with 10% chance during TE_SPIKE/TE_SUPERSPIKE (empty cvar disables sound)"};
 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"};
+cvar_t cl_joinbeforedownloadsfinish = {CVAR_SAVE, "cl_joinbeforedownloadsfinish", "1", "if non-zero the game will begin after the map is loaded before other downloads finish"};
+cvar_t cl_nettimesyncmode = {CVAR_SAVE, "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 = loose sync with low tolerance (reset timing if slightly out of bounds), 6 = adaptive sync (tries to correct timing errors gradually), 7  = adaptive sync + loose sync (adapts slowly to reduce cumulative error, and also corrects large errors immediately)"};
 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);
@@ -2773,7 +2773,7 @@ static void CL_NetworkTimeReceived(double newtime)
        {
                cl.mtime[1] = max(cl.mtime[0], newtime - 0.1);
                cl.mtime[0] = newtime;
-               if (developer.integer >= 10)
+               if (developer.integer >= 100 && vid_activewindow)
                {
                        if (cl.time < cl.mtime[1] - (cl.mtime[0] - cl.mtime[1]))
                                Con_Printf("--- cl.time < cl.mtime[1] (%f < %f ... %f)\n", cl.time, cl.mtime[1], cl.mtime[0]);
@@ -2782,7 +2782,28 @@ static void CL_NetworkTimeReceived(double newtime)
                }
                if (cl_nettimesyncmode.integer == 2)
                {
-                       if (cl.time < cl.mtime[1] || cl.time > cl.mtime[0] + (cl.mtime[0] - cl.mtime[1]))
+                       if (cl.time < cl.mtime[1] || cl.time > cl.mtime[0])
+                               cl.time = cl.mtime[1];
+               }
+               else if (cl_nettimesyncmode.integer == 4)
+               {
+                       // if it's significantly out of bounds, reset it to cl.mtime[1]
+                       if (cl.time > cl.mtime[0] + (cl.mtime[0] - cl.mtime[1]))
+                               cl.time = cl.mtime[1];
+                       // clamp it to the valid range
+                       cl.time = bound(cl.mtime[1], cl.time, cl.mtime[0]);
+               }
+               else if (cl_nettimesyncmode.integer == 5)
+               {
+                       if (cl.time < cl.mtime[1] || cl.time > cl.mtime[1] + (cl.mtime[0] - cl.mtime[1]) / (4.0))
+                               cl.time = cl.mtime[1];
+               }
+               else if (cl_nettimesyncmode.integer == 6)
+                       cl.time = cl.mtime[1] * (1.0 / 8.0) + cl.time * (7.0 / 8.0);
+               else if (cl_nettimesyncmode.integer == 7)
+               {
+                       cl.time = cl.mtime[1] * (1.0 / 16.0) + cl.time * (15.0 / 16.0);
+                       if (cl.time < cl.mtime[1] || cl.time > cl.mtime[1] + (cl.mtime[0] - cl.mtime[1]) / (4.0))
                                cl.time = cl.mtime[1];
                }
                else if (cl_nettimesyncmode.integer)