]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Added ITEM_FLAG_NORMAL.
authorLyberta <lyberta@lyberta.net>
Fri, 10 Nov 2017 11:28:11 +0000 (14:28 +0300)
committerLyberta <lyberta@lyberta.net>
Fri, 10 Nov 2017 11:28:11 +0000 (14:28 +0300)
qcsrc/common/items/item.qh
qcsrc/common/items/item/ammo.qh
qcsrc/common/items/item/armor.qh
qcsrc/common/items/item/health.qh
qcsrc/common/items/item/jetpack.qh
qcsrc/common/items/item/powerup.qh
qcsrc/common/mutators/mutator/random_items/sv_random_items.qc

index 01bf81a9d49632cbf880e64f6412b124b97699ce..b7fc933e8b5dbaf35dde8a37fca1762c51a4e08a 100644 (file)
@@ -58,9 +58,10 @@ const int IT_PICKUPMASK                      = IT_UNLIMITED_AMMO | IT_JETPACK | IT_FU
 
 enum
 {
-       ITEM_FLAG_INSTAGIB = BIT(0), ///< Item is usable in instagib.
-       ITEM_FLAG_OVERKILL = BIT(1), ///< Item is usable in overkill.
-    ITEM_FLAG_MUTATORBLOCKED = BIT(2)
+       ITEM_FLAG_NORMAL = BIT(0), ///< Item is usable during normal gameplay.
+       ITEM_FLAG_INSTAGIB = BIT(1), ///< Item is usable in instagib.
+       ITEM_FLAG_OVERKILL = BIT(2), ///< Item is usable in overkill.
+       ITEM_FLAG_MUTATORBLOCKED = BIT(3)
 };
 
 #define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__)
