From debadff4958817c707ed86ba0be4d7f1580defc7 Mon Sep 17 00:00:00 2001 From: Kamay Xutax Date: Wed, 31 Jan 2024 15:34:40 +0100 Subject: [PATCH] Add a way to set to tick interval cl_interp --- game/client/cdll_bounded_cvars.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/game/client/cdll_bounded_cvars.cpp b/game/client/cdll_bounded_cvars.cpp index e79454209b..70ba4dd921 100644 --- a/game/client/cdll_bounded_cvars.cpp +++ b/game/client/cdll_bounded_cvars.cpp @@ -7,8 +7,10 @@ #include "cbase.h" #include "cdll_bounded_cvars.h" +#include "cdll_client_int.h" #include "convar_serverbounded.h" #include "icvar.h" +#include "shareddefs.h" #include "tier0/icommandline.h" @@ -100,23 +102,30 @@ class CBoundedCvar_Interp : public ConVar_ServerBounded public: CBoundedCvar_Interp() : ConVar_ServerBounded( "cl_interp", - "0.0", + "-1.0", FCVAR_USERINFO, - "Sets the interpolation amount (bounded on low side by server interp ratio settings).", true, 0.0f, true, 0.5f ) + "Sets the interpolation amount (bounded on low side by server interp ratio settings).", true, -1.0f, true, 0.5f ) { } virtual float GetFloat() const { + float value = GetBaseFloatValue(); + + if (value < 0.0f) + { + value = TICK_INTERVAL; + } + static const ConVar *pUpdateRate = g_pCVar->FindVar( "cl_updaterate" ); static const ConVar *pMin = g_pCVar->FindVar( "sv_client_min_interp_ratio" ); if ( pUpdateRate && pMin && pMin->GetFloat() != -1 ) { - return MAX( GetBaseFloatValue(), pMin->GetFloat() / pUpdateRate->GetFloat() ); + return MAX( value, pMin->GetFloat() / pUpdateRate->GetFloat() ); } else { - return GetBaseFloatValue(); + return value; } } };