diff options
Diffstat (limited to 'src/cgame/cg_animmapobj.c')
-rw-r--r-- | src/cgame/cg_animmapobj.c | 93 |
1 files changed, 3 insertions, 90 deletions
diff --git a/src/cgame/cg_animmapobj.c b/src/cgame/cg_animmapobj.c index 18f49b53..f0e964bf 100644 --- a/src/cgame/cg_animmapobj.c +++ b/src/cgame/cg_animmapobj.c @@ -13,93 +13,6 @@ #include "cg_local.h" -/* -=============== -CG_RunAMOLerpFrame - -Sets cg.snap, cg.oldFrame, and cg.backlerp -cg.time should be between oldFrameTime and frameTime after exit -=============== -*/ -static void CG_RunAMOLerpFrame( lerpFrame_t *lf ) -{ - int f, numFrames; - animation_t *anim; - - // debugging tool to get no animations - if( cg_animSpeed.integer == 0 ) - { - lf->oldFrame = lf->frame = lf->backlerp = 0; - return; - } - - // if we have passed the current frame, move it to - // oldFrame and calculate a new frame - if( cg.time >= lf->frameTime ) - { - lf->oldFrame = lf->frame; - lf->oldFrameTime = lf->frameTime; - - // get the next frame based on the animation - anim = lf->animation; - if( !anim->frameLerp ) - return; // shouldn't happen - - if( cg.time < lf->animationTime ) - lf->frameTime = lf->animationTime; // initial lerp - else - lf->frameTime = lf->oldFrameTime + anim->frameLerp; - - f = ( lf->frameTime - lf->animationTime ) / anim->frameLerp; - numFrames = anim->numFrames; - if( anim->flipflop ) - numFrames *= 2; - - if( f >= numFrames ) - { - f -= numFrames; - if( anim->loopFrames ) - { - f %= anim->loopFrames; - f += anim->numFrames - anim->loopFrames; - } - else - { - f = numFrames - 1; - // the animation is stuck at the end, so it - // can immediately transition to another sequence - lf->frameTime = cg.time; - } - } - - if( anim->reversed ) - lf->frame = anim->firstFrame + anim->numFrames - 1 - f; - else if( anim->flipflop && f >= anim->numFrames ) - lf->frame = anim->firstFrame + anim->numFrames - 1 - ( f % anim->numFrames ); - else - lf->frame = anim->firstFrame + f; - - if( cg.time > lf->frameTime ) - { - lf->frameTime = cg.time; - if( cg_debugAnim.integer ) - CG_Printf( "Clamp lf->frameTime\n" ); - } - } - - if( lf->frameTime > cg.time + 200 ) - lf->frameTime = cg.time; - - if( lf->oldFrameTime > cg.time ) - lf->oldFrameTime = cg.time; - - // calculate current lerp value - if( lf->frameTime == lf->oldFrameTime ) - lf->backlerp = 0; - else - lf->backlerp = 1.0 - (float)( cg.time - lf->oldFrameTime ) / ( lf->frameTime - lf->oldFrameTime ); -} - /* =============== @@ -108,7 +21,7 @@ CG_DoorAnimation */ static void CG_DoorAnimation( centity_t *cent, int *old, int *now, float *backLerp ) { - CG_RunAMOLerpFrame( ¢->lerpFrame ); + CG_RunLerpFrame( ¢->lerpFrame ); *old = cent->lerpFrame.oldFrame; *now = cent->lerpFrame.frame; @@ -194,7 +107,7 @@ static void CG_AMOAnimation( centity_t *cent, int *old, int *now, float *backLer cent->lerpFrame.frameTime += delta; } - CG_RunAMOLerpFrame( ¢->lerpFrame ); + CG_RunLerpFrame( ¢->lerpFrame ); cent->miscTime = cg.time; } @@ -209,7 +122,7 @@ static void CG_AMOAnimation( centity_t *cent, int *old, int *now, float *backLer CG_animMapObj ================== */ -void CG_animMapObj( centity_t *cent ) +void CG_AnimMapObj( centity_t *cent ) { refEntity_t ent; entityState_t *es; |