From a7ff55a9330f06f7d7c8bfaade76cb854e18afc0 Mon Sep 17 00:00:00 2001 From: havoc Date: Tue, 6 Feb 2007 08:43:08 +0000 Subject: [PATCH] some slight cleanup of CL_LerpPoint, and now does a bound() on cl.time as well as cl.timenonlerp whenever cl.mtime[] is updated git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6801 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_main.c | 5 ++--- cl_parse.c | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cl_main.c b/cl_main.c index d3d41fe3..fdd019a2 100644 --- 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); } diff --git a/cl_parse.c b/cl_parse.c index 4c1bc80d..d2dbea23 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -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[] -- 2.39.2