Skip to content

Commit

Permalink
Events: avoid entity events from recently freed/reused entities. caus…
Browse files Browse the repository at this point in the history
…es issues at large timescales such as during cutscene skipping.
  • Loading branch information
redsaurus committed Jul 1, 2020
1 parent bc31875 commit 968b8ac
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions code/cgame/cg_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,14 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
return;
}

if ( cg_skippingcin.integer )
{
return;
}
//When skipping a cutscene the timescale is drastically increased, causing entities to be freed
//and possibly reused between the snapshot currentState and the actual state of the gent when accessed.
//We try to avoid this issue by ignoring events on entities that have been freed since the snapshot.

if (cent->gent->freetime > cent->snapShotTime)
{
return;
}

//ci = &cent->gent->client->clientInfo;
clientNum = cent->gent->s.number;
Expand Down

0 comments on commit 968b8ac

Please sign in to comment.