/* * =============== * CG_TransitionEntity * * cent->nextState is moved to cent->currentState and events are fired * =============== */ static void CG_TransitionEntity(centity_t *cent) { cent->currentState = cent->nextState; cent->currentValid = true; // reset if the entity wasn't in the last frame or was teleported if (!cent->interpolate) { CG_ResetEntity(cent); } // clear the next state. if will be set by the next CG_SetNextSnap cent->interpolate = false; // check for events CG_CheckEvents(cent); }
/* * ================== * CG_ResetEntity * ================== */ static void CG_ResetEntity(centity_t *cent) { // if the previous snapshot this entity was updated in is at least // an event window back in time then we can reset the previous event if (cent->snapShotTime < cg.time - EVENT_VALID_MSEC) { cent->previousEvent = 0; } cent->trailTime = cg.snap->serverTime; VectorCopy(cent->currentState.origin, cent->lerpOrigin); VectorCopy(cent->currentState.angles, cent->lerpAngles); if (cent->currentState.eType == ET_PLAYER) { CG_ResetPlayerEntity(cent); } }