From 49f972a7c924b73128d8f9ebd3c22fec4b8bb288 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 4 Jan 2024 05:05:03 +0300 Subject: [PATCH] engine: add new engine feature ENGINE_STEP_POSHISTORY_LERP that enables CStrike's MOVETYPE_STEP lerp based on position history --- common/enginefeatures.h | 5 ++++- engine/client/cl_frame.c | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/common/enginefeatures.h b/common/enginefeatures.h index 8fe254d0..f2f9e199 100644 --- a/common/enginefeatures.h +++ b/common/enginefeatures.h @@ -27,6 +27,8 @@ GNU General Public License for more details. #define ENGINE_COMPUTE_STUDIO_LERP (1<<7) // enable MOVETYPE_STEP lerping back in engine #define ENGINE_LINEAR_GAMMA_SPACE (1<<8) // disable influence of gamma/brightness cvars to textures/lightmaps, for mods with custom renderer +#define ENGINE_STEP_POSHISTORY_LERP (1U<<31) // enable MOVETYPE_STEP interpolation based on position history. Incompatible with ENGINE_COMPUTE_STUDIO_LERP! + // adjust the mask when features will be added or removed #define ENGINE_FEATURES_MASK \ ( ENGINE_WRITE_LARGE_COORD \ @@ -37,6 +39,7 @@ GNU General Public License for more details. | ENGINE_COMPENSATE_QUAKE_BUG \ | ENGINE_IMPROVED_LINETRACE \ | ENGINE_COMPUTE_STUDIO_LERP \ - | ENGINE_LINEAR_GAMMA_SPACE ) + | ENGINE_LINEAR_GAMMA_SPACE \ + | ENGINE_STEP_POSHISTORY_LERP ) #endif//FEATURES_H diff --git a/engine/client/cl_frame.c b/engine/client/cl_frame.c index b6409036..1b02899a 100644 --- a/engine/client/cl_frame.c +++ b/engine/client/cl_frame.c @@ -189,7 +189,7 @@ CL_ParametricMove check for parametrical moved entities ================== */ -qboolean CL_ParametricMove( cl_entity_t *ent ) +static qboolean CL_ParametricMove( cl_entity_t *ent ) { float frac, dt, t; vec3_t delta; @@ -1279,7 +1279,10 @@ void CL_LinkPacketEntities( frame_t *frame ) if ( !CL_InterpolateModel( ent )) continue; } - else if( ent->curstate.movetype == MOVETYPE_STEP && !NET_IsLocalAddress( cls.netchan.remote_address )) + // a1ba: in GoldSrc this is done for cstrike and czero + // but let modders use this as an engine feature + else if( FBitSet( host.features, ENGINE_STEP_POSHISTORY_LERP ) && + ent->curstate.movetype == MOVETYPE_STEP && !NET_IsLocalAddress( cls.netchan.remote_address )) { if( !CL_InterpolateModel( ent )) continue;