summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
author/dev/humancontroller <devhc@example.com>2017-04-13 11:30:00 +0000
committer/dev/humancontroller <devhc@example.com>2017-04-15 17:24:20 +0200
commit5113fbfc0c949a7c5729bf7fece55a9bde7e7720 (patch)
treeaa16f0a167731f4e9b48860dce23d2748a63ee36 /src/game
parent3f7914b0dad5c5270986c3d9d3a9369536427cd3 (diff)
generate buildable death sounds
sounds are from the previously-unused portions of the stock data pack; implemented via general sound events and temporary entities
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_buildable.c15
1 files changed, 15 insertions, 0 deletions
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 );