]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
some slight cleanup of CL_LerpPoint, and now does a bound() on cl.time as well as...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 6 Feb 2007 08:43:08 +0000 (08:43 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 6 Feb 2007 08:43:08 +0000 (08:43 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6801 d7cf8633-e32d-0410-b094-e92efae38249

cl_main.c
cl_parse.c

index d3d41fe3846bd85b4ffa437cd3eddc4f45824ccf..fdd019a22ac4a81038daec83fac3fb0ce4b41a0e 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -507,14 +507,13 @@ static float CL_LerpPoint(void)
        cl.time = bound(cl.mtime[1], cl.time, cl.mtime[0]);
 
        // LordHavoc: lerp in listen games as the server is being capped below the client (usually)
-       f = cl.mtime[0] - cl.mtime[1];
-       if (!f || cl_nolerp.integer || cls.timedemo || (cl.islocalgame && !sv_fixedframeratesingleplayer.integer))
+       if (cl.mtime[0] <= cl.mtime[1] || cl_nolerp.integer || cls.timedemo || (cl.islocalgame && !sv_fixedframeratesingleplayer.integer))
        {
                cl.time = cl.mtime[0];
                return 1;
        }
 
-       f = (cl.time - cl.mtime[1]) / f;
+       f = (cl.time - cl.mtime[1]) / (cl.mtime[0] - cl.mtime[1]);
        return bound(0, f, 1);
 }
 
index 4c1bc80dd3cb39201478b5e552cb03345471e3d7..d2dbea235dad842318eac53ab7aef521983e6326 100644 (file)
@@ -2547,6 +2547,7 @@ void CL_ParseServerMessage(void)
        {
                cl.mtime[1] = cl.mtime[0];
                cl.mtime[0] = realtime; // qw has no clock
+               cl.time = bound(cl.mtime[1], cl.time, cl.mtime[0]);
                cl.timenonlerp = bound(cl.mtime[1], cl.timenonlerp, cl.mtime[0]);
                cl.onground = false; // since there's no clientdata parsing, clear the onground flag here
                // if true the cl.viewangles are interpolated from cl.mviewangles[]
@@ -2968,6 +2969,7 @@ void CL_ParseServerMessage(void)
                        case svc_time:
                                cl.mtime[1] = cl.mtime[0];
                                cl.mtime[0] = MSG_ReadFloat ();
+                               cl.time = bound(cl.mtime[1], cl.time, cl.mtime[0]);
                                cl.timenonlerp = bound(cl.mtime[1], cl.timenonlerp, cl.mtime[0]);
                                cl.movement_needupdate = true;
                                // if true the cl.viewangles are interpolated from cl.mviewangles[]