summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_buildable.c10
-rw-r--r--src/cgame/cg_event.c10
-rw-r--r--src/cgame/cg_local.h1
3 files changed, 10 insertions, 11 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c
index 4b7f4a2d..fd362f9d 100644
--- a/src/cgame/cg_buildable.c
+++ b/src/cgame/cg_buildable.c
@@ -472,10 +472,18 @@ CG_BuildableAnimation
*/
static void CG_BuildableAnimation( centity_t *cent, int *old, int *now, float *backLerp )
{
+ entityState_t *es = &cent->currentState;
+
//if no animation is set default to idle anim
if( cent->buildableAnim == BANIM_NONE )
- cent->buildableAnim = cent->currentState.torsoAnim;
+ cent->buildableAnim = es->torsoAnim;
+ if( cent->oldBuildableAnim != es->legsAnim )
+ {
+ if( cent->buildableAnim == es->torsoAnim || es->legsAnim & ANIM_TOGGLEBIT )
+ cent->buildableAnim = cent->oldBuildableAnim = es->legsAnim;
+ }
+
CG_RunBuildableLerpFrame( cent );
*old = cent->lerpFrame.oldFrame;
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index ea4781cd..fe3ebd24 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -607,9 +607,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
case EV_BUILD_CONSTRUCT:
DEBUGNAME( "EV_BUILD_CONSTRUCT" );
cent->miscTime = cg.time; // scale up from this
- //probably a better place for this, but for the time being it lives here
- memset( &cent->lerpFrame, 0, sizeof( lerpFrame_t ) );
- cent->buildableAnim = es->eventParm;
break;
case EV_BUILD_DESTROY:
@@ -617,13 +614,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
cent->miscTime = -cg.time; // scale down from this
break;
- //TA: trigger an anim on a buildable item
- case EV_BUILD_ANIM:
- DEBUGNAME( "EV_BUILD_ANIM" );
- if( cent->buildableAnim == es->torsoAnim || es->eventParm & ANIM_TOGGLEBIT )
- cent->buildableAnim = es->eventParm;
- break;
-
case EV_RPTUSE_SOUND:
DEBUGNAME( "EV_RPTUSE_SOUND" );
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.repeaterUseSound );
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index b5e7238c..177ab40c 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -213,6 +213,7 @@ typedef struct centity_s
int jetTime; //limit jet count
buildableAnimNumber_t buildableAnim; //persistant anim number
+ buildableAnimNumber_t oldBuildableAnim; //to detect when new anims are set
int buildableSmokeTime;
int buildableSparkTime;
int buildableBleedTime;