From: Lyberta Date: Fri, 10 Nov 2017 11:28:11 +0000 (+0300) Subject: Added ITEM_FLAG_NORMAL. X-Git-Tag: xonotic-v0.8.5~2426^2~6 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=87915c38a892fa1464b8c077014705ac0ead8e18;p=xonotic%2Fxonotic-data.pk3dir.git Added ITEM_FLAG_NORMAL. --- diff --git a/qcsrc/common/items/item.qh b/qcsrc/common/items/item.qh index 01bf81a9d..b7fc933e8 100644 --- a/qcsrc/common/items/item.qh +++ b/qcsrc/common/items/item.qh @@ -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__) diff --git a/qcsrc/common/items/item/ammo.qh b/qcsrc/common/items/item/ammo.qh index cc3cfe064..1d5bd87ba 100644 --- a/qcsrc/common/items/item/ammo.qh +++ b/qcsrc/common/items/item/ammo.qh @@ -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"; diff --git a/qcsrc/common/items/item/armor.qh b/qcsrc/common/items/item/armor.qh index 53255f9f1..7f37c75ae 100644 --- a/qcsrc/common/items/item/armor.qh +++ b/qcsrc/common/items/item/armor.qh @@ -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 diff --git a/qcsrc/common/items/item/health.qh b/qcsrc/common/items/item/health.qh index a64a37701..da431086e 100644 --- a/qcsrc/common/items/item/health.qh +++ b/qcsrc/common/items/item/health.qh @@ -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 diff --git a/qcsrc/common/items/item/jetpack.qh b/qcsrc/common/items/item/jetpack.qh index 389a11a29..284bf3d39 100644 --- a/qcsrc/common/items/item/jetpack.qh +++ b/qcsrc/common/items/item/jetpack.qh @@ -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"; diff --git a/qcsrc/common/items/item/powerup.qh b/qcsrc/common/items/item/powerup.qh index 787a7c946..fe47b6343 100644 --- a/qcsrc/common/items/item/powerup.qh +++ b/qcsrc/common/items/item/powerup.qh @@ -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; diff --git a/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc b/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc index 3e11d3af5..43ff0a5e3 100644 --- a/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc +++ b/qcsrc/common/mutators/mutator/random_items/sv_random_items.qc @@ -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,