/* =============== CG_DoorAnimation =============== */ static void CG_DoorAnimation( centity_t *cent, int *old, int *now, float *backLerp ) { CG_RunLerpFrame( ¢->lerpFrame ); *old = cent->lerpFrame.oldFrame; *now = cent->lerpFrame.frame; *backLerp = cent->lerpFrame.backlerp; }
void CG_RunMD5LerpFrame( lerpFrame_t *lf, float scale, bool animChanged ) { if (animChanged) { lf->frame = lf->oldFrame = 0; lf->frameTime = lf->oldFrameTime = cg.time; } CG_RunLerpFrame(lf, scale); }
/* =============== CG_WeaponAnimation =============== */ static void CG_WeaponAnimation( centity_t *cent, int *old, int *now, float *backLerp ) { lerpFrame_t *lf = ¢->pe.weapon; entityState_t *es = ¢->currentState; // see if the animation sequence is switching if( es->weaponAnim != lf->animationNumber || !lf->animation ) CG_SetWeaponLerpFrameAnimation( es->weapon, lf, es->weaponAnim ); CG_RunLerpFrame( lf, 1.0f ); *old = lf->oldFrame; *now = lf->frame; *backLerp = lf->backlerp; }
/* =============== CG_RunBuildableLerpFrame Sets cg.snap, cg.oldFrame, and cg.backlerp cg.time should be between oldFrameTime and frameTime after exit =============== */ static void CG_RunBuildableLerpFrame( centity_t *cent ) { buildable_t buildable = cent->currentState.modelindex; lerpFrame_t *lf = ¢->lerpFrame; buildableAnimNumber_t newAnimation = cent->buildableAnim & ~( ANIM_TOGGLEBIT|ANIM_FORCEBIT ); // see if the animation sequence is switching if( newAnimation != lf->animationNumber || !lf->animation ) { if( cg_debugRandom.integer ) CG_Printf( "newAnimation: %d lf->animationNumber: %d lf->animation: %d\n", newAnimation, lf->animationNumber, lf->animation ); CG_SetBuildableLerpFrameAnimation( buildable, lf, newAnimation ); if( !cg_buildables[ buildable ].sounds[ newAnimation ].looped && cg_buildables[ buildable ].sounds[ newAnimation ].enabled ) { if( cg_debugRandom.integer ) CG_Printf( "Sound for animation %d for a %s\n", newAnimation, BG_Buildable( buildable )->humanName ); trap_S_StartSound( cent->lerpOrigin, cent->currentState.number, CHAN_AUTO, cg_buildables[ buildable ].sounds[ newAnimation ].sound ); } } if( cg_buildables[ buildable ].sounds[ lf->animationNumber ].looped && cg_buildables[ buildable ].sounds[ lf->animationNumber ].enabled ) trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, cg_buildables[ buildable ].sounds[ lf->animationNumber ].sound ); CG_RunLerpFrame( lf, 1.0f ); // animation ended if( lf->frameTime == cg.time ) { cent->buildableAnim = cent->currentState.torsoAnim; cent->buildableIdleAnim = qtrue; } }
/* =============== CG_AMOAnimation =============== */ static void CG_AMOAnimation( centity_t *cent, int *old, int *now, float *backLerp ) { if( !( cent->currentState.eFlags & EF_MOVER_STOP ) ) { int delta = cg.time - cent->miscTime; //hack to prevent "pausing" mucking up the lerping if( delta > 900 ) { cent->lerpFrame.oldFrameTime += delta; cent->lerpFrame.frameTime += delta; } CG_RunLerpFrame( ¢->lerpFrame ); cent->miscTime = cg.time; } *old = cent->lerpFrame.oldFrame; *now = cent->lerpFrame.frame; *backLerp = cent->lerpFrame.backlerp; }