Improvements in time accounting. Accurate to +-0.5ms, instead of -1,0 like

others.

Based on Grievre's and zquake's code.
This commit is contained in:
Ragnvald Maartmann-Moe IV 2004-02-02 21:18:11 +00:00
parent f8bc0ba9e2
commit cb94d50500

View file

@ -566,6 +566,7 @@ static void
CL_FinishMove (usercmd_t *cmd)
{
int ms, i;
static double accum = 0.0;
// always dump the first two message, because it may contain leftover
// inputs from the last level
@ -588,9 +589,14 @@ CL_FinishMove (usercmd_t *cmd)
// 1999-10-29 +USE fix by Maddes end
// send milliseconds of time to apply the move
ms = host_frametime * 1000;
if (ms > 250)
accum += (host_frametime * 1000.0);
ms = accum + 0.5;
accum -= ms;
if (ms > 250) {
ms = 100; // time was unreasonable
accum = 0.0;
}
cmd->msec = ms;
VectorCopy (cl.viewangles, cmd->angles);