From 5113fbfc0c949a7c5729bf7fece55a9bde7e7720 Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Thu, 13 Apr 2017 11:30:00 +0000 Subject: generate buildable death sounds sounds are from the previously-unused portions of the stock data pack; implemented via general sound events and temporary entities --- src/game/g_buildable.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 446311f..ed243cc 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 @@ -696,6 +703,8 @@ void ASpawn_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int new->next = NULL; G_LogBuild( new ); + G_BuildableDeathSound( self ); + G_SetBuildableAnim( self, BANIM_DESTROY1, qtrue ); G_SetIdleBuildableAnim( self, BANIM_DESTROYED ); @@ -1020,6 +1029,8 @@ void ABarricade_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, new->next = NULL; G_LogBuild( new ); + G_BuildableDeathSound( self ); + G_SetBuildableAnim( self, BANIM_DESTROY1, qtrue ); G_SetIdleBuildableAnim( self, BANIM_DESTROYED ); @@ -1478,6 +1489,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 @@ -2641,6 +2654,8 @@ void HSpawn_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int 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