index cc3cfe06419b39499374bb05bdc6747a6ee48a7f..1d5bd87baceb116b7e241f9955e4e12b8f6d3ee9 100644 (file)
@@ -51,6 +51,7 @@ ENDCLASS(Bullets)
 REGISTER_ITEM(Bullets, Bullets) {
     this.m_canonical_spawnfunc = "item_bullets";
 #ifdef GAMEQC
+       this.spawnflags = ITEM_FLAG_NORMAL;
     this.m_model    =   MDL_Bullets_ITEM;
 #endif
     this.netname    =   "bullets";
@@ -80,6 +81,7 @@ void ammo_cells_init(entity item)
 REGISTER_ITEM(Cells, Ammo) {
     this.m_canonical_spawnfunc = "item_cells";
 #ifdef GAMEQC
+       this.spawnflags = ITEM_FLAG_NORMAL;
     this.m_model    =   MDL_Cells_ITEM;
 #endif
     this.netname    =   "cells";
@@ -109,6 +111,7 @@ void ammo_plasma_init(entity item)
 REGISTER_ITEM(Plasma, Ammo) {
     this.m_canonical_spawnfunc = "item_plasma";
 #ifdef GAMEQC
+       this.spawnflags = ITEM_FLAG_NORMAL;
     this.m_model    =   MDL_Plasma_ITEM;
 #endif
     this.netname    =   "plasma";
@@ -138,6 +141,7 @@ void ammo_rockets_init(entity item)
 REGISTER_ITEM(Rockets, Ammo) {
     this.m_canonical_spawnfunc = "item_rockets";
 #ifdef GAMEQC
+       this.spawnflags = ITEM_FLAG_NORMAL;
     this.m_model    =   MDL_Rockets_ITEM;
 #endif
     this.netname    =   "rockets";
@@ -171,6 +175,7 @@ ENDCLASS(Shells)
 REGISTER_ITEM(Shells, Shells) {
     this.m_canonical_spawnfunc = "item_shells";
 #ifdef GAMEQC
+       this.spawnflags = ITEM_FLAG_NORMAL;
     this.m_model    =   MDL_Shells_ITEM;
 #endif
     this.netname    =   "shells";
index 53255f9f10eaf8d45d61517e9bf5cd49350c24f5..7f37c75aec002465260b1852810253e05c6a4b11 100644 (file)
@@ -34,7 +34,7 @@ void item_armorsmall_init(entity item)
 REGISTER_ITEM(ArmorSmall, Armor) {
     this.m_canonical_spawnfunc = "item_armor_small";
 #ifdef GAMEQC
-    this.spawnflags = ITEM_FLAG_OVERKILL;
+    this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_OVERKILL;
     this.m_model                =   MDL_ArmorSmall_ITEM;
     this.m_sound                =   SND_ArmorSmall;
 #endif
@@ -72,7 +72,7 @@ void item_armormedium_init(entity item)
 REGISTER_ITEM(ArmorMedium, Armor) {
     this.m_canonical_spawnfunc = "item_armor_medium";
 #ifdef GAMEQC
-    this.spawnflags = ITEM_FLAG_OVERKILL;
+    this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_OVERKILL;
     this.m_model                =   MDL_ArmorMedium_ITEM;
     this.m_sound                =   SND_ArmorMedium;
 #endif
@@ -110,7 +110,7 @@ void item_armorbig_init(entity item)
 REGISTER_ITEM(ArmorBig, Armor) {
     this.m_canonical_spawnfunc = "item_armor_big";
 #ifdef GAMEQC
-    this.spawnflags = ITEM_FLAG_OVERKILL;
+    this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_OVERKILL;
     this.m_model                =   MDL_ArmorBig_ITEM;
     this.m_sound                =   SND_ArmorBig;
 #endif
@@ -150,7 +150,7 @@ void item_armormega_init(entity item)
 REGISTER_ITEM(ArmorMega, Armor) {
     this.m_canonical_spawnfunc = "item_armor_mega";
 #ifdef GAMEQC
-    this.spawnflags = ITEM_FLAG_OVERKILL;
+    this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_OVERKILL;
     this.m_model                =   MDL_ArmorMega_ITEM;
     this.m_sound                =   SND_ArmorMega;
 #endif
index a64a37701d2abe9a097929e61f76b4c1c3c42b30..da431086e18587448cf697c8127390fd166134f0 100644 (file)
@@ -34,6 +34,7 @@ void item_healthsmall_init(entity item)
 REGISTER_ITEM(HealthSmall, Health) {
     this.m_canonical_spawnfunc = "item_health_small";
 #ifdef GAMEQC
+       this.spawnflags = ITEM_FLAG_NORMAL;
     this.m_model                =   MDL_HealthSmall_ITEM;
     this.m_sound                =   SND_HealthSmall;
 #endif
@@ -71,6 +72,7 @@ void item_healthmedium_init(entity item)
 REGISTER_ITEM(HealthMedium, Health) {
     this.m_canonical_spawnfunc = "item_health_medium";
 #ifdef GAMEQC
+       this.spawnflags = ITEM_FLAG_NORMAL;
     this.m_model                =   MDL_HealthMedium_ITEM;
     this.m_sound                =   SND_HealthMedium;
 #endif
@@ -108,6 +110,7 @@ void item_healthbig_init(entity item)
 REGISTER_ITEM(HealthBig, Health) {
     this.m_canonical_spawnfunc = "item_health_big";
 #ifdef GAMEQC
+       this.spawnflags = ITEM_FLAG_NORMAL;
     this.m_model                =   MDL_HealthBig_ITEM;
     this.m_sound                =   SND_HealthBig;
 #endif
@@ -147,7 +150,7 @@ void item_healthmega_init(entity item)
 REGISTER_ITEM(HealthMega, Health) {
     this.m_canonical_spawnfunc = "item_health_mega";
 #ifdef GAMEQC
-    this.spawnflags = ITEM_FLAG_OVERKILL;
+    this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_OVERKILL;
     this.m_model                =   MDL_HealthMega_ITEM;
     this.m_sound                =   SND_HealthMega;
 #endif
index 389a11a29ce93b691be944b9b3eb58f5ee44777e..284bf3d390fce1c7b62653a9570b9ef20a7dffe5 100644 (file)
@@ -30,6 +30,7 @@ ENDCLASS(Jetpack)
 REGISTER_ITEM(Jetpack, Powerup) {
     this.m_canonical_spawnfunc = "item_jetpack";
 #ifdef GAMEQC
+       this.spawnflags = ITEM_FLAG_NORMAL;
     this.m_model                =   MDL_Jetpack_ITEM;
     this.m_itemid               =   IT_JETPACK;
 #endif
@@ -63,6 +64,7 @@ void ammo_fuel_init(entity item)
 REGISTER_ITEM(JetpackFuel, Ammo) {
     this.m_canonical_spawnfunc = "item_fuel";
 #ifdef GAMEQC
+       this.spawnflags = ITEM_FLAG_NORMAL;
     this.m_model    =   MDL_JetpackFuel_ITEM;
 #endif
     this.netname    =   "fuel";
@@ -87,6 +89,7 @@ ENDCLASS(JetpackRegen)
 REGISTER_ITEM(JetpackRegen, JetpackRegen) {
     this.m_canonical_spawnfunc = "item_fuel_regen";
 #ifdef GAMEQC
+       this.spawnflags = ITEM_FLAG_NORMAL;
     this.m_model                =   MDL_JetpackRegen_ITEM;
 #endif
     this.netname                =   "fuel_regen";
index 787a7c94691898f2eb04566cc4b448159f72f218..fe47b63430ddd1726b774f080f56905a4dc7568c 100644 (file)
@@ -33,6 +33,7 @@ void powerup_strength_init(entity item)
 REGISTER_ITEM(Strength, Powerup) {
     this.m_canonical_spawnfunc = "item_strength";
 #ifdef GAMEQC
+       this.spawnflags = ITEM_FLAG_NORMAL;
     this.m_model            =   MDL_Strength_ITEM;
     this.m_sound            =   SND_Strength;
     this.m_glow             =   true;
@@ -68,6 +69,7 @@ void powerup_shield_init(entity item)
 REGISTER_ITEM(Shield, Powerup) {
     this.m_canonical_spawnfunc = "item_shield";
 #ifdef GAMEQC
+       this.spawnflags = ITEM_FLAG_NORMAL;
     this.m_model            =   MDL_Shield_ITEM;
     this.m_sound            =   SND_Shield;
     this.m_glow             =   true;
index 3e11d3af5bc63ac386d97fbd475611207fbfe7cd..43ff0a5e33026b2033043ed420733fbfaa52283e 100644 (file)
@@ -121,19 +121,8 @@ string RandomItems_GetRandomVanillaItemClassName(string prefix)
                }
                case RANDOM_ITEM_TYPE_POWERUP:
                {
-                       RandomSelection_Init();
-                       #define X(classname) \
-                               RandomSelection_AddString( \
-                                       classname, \
-                                       cvar(sprintf("g_%s_%s_probability", prefix, classname)), \
-                                       1 \
-                               )
-                       X("item_strength");
-                       X("item_shield");
-                       X("item_fuel_regen");
-                       X("item_jetpack");
-                       #undef X
-                       return RandomSelection_chosen_string;
+                       return RandomItems_GetRandomItemClassNameWithProperty(prefix,
+                               instanceOfPowerup);
                }
        }
        return "";
@@ -182,7 +171,7 @@ string RandomItems_GetRandomItemClassNameWithProperty(string prefix,
        .bool item_property)
 {
        RandomSelection_Init();
-       FOREACH(Items, it.item_property,
+       FOREACH(Items, it.item_property && (it.spawnflags & ITEM_FLAG_NORMAL),
        {
                RandomSelection_AddString(it.m_canonical_spawnfunc,
                        cvar(sprintf("g_%s_%s_probability", prefix,