]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Added ITEM_FLAG_INSTAGIB.
authorLyberta <lyberta@lyberta.net>
Fri, 10 Nov 2017 10:24:19 +0000 (13:24 +0300)
committerLyberta <lyberta@lyberta.net>
Fri, 10 Nov 2017 10:24:19 +0000 (13:24 +0300)
qcsrc/common/items/item.qh
qcsrc/common/mutators/mutator/instagib/items.qh
qcsrc/common/mutators/mutator/random_items/sv_random_items.qc

index 6ec6dd8a4a843cf000b03d91b6d72fed1b94d63a..1d2c8d67138fb0853e7ae0ad929368794d7d3c00 100644 (file)
@@ -56,8 +56,10 @@ const int IT_PICKUPMASK                      = IT_UNLIMITED_AMMO | IT_JETPACK | IT_FU
 
 #endif
 
-enum {
-    ITEM_FLAG_MUTATORBLOCKED = BIT(0)
+enum
+{
+       ITEM_FLAG_INSTAGIB = BIT(0), ///< Item is usable in instagib.
+    ITEM_FLAG_MUTATORBLOCKED = BIT(1)
 };
 
 #define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__)
index 597fddc11e2fee1a4eb99a97aaf679dccb6fd975..e6354c9361bc4323ce01d38b575023877e09b85a 100644 (file)
@@ -24,7 +24,7 @@ void ammo_vaporizercells_init(entity item)
 #endif
 REGISTER_ITEM(VaporizerCells, Ammo) {
     this.m_canonical_spawnfunc = "item_vaporizer_cells";
-    this.spawnflags = ITEM_FLAG_MUTATORBLOCKED;
+    this.spawnflags = ITEM_FLAG_INSTAGIB | ITEM_FLAG_MUTATORBLOCKED;
 #ifdef GAMEQC
     this.m_model                =   MDL_VaporizerCells_ITEM;
     this.m_sound                =   SND_VaporizerCells;
@@ -51,6 +51,7 @@ SOUND(ExtraLife, Item_Sound("megahealth"));
 
 REGISTER_ITEM(ExtraLife, Powerup) {
     this.m_canonical_spawnfunc = "item_extralife";
+       this.spawnflags = ITEM_FLAG_INSTAGIB;
 #ifdef GAMEQC
     this.m_model                =   MDL_ExtraLife_ITEM;
     this.m_sound                =   SND_ExtraLife;
@@ -80,6 +81,7 @@ void powerup_invisibility_init(entity item);
 
 REGISTER_ITEM(Invisibility, Powerup) {
     this.m_canonical_spawnfunc = "item_invisibility";
+       this.spawnflags = ITEM_FLAG_INSTAGIB;
 #ifdef GAMEQC
     this.m_model            =   MDL_Invisibility_ITEM;
     this.m_sound            =   SND_Invisibility;
@@ -114,6 +116,7 @@ void powerup_speed_init(entity item);
 
 REGISTER_ITEM(Speed, Powerup) {
     this.m_canonical_spawnfunc = "item_speed";
+       this.spawnflags = ITEM_FLAG_INSTAGIB;
 #ifdef GAMEQC
     this.m_model            =   MDL_Speed_ITEM;
     this.m_sound            =   SND_Speed;
index 2de2dbf69a0e54164cef3dd32c61105d913720c1..2cf4b0a7738497ba50dc8917d84c26fc11367ce9 100644 (file)
@@ -144,17 +144,12 @@ string RandomItems_GetRandomVanillaItemClassName(string prefix)
 string RandomItems_GetRandomInstagibItemClassName(string prefix)
 {
        RandomSelection_Init();
-       #define X(classname) \
-               RandomSelection_AddString( \
-                       classname, \
-                       cvar(sprintf("g_%s_%s_probability", prefix, classname)), \
-                       1 \
-               )
-       X("item_vaporizer_cells");
-       X("item_invisibility");
-       X("item_extralife");
-       X("item_speed");
-       #undef X
+       FOREACH(Items, it.spawnflags & ITEM_FLAG_INSTAGIB,
+       {
+               RandomSelection_AddString(it.m_canonical_spawnfunc,
+                       cvar(sprintf("g_%s_%s_probability", prefix,
+                       it.m_canonical_spawnfunc)), 1);
+       });
        return RandomSelection_chosen_string;
 }