Skip to content

Commit a4e5cf8

Browse files
committed
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.
1 parent 0976d96 commit a4e5cf8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

engine/client/cl_frame.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,21 @@ static void CL_ProcessEntityUpdate( cl_entity_t *ent )
311311
if( FBitSet( ent->curstate.entityType, ENTITY_NORMAL ))
312312
COM_NormalizeAngles( ent->curstate.angles );
313313

314+
// a1ba: follow entities are sent with null origin, grab their aiment origin here
315+
//
316+
// null origin leads to triggered entity teleport check and subsequent reset of position history
317+
// and empty position history doesn't allow entity to render correctly
318+
//
319+
// it's probably should be done somewhere else, as goldsrc doesn't do this here
320+
// it has MoveAiments function but it's called after LinkPacketEntities :shrug:
321+
if( ent->curstate.movetype == MOVETYPE_FOLLOW && VectorIsNull( ent->curstate.origin ) && ent->curstate.aiment )
322+
{
323+
cl_entity_t *aiment = CL_GetEntityByIndex( ent->curstate.aiment );
324+
325+
if( aiment )
326+
VectorCopy( aiment->origin, ent->curstate.origin );
327+
}
328+
314329
parametric = ent->curstate.starttime != 0.0f && ent->curstate.impacttime != 0.0f;
315330

316331
// allow interpolation on bmodels too

0 commit comments

Comments
 (0)