From 7b6cf403eaf1f6fce9c77be172498a8b17463ad5 Mon Sep 17 00:00:00 2001 From: Christopher Schwarz Date: Fri, 23 Oct 2009 08:21:00 +0000 Subject: * (bug 4006) Prevent human buildables from playing idle sounds while unpowered and give them new slightly-different animations so they also look different. In the case of turrets, 'droop' a bit when unpowered. (Rezyn) --- src/cgame/cg_buildable.c | 17 +++++++++++++++++ src/cgame/cg_local.h | 1 + 2 files changed, 18 insertions(+) (limited to 'src/cgame') diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c index 8a5bb858..b457808b 100644 --- a/src/cgame/cg_buildable.c +++ b/src/cgame/cg_buildable.c @@ -464,7 +464,10 @@ static void CG_RunBuildableLerpFrame( centity_t *cent ) // animation ended if( lf->frameTime == cg.time ) + { cent->buildableAnim = cent->currentState.torsoAnim; + cent->buildableIdleAnim = qtrue; + } } /* @@ -478,7 +481,10 @@ static void CG_BuildableAnimation( centity_t *cent, int *old, int *now, float *b //if no animation is set default to idle anim if( cent->buildableAnim == BANIM_NONE ) + { cent->buildableAnim = es->torsoAnim; + cent->buildableIdleAnim = qtrue; + } //display the first frame of the construction anim if not yet spawned if( !( es->eFlags & EF_B_SPAWNED ) ) @@ -509,9 +515,20 @@ static void CG_BuildableAnimation( centity_t *cent, int *old, int *now, float *b BG_Buildable( es->modelindex )->humanName, es->number ); if( cent->buildableAnim == es->torsoAnim || es->legsAnim & ANIM_FORCEBIT ) + { cent->buildableAnim = cent->oldBuildableAnim = es->legsAnim; + cent->buildableIdleAnim = qfalse; + } else + { cent->buildableAnim = cent->oldBuildableAnim = es->torsoAnim; + cent->buildableIdleAnim = qtrue; + } + } + else if( cent->buildableIdleAnim == qtrue && + cent->buildableAnim != es->torsoAnim ) + { + cent->buildableAnim = es->torsoAnim; } CG_RunBuildableLerpFrame( cent ); diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 90e88648..477bd384 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -647,6 +647,7 @@ typedef struct centity_s buildableAnimNumber_t buildableAnim; //persistant anim number buildableAnimNumber_t oldBuildableAnim; //to detect when new anims are set + qboolean buildableIdleAnim; //to check if new idle anim particleSystem_t *buildablePS; buildableStatus_t buildableStatus; buildableCache_t buildableCache; // so we don't recalculate things -- cgit