From 58a8c756c67948a1c9e4bce9b7b9f1edcaacec97 Mon Sep 17 00:00:00 2001 From: Freddy Date: Thu, 10 Nov 2016 22:48:44 +0100 Subject: [PATCH] Add .m_respawnsound for GameItems --- qcsrc/common/items/item.qh | 1 + qcsrc/common/items/item/powerup.qh | 2 ++ qcsrc/common/t_items.qc | 14 +------------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/qcsrc/common/items/item.qh b/qcsrc/common/items/item.qh index 679deb2c5a..bac127059d 100644 --- a/qcsrc/common/items/item.qh +++ b/qcsrc/common/items/item.qh @@ -48,6 +48,7 @@ CLASS(GameItem, Object) ATTRIB(GameItem, m_waypointblink, int, 1); #ifdef GAMEQC ATTRIB(GameItem, m_glow, bool, false); + ATTRIB(GameItem, m_respawnsound, Sound, SND_ITEMRESPAWN); #endif METHOD(GameItem, display, void(GameItem this, void(string name, string icon) returns)) { diff --git a/qcsrc/common/items/item/powerup.qh b/qcsrc/common/items/item/powerup.qh index 664c378470..26d649d7ad 100644 --- a/qcsrc/common/items/item/powerup.qh +++ b/qcsrc/common/items/item/powerup.qh @@ -27,6 +27,7 @@ REGISTER_ITEM(Strength, Powerup) { this.m_model = MDL_Strength_ITEM; this.m_sound = SND_Strength; this.m_glow = true; + this.m_respawnsound = SND_STRENGTH_RESPAWN; #endif this.m_name = "Strength Powerup"; this.m_icon = "strength"; @@ -46,6 +47,7 @@ REGISTER_ITEM(Shield, Powerup) { this.m_model = MDL_Shield_ITEM; this.m_sound = SND_Shield; this.m_glow = true; + this.m_respawnsound = SND_SHIELD_RESPAWN; #endif this.m_name = "Shield"; this.m_icon = "shield"; diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 4f8d5370fd..3a7aea729e 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -497,19 +497,7 @@ void Item_ItemsTime_SetTimesForAllPlayers(); void Item_Respawn (entity this) { Item_Show(this, 1); - // this is ugly... - switch(this.itemdef) - { - case ITEM_Strength: - sound(this, CH_TRIGGER, SND_STRENGTH_RESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound - break; - case ITEM_Shield: - sound(this, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound - break; - default: - sound(this, CH_TRIGGER, SND_ITEMRESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound - break; - } + sound(this, CH_TRIGGER, this.itemdef.m_respawnsound, VOL_BASE, ATTEN_NORM); // play respawn sound setorigin(this, this.origin); if (Item_ItemsTime_Allow(this.itemdef) || this.weapons & WEPSET_SUPERWEAPONS) -- 2.39.2