]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add .m_respawnsound for GameItems 386/head
authorFreddy <schro.sb@gmail.com>
Thu, 10 Nov 2016 21:48:44 +0000 (22:48 +0100)
committerFreddy <schro.sb@gmail.com>
Thu, 10 Nov 2016 21:48:44 +0000 (22:48 +0100)
qcsrc/common/items/item.qh
qcsrc/common/items/item/powerup.qh
qcsrc/common/t_items.qc

index 679deb2c5ac837f1ad72961b18fecd11c958bc8c..bac127059daa12c6db32695d90aea95cf22f28ff 100644 (file)
@@ -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))
     {
index 664c3784702c2f86a8e65ae48bb64252c633fa0e..26d649d7adeb1a7f0a14e473205e00953fd4dd29 100644 (file)
@@ -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";
index 4f8d5370fde332ca4e092a8f8c15268176d5a43d..3a7aea729e945ae59ac1c6c6f5e5104b15c2eb47 100644 (file)
@@ -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)