From a4e5cf8bac0bf35a07b94dc32ccd264496f82ac9 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Fri, 9 Jan 2026 18:50:22 +0500 Subject: [PATCH] engine: client: fix up origin of MOVETYPE_FOLLOW entities immediately after entity update This fixes an issue when MOVETYPE_FOLLOW entities seem to be "blinking". Explanation of what's happening is in the comment in the code. --- engine/client/cl_frame.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/engine/client/cl_frame.c b/engine/client/cl_frame.c index 605f8eb4..b0b66ad1 100644 --- a/engine/client/cl_frame.c +++ b/engine/client/cl_frame.c @@ -311,6 +311,21 @@ static void CL_ProcessEntityUpdate( cl_entity_t *ent ) if( FBitSet( ent->curstate.entityType, ENTITY_NORMAL )) COM_NormalizeAngles( ent->curstate.angles ); + // a1ba: follow entities are sent with null origin, grab their aiment origin here + // + // null origin leads to triggered entity teleport check and subsequent reset of position history + // and empty position history doesn't allow entity to render correctly + // + // it's probably should be done somewhere else, as goldsrc doesn't do this here + // it has MoveAiments function but it's called after LinkPacketEntities :shrug: + if( ent->curstate.movetype == MOVETYPE_FOLLOW && VectorIsNull( ent->curstate.origin ) && ent->curstate.aiment ) + { + cl_entity_t *aiment = CL_GetEntityByIndex( ent->curstate.aiment ); + + if( aiment ) + VectorCopy( aiment->origin, ent->curstate.origin ); + } + parametric = ent->curstate.starttime != 0.0f && ent->curstate.impacttime != 0.0f; // allow interpolation on bmodels too