diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_animmapobj.c | 26 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 4 | ||||
-rw-r--r-- | src/game/g_misc.c | 4 | ||||
-rw-r--r-- | src/game/g_trigger.c | 20 |
4 files changed, 34 insertions, 20 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; diff --git a/src/game/g_misc.c b/src/game/g_misc.c index 9d54033e..5352dbe3 100644 --- a/src/game/g_misc.c +++ b/src/game/g_misc.c @@ -341,6 +341,10 @@ void SP_misc_anim_model( gentity_t *self ) self->s.eType = ET_ANIMMAPOBJ; + // spawn with animation stopped + if( self->spawnflags & 2 ) + self->s.eFlags |= EF_MOVER_STOP; + trap_LinkEntity( self ); } diff --git a/src/game/g_trigger.c b/src/game/g_trigger.c index f9472e0e..2b5b25af 100644 --- a/src/game/g_trigger.c +++ b/src/game/g_trigger.c @@ -217,9 +217,6 @@ void SP_trigger_push( gentity_t *self ) // unlike other triggers, we need to send this one to the client self->r.svFlags &= ~SVF_NOCLIENT; - // make sure the client precaches this sound - G_SoundIndex( "sound/world/jumppad.wav" ); - self->s.eType = ET_PUSH_TRIGGER; self->touch = trigger_push_touch; self->think = AimAtTarget; @@ -238,21 +235,11 @@ void Use_target_push( gentity_t *self, gentity_t *other, gentity_t *activator ) VectorCopy( self->s.origin2, activator->client->ps.velocity ); - if( !( self->spawnflags & 2 ) ) - { - // play fly sound every 1.5 seconds - if( activator->fly_sound_debounce_time < level.time ) - { - activator->fly_sound_debounce_time = level.time + 1500; - G_Sound( activator, CHAN_AUTO, self->noise_index ); - } - } } -/*QUAKED target_push (.5 .5 .5) (-8 -8 -8) (8 8 8) bouncepad +/*QUAKED target_push (.5 .5 .5) (-8 -8 -8) (8 8 8) Pushes the activator in the direction.of angle, or towards a target apex. "speed" defaults to 1000 -if "bouncepad", play bounce noise instead of windfly */ void SP_target_push( gentity_t *self ) { @@ -262,11 +249,6 @@ void SP_target_push( gentity_t *self ) G_SetMovedir( self->s.angles, self->s.origin2 ); VectorScale( self->s.origin2, self->speed, self->s.origin2 ); - if( self->spawnflags & 1 ) - self->noise_index = G_SoundIndex( "sound/world/jumppad.wav" ); - else - self->noise_index = G_SoundIndex( "sound/misc/windfly.wav" ); - if( self->target ) { VectorCopy( self->s.origin, self->r.absmin ); |