summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cgame/cg_buildable.c10
-rw-r--r--src/cgame/cg_event.c10
-rw-r--r--src/cgame/cg_local.h1
-rw-r--r--src/game/bg_public.h1
-rw-r--r--src/game/g_buildable.c7
5 files changed, 15 insertions, 14 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;
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index b923f88d..ffeefc70 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -525,7 +525,6 @@ typedef enum
EV_BUILD_CONSTRUCT, //TA
EV_BUILD_DESTROY, //TA
- EV_BUILD_ANIM, //TA
EV_DEBUG_LINE,
EV_STOPLOOPINGSOUND,
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index a0cc8c02..8163bbf9 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -27,7 +27,7 @@ void G_setBuildableAnim( gentity_t *ent, buildableAnimNumber_t anim, qboolean fo
if( force )
localAnim |= ANIM_TOGGLEBIT;
- G_AddEvent( ent, EV_BUILD_ANIM, localAnim );
+ ent->s.legsAnim = localAnim;
}
/*
@@ -2170,7 +2170,10 @@ gentity_t *G_buildItem( gentity_t *builder, buildable_t buildable, vec3_t origin
VectorCopy( normal, built->s.origin2 );
- G_AddEvent( built, EV_BUILD_CONSTRUCT, BANIM_CONSTRUCT1 );
+ G_AddEvent( built, EV_BUILD_CONSTRUCT, 0 );
+
+ if( built->builtBy >= 0 )
+ G_setBuildableAnim( built, BANIM_CONSTRUCT1, qfalse );
trap_LinkEntity( built );