From 0f84ce40f0e60afbbbe85556f477d060697fa2e9 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 6 Jun 2021 16:21:57 +0300 Subject: [PATCH] engine: client: fix cl_smoothtime, don't smooth movements when running local server(singleplayer, listenserve, etc) --- engine/client/cl_pmove.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/engine/client/cl_pmove.c b/engine/client/cl_pmove.c index f6a2d65e..3203a9ca 100644 --- a/engine/client/cl_pmove.c +++ b/engine/client/cl_pmove.c @@ -264,7 +264,9 @@ void CL_CheckPredictionError( void ) // save for error interpolation VectorCopy( delta, cl.local.prediction_error ); - if( dist > MIN_CORRECTION_DISTANCE ) + // GoldSrc checks for singleplayer + // we would check for local server + if( dist > MIN_CORRECTION_DISTANCE && !SV_Active() ) cls.correction_time = cl_smoothtime->value; } } @@ -1227,10 +1229,6 @@ void CL_PredictMovement( qboolean repredicting ) if( to_cmd->senttime >= host.realtime ) break; - // now interpolate some fraction of the final frame - if( to_cmd->senttime != from_cmd->senttime ) - f = (host.realtime - from_cmd->senttime) / (to_cmd->senttime - from_cmd->senttime) * 0.1; - from = to; from_cmd = to_cmd; } @@ -1263,8 +1261,10 @@ void CL_PredictMovement( qboolean repredicting ) return; } - f = bound( 0.0f, f, 1.0f ); - f = 0.0; // FIXME: make work, do revision + // now interpolate some fraction of the final frame + if( to_cmd->senttime != from_cmd->senttime ) + f = bound( 0.0, (host.realtime - from_cmd->senttime) / (to_cmd->senttime - from_cmd->senttime) * 0.1, 1.0 ); + else f = 0.0; if( CL_PlayerTeleported( from, to )) {