From: havoc Date: Sun, 15 Apr 2007 22:13:01 +0000 (+0000) Subject: added cl_nettimesyncmode 7 (adaptive + loose sync) X-Git-Tag: xonotic-v0.1.0preview~3328 X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=999cb0d9f3f4f66a9f6447acee596c8b5b82d26a;p=xonotic%2Fdarkplaces.git added cl_nettimesyncmode 7 (adaptive + loose sync) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7102 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_parse.c b/cl_parse.c index 37fedef0..e43ad5da 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -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", "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)"}; +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 = 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); @@ -2799,7 +2799,13 @@ static void CL_NetworkTimeReceived(double newtime) cl.time = cl.mtime[1]; } else if (cl_nettimesyncmode.integer == 6) - cl.time = cl.mtime[1] * 0.125 + cl.time * 0.875; + 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) cl.time = cl.mtime[1]; }