From 2a062e07ade9a2f76e90b3f2794b08189db75e89 Mon Sep 17 00:00:00 2001 From: IronClawTrem Date: Tue, 27 Aug 2019 01:27:55 +0100 Subject: buildable death sound --- src/game/g_buildable.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 43ac66a..b7bc386 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -503,6 +503,13 @@ static void nullDieFunction( gentity_t *self, gentity_t *inflictor, gentity_t *a { } +static void G_BuildableDeathSound( gentity_t *self ) +{ + gentity_t *snd = G_TempEntity( self->r.currentOrigin, EV_GENERAL_SOUND ); + snd->s.eventParm = G_SoundIndex( BG_FindTeamForBuildable( self->s.modelindex ) == PTE_HUMANS ? + "sound/buildables/human/destroyed" : "sound/buildables/alien/construct2" ); +} + /* ================ freeBuildable @@ -644,7 +651,9 @@ void ASpawn_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int new->fate = ( attacker && attacker->client && attacker->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) ? BF_TEAMKILLED : BF_DESTROYED; new->next = NULL; G_LogBuild( new ); - + + G_BuildableDeathSound( self ); + G_SetBuildableAnim( self, BANIM_DESTROY1, qtrue ); G_SetIdleBuildableAnim( self, BANIM_DESTROYED ); @@ -958,7 +967,9 @@ void ABarricade_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, new->fate = ( attacker && attacker->client && attacker->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) ? BF_TEAMKILLED : BF_DESTROYED; new->next = NULL; G_LogBuild( new ); - + + G_BuildableDeathSound( self ); + G_SetBuildableAnim( self, BANIM_DESTROY1, qtrue ); G_SetIdleBuildableAnim( self, BANIM_DESTROYED ); @@ -1408,6 +1419,8 @@ void AHovel_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int new->next = NULL; G_LogBuild( new ); + G_BuildableDeathSound( self ); + VectorCopy( self->s.origin2, dir ); //do a bit of radius damage @@ -2480,7 +2493,9 @@ void HSpawn_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int new->fate = ( attacker && attacker->client && attacker->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) ? BF_TEAMKILLED : BF_DESTROYED; new->next = NULL; G_LogBuild( new ); - + + G_BuildableDeathSound( self ); + //pretty events and cleanup G_SetBuildableAnim( self, BANIM_DESTROY1, qtrue ); G_SetIdleBuildableAnim( self, BANIM_DESTROYED ); -- cgit