]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
cl_parse: Further optimize CL_NetworkTimeReceived
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 11 Apr 2021 16:46:12 +0000 (16:46 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 11 Apr 2021 16:46:12 +0000 (16:46 +0000)
Authored by bones_was_here
https://gitlab.com/xonotic/darkplaces/-/merge_requests/112

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

cl_parse.c

index 997777146c5502ffd271a43068363ff14d521188..ea55f8e65f775533bfd92f72454352fad9055d7d 100644 (file)
@@ -3278,7 +3278,6 @@ extern cvar_t host_timescale;
 extern cvar_t cl_lerpexcess;
 static void CL_NetworkTimeReceived(double newtime)
 {
-       double timehigh;
        cl.mtime[1] = cl.mtime[0];
        cl.mtime[0] = newtime;
        if (cl_nolerp.integer || cls.timedemo || cl.mtime[1] == cl.mtime[0] || cls.signon < SIGNONS)
@@ -3293,7 +3292,9 @@ static void CL_NetworkTimeReceived(double newtime)
        }
        else if (cls.protocol != PROTOCOL_QUAKEWORLD)
        {
+               double timehigh;
                cl.mtime[1] = max(cl.mtime[1], cl.mtime[0] - 0.1);
+
                if (developer_extra.integer && vid_activewindow)
                {
                        if (cl.time < cl.mtime[1] - (cl.mtime[0] - cl.mtime[1]))
@@ -3301,8 +3302,14 @@ static void CL_NetworkTimeReceived(double newtime)
                        else if (cl.time > cl.mtime[0] + (cl.mtime[0] - cl.mtime[1]))
                                Con_DPrintf("--- cl.time > cl.mtime[0] (%f > %f ... %f)\n", cl.time, cl.mtime[1], cl.mtime[0]);
                }
-               cl.time += (cl.mtime[1] - cl.time) * bound(0, cl_nettimesyncfactor.value, 1);
-               timehigh = cl.mtime[1] + (cl.mtime[0] - cl.mtime[1]) * cl_nettimesyncboundtolerance.value;
+
+               if (cl_nettimesyncboundmode.integer < 4)
+               {
+                       // doesn't make sense for modes > 3
+                       cl.time += (cl.mtime[1] - cl.time) * bound(0, cl_nettimesyncfactor.value, 1);
+                       timehigh = cl.mtime[1] + (cl.mtime[0] - cl.mtime[1]) * cl_nettimesyncboundtolerance.value;
+               }
+
                switch (cl_nettimesyncboundmode.integer)
                {
                case 1: