diff options
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_animmapobj.c | 26 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 4 |
2 files changed, 29 insertions, 1 deletions
diff --git a/src/cgame/cg_animmapobj.c b/src/cgame/cg_animmapobj.c index 133ecab8..2e80b7e9 100644 --- a/src/cgame/cg_animmapobj.c +++ b/src/cgame/cg_animmapobj.c @@ -106,7 +106,7 @@ CG_AMOAnimation */ static void CG_AMOAnimation( centity_t *cent, int *old, int *now, float *backLerp ) { - if( !( cent->currentState.eFlags & EF_MOVER_STOP ) ) + if( !( cent->currentState.eFlags & EF_MOVER_STOP ) || cent->animPlaying ) { int delta = cg.time - cent->miscTime; @@ -194,6 +194,30 @@ void CG_AnimMapObj( centity_t *cent ) } cent->lerpFrame.animation = &anim; + + if( !anim.loopFrames ) + { + // add one frame to allow the animation to play the last frame + // add another to get it to stop playing at the first frame + anim.numFrames += 2; + + if( !cent->animInit ) + { + cent->animInit = qtrue; + cent->animPlaying = !( cent->currentState.eFlags & EF_MOVER_STOP ); + } + else + { + if( cent->animLastState != + !( cent->currentState.eFlags & EF_MOVER_STOP ) ) + { + cent->animPlaying = qtrue; + cent->lerpFrame.animationTime = cg.time; + cent->lerpFrame.frameTime = cg.time; + } + } + cent->animLastState = !( cent->currentState.eFlags & EF_MOVER_STOP ); + } //run animation CG_AMOAnimation( cent, &ent.oldframe, &ent.frame, &ent.backlerp ); diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 80581e8d..66aea83e 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -646,6 +646,10 @@ typedef struct centity_s qboolean doorState; + qboolean animInit; + qboolean animPlaying; + qboolean animLastState; + particleSystem_t *muzzlePS; qboolean muzzlePsTrigger; |