]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Push down spawning logic from spawnfuncs to dedicated spawning functions
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 8 Oct 2017 09:30:52 +0000 (20:30 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 8 Oct 2017 09:30:52 +0000 (20:30 +1100)
68 files changed:
qcsrc/common/items/item.qh
qcsrc/common/items/item/ammo.qc
qcsrc/common/items/item/ammo.qh
qcsrc/common/items/item/armor.qh
qcsrc/common/items/item/health.qh
qcsrc/common/items/item/jetpack.qc
qcsrc/common/items/item/jetpack.qh
qcsrc/common/items/item/powerup.qh
qcsrc/common/mutators/mutator/instagib/items.qh
qcsrc/common/mutators/mutator/instagib/sv_instagib.qc
qcsrc/common/mutators/mutator/instagib/sv_instagib.qh
qcsrc/common/mutators/mutator/overkill/hmg.qc
qcsrc/common/mutators/mutator/overkill/hmg.qh
qcsrc/common/mutators/mutator/overkill/rpc.qc
qcsrc/common/mutators/mutator/overkill/rpc.qh
qcsrc/common/mutators/mutator/overkill/sv_overkill.qc
qcsrc/common/mutators/mutator/random_items/_mod.qh
qcsrc/common/t_items.qc
qcsrc/common/weapons/weapon.qh
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/arc.qh
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/common/weapons/weapon/blaster.qh
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/crylink.qh
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/devastator.qh
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/electro.qh
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/fireball.qh
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hagar.qh
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/hlac.qh
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/hook.qh
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/machinegun.qh
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/minelayer.qh
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/mortar.qh
qcsrc/common/weapons/weapon/porto.qc
qcsrc/common/weapons/weapon/porto.qh
qcsrc/common/weapons/weapon/rifle.qc
qcsrc/common/weapons/weapon/rifle.qh
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/seeker.qh
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/common/weapons/weapon/shockwave.qh
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/shotgun.qh
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/common/weapons/weapon/tuba.qh
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vaporizer.qh
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/common/weapons/weapon/vortex.qh
qcsrc/server/compat/quake.qc
qcsrc/server/compat/quake2.qc
qcsrc/server/compat/quake3.qc
qcsrc/server/compat/wop.qc
qcsrc/server/items.qc
qcsrc/server/items.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/weapons/spawning.qc
qcsrc/server/weapons/weaponsystem.qh

index c302ae40281d43699b335ab24a7d382b7d3d667e..d5b25c436b120adc11a850f9a6c674eed0c3097c 100644 (file)
@@ -45,11 +45,26 @@ const int IT_PICKUPMASK                     = IT_UNLIMITED_AMMO | IT_JETPACK | IT_FU
 #ifdef SVQC
 .float  strength_finished = _STAT(STRENGTH_FINISHED);
 .float  invincible_finished = _STAT(INVINCIBLE_FINISHED);
 #ifdef SVQC
 .float  strength_finished = _STAT(STRENGTH_FINISHED);
 .float  invincible_finished = _STAT(INVINCIBLE_FINISHED);
+
+#define SPAWNFUNC_ITEM(name, item) \
+    spawnfunc(name) { StartItem(this, item); }
+
+#else
+
+#define SPAWNFUNC_ITEM(name, item)
+
 #endif
 
 #endif
 
+enum {
+    ITEM_FLAG_MUTATORBLOCKED = BIT(0)
+};
+
 #define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__)
 CLASS(GameItem, Object)
     ATTRIB(GameItem, m_id, int, 0);
 #define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__)
 CLASS(GameItem, Object)
     ATTRIB(GameItem, m_id, int, 0);
+    /** the canonical spawnfunc name */
+    ATTRIB(GameItem, m_canonical_spawnfunc, string);
+    METHOD(GameItem, m_spawnfunc_hookreplace, GameItem(GameItem this, entity e)) { return this; }
     ATTRIB(GameItem, m_name, string);
     ATTRIB(GameItem, m_icon, string);
     ATTRIB(GameItem, m_color, vector, '1 1 1');
     ATTRIB(GameItem, m_name, string);
     ATTRIB(GameItem, m_icon, string);
     ATTRIB(GameItem, m_color, vector, '1 1 1');
index d7e0dcc6872d0d55b9d7b00aad234920acf5cb45..38a0a022a92b818defcd6a67456826de4703f82c 100644 (file)
@@ -1 +1,23 @@
 #include "ammo.qh"
 #include "ammo.qh"
+
+#ifdef SVQC
+
+METHOD(Bullets, m_spawnfunc_hookreplace, GameItem(Bullets this, entity e))
+{
+       if (autocvar_sv_q3acompat_machineshotgunswap && e.classname != "droppedweapon")
+       {
+               return ITEM_Shells;
+       }
+       return this;
+}
+
+METHOD(Shells, m_spawnfunc_hookreplace, GameItem(Shells this, entity e))
+{
+       if (autocvar_sv_q3acompat_machineshotgunswap && e.classname != "droppedweapon")
+       {
+               return ITEM_Bullets;
+       }
+       return this;
+}
+
+#endif
index b3361d248c852db75ace43b232885c5bf460f6ff..b9b6fc158552c47dc42252a388bf40049798413f 100644 (file)
@@ -31,7 +31,12 @@ void ammo_bullets_init(entity item)
         item.ammo_nails = g_pickup_nails;
 }
 #endif
         item.ammo_nails = g_pickup_nails;
 }
 #endif
-REGISTER_ITEM(Bullets, Ammo) {
+
+CLASS(Bullets, Ammo)
+ENDCLASS(Bullets)
+
+REGISTER_ITEM(Bullets, Bullets) {
+    this.m_canonical_spawnfunc = "item_bullets";
 #ifdef GAMEQC
     this.m_model    =   MDL_Bullets_ITEM;
 #endif
 #ifdef GAMEQC
     this.m_model    =   MDL_Bullets_ITEM;
 #endif
@@ -45,6 +50,8 @@ REGISTER_ITEM(Bullets, Ammo) {
 #endif
 }
 
 #endif
 }
 
+SPAWNFUNC_ITEM(item_bullets, ITEM_Bullets)
+
 #ifdef GAMEQC
 MODEL(Cells_ITEM, Item_Model("a_cells.md3"));
 #endif
 #ifdef GAMEQC
 MODEL(Cells_ITEM, Item_Model("a_cells.md3"));
 #endif
@@ -58,6 +65,7 @@ void ammo_cells_init(entity item)
 }
 #endif
 REGISTER_ITEM(Cells, Ammo) {
 }
 #endif
 REGISTER_ITEM(Cells, Ammo) {
+    this.m_canonical_spawnfunc = "item_cells";
 #ifdef GAMEQC
     this.m_model    =   MDL_Cells_ITEM;
 #endif
 #ifdef GAMEQC
     this.m_model    =   MDL_Cells_ITEM;
 #endif
@@ -71,6 +79,8 @@ REGISTER_ITEM(Cells, Ammo) {
 #endif
 }
 
 #endif
 }
 
+SPAWNFUNC_ITEM(item_cells, ITEM_Cells)
+
 #ifdef GAMEQC
 MODEL(Plasma_ITEM, Item_Model("a_cells.md3"));
 #endif
 #ifdef GAMEQC
 MODEL(Plasma_ITEM, Item_Model("a_cells.md3"));
 #endif
@@ -84,6 +94,7 @@ void ammo_plasma_init(entity item)
 }
 #endif
 REGISTER_ITEM(Plasma, Ammo) {
 }
 #endif
 REGISTER_ITEM(Plasma, Ammo) {
+    this.m_canonical_spawnfunc = "item_plasma";
 #ifdef GAMEQC
     this.m_model    =   MDL_Plasma_ITEM;
 #endif
 #ifdef GAMEQC
     this.m_model    =   MDL_Plasma_ITEM;
 #endif
@@ -97,6 +108,8 @@ REGISTER_ITEM(Plasma, Ammo) {
 #endif
 }
 
 #endif
 }
 
+SPAWNFUNC_ITEM(item_plasma, ITEM_Plasma)
+
 #ifdef GAMEQC
 MODEL(Rockets_ITEM, Item_Model("a_rockets.md3"));
 #endif
 #ifdef GAMEQC
 MODEL(Rockets_ITEM, Item_Model("a_rockets.md3"));
 #endif
@@ -110,6 +123,7 @@ void ammo_rockets_init(entity item)
 }
 #endif
 REGISTER_ITEM(Rockets, Ammo) {
 }
 #endif
 REGISTER_ITEM(Rockets, Ammo) {
+    this.m_canonical_spawnfunc = "item_rockets";
 #ifdef GAMEQC
     this.m_model    =   MDL_Rockets_ITEM;
 #endif
 #ifdef GAMEQC
     this.m_model    =   MDL_Rockets_ITEM;
 #endif
@@ -123,6 +137,8 @@ REGISTER_ITEM(Rockets, Ammo) {
 #endif
 }
 
 #endif
 }
 
+SPAWNFUNC_ITEM(item_rockets, ITEM_Rockets)
+
 #ifdef GAMEQC
 MODEL(Shells_ITEM, Item_Model("a_shells.md3"));
 #endif
 #ifdef GAMEQC
 MODEL(Shells_ITEM, Item_Model("a_shells.md3"));
 #endif
@@ -135,7 +151,12 @@ void ammo_shells_init(entity item)
         item.ammo_shells = g_pickup_shells;
 }
 #endif
         item.ammo_shells = g_pickup_shells;
 }
 #endif
-REGISTER_ITEM(Shells, Ammo) {
+
+CLASS(Shells, Ammo)
+ENDCLASS(Shells)
+
+REGISTER_ITEM(Shells, Shells) {
+    this.m_canonical_spawnfunc = "item_shells";
 #ifdef GAMEQC
     this.m_model    =   MDL_Shells_ITEM;
 #endif
 #ifdef GAMEQC
     this.m_model    =   MDL_Shells_ITEM;
 #endif
@@ -148,3 +169,5 @@ REGISTER_ITEM(Shells, Ammo) {
     this.m_iteminit =   ammo_shells_init;
 #endif
 }
     this.m_iteminit =   ammo_shells_init;
 #endif
 }
+
+SPAWNFUNC_ITEM(item_shells, ITEM_Shells)
index 0258cf8811c7682e0922f3f6960ed6af2f9c7065..9a9326c43e1ae20a7a469ea2786ab5120fdf0195 100644 (file)
@@ -32,6 +32,7 @@ void item_armorsmall_init(entity item)
 #endif
 
 REGISTER_ITEM(ArmorSmall, Armor) {
 #endif
 
 REGISTER_ITEM(ArmorSmall, Armor) {
+    this.m_canonical_spawnfunc = "item_armor_small";
 #ifdef GAMEQC
     this.m_model                =   MDL_ArmorSmall_ITEM;
     this.m_sound                =   SND_ArmorSmall;
 #ifdef GAMEQC
     this.m_model                =   MDL_ArmorSmall_ITEM;
     this.m_sound                =   SND_ArmorSmall;
@@ -48,6 +49,8 @@ REGISTER_ITEM(ArmorSmall, Armor) {
 #endif
 }
 
 #endif
 }
 
+SPAWNFUNC_ITEM(item_armor_small, ITEM_ArmorSmall)
+
 #ifdef GAMEQC
 MODEL(ArmorMedium_ITEM, Item_Model("item_armor_medium.md3"));
 SOUND(ArmorMedium, Item_Sound("armor10"));
 #ifdef GAMEQC
 MODEL(ArmorMedium_ITEM, Item_Model("item_armor_medium.md3"));
 SOUND(ArmorMedium, Item_Sound("armor10"));
@@ -66,6 +69,7 @@ void item_armormedium_init(entity item)
 #endif
 
 REGISTER_ITEM(ArmorMedium, Armor) {
 #endif
 
 REGISTER_ITEM(ArmorMedium, Armor) {
+    this.m_canonical_spawnfunc = "item_armor_medium";
 #ifdef GAMEQC
     this.m_model                =   MDL_ArmorMedium_ITEM;
     this.m_sound                =   SND_ArmorMedium;
 #ifdef GAMEQC
     this.m_model                =   MDL_ArmorMedium_ITEM;
     this.m_sound                =   SND_ArmorMedium;
@@ -82,6 +86,8 @@ REGISTER_ITEM(ArmorMedium, Armor) {
 #endif
 }
 
 #endif
 }
 
+SPAWNFUNC_ITEM(item_armor_medium, ITEM_ArmorMedium)
+
 #ifdef GAMEQC
 MODEL(ArmorBig_ITEM, Item_Model("item_armor_big.md3"));
 SOUND(ArmorBig, Item_Sound("armor17_5"));
 #ifdef GAMEQC
 MODEL(ArmorBig_ITEM, Item_Model("item_armor_big.md3"));
 SOUND(ArmorBig, Item_Sound("armor17_5"));
@@ -100,6 +106,7 @@ void item_armorbig_init(entity item)
 #endif
 
 REGISTER_ITEM(ArmorBig, Armor) {
 #endif
 
 REGISTER_ITEM(ArmorBig, Armor) {
+    this.m_canonical_spawnfunc = "item_armor_big";
 #ifdef GAMEQC
     this.m_model                =   MDL_ArmorBig_ITEM;
     this.m_sound                =   SND_ArmorBig;
 #ifdef GAMEQC
     this.m_model                =   MDL_ArmorBig_ITEM;
     this.m_sound                =   SND_ArmorBig;
@@ -118,6 +125,8 @@ REGISTER_ITEM(ArmorBig, Armor) {
 #endif
 }
 
 #endif
 }
 
+SPAWNFUNC_ITEM(item_armor_big, ITEM_ArmorBig)
+
 #ifdef GAMEQC
 MODEL(ArmorMega_ITEM, Item_Model("item_armor_large.md3"));
 SOUND(ArmorMega, Item_Sound("armor25"));
 #ifdef GAMEQC
 MODEL(ArmorMega_ITEM, Item_Model("item_armor_large.md3"));
 SOUND(ArmorMega, Item_Sound("armor25"));
@@ -136,6 +145,7 @@ void item_armormega_init(entity item)
 #endif
 
 REGISTER_ITEM(ArmorMega, Armor) {
 #endif
 
 REGISTER_ITEM(ArmorMega, Armor) {
+    this.m_canonical_spawnfunc = "item_armor_mega";
 #ifdef GAMEQC
     this.m_model                =   MDL_ArmorMega_ITEM;
     this.m_sound                =   SND_ArmorMega;
 #ifdef GAMEQC
     this.m_model                =   MDL_ArmorMega_ITEM;
     this.m_sound                =   SND_ArmorMega;
@@ -155,3 +165,5 @@ REGISTER_ITEM(ArmorMega, Armor) {
     this.m_iteminit             =   item_armormega_init;
 #endif
 }
     this.m_iteminit             =   item_armormega_init;
 #endif
 }
+
+SPAWNFUNC_ITEM(item_armor_mega, ITEM_ArmorMega)
index cad5a376e753d3cd18cfb997261ed37141072881..3ffb5728b1a1d86ea51b8ea93f53824ffb088b28 100644 (file)
@@ -32,6 +32,7 @@ void item_healthsmall_init(entity item)
 #endif
 
 REGISTER_ITEM(HealthSmall, Health) {
 #endif
 
 REGISTER_ITEM(HealthSmall, Health) {
+    this.m_canonical_spawnfunc = "item_health_small";
 #ifdef GAMEQC
     this.m_model                =   MDL_HealthSmall_ITEM;
     this.m_sound                =   SND_HealthSmall;
 #ifdef GAMEQC
     this.m_model                =   MDL_HealthSmall_ITEM;
     this.m_sound                =   SND_HealthSmall;
@@ -48,6 +49,8 @@ REGISTER_ITEM(HealthSmall, Health) {
 #endif
 }
 
 #endif
 }
 
+SPAWNFUNC_ITEM(item_health_small, ITEM_HealthSmall)
+
 #ifdef GAMEQC
 MODEL(HealthMedium_ITEM, Item_Model("g_h25.md3"));
 SOUND(HealthMedium, Item_Sound("mediumhealth"));
 #ifdef GAMEQC
 MODEL(HealthMedium_ITEM, Item_Model("g_h25.md3"));
 SOUND(HealthMedium, Item_Sound("mediumhealth"));
@@ -66,6 +69,7 @@ void item_healthmedium_init(entity item)
 #endif
 
 REGISTER_ITEM(HealthMedium, Health) {
 #endif
 
 REGISTER_ITEM(HealthMedium, Health) {
+    this.m_canonical_spawnfunc = "item_health_medium";
 #ifdef GAMEQC
     this.m_model                =   MDL_HealthMedium_ITEM;
     this.m_sound                =   SND_HealthMedium;
 #ifdef GAMEQC
     this.m_model                =   MDL_HealthMedium_ITEM;
     this.m_sound                =   SND_HealthMedium;
@@ -82,6 +86,8 @@ REGISTER_ITEM(HealthMedium, Health) {
 #endif
 }
 
 #endif
 }
 
+SPAWNFUNC_ITEM(item_health_medium, ITEM_HealthMedium)
+
 #ifdef GAMEQC
 MODEL(HealthBig_ITEM, Item_Model("g_h50.md3"));
 SOUND(HealthBig, Item_Sound("mediumhealth"));
 #ifdef GAMEQC
 MODEL(HealthBig_ITEM, Item_Model("g_h50.md3"));
 SOUND(HealthBig, Item_Sound("mediumhealth"));
@@ -100,6 +106,7 @@ void item_healthbig_init(entity item)
 #endif
 
 REGISTER_ITEM(HealthBig, Health) {
 #endif
 
 REGISTER_ITEM(HealthBig, Health) {
+    this.m_canonical_spawnfunc = "item_health_big";
 #ifdef GAMEQC
     this.m_model                =   MDL_HealthBig_ITEM;
     this.m_sound                =   SND_HealthBig;
 #ifdef GAMEQC
     this.m_model                =   MDL_HealthBig_ITEM;
     this.m_sound                =   SND_HealthBig;
@@ -118,6 +125,8 @@ REGISTER_ITEM(HealthBig, Health) {
 #endif
 }
 
 #endif
 }
 
+SPAWNFUNC_ITEM(item_health_big, ITEM_HealthBig)
+
 #ifdef GAMEQC
 MODEL(HealthMega_ITEM, Item_Model("g_h100.md3"));
 SOUND(HealthMega, Item_Sound("megahealth"));
 #ifdef GAMEQC
 MODEL(HealthMega_ITEM, Item_Model("g_h100.md3"));
 SOUND(HealthMega, Item_Sound("megahealth"));
@@ -136,6 +145,7 @@ void item_healthmega_init(entity item)
 #endif
 
 REGISTER_ITEM(HealthMega, Health) {
 #endif
 
 REGISTER_ITEM(HealthMega, Health) {
+    this.m_canonical_spawnfunc = "item_health_mega";
 #ifdef GAMEQC
     this.m_model                =   MDL_HealthMega_ITEM;
     this.m_sound                =   SND_HealthMega;
 #ifdef GAMEQC
     this.m_model                =   MDL_HealthMega_ITEM;
     this.m_sound                =   SND_HealthMega;
@@ -155,3 +165,5 @@ REGISTER_ITEM(HealthMega, Health) {
     this.m_iteminit             =   item_healthmega_init;
 #endif
 }
     this.m_iteminit             =   item_healthmega_init;
 #endif
 }
+
+SPAWNFUNC_ITEM(item_health_mega, ITEM_HealthMega)
index ec09d5c45d62d904c6e4a2ada5ec570ae3b5c4bc..11b9d924309d32e5e666c38827ae841dce043ae3 100644 (file)
@@ -1 +1,23 @@
 #include "jetpack.qh"
 #include "jetpack.qh"
+
+#ifdef SVQC
+
+METHOD(Jetpack, m_spawnfunc_hookreplace, GameItem(Jetpack this, entity e))
+{
+       if(start_items & ITEM_Jetpack.m_itemid)
+       {
+               return ITEM_JetpackFuel;
+       }
+       return this;
+}
+
+METHOD(JetpackRegen, m_spawnfunc_hookreplace, GameItem(JetpackRegen this, entity e))
+{
+       if (start_items & ITEM_JetpackRegen.m_itemid)
+       {
+               return ITEM_JetpackFuel;
+       }
+       return this;
+}
+
+#endif
index a6d1c8dae89751694d03d16bc6f35238eceec0c5..389a11a29ce93b691be944b9b3eb58f5ee44777e 100644 (file)
@@ -23,7 +23,12 @@ void powerup_jetpack_init(entity item)
         item.ammo_fuel = g_pickup_fuel_jetpack;
 }
 #endif
         item.ammo_fuel = g_pickup_fuel_jetpack;
 }
 #endif
+
+CLASS(Jetpack, Powerup)
+ENDCLASS(Jetpack)
+
 REGISTER_ITEM(Jetpack, Powerup) {
 REGISTER_ITEM(Jetpack, Powerup) {
+    this.m_canonical_spawnfunc = "item_jetpack";
 #ifdef GAMEQC
     this.m_model                =   MDL_Jetpack_ITEM;
     this.m_itemid               =   IT_JETPACK;
 #ifdef GAMEQC
     this.m_model                =   MDL_Jetpack_ITEM;
     this.m_itemid               =   IT_JETPACK;
@@ -41,6 +46,8 @@ REGISTER_ITEM(Jetpack, Powerup) {
 #endif
 }
 
 #endif
 }
 
+SPAWNFUNC_ITEM(item_jetpack, ITEM_Jetpack)
+
 #ifdef GAMEQC
 MODEL(JetpackFuel_ITEM, Item_Model("g_fuel.md3"));
 #endif
 #ifdef GAMEQC
 MODEL(JetpackFuel_ITEM, Item_Model("g_fuel.md3"));
 #endif
@@ -54,6 +61,7 @@ void ammo_fuel_init(entity item)
 }
 #endif
 REGISTER_ITEM(JetpackFuel, Ammo) {
 }
 #endif
 REGISTER_ITEM(JetpackFuel, Ammo) {
+    this.m_canonical_spawnfunc = "item_fuel";
 #ifdef GAMEQC
     this.m_model    =   MDL_JetpackFuel_ITEM;
 #endif
 #ifdef GAMEQC
     this.m_model    =   MDL_JetpackFuel_ITEM;
 #endif
@@ -67,11 +75,17 @@ REGISTER_ITEM(JetpackFuel, Ammo) {
 #endif
 }
 
 #endif
 }
 
+SPAWNFUNC_ITEM(item_fuel, ITEM_JetpackFuel)
+
 #ifdef GAMEQC
 MODEL(JetpackRegen_ITEM, Item_Model("g_fuelregen.md3"));
 #endif
 
 #ifdef GAMEQC
 MODEL(JetpackRegen_ITEM, Item_Model("g_fuelregen.md3"));
 #endif
 
-REGISTER_ITEM(JetpackRegen, Powerup) {
+CLASS(JetpackRegen, Powerup)
+ENDCLASS(JetpackRegen)
+
+REGISTER_ITEM(JetpackRegen, JetpackRegen) {
+    this.m_canonical_spawnfunc = "item_fuel_regen";
 #ifdef GAMEQC
     this.m_model                =   MDL_JetpackRegen_ITEM;
 #endif
 #ifdef GAMEQC
     this.m_model                =   MDL_JetpackRegen_ITEM;
 #endif
@@ -87,3 +101,5 @@ REGISTER_ITEM(JetpackRegen, Powerup) {
     this.m_pickupevalfunc       =   ammo_pickupevalfunc;
 #endif
 }
     this.m_pickupevalfunc       =   ammo_pickupevalfunc;
 #endif
 }
+
+SPAWNFUNC_ITEM(item_fuel_regen, ITEM_JetpackRegen)
index 41b658c2fc5a25afe03eefcaeea7867e07f1a6de..fa14bdaf6ee2bb10bc00a8367c169750197c9583 100644 (file)
@@ -31,6 +31,7 @@ void powerup_strength_init(entity item)
 }
 #endif
 REGISTER_ITEM(Strength, Powerup) {
 }
 #endif
 REGISTER_ITEM(Strength, Powerup) {
+    this.m_canonical_spawnfunc = "item_strength";
 #ifdef GAMEQC
     this.m_model            =   MDL_Strength_ITEM;
     this.m_sound            =   SND_Strength;
 #ifdef GAMEQC
     this.m_model            =   MDL_Strength_ITEM;
     this.m_sound            =   SND_Strength;
@@ -49,6 +50,8 @@ REGISTER_ITEM(Strength, Powerup) {
 #endif
 }
 
 #endif
 }
 
+SPAWNFUNC_ITEM(item_strength, ITEM_Strength)
+
 #ifdef GAMEQC
 MODEL(Shield_ITEM, Item_Model("g_invincible.md3"));
 SOUND(Shield, Item_Sound("powerup_shield"));
 #ifdef GAMEQC
 MODEL(Shield_ITEM, Item_Model("g_invincible.md3"));
 SOUND(Shield, Item_Sound("powerup_shield"));
@@ -63,6 +66,7 @@ void powerup_shield_init(entity item)
 }
 #endif
 REGISTER_ITEM(Shield, Powerup) {
 }
 #endif
 REGISTER_ITEM(Shield, Powerup) {
+    this.m_canonical_spawnfunc = "item_invincible";
 #ifdef GAMEQC
     this.m_model            =   MDL_Shield_ITEM;
     this.m_sound            =   SND_Shield;
 #ifdef GAMEQC
     this.m_model            =   MDL_Shield_ITEM;
     this.m_sound            =   SND_Shield;
@@ -80,3 +84,5 @@ REGISTER_ITEM(Shield, Powerup) {
     this.m_iteminit         =   powerup_shield_init;
 #endif
 }
     this.m_iteminit         =   powerup_shield_init;
 #endif
 }
+
+SPAWNFUNC_ITEM(item_invincible, ITEM_Shield)
index a8f4c6db7b7a6e0b2c23e99a95f0c9ac4c09c352..34ab62525d1bd5125effaea444e643ddb24afcbd 100644 (file)
@@ -23,6 +23,8 @@ void ammo_vaporizercells_init(entity item)
 }
 #endif
 REGISTER_ITEM(VaporizerCells, Ammo) {
 }
 #endif
 REGISTER_ITEM(VaporizerCells, Ammo) {
+    this.m_canonical_spawnfunc = "item_vaporizer_cells";
+    this.spawnflags = ITEM_FLAG_MUTATORBLOCKED;
 #ifdef GAMEQC
     this.m_model                =   MDL_VaporizerCells_ITEM;
     this.m_sound                =   SND_VaporizerCells;
 #ifdef GAMEQC
     this.m_model                =   MDL_VaporizerCells_ITEM;
     this.m_sound                =   SND_VaporizerCells;
@@ -39,6 +41,9 @@ REGISTER_ITEM(VaporizerCells, Ammo) {
 #endif
 }
 
 #endif
 }
 
+SPAWNFUNC_ITEM(item_vaporizer_cells, ITEM_VaporizerCells)
+SPAWNFUNC_ITEM(item_minst_cells, ITEM_VaporizerCells)
+
 #ifdef GAMEQC
 MODEL(ExtraLife_ITEM, Item_Model("g_h100.md3"));
 SOUND(ExtraLife, Item_Sound("megahealth"));
 #ifdef GAMEQC
 MODEL(ExtraLife_ITEM, Item_Model("g_h100.md3"));
 SOUND(ExtraLife, Item_Sound("megahealth"));
index 5a4f7d911ffb867d51541ea37784c1e5b627f5e1..8716264f4719739330feed37b14bf694f9e79235 100644 (file)
@@ -17,17 +17,16 @@ float autocvar_g_instagib_speed_highspeed;
 
 #include <common/items/_mod.qh>
 
 
 #include <common/items/_mod.qh>
 
-REGISTER_MUTATOR(mutator_instagib, autocvar_g_instagib && !g_nexball);
-
-spawnfunc(item_vaporizer_cells)
-{
-       if (!g_instagib) { delete(this); return; }
-       StartItem(this, ITEM_VaporizerCells);
-}
-
-spawnfunc(item_minst_cells)
+REGISTER_MUTATOR(mutator_instagib, autocvar_g_instagib && !g_nexball)
 {
 {
-       spawnfunc_item_vaporizer_cells(this);
+    MUTATOR_ONADD
+    {
+        ITEM_VaporizerCells.spawnflags &= ~ITEM_FLAG_MUTATORBLOCKED;
+    }
+    MUTATOR_ONROLLBACK_OR_REMOVE
+    {
+        ITEM_VaporizerCells.spawnflags |= ITEM_FLAG_MUTATORBLOCKED;
+    }
 }
 
 void instagib_invisibility(entity this)
 }
 
 void instagib_invisibility(entity this)
index 051c93525afcddbaf621e42448e9eb09539c0456..9020b93124777851f80a80eb1e2dc4b0edab75fa 100644 (file)
@@ -4,7 +4,6 @@
 
 float autocvar_g_instagib_invis_alpha;
 
 
 float autocvar_g_instagib_invis_alpha;
 
-spawnfunc(item_vaporizer_cells);
 void instagib_invisibility(entity this);
 void instagib_extralife(entity this);
 void instagib_speed(entity this);
 void instagib_invisibility(entity this);
 void instagib_extralife(entity this);
 void instagib_speed(entity this);
index 41327956f383b062deb21356e896170cb57c82f9..f88e52a9dfea6ab2d4efd9f8d61581ac28683b44 100644 (file)
@@ -10,8 +10,6 @@ MUTATOR_HOOKFUNCTION(hmg_nadesupport, Nade_Damage)
        M_ARGV(3, float) /* damage */ = (M_ARGV(0, entity)).max_health * 0.1;
 }
 
        M_ARGV(3, float) /* damage */ = (M_ARGV(0, entity)).max_health * 0.1;
 }
 
-spawnfunc(weapon_hmg) { weapon_defaultspawnfunc(this, WEP_HMG); }
-
 void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
        if (!PHYS_INPUT_BUTTON_ATCK(actor))
 void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
        if (!PHYS_INPUT_BUTTON_ATCK(actor))
index b77728fc988ccc7bea722ab08ce412b78f4b15f5..49457fb76f16dfc6aff7923cc4784d1e4a3f822f 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(HeavyMachineGun, Weapon)
 #pragma once
 
 CLASS(HeavyMachineGun, Weapon)
+/* spawnfunc */ ATTRIB(HeavyMachineGun, m_canonical_spawnfunc, string, "weapon_hmg");
 /* ammotype  */ ATTRIB(HeavyMachineGun, ammo_type, int, RESOURCE_BULLETS);
 /* impulse   */ ATTRIB(HeavyMachineGun, impulse, int, 3);
 /* flags     */ ATTRIB(HeavyMachineGun, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN | WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_SUPERWEAPON);
 /* ammotype  */ ATTRIB(HeavyMachineGun, ammo_type, int, RESOURCE_BULLETS);
 /* impulse   */ ATTRIB(HeavyMachineGun, impulse, int, 3);
 /* flags     */ ATTRIB(HeavyMachineGun, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN | WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_SUPERWEAPON);
@@ -41,6 +42,4 @@ CLASS(HeavyMachineGun, Weapon)
 ENDCLASS(HeavyMachineGun)
 REGISTER_WEAPON(HMG, hmg, NEW(HeavyMachineGun));
 
 ENDCLASS(HeavyMachineGun)
 REGISTER_WEAPON(HMG, hmg, NEW(HeavyMachineGun));
 
-#ifdef SVQC
-spawnfunc(weapon_hmg);
-#endif
+SPAWNFUNC_WEAPON(weapon_hmg, WEP_HMG)
index f901d11593d2951ccf0e542002be2d4230886f85..b38e0ee52ce78ab021f179fabe8e42ca64d04a2e 100644 (file)
@@ -1,7 +1,6 @@
 #include "rpc.qh"
 
 #ifdef SVQC
 #include "rpc.qh"
 
 #ifdef SVQC
-spawnfunc(weapon_rpc) { weapon_defaultspawnfunc(this, WEP_RPC); }
 
 void W_RocketPropelledChainsaw_Explode(entity this, entity directhitentity)
 {
 
 void W_RocketPropelledChainsaw_Explode(entity this, entity directhitentity)
 {
index a107da39b19908c85fa42b601b63ac9084d64562..a6891a05d31c6b14b57f9fd0747b6106c53893a2 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(RocketPropelledChainsaw, Weapon)
 #pragma once
 
 CLASS(RocketPropelledChainsaw, Weapon)
+/* spawnfunc */ ATTRIB(RocketPropelledChainsaw, m_canonical_spawnfunc, string, "weapon_rpc");
 /* ammotype  */ ATTRIB(RocketPropelledChainsaw, ammo_type, int, RESOURCE_ROCKETS);
 /* impulse   */ ATTRIB(RocketPropelledChainsaw, impulse, int, 9);
 /* flags     */ ATTRIB(RocketPropelledChainsaw, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN | WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH | WEP_FLAG_SUPERWEAPON);
 /* ammotype  */ ATTRIB(RocketPropelledChainsaw, ammo_type, int, RESOURCE_ROCKETS);
 /* impulse   */ ATTRIB(RocketPropelledChainsaw, impulse, int, 9);
 /* flags     */ ATTRIB(RocketPropelledChainsaw, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN | WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH | WEP_FLAG_SUPERWEAPON);
@@ -46,6 +47,4 @@ CLASS(RocketPropelledChainsaw, Weapon)
 ENDCLASS(RocketPropelledChainsaw)
 REGISTER_WEAPON(RPC, rpc, NEW(RocketPropelledChainsaw));
 
 ENDCLASS(RocketPropelledChainsaw)
 REGISTER_WEAPON(RPC, rpc, NEW(RocketPropelledChainsaw));
 
-#ifdef SVQC
-spawnfunc(weapon_rpc);
-#endif
+SPAWNFUNC_WEAPON(weapon_rpc, WEP_RPC)
index ce015b12c3aca738cc72c549320a3987b5cdc58b..734a14baee95ec3da8a5d9d5ad6c6fa676f19f86 100644 (file)
@@ -28,8 +28,6 @@ REGISTER_MUTATOR(ok, expr_evaluate(autocvar_g_overkill) && !cvar("g_instagib") &
 }
 
 void W_Blaster_Attack(entity, .entity, float, float, float, float, float, float, float, float, float, float);
 }
 
 void W_Blaster_Attack(entity, .entity, float, float, float, float, float, float, float, float, float, float);
-spawnfunc(weapon_hmg);
-spawnfunc(weapon_rpc);
 
 MUTATOR_HOOKFUNCTION(ok, Damage_Calculate, CBC_ORDER_LAST)
 {
 
 MUTATOR_HOOKFUNCTION(ok, Damage_Calculate, CBC_ORDER_LAST)
 {
index 98fb4815c1ce28cc699a429537ea75c2643b4487..928d174b13b5208ae0b14867e7e1a1fad430cc4e 100644 (file)
@@ -1 +1,4 @@
 // generated file; do not modify
 // generated file; do not modify
+#ifdef SVQC
+    #include <common/mutators/mutator/random_items/sv_random_items.qh>
+#endif
index 1575fc9931c6654608752fc442e1ee49232269f9..97938e81d850d65b490aac9728cacb2c47da0e0e 100644 (file)
@@ -934,7 +934,7 @@ LABEL(pickup)
 
        Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1);
        _sound (toucher, (this.itemdef.instanceOfPowerup ? CH_TRIGGER_SINGLE : CH_TRIGGER), (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM);
 
        Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1);
        _sound (toucher, (this.itemdef.instanceOfPowerup ? CH_TRIGGER_SINGLE : CH_TRIGGER), (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM);
-       
+
        MUTATOR_CALLHOOK(ItemTouched, this, toucher);
        if (wasfreed(this))
        {
        MUTATOR_CALLHOOK(ItemTouched, this, toucher);
        if (wasfreed(this))
        {
@@ -1387,6 +1387,13 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
 
 void StartItem(entity this, GameItem def)
 {
 
 void StartItem(entity this, GameItem def)
 {
+    def = def.m_spawnfunc_hookreplace(def, this);
+    if (def.spawnflags & ITEM_FLAG_MUTATORBLOCKED)
+    {
+        delete(this);
+        return;
+    }
+    this.classname = def.m_canonical_spawnfunc;
     _StartItem(
        this,
        this.itemdef = def,
     _StartItem(
        this,
        this.itemdef = def,
index 71d7c3db39f464b975e9258764fa08676984eae5..fa62ffbd349490fe022fe71344470704b6c2f3a4 100644 (file)
@@ -58,6 +58,10 @@ const int WS_READY  = 4;
 /** fields which are explicitly/manually set are marked with "M", fields set automatically are marked with "A" */
 CLASS(Weapon, Object)
        ATTRIB(Weapon, m_id, int, 0);
 /** fields which are explicitly/manually set are marked with "M", fields set automatically are marked with "A" */
 CLASS(Weapon, Object)
        ATTRIB(Weapon, m_id, int, 0);
+       /** the canonical spawnfunc name */
+    ATTRIB(Weapon, m_canonical_spawnfunc, string);
+    /** control what happens when this weapon is spawned */
+    METHOD(Weapon, m_spawnfunc_hookreplace, Weapon(Weapon this, entity e)) { return this; }
     /** A: WEPSET_id : WEPSET_... */
     ATTRIB(Weapon, weapons, WepSet, '0 0 0');
     /** M: ammotype  : main ammo type */
     /** A: WEPSET_id : WEPSET_... */
     ATTRIB(Weapon, weapons, WepSet, '0 0 0');
     /** M: ammotype  : main ammo type */
@@ -137,6 +141,18 @@ CLASS(Weapon, Object)
        }
 ENDCLASS(Weapon)
 
        }
 ENDCLASS(Weapon)
 
+#ifdef SVQC
+
+void weapon_defaultspawnfunc(entity this, Weapon e);
+#define SPAWNFUNC_WEAPON(name, weapon) \
+    spawnfunc(name) { weapon_defaultspawnfunc(this, weapon); }
+
+#else
+
+#define SPAWNFUNC_WEAPON(name, weapon)
+
+#endif
+
 #include <common/items/_mod.qh>
 CLASS(WeaponPickup, Pickup)
     ATTRIB(WeaponPickup, m_weapon, Weapon);
 #include <common/items/_mod.qh>
 CLASS(WeaponPickup, Pickup)
     ATTRIB(WeaponPickup, m_weapon, Weapon);
index 5b982219e7cc6708dd0ba994b0e5d2501be34797..23e3dbcb2bc8d235e2921f45ab8803570bd0ea35 100644 (file)
@@ -1,7 +1,6 @@
 #include "arc.qh"
 
 #ifdef SVQC
 #include "arc.qh"
 
 #ifdef SVQC
-spawnfunc(weapon_arc) { weapon_defaultspawnfunc(this, WEP_ARC); }
 
 bool W_Arc_Beam_Send(entity this, entity to, int sf)
 {
 
 bool W_Arc_Beam_Send(entity this, entity to, int sf)
 {
index ed2d0a800ebec8281634d5ab4ace72132c864091..4ec2d4edc98a1a59053f8a7ac8346c9f5a7bd52e 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(Arc, Weapon)
 #pragma once
 
 CLASS(Arc, Weapon)
+/* spawnfunc */ ATTRIB(Arc, m_canonical_spawnfunc, string, "weapon_arc");
 /* ammotype  */ ATTRIB(Arc, ammo_type, int, RESOURCE_CELLS);
 /* impulse   */ ATTRIB(Arc, impulse, int, 3);
 /* flags     */ ATTRIB(Arc, spawnflags, int, WEP_TYPE_HITSCAN);
 /* ammotype  */ ATTRIB(Arc, ammo_type, int, RESOURCE_CELLS);
 /* impulse   */ ATTRIB(Arc, impulse, int, 3);
 /* flags     */ ATTRIB(Arc, spawnflags, int, WEP_TYPE_HITSCAN);
@@ -74,6 +75,7 @@ CLASS(Arc, Weapon)
 ENDCLASS(Arc)
 REGISTER_WEAPON(ARC, arc, NEW(Arc));
 
 ENDCLASS(Arc)
 REGISTER_WEAPON(ARC, arc, NEW(Arc));
 
+SPAWNFUNC_WEAPON(weapon_arc, WEP_ARC)
 
 #ifdef GAMEQC
 const float ARC_MAX_SEGMENTS = 20;
 
 #ifdef GAMEQC
 const float ARC_MAX_SEGMENTS = 20;
@@ -112,7 +114,6 @@ const int ARC_SF_LOCALMASK =   ARC_SF_START | ARC_SF_WANTDIR | ARC_SF_BEAMDIR;
 .float arc_cooldown; // (dropped arc/player) cooling speed
 .float arc_heat_percent = _STAT(ARC_HEAT);
 .float arc_smoke_sound;
 .float arc_cooldown; // (dropped arc/player) cooling speed
 .float arc_heat_percent = _STAT(ARC_HEAT);
 .float arc_smoke_sound;
-spawnfunc(weapon_arc);
 #endif
 #ifdef CSQC
 
 #endif
 #ifdef CSQC
 
index ac1540cd51fc860038f1f04072b55c75a40e5656..2189c1db209d1d1d68b57949bdd8a5103183bb17 100644 (file)
@@ -1,8 +1,6 @@
 #include "blaster.qh"
 
 #ifdef SVQC
 #include "blaster.qh"
 
 #ifdef SVQC
-spawnfunc(weapon_blaster) { weapon_defaultspawnfunc(this, WEP_BLASTER); }
-spawnfunc(weapon_laser) { spawnfunc_weapon_blaster(this); }
 
 void W_Blaster_Touch(entity this, entity toucher)
 {
 
 void W_Blaster_Touch(entity this, entity toucher)
 {
index 40e453511dd1968fabac276c460f16f67a96cb8e..0a0e7c17d2f57c21cdbee6d3735f0576c566377e 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(Blaster, Weapon)
 #pragma once
 
 CLASS(Blaster, Weapon)
+/* spawnfunc */ ATTRIB(Blaster, m_canonical_spawnfunc, string, "weapon_blaster");
 /* ammotype  */ //ATTRIB(Blaster, ammo_type, int, RESOURCE_NONE);
 /* impulse   */ ATTRIB(Blaster, impulse, int, 1);
 /* flags     */ ATTRIB(Blaster, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
 /* ammotype  */ //ATTRIB(Blaster, ammo_type, int, RESOURCE_NONE);
 /* impulse   */ ATTRIB(Blaster, impulse, int, 1);
 /* flags     */ ATTRIB(Blaster, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
@@ -44,6 +45,9 @@ CLASS(Blaster, Weapon)
 ENDCLASS(Blaster)
 REGISTER_WEAPON(BLASTER, blaster, NEW(Blaster));
 
 ENDCLASS(Blaster)
 REGISTER_WEAPON(BLASTER, blaster, NEW(Blaster));
 
+SPAWNFUNC_WEAPON(weapon_blaster, WEP_BLASTER)
+SPAWNFUNC_WEAPON(weapon_laser, WEP_BLASTER)
+
 #ifdef SVQC
 .float blaster_damage;
 .float blaster_edgedamage;
 #ifdef SVQC
 .float blaster_damage;
 .float blaster_edgedamage;
@@ -51,5 +55,4 @@ REGISTER_WEAPON(BLASTER, blaster, NEW(Blaster));
 .float blaster_force;
 .float blaster_lifetime;
 
 .float blaster_force;
 .float blaster_lifetime;
 
-spawnfunc(weapon_blaster);
 #endif
 #endif
index 2e2cb519af644ad83fa9133dc6f711227542b72f..246452fe62ff9cce932ec72a698033ef5d8839de 100644 (file)
@@ -1,7 +1,6 @@
 #include "crylink.qh"
 
 #ifdef SVQC
 #include "crylink.qh"
 
 #ifdef SVQC
-spawnfunc(weapon_crylink) { weapon_defaultspawnfunc(this, WEP_CRYLINK); }
 
 void W_Crylink_CheckLinks(entity e)
 {
 
 void W_Crylink_CheckLinks(entity e)
 {
index be6afd82c51c01a088caca071813a441f9f4b649..5ecef08d9f48bed31aa471cafefe95db1b158666 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(Crylink, Weapon)
 #pragma once
 
 CLASS(Crylink, Weapon)
+/* spawnfunc */ ATTRIB(Crylink, m_canonical_spawnfunc, string, "weapon_crylink");
 /* ammotype  */ ATTRIB(Crylink, ammo_type, int, RESOURCE_CELLS);
 /* impulse   */ ATTRIB(Crylink, impulse, int, 6);
 /* flags     */ ATTRIB(Crylink, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH | WEP_FLAG_CANCLIMB | WEP_FLAG_NODUAL);
 /* ammotype  */ ATTRIB(Crylink, ammo_type, int, RESOURCE_CELLS);
 /* impulse   */ ATTRIB(Crylink, impulse, int, 6);
 /* flags     */ ATTRIB(Crylink, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH | WEP_FLAG_CANCLIMB | WEP_FLAG_NODUAL);
@@ -59,6 +60,8 @@ CLASS(Crylink, Weapon)
 ENDCLASS(Crylink)
 REGISTER_WEAPON(CRYLINK, crylink, NEW(Crylink));
 
 ENDCLASS(Crylink)
 REGISTER_WEAPON(CRYLINK, crylink, NEW(Crylink));
 
+SPAWNFUNC_WEAPON(weapon_crylink, WEP_CRYLINK)
+
 #ifdef SVQC
 .float gravity;
 .float crylink_waitrelease;
 #ifdef SVQC
 .float gravity;
 .float crylink_waitrelease;
@@ -68,5 +71,4 @@ REGISTER_WEAPON(CRYLINK, crylink, NEW(Crylink));
 
 .entity queuenext;
 .entity queueprev;
 
 .entity queuenext;
 .entity queueprev;
-spawnfunc(weapon_crylink);
 #endif
 #endif
index f4ef7ad32c08b320d139348908b42e7c95cb54bb..46db8358cef76b423c43e5b218e391d6ff876a9a 100644 (file)
@@ -1,8 +1,6 @@
 #include "devastator.qh"
 
 #ifdef SVQC
 #include "devastator.qh"
 
 #ifdef SVQC
-spawnfunc(weapon_devastator) { weapon_defaultspawnfunc(this, WEP_DEVASTATOR); }
-spawnfunc(weapon_rocketlauncher) { spawnfunc_weapon_devastator(this); }
 
 .entity lastrocket;
 
 
 .entity lastrocket;
 
index ebfde371c69f62bbb978811762d20d94e9e37ee8..0e8d8b2fbc8b271102ac17363b1435a957db1047 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(Devastator, Weapon)
 #pragma once
 
 CLASS(Devastator, Weapon)
+/* spawnfunc */ ATTRIB(Devastator, m_canonical_spawnfunc, string, "weapon_devastator");
 /* ammotype  */ ATTRIB(Devastator, ammo_type, int, RESOURCE_ROCKETS);
 /* impulse   */ ATTRIB(Devastator, impulse, int, 9);
 /* flags     */ ATTRIB(Devastator, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH | WEP_FLAG_NODUAL);
 /* ammotype  */ ATTRIB(Devastator, ammo_type, int, RESOURCE_ROCKETS);
 /* impulse   */ ATTRIB(Devastator, impulse, int, 9);
 /* flags     */ ATTRIB(Devastator, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH | WEP_FLAG_NODUAL);
@@ -62,8 +63,10 @@ CLASS(Devastator, Weapon)
 ENDCLASS(Devastator)
 REGISTER_WEAPON(DEVASTATOR, devastator, NEW(Devastator));
 
 ENDCLASS(Devastator)
 REGISTER_WEAPON(DEVASTATOR, devastator, NEW(Devastator));
 
+SPAWNFUNC_WEAPON(weapon_devastator, WEP_DEVASTATOR)
+SPAWNFUNC_WEAPON(weapon_rocketlauncher, WEP_DEVASTATOR)
+
 #ifdef SVQC
 .float rl_release;
 .float rl_detonate_later;
 #ifdef SVQC
 .float rl_release;
 .float rl_detonate_later;
-spawnfunc(weapon_devastator);
 #endif
 #endif
index 8b3946e46e43d77b673b7023c89b3ab4c5afbf6c..5aec7fef96367996a8a144268897a65cbfdbf5fa 100644 (file)
@@ -1,7 +1,6 @@
 #include "electro.qh"
 
 #ifdef SVQC
 #include "electro.qh"
 
 #ifdef SVQC
-spawnfunc(weapon_electro) { weapon_defaultspawnfunc(this, WEP_ELECTRO); }
 
 void W_Electro_TriggerCombo(vector org, float rad, entity own)
 {
 
 void W_Electro_TriggerCombo(vector org, float rad, entity own)
 {
index d881908278392ae386f20a6a6cfb3debf3988b51..4018e5926c78ac03364173ce19883119b59d1503 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(Electro, Weapon)
 #pragma once
 
 CLASS(Electro, Weapon)
+/* spawnfunc */ ATTRIB(Electro, m_canonical_spawnfunc, string, "weapon_electro");
 /* ammotype  */ ATTRIB(Electro, ammo_type, int, RESOURCE_CELLS);
 /* impulse   */ ATTRIB(Electro, impulse, int, 5);
 /* flags     */ ATTRIB(Electro, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
 /* ammotype  */ ATTRIB(Electro, ammo_type, int, RESOURCE_CELLS);
 /* impulse   */ ATTRIB(Electro, impulse, int, 5);
 /* flags     */ ATTRIB(Electro, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
@@ -66,10 +67,10 @@ CLASS(Electro, Weapon)
 ENDCLASS(Electro)
 REGISTER_WEAPON(ELECTRO, electro, NEW(Electro));
 
 ENDCLASS(Electro)
 REGISTER_WEAPON(ELECTRO, electro, NEW(Electro));
 
+SPAWNFUNC_WEAPON(weapon_electro, WEP_ELECTRO)
 
 #ifdef SVQC
 .float electro_count;
 .float electro_secondarytime;
 
 #ifdef SVQC
 .float electro_count;
 .float electro_secondarytime;
-spawnfunc(weapon_electro);
 void W_Electro_ExplodeCombo(entity this);
 #endif
 void W_Electro_ExplodeCombo(entity this);
 #endif
index 3f9cd4c4e18f6d731d2d7db54764b983ceb8ec0e..3f6830f33c271516446592883fed8ff4e08a6c06 100644 (file)
@@ -1,7 +1,6 @@
 #include "fireball.qh"
 
 #ifdef SVQC
 #include "fireball.qh"
 
 #ifdef SVQC
-spawnfunc(weapon_fireball) { weapon_defaultspawnfunc(this, WEP_FIREBALL); }
 
 void W_Fireball_Explode(entity this, entity directhitentity)
 {
 
 void W_Fireball_Explode(entity this, entity directhitentity)
 {
index cd52d2a70ca5e2f3c11d271a15df40ff2684d827..4302c9e7973467d5843917f708cc805260db2cce 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(Fireball, Weapon)
 #pragma once
 
 CLASS(Fireball, Weapon)
+/* spawnfunc */ ATTRIB(Fireball, m_canonical_spawnfunc, string, "weapon_fireball");
 /* ammotype  */ //ATTRIB(Fireball, ammo_type, int, RESOURCE_NONE);
 /* impulse   */ ATTRIB(Fireball, impulse, int, 9);
 /* flags     */ ATTRIB(Fireball, spawnflags, int, WEP_FLAG_SUPERWEAPON | WEP_TYPE_SPLASH | WEP_FLAG_NODUAL);
 /* ammotype  */ //ATTRIB(Fireball, ammo_type, int, RESOURCE_NONE);
 /* impulse   */ ATTRIB(Fireball, impulse, int, 9);
 /* flags     */ ATTRIB(Fireball, spawnflags, int, WEP_FLAG_SUPERWEAPON | WEP_TYPE_SPLASH | WEP_FLAG_NODUAL);
@@ -53,9 +54,10 @@ CLASS(Fireball, Weapon)
 ENDCLASS(Fireball)
 REGISTER_WEAPON(FIREBALL, fireball, NEW(Fireball));
 
 ENDCLASS(Fireball)
 REGISTER_WEAPON(FIREBALL, fireball, NEW(Fireball));
 
+SPAWNFUNC_WEAPON(weapon_fireball, WEP_FIREBALL)
+
 #ifdef SVQC
 .float bot_primary_fireballmooth; // whatever a mooth is
 .vector fireball_impactvec;
 .float fireball_primarytime;
 #ifdef SVQC
 .float bot_primary_fireballmooth; // whatever a mooth is
 .vector fireball_impactvec;
 .float fireball_primarytime;
-spawnfunc(weapon_fireball);
 #endif
 #endif
index be95d5dde2a3650367840715bf865565d1d69256..ff2e74539ce83faf9acb719b3faf4c26cd376bc7 100644 (file)
@@ -1,7 +1,6 @@
 #include "hagar.qh"
 
 #ifdef SVQC
 #include "hagar.qh"
 
 #ifdef SVQC
-spawnfunc(weapon_hagar) { weapon_defaultspawnfunc(this, WEP_HAGAR); }
 
 // NO bounce protection, as bounces are limited!
 
 
 // NO bounce protection, as bounces are limited!
 
index c5661f1e66831df9576c1ebd0e1fa615aeb7f51f..924326fb3a0a65e211ef2a0eba363444e5f1b771 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(Hagar, Weapon)
 #pragma once
 
 CLASS(Hagar, Weapon)
+/* spawnfunc */ ATTRIB(Hagar, m_canonical_spawnfunc, string, "weapon_hagar");
 /* ammotype  */ ATTRIB(Hagar, ammo_type, int, RESOURCE_ROCKETS);
 /* impulse   */ ATTRIB(Hagar, impulse, int, 8);
 /* flags     */ ATTRIB(Hagar, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
 /* ammotype  */ ATTRIB(Hagar, ammo_type, int, RESOURCE_ROCKETS);
 /* impulse   */ ATTRIB(Hagar, impulse, int, 8);
 /* flags     */ ATTRIB(Hagar, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
@@ -57,6 +58,4 @@ CLASS(Hagar, Weapon)
 ENDCLASS(Hagar)
 REGISTER_WEAPON(HAGAR, hagar, NEW(Hagar));
 
 ENDCLASS(Hagar)
 REGISTER_WEAPON(HAGAR, hagar, NEW(Hagar));
 
-#ifdef SVQC
-spawnfunc(weapon_hagar);
-#endif
+SPAWNFUNC_WEAPON(weapon_hagar, WEP_HAGAR)
index 2fb16d6e35f0dd9a1c60ffc96a4034c22ff86596..ae6c9a66372f4637ec28cfacb5890a82987f0e33 100644 (file)
@@ -1,7 +1,6 @@
 #include "hlac.qh"
 
 #ifdef SVQC
 #include "hlac.qh"
 
 #ifdef SVQC
-spawnfunc(weapon_hlac) { weapon_defaultspawnfunc(this, WEP_HLAC); }
 
 void W_HLAC_Touch(entity this, entity toucher)
 {
 
 void W_HLAC_Touch(entity this, entity toucher)
 {
index 3ab29907e07aadb236c8b9731eed8f9acbadd5db..d2bd427c2397bb90a1a69acb5c8be17382e39da0 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(HLAC, Weapon)
 #pragma once
 
 CLASS(HLAC, Weapon)
+/* spawnfunc */ ATTRIB(HLAC, m_canonical_spawnfunc, string, "weapon_hlac");
 /* ammotype  */ ATTRIB(HLAC, ammo_type, int, RESOURCE_CELLS);
 /* impulse   */ ATTRIB(HLAC, impulse, int, 6);
 /* flags     */ ATTRIB(HLAC, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
 /* ammotype  */ ATTRIB(HLAC, ammo_type, int, RESOURCE_CELLS);
 /* impulse   */ ATTRIB(HLAC, impulse, int, 6);
 /* flags     */ ATTRIB(HLAC, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
@@ -49,6 +50,4 @@ CLASS(HLAC, Weapon)
 ENDCLASS(HLAC)
 REGISTER_WEAPON(HLAC, hlac, NEW(HLAC));
 
 ENDCLASS(HLAC)
 REGISTER_WEAPON(HLAC, hlac, NEW(HLAC));
 
-#ifdef SVQC
-spawnfunc(weapon_hlac);
-#endif
+SPAWNFUNC_WEAPON(weapon_hlac, WEP_HLAC)
index d92e0caa8538b4c9ec4ccc5c0bc79a3fef41e7f4..4a21a516947ba0d18a95c178a513b95dbe0269fa 100644 (file)
@@ -2,8 +2,6 @@
 
 #ifdef SVQC
 
 
 #ifdef SVQC
 
-spawnfunc(weapon_hook) { weapon_defaultspawnfunc(this, WEP_HOOK); }
-
 void W_Hook_ExplodeThink(entity this)
 {
        float dt, dmg_remaining_next, f;
 void W_Hook_ExplodeThink(entity this)
 {
        float dt, dmg_remaining_next, f;
index d028323ff1755ffe7d73cf237a127861a1aed66f..31424d421b14d68009a52e061c9e6dbf252d40e7 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(Hook, Weapon)
 #pragma once
 
 CLASS(Hook, Weapon)
+/* spawnfunc */ ATTRIB(Hook, m_canonical_spawnfunc, string, "weapon_hook");
 /* ammotype  */ ATTRIB(Hook, ammo_type, int, RESOURCE_FUEL);
 /* impulse   */ ATTRIB(Hook, impulse, int, 0);
 /* flags     */ ATTRIB(Hook, spawnflags, int, WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
 /* ammotype  */ ATTRIB(Hook, ammo_type, int, RESOURCE_FUEL);
 /* impulse   */ ATTRIB(Hook, impulse, int, 0);
 /* flags     */ ATTRIB(Hook, spawnflags, int, WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
@@ -49,6 +50,8 @@ CLASS(Hook, Weapon)
 ENDCLASS(Hook)
 REGISTER_WEAPON(HOOK, hook, NEW(Hook));
 
 ENDCLASS(Hook)
 REGISTER_WEAPON(HOOK, hook, NEW(Hook));
 
+SPAWNFUNC_WEAPON(weapon_hook, WEP_HOOK)
+
 CLASS(OffhandHook, OffhandWeapon)
 #ifdef SVQC
     METHOD(OffhandHook, offhand_think, void(OffhandHook this, entity actor, bool key_pressed))
 CLASS(OffhandHook, OffhandWeapon)
 #ifdef SVQC
     METHOD(OffhandHook, offhand_think, void(OffhandHook this, entity actor, bool key_pressed))
@@ -73,5 +76,4 @@ OffhandHook OFFHAND_HOOK; STATIC_INIT(OFFHAND_HOOK) { OFFHAND_HOOK = NEW(Offhand
 .float hook_refire;
 .float hook_time_hooked;
 .float hook_time_fueldecrease;
 .float hook_refire;
 .float hook_time_hooked;
 .float hook_time_fueldecrease;
-spawnfunc(weapon_hook);
 #endif
 #endif
index 8d96c4b1013ca875a0d581408a335877c83c160a..100a11a0cd2ee8683275dce84f6555c853e1fff1 100644 (file)
@@ -2,17 +2,15 @@
 
 #ifdef SVQC
 
 
 #ifdef SVQC
 
-spawnfunc(weapon_machinegun)
+METHOD(MachineGun, m_spawnfunc_hookreplace, Weapon(MachineGun this, entity e))
 {
        if(autocvar_sv_q3acompat_machineshotgunswap)
 {
        if(autocvar_sv_q3acompat_machineshotgunswap)
-       if(this.classname != "droppedweapon")
+       if(e.classname != "droppedweapon")
        {
        {
-               weapon_defaultspawnfunc(this, WEP_SHOCKWAVE);
-               return;
+               return WEP_SHOCKWAVE;
        }
        }
-       weapon_defaultspawnfunc(this, WEP_MACHINEGUN);
+       return this;
 }
 }
-spawnfunc(weapon_uzi) { spawnfunc_weapon_machinegun(this); }
 
 void W_MachineGun_MuzzleFlash_Think(entity this)
 {
 
 void W_MachineGun_MuzzleFlash_Think(entity this)
 {
index 183a736c2572ebe107f465fa3e0ecf7ed2a8bbe6..a7ede47a2105125d60a9a07778130c633720ce8e 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(MachineGun, Weapon)
 #pragma once
 
 CLASS(MachineGun, Weapon)
+/* spawnfunc */ ATTRIB(MachineGun, m_canonical_spawnfunc, string, "weapon_machinegun");
 /* ammotype  */ ATTRIB(MachineGun, ammo_type, int, RESOURCE_BULLETS);
 /* impulse   */ ATTRIB(MachineGun, impulse, int, 3);
 /* flags     */ ATTRIB(MachineGun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_PENETRATEWALLS);
 /* ammotype  */ ATTRIB(MachineGun, ammo_type, int, RESOURCE_BULLETS);
 /* impulse   */ ATTRIB(MachineGun, impulse, int, 3);
 /* flags     */ ATTRIB(MachineGun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_PENETRATEWALLS);
@@ -55,6 +56,5 @@ CLASS(MachineGun, Weapon)
 ENDCLASS(MachineGun)
 REGISTER_WEAPON(MACHINEGUN, machinegun, NEW(MachineGun));
 
 ENDCLASS(MachineGun)
 REGISTER_WEAPON(MACHINEGUN, machinegun, NEW(MachineGun));
 
-#ifdef SVQC
-spawnfunc(weapon_machinegun);
-#endif
+SPAWNFUNC_WEAPON(weapon_machinegun, WEP_MACHINEGUN)
+SPAWNFUNC_WEAPON(weapon_uzi, WEP_MACHINEGUN)
index 99b00a814f20ffbdb4d3d62507ba6ccff96f2e80..575b76d72e12f4fbf9000331b3ed56a32cafd338 100644 (file)
@@ -1,7 +1,6 @@
 #include "minelayer.qh"
 
 #ifdef SVQC
 #include "minelayer.qh"
 
 #ifdef SVQC
-spawnfunc(weapon_minelayer) { weapon_defaultspawnfunc(this, WEP_MINE_LAYER); }
 
 void W_MineLayer_Stick(entity this, entity to)
 {
 
 void W_MineLayer_Stick(entity this, entity to)
 {
index 7369d8c675a79c64e886086cf5491ecb22938ab0..f804aaf44e9c637520a33a2673b47bed06aba853 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(MineLayer, Weapon)
 #pragma once
 
 CLASS(MineLayer, Weapon)
+/* spawnfunc */ ATTRIB(MineLayer, m_canonical_spawnfunc, string, "weapon_minelayer");
 /* ammotype  */ ATTRIB(MineLayer, ammo_type, int, RESOURCE_ROCKETS);
 /* impulse   */ ATTRIB(MineLayer, impulse, int, 4);
 /* flags     */ ATTRIB(MineLayer, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
 /* ammotype  */ ATTRIB(MineLayer, ammo_type, int, RESOURCE_ROCKETS);
 /* impulse   */ ATTRIB(MineLayer, impulse, int, 4);
 /* flags     */ ATTRIB(MineLayer, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
@@ -53,10 +54,11 @@ CLASS(MineLayer, Weapon)
 ENDCLASS(MineLayer)
 REGISTER_WEAPON(MINE_LAYER, minelayer, NEW(MineLayer));
 
 ENDCLASS(MineLayer)
 REGISTER_WEAPON(MINE_LAYER, minelayer, NEW(MineLayer));
 
+SPAWNFUNC_WEAPON(weapon_minelayer, WEP_MINE_LAYER)
+
 #ifdef SVQC
 void W_MineLayer_Think(entity this);
 .float minelayer_detonate, mine_explodeanyway;
 .float mine_time;
 .vector mine_orientation;
 #ifdef SVQC
 void W_MineLayer_Think(entity this);
 .float minelayer_detonate, mine_explodeanyway;
 .float mine_time;
 .vector mine_orientation;
-spawnfunc(weapon_minelayer);
 #endif
 #endif
index 6a3d2e1250a63294e400a4a283e850fef651eb6e..6ada37cd675fd92db33ab02e849df8fcc364968a 100644 (file)
@@ -2,9 +2,6 @@
 
 #ifdef SVQC
 
 
 #ifdef SVQC
 
-spawnfunc(weapon_mortar) { weapon_defaultspawnfunc(this, WEP_MORTAR); }
-spawnfunc(weapon_grenadelauncher) { spawnfunc_weapon_mortar(this); }
-
 void W_Mortar_Grenade_Explode(entity this, entity directhitentity)
 {
        if(directhitentity.takedamage == DAMAGE_AIM)
 void W_Mortar_Grenade_Explode(entity this, entity directhitentity)
 {
        if(directhitentity.takedamage == DAMAGE_AIM)
index be9cdbb1f3ef8577285193c13881301cba010faa..affec0dbcae952696866a9c6e08c84d15b7ba454 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(Mortar, Weapon)
 #pragma once
 
 CLASS(Mortar, Weapon)
+/* spawnfunc */ ATTRIB(Mortar, m_canonical_spawnfunc, string, "weapon_mortar");
 /* ammotype  */ ATTRIB(Mortar, ammo_type, int, RESOURCE_ROCKETS);
 /* impulse   */ ATTRIB(Mortar, impulse, int, 4);
 /* flags     */ ATTRIB(Mortar, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
 /* ammotype  */ ATTRIB(Mortar, ammo_type, int, RESOURCE_ROCKETS);
 /* impulse   */ ATTRIB(Mortar, impulse, int, 4);
 /* flags     */ ATTRIB(Mortar, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
@@ -53,9 +54,10 @@ CLASS(Mortar, Weapon)
 ENDCLASS(Mortar)
 REGISTER_WEAPON(MORTAR, mortar, NEW(Mortar));
 
 ENDCLASS(Mortar)
 REGISTER_WEAPON(MORTAR, mortar, NEW(Mortar));
 
+SPAWNFUNC_WEAPON(weapon_mortar, WEP_MORTAR)
+SPAWNFUNC_WEAPON(weapon_grenadelauncher, WEP_MORTAR)
 
 #ifdef SVQC
 .float gl_detonate_later;
 .float gl_bouncecnt;
 
 #ifdef SVQC
 .float gl_detonate_later;
 .float gl_bouncecnt;
-spawnfunc(weapon_mortar);
 #endif
 #endif
index b4dab73cc951c2d8e93ba90c3024da215b799e00..9738914644ceb482b3936d07c734c4cef9eda899 100644 (file)
@@ -3,8 +3,6 @@
 #ifdef SVQC
 #include <common/triggers/trigger/jumppads.qh>
 
 #ifdef SVQC
 #include <common/triggers/trigger/jumppads.qh>
 
-spawnfunc(weapon_porto) { weapon_defaultspawnfunc(this, WEP_PORTO); }
-
 REGISTER_MUTATOR(porto_ticker, true);
 MUTATOR_HOOKFUNCTION(porto_ticker, SV_StartFrame) {
        FOREACH_CLIENT(IS_PLAYER(it), it.porto_forbidden = max(0, it.porto_forbidden - 1));
 REGISTER_MUTATOR(porto_ticker, true);
 MUTATOR_HOOKFUNCTION(porto_ticker, SV_StartFrame) {
        FOREACH_CLIENT(IS_PLAYER(it), it.porto_forbidden = max(0, it.porto_forbidden - 1));
index 6af9e3b92fbf7b54addd8fe84a0529ad44e4e0a8..93b3a6e9f7da4d73251da4dd731ab1810390227c 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(PortoLaunch, Weapon)
 #pragma once
 
 CLASS(PortoLaunch, Weapon)
+/* spawnfunc */ ATTRIB(PortoLaunch, m_canonical_spawnfunc, string, "weapon_porto");
 /* ammotype  */ ATTRIB(PortoLaunch, ammo_type, int, RESOURCE_NONE);
 /* impulse   */ ATTRIB(PortoLaunch, impulse, int, 0);
 /* flags     */ ATTRIB(PortoLaunch, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_SUPERWEAPON | WEP_FLAG_NODUAL);
 /* ammotype  */ ATTRIB(PortoLaunch, ammo_type, int, RESOURCE_NONE);
 /* impulse   */ ATTRIB(PortoLaunch, impulse, int, 0);
 /* flags     */ ATTRIB(PortoLaunch, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_SUPERWEAPON | WEP_FLAG_NODUAL);
@@ -35,11 +36,12 @@ CLASS(PortoLaunch, Weapon)
 ENDCLASS(PortoLaunch)
 REGISTER_WEAPON(PORTO, porto, NEW(PortoLaunch));
 
 ENDCLASS(PortoLaunch)
 REGISTER_WEAPON(PORTO, porto, NEW(PortoLaunch));
 
+SPAWNFUNC_WEAPON(weapon_porto, WEP_PORTO)
+
 #ifdef SVQC
 .entity porto_current;
 .vector porto_v_angle; // holds "held" view angles
 .float porto_v_angle_held;
 .vector right_vector;
 .float porto_forbidden;
 #ifdef SVQC
 .entity porto_current;
 .vector porto_v_angle; // holds "held" view angles
 .float porto_v_angle_held;
 .vector right_vector;
 .float porto_forbidden;
-spawnfunc(weapon_porto);
 #endif
 #endif
index 54784251281c0b488c4867123984548e060ae028..0e49171122634db1b0aaecce386dd1ccc984914d 100644 (file)
@@ -1,9 +1,6 @@
 #include "rifle.qh"
 
 #ifdef SVQC
 #include "rifle.qh"
 
 #ifdef SVQC
-spawnfunc(weapon_rifle) { weapon_defaultspawnfunc(this, WEP_RIFLE); }
-spawnfunc(weapon_campingrifle) { spawnfunc_weapon_rifle(this); }
-spawnfunc(weapon_sniperrifle) { spawnfunc_weapon_rifle(this); }
 
 void W_Rifle_FireBullet(Weapon thiswep, .entity weaponentity, float pSpread, float pDamage, float pForce, float pSolidPenetration, float pAmmo, int deathtype, float pTracer, float pShots, Sound pSound, entity actor)
 {
 
 void W_Rifle_FireBullet(Weapon thiswep, .entity weaponentity, float pSpread, float pDamage, float pForce, float pSolidPenetration, float pAmmo, int deathtype, float pTracer, float pShots, Sound pSound, entity actor)
 {
index 0340d9fdb1e87d87e9f18d3bb88b42111ecfb98e..560354c0529b40b5e19e9a4ff389a01946dae6c6 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(Rifle, Weapon)
 #pragma once
 
 CLASS(Rifle, Weapon)
+/* spawnfunc */ ATTRIB(Rifle, m_canonical_spawnfunc, string, "weapon_rifle");
 /* ammotype  */ ATTRIB(Rifle, ammo_type, int, RESOURCE_BULLETS);
 /* impulse   */ ATTRIB(Rifle, impulse, int, 7);
 /* flags     */ ATTRIB(Rifle, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_PENETRATEWALLS);
 /* ammotype  */ ATTRIB(Rifle, ammo_type, int, RESOURCE_BULLETS);
 /* impulse   */ ATTRIB(Rifle, impulse, int, 7);
 /* flags     */ ATTRIB(Rifle, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_PENETRATEWALLS);
@@ -47,8 +48,10 @@ CLASS(Rifle, Weapon)
 ENDCLASS(Rifle)
 REGISTER_WEAPON(RIFLE, rifle, NEW(Rifle));
 
 ENDCLASS(Rifle)
 REGISTER_WEAPON(RIFLE, rifle, NEW(Rifle));
 
+SPAWNFUNC_WEAPON(weapon_rifle, WEP_RIFLE)
+SPAWNFUNC_WEAPON(weapon_campingrifle, WEP_RIFLE)
+SPAWNFUNC_WEAPON(weapon_sniperrifle, WEP_RIFLE)
 
 #ifdef SVQC
 .float rifle_accumulator;
 
 #ifdef SVQC
 .float rifle_accumulator;
-spawnfunc(weapon_rifle);
 #endif
 #endif
index b2df4f0efb54c53e5b951f9c874e3ce651b4b25e..5e3faeeab94a347424dda81601187a329f229f53 100644 (file)
@@ -1,7 +1,6 @@
 #include "seeker.qh"
 
 #ifdef SVQC
 #include "seeker.qh"
 
 #ifdef SVQC
-spawnfunc(weapon_seeker) { weapon_defaultspawnfunc(this, WEP_SEEKER); }
 
 // ============================
 // Begin: Missile functions, these are general functions to be manipulated by other code
 
 // ============================
 // Begin: Missile functions, these are general functions to be manipulated by other code
index 40ba463ec7366362795881c0fb2ea36528eb2c01..e4e9fd535248f4b1f58bfe71e96866d9ac2f9306 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(Seeker, Weapon)
 #pragma once
 
 CLASS(Seeker, Weapon)
+/* spawnfunc */ ATTRIB(Seeker, m_canonical_spawnfunc, string, "weapon_seeker");
 /* ammotype  */ ATTRIB(Seeker, ammo_type, int, RESOURCE_ROCKETS);
 /* impulse   */ ATTRIB(Seeker, impulse, int, 8);
 /* flags     */ ATTRIB(Seeker, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
 /* ammotype  */ ATTRIB(Seeker, ammo_type, int, RESOURCE_ROCKETS);
 /* impulse   */ ATTRIB(Seeker, impulse, int, 8);
 /* flags     */ ATTRIB(Seeker, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
@@ -82,10 +83,11 @@ CLASS(Seeker, Weapon)
 ENDCLASS(Seeker)
 REGISTER_WEAPON(SEEKER, seeker, NEW(Seeker));
 
 ENDCLASS(Seeker)
 REGISTER_WEAPON(SEEKER, seeker, NEW(Seeker));
 
+SPAWNFUNC_WEAPON(weapon_seeker, WEP_SEEKER)
+
 #ifdef SVQC
 .entity tag_target, wps_tag_tracker;
 .float tag_time;
 #ifdef SVQC
 .entity tag_target, wps_tag_tracker;
 .float tag_time;
-spawnfunc(weapon_seeker);
 
 IntrusiveList g_seeker_trackers;
 STATIC_INIT(g_seeker_trackers) { g_seeker_trackers = IL_NEW(); }
 
 IntrusiveList g_seeker_trackers;
 STATIC_INIT(g_seeker_trackers) { g_seeker_trackers = IL_NEW(); }
index bc9e94767a45177e35b3dd788f283f3beeeb7c00..b52a5a21ba9bb6a0b889e00d791d0c77693b02db 100644 (file)
@@ -3,16 +3,15 @@
 REGISTER_NET_TEMP(TE_CSQC_SHOCKWAVEPARTICLE)
 
 #ifdef SVQC
 REGISTER_NET_TEMP(TE_CSQC_SHOCKWAVEPARTICLE)
 
 #ifdef SVQC
-spawnfunc(weapon_shockwave)
+METHOD(Shockwave, m_spawnfunc_hookreplace, Weapon(Shockwave this, entity e))
 {
        //if(autocvar_sv_q3acompat_machineshockwaveswap) // WEAPONTODO
        if(autocvar_sv_q3acompat_machineshotgunswap)
 {
        //if(autocvar_sv_q3acompat_machineshockwaveswap) // WEAPONTODO
        if(autocvar_sv_q3acompat_machineshotgunswap)
-       if(this.classname != "droppedweapon")
+       if(e.classname != "droppedweapon")
        {
        {
-               weapon_defaultspawnfunc(this, WEP_MACHINEGUN);
-               return;
+               return WEP_MACHINEGUN;
        }
        }
-       weapon_defaultspawnfunc(this, WEP_SHOCKWAVE);
+       return this;
 }
 
 const float MAX_SHOCKWAVE_HITS = 10;
 }
 
 const float MAX_SHOCKWAVE_HITS = 10;
index d382890684ab5e66d6ddc5af73dc351920289647..ade2e9a85c46a08984c3adb698f80254323021a2 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(Shockwave, Weapon)
 #pragma once
 
 CLASS(Shockwave, Weapon)
+/* spawnfunc */ ATTRIB(Shockwave, m_canonical_spawnfunc, string, "weapon_shockwave");
 /* ammotype  */ //ATTRIB(Shockwave, ammo_type, int, RESOURCE_NONE);
 /* impulse   */ ATTRIB(Shockwave, impulse, int, 2);
 /* flags     */ ATTRIB(Shockwave, spawnflags, int, WEP_TYPE_HITSCAN | WEP_FLAG_CANCLIMB | WEP_TYPE_MELEE_SEC);
 /* ammotype  */ //ATTRIB(Shockwave, ammo_type, int, RESOURCE_NONE);
 /* impulse   */ ATTRIB(Shockwave, impulse, int, 2);
 /* flags     */ ATTRIB(Shockwave, spawnflags, int, WEP_TYPE_HITSCAN | WEP_FLAG_CANCLIMB | WEP_TYPE_MELEE_SEC);
@@ -74,6 +75,7 @@ CLASS(Shockwave, Weapon)
 ENDCLASS(Shockwave)
 REGISTER_WEAPON(SHOCKWAVE, shockwave, NEW(Shockwave));
 
 ENDCLASS(Shockwave)
 REGISTER_WEAPON(SHOCKWAVE, shockwave, NEW(Shockwave));
 
+SPAWNFUNC_WEAPON(weapon_shockwave, WEP_SHOCKWAVE)
 
 #ifdef CSQC
 void Net_ReadShockwaveParticle();
 
 #ifdef CSQC
 void Net_ReadShockwaveParticle();
@@ -84,7 +86,3 @@ void Net_ReadShockwaveParticle();
 .float sw_spread_min;
 .float sw_time;
 #endif
 .float sw_spread_min;
 .float sw_time;
 #endif
-
-#ifdef SVQC
-spawnfunc(weapon_shockwave);
-#endif
index e163df4bc61d1958c0ff203bbd8937005abaddef..9ffef64287ca8cfe7841bebc53c46a0232de05aa 100644 (file)
@@ -1,7 +1,6 @@
 #include "shotgun.qh"
 
 #ifdef SVQC
 #include "shotgun.qh"
 
 #ifdef SVQC
-spawnfunc(weapon_shotgun) { weapon_defaultspawnfunc(this, WEP_SHOTGUN); }
 
 void W_Shotgun_Attack(Weapon thiswep, entity actor, .entity weaponentity, float isprimary)
 {
 
 void W_Shotgun_Attack(Weapon thiswep, entity actor, .entity weaponentity, float isprimary)
 {
index f4afbc070c12911b6e942100e7f7a7de1f8e8558..e40b1d8a1f7f8aa07914fd2a4afabc325cff901d 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(Shotgun, Weapon)
 #pragma once
 
 CLASS(Shotgun, Weapon)
+/* spawnfunc */ ATTRIB(Shotgun, m_canonical_spawnfunc, string, "weapon_shotgun");
 /* ammotype  */ ATTRIB(Shotgun, ammo_type, int, RESOURCE_SHELLS);
 /* impulse   */ ATTRIB(Shotgun, impulse, int, 2);
 /* flags     */ ATTRIB(Shotgun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_TYPE_MELEE_SEC);
 /* ammotype  */ ATTRIB(Shotgun, ammo_type, int, RESOURCE_SHELLS);
 /* impulse   */ ATTRIB(Shotgun, impulse, int, 2);
 /* flags     */ ATTRIB(Shotgun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_TYPE_MELEE_SEC);
@@ -53,6 +54,4 @@ CLASS(Shotgun, Weapon)
 ENDCLASS(Shotgun)
 REGISTER_WEAPON(SHOTGUN, shotgun, NEW(Shotgun));
 
 ENDCLASS(Shotgun)
 REGISTER_WEAPON(SHOTGUN, shotgun, NEW(Shotgun));
 
-#ifdef SVQC
-spawnfunc(weapon_shotgun);
-#endif
+SPAWNFUNC_WEAPON(weapon_shotgun, WEP_SHOTGUN)
index a5ae87c36b392256205cc47dd79aa879c628ae7a..37c36964a2299655452f9cffb2e9397181aaaabe 100644 (file)
@@ -10,8 +10,6 @@
 .float tuba_lastnotes_cnt; // over
 .vector tuba_lastnotes[MAX_TUBANOTES];
 
 .float tuba_lastnotes_cnt; // over
 .vector tuba_lastnotes[MAX_TUBANOTES];
 
-spawnfunc(weapon_tuba) { weapon_defaultspawnfunc(this, WEP_TUBA); }
-
 bool W_Tuba_HasPlayed(entity pl, .entity weaponentity, string melody, int instrument, bool ignorepitch, float mintempo, float maxtempo)
 {
        float i, j, mmin, mmax, nolength;
 bool W_Tuba_HasPlayed(entity pl, .entity weaponentity, string melody, int instrument, bool ignorepitch, float mintempo, float maxtempo)
 {
        float i, j, mmin, mmax, nolength;
index 8e5f3b8c0db905cae65fef86c03e1b6a0fed3d04..ffa1dd6e2dd5589e5623611655bce63a87bf4042 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(Tuba, Weapon)
 #pragma once
 
 CLASS(Tuba, Weapon)
+/* spawnfunc */ ATTRIB(Tuba, m_canonical_spawnfunc, string, "weapon_tuba");
 /* impulse   */ ATTRIB(Tuba, impulse, int, 1);
 /* flags     */ ATTRIB(Tuba, spawnflags, int, WEP_FLAG_HIDDEN | WEP_TYPE_SPLASH | WEP_FLAG_NODUAL);
 /* rating    */ ATTRIB(Tuba, bot_pickupbasevalue, float, 2000);
 /* impulse   */ ATTRIB(Tuba, impulse, int, 1);
 /* flags     */ ATTRIB(Tuba, spawnflags, int, WEP_FLAG_HIDDEN | WEP_TYPE_SPLASH | WEP_FLAG_NODUAL);
 /* rating    */ ATTRIB(Tuba, bot_pickupbasevalue, float, 2000);
@@ -40,6 +41,8 @@ CLASS(Tuba, Weapon)
 ENDCLASS(Tuba)
 REGISTER_WEAPON(TUBA, tuba, NEW(Tuba));
 
 ENDCLASS(Tuba)
 REGISTER_WEAPON(TUBA, tuba, NEW(Tuba));
 
+SPAWNFUNC_WEAPON(weapon_tuba, WEP_TUBA)
+
 #ifdef CSQC
 entityclass(Tuba);
 class(Tuba) .int note;
 #ifdef CSQC
 entityclass(Tuba);
 class(Tuba) .int note;
@@ -48,7 +51,3 @@ class(Tuba) .float tuba_volume;
 class(Tuba) .float tuba_volume_initial;
 class(Tuba) .int tuba_instrument;
 #endif
 class(Tuba) .float tuba_volume_initial;
 class(Tuba) .int tuba_instrument;
 #endif
-
-#ifdef SVQC
-spawnfunc(weapon_tuba);
-#endif
index 73822b4c50fcbecad3a12f3189253ee4df03054c..4a9475a9ccebc212ebfc9ff36016c546865a1aef 100644 (file)
@@ -105,8 +105,6 @@ NET_HANDLE(TE_CSQC_VAPORBEAMPARTICLE, bool isNew)
 #endif
 
 #ifdef SVQC
 #endif
 
 #ifdef SVQC
-spawnfunc(weapon_vaporizer) { weapon_defaultspawnfunc(this, WEP_VAPORIZER); }
-spawnfunc(weapon_minstanex) { spawnfunc_weapon_vaporizer(this); }
 
 void W_RocketMinsta_Explosion(entity actor, vector loc)
 {
 
 void W_RocketMinsta_Explosion(entity actor, vector loc)
 {
index 874f318633710d90b282b362eafbf4c6a72c0c8a..ea9f8dd2ba60db6a8452b088e424e5ed0d976046 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(Vaporizer, Weapon)
 #pragma once
 
 CLASS(Vaporizer, Weapon)
+/* spawnfunc */ ATTRIB(Vaporizer, m_canonical_spawnfunc, string, "weapon_vaporizer");
 /* ammotype  */ ATTRIB(Vaporizer, ammo_type, int, RESOURCE_CELLS);
 /* impulse   */ ATTRIB(Vaporizer, impulse, int, 7);
 /* flags     */ ATTRIB(Vaporizer, spawnflags, int, WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN | WEP_FLAG_NODUAL);
 /* ammotype  */ ATTRIB(Vaporizer, ammo_type, int, RESOURCE_CELLS);
 /* impulse   */ ATTRIB(Vaporizer, impulse, int, 7);
 /* flags     */ ATTRIB(Vaporizer, spawnflags, int, WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN | WEP_FLAG_NODUAL);
@@ -50,6 +51,8 @@ CLASS(Vaporizer, Weapon)
 ENDCLASS(Vaporizer)
 REGISTER_WEAPON(VAPORIZER, vaporizer, NEW(Vaporizer));
 
 ENDCLASS(Vaporizer)
 REGISTER_WEAPON(VAPORIZER, vaporizer, NEW(Vaporizer));
 
+SPAWNFUNC_WEAPON(weapon_vaporizer, WEP_VAPORIZER)
+SPAWNFUNC_WEAPON(weapon_minstanex, WEP_VAPORIZER)
 
 #ifdef SVQC
 .float vaporizer_lasthit;
 
 #ifdef SVQC
 .float vaporizer_lasthit;
@@ -59,5 +62,4 @@ REGISTER_WEAPON(VAPORIZER, vaporizer, NEW(Vaporizer));
 .float rm_force;
 .float rm_damage;
 .float rm_edmg;
 .float rm_force;
 .float rm_damage;
 .float rm_edmg;
-spawnfunc(weapon_vaporizer);
 #endif
 #endif
index 202780e29afc4d982400df3cd2ee3ad98fa43f5b..60557cbf8d42211602f985a6ba32da1c22551fa1 100644 (file)
@@ -71,8 +71,6 @@ NET_HANDLE(TE_CSQC_VORTEXBEAMPARTICLE, bool isNew)
 #endif
 
 #ifdef SVQC
 #endif
 
 #ifdef SVQC
-spawnfunc(weapon_vortex) { weapon_defaultspawnfunc(this, WEP_VORTEX); }
-spawnfunc(weapon_nex) { spawnfunc_weapon_vortex(this); }
 
 REGISTER_MUTATOR(vortex_charge, true);
 
 
 REGISTER_MUTATOR(vortex_charge, true);
 
index 3a4ab52a54a2efcc94537df688a9198f0d486b36..59152e2759f93b144585d9b8fcc6f394e6751627 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 CLASS(Vortex, Weapon)
 #pragma once
 
 CLASS(Vortex, Weapon)
+/* spawnfunc */ ATTRIB(Vortex, m_canonical_spawnfunc, string, "weapon_vortex");
 /* ammotype  */ ATTRIB(Vortex, ammo_type, int, RESOURCE_CELLS);
 /* impulse   */ ATTRIB(Vortex, impulse, int, 7);
 /* flags     */ ATTRIB(Vortex, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_NODUAL);
 /* ammotype  */ ATTRIB(Vortex, ammo_type, int, RESOURCE_CELLS);
 /* impulse   */ ATTRIB(Vortex, impulse, int, 7);
 /* flags     */ ATTRIB(Vortex, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_NODUAL);
@@ -59,8 +60,9 @@ CLASS(Vortex, Weapon)
 ENDCLASS(Vortex)
 REGISTER_WEAPON(VORTEX, vortex, NEW(Vortex));
 
 ENDCLASS(Vortex)
 REGISTER_WEAPON(VORTEX, vortex, NEW(Vortex));
 
+SPAWNFUNC_WEAPON(weapon_vortex, WEP_VORTEX)
+SPAWNFUNC_WEAPON(weapon_nex, WEP_VORTEX)
 
 #ifdef SVQC
 .float vortex_lasthit;
 
 #ifdef SVQC
 .float vortex_lasthit;
-spawnfunc(weapon_vortex);
 #endif
 #endif
index 126a0f6f6e7a98fc357917b8707f0c34ebf7dc8b..e830fe6c4fe8ed7caf27748935faa8d41cdd4967 100644 (file)
@@ -4,29 +4,15 @@
 #include <server/miscfunctions.qh>
 #include <common/weapons/_all.qh>
 
 #include <server/miscfunctions.qh>
 #include <common/weapons/_all.qh>
 
-spawnfunc(weapon_electro);
-spawnfunc(weapon_hagar);
-spawnfunc(weapon_machinegun);
-spawnfunc(item_bullets);
-spawnfunc(item_armor_mega);
-spawnfunc(item_health_mega);
-spawnfunc(item_health_medium);
-
 //***********************
 //QUAKE 1 ENTITIES - So people can play quake1 maps with the xonotic weapons
 //***********************
 //***********************
 //QUAKE 1 ENTITIES - So people can play quake1 maps with the xonotic weapons
 //***********************
-spawnfunc(weapon_nailgun) {spawnfunc_weapon_electro(this);}
-spawnfunc(weapon_supernailgun) {spawnfunc_weapon_hagar(this);}
-spawnfunc(weapon_supershotgun) {spawnfunc_weapon_machinegun(this);}
+SPAWNFUNC_WEAPON(weapon_nailgun, WEP_ELECTRO)
+SPAWNFUNC_WEAPON(weapon_supernailgun, WEP_HAGAR)
+SPAWNFUNC_WEAPON(weapon_supershotgun, WEP_MACHINEGUN)
 
 
-spawnfunc(item_spikes) {spawnfunc_item_bullets(this);}
+SPAWNFUNC_ITEM(item_spikes, ITEM_Bullets)
 //spawnfunc(item_armor1) {spawnfunc_item_armor_medium(this);}  // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
 //spawnfunc(item_armor1) {spawnfunc_item_armor_medium(this);}  // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
-spawnfunc(item_armor2) {spawnfunc_item_armor_mega(this);}
-spawnfunc(item_armorInv) {spawnfunc_item_armor_mega(this);} // TODO: make sure we actually want this
-spawnfunc(item_health) {if (this.spawnflags & 2) spawnfunc_item_health_mega(this);else spawnfunc_item_health_medium(this);}
-
-//spawnfunc_item_spikes
-//spawnfunc_item_health
-
-
-
+SPAWNFUNC_ITEM(item_armor2, ITEM_ArmorMega)
+SPAWNFUNC_ITEM(item_armorInv, ITEM_ArmorMega) // TODO: make sure we actually want this
+spawnfunc(item_health) {if (this.spawnflags & 2) StartItem(this, ITEM_HealthMega);else StartItem(this, ITEM_HealthMedium);}
index df99f1570388c1a92bdcc6300d80b81027c83262..3231277647dc21a3f8216117228ab0a8fbed787c 100644 (file)
@@ -1,15 +1,10 @@
 #include "quake2.qh"
 
 #include "quake2.qh"
 
-spawnfunc(item_armor_medium);
-
-spawnfunc(item_invincible);
-
-
 //***********************
 //QUAKE 2 ENTITIES - So people can play quake2 maps with the xonotic weapons
 //***********************
 //***********************
 //QUAKE 2 ENTITIES - So people can play quake2 maps with the xonotic weapons
 //***********************
-spawnfunc(item_armor_jacket) {spawnfunc_item_armor_medium(this);}
+SPAWNFUNC_ITEM(item_armor_jacket, ITEM_ArmorMedium)
 
 
-spawnfunc(item_invulnerability) {spawnfunc_item_invincible(this);}
+SPAWNFUNC_ITEM(item_invulnerability, ITEM_Shield)
 
 // rest of the quake 2 entities are handled by q1 and q3 compat
 
 // rest of the quake 2 entities are handled by q1 and q3 compat
index d7dcbf3a803890d7a0c016fac4c324d48017bb7c..4fc33badcce733aabb9448dd034739ad74537478 100644 (file)
@@ -14,51 +14,51 @@ spawnfunc(target_items);
 // NOTE: for best experience, you need to swap MGs with SGs in the map or it won't have a MG
 
 // SG -> SG
 // NOTE: for best experience, you need to swap MGs with SGs in the map or it won't have a MG
 
 // SG -> SG
-spawnfunc(ammo_shells)         { spawnfunc_item_shells(this);         }
+SPAWNFUNC_ITEM(ammo_shells, ITEM_Shells)
 
 // MG -> MG
 
 // MG -> MG
-spawnfunc(ammo_bullets)        { spawnfunc_item_bullets(this);        }
+SPAWNFUNC_ITEM(ammo_bullets, ITEM_Bullets)
 
 // GL -> Mortar
 
 // GL -> Mortar
-spawnfunc(ammo_grenades)       { spawnfunc_item_rockets(this);        }
+SPAWNFUNC_ITEM(ammo_grenades, ITEM_Rockets)
 
 // Mines -> Rockets
 
 // Mines -> Rockets
-spawnfunc(weapon_prox_launcher) { spawnfunc_weapon_minelayer(this);   }
-spawnfunc(ammo_mines)           { spawnfunc_item_rockets(this);       }
+SPAWNFUNC_WEAPON(weapon_prox_launcher, WEP_MINE_LAYER)
+SPAWNFUNC_ITEM(ammo_mines, ITEM_Rockets)
 
 // LG -> Lightning
 
 // LG -> Lightning
-spawnfunc(weapon_lightning)    { spawnfunc_weapon_electro(this);      }
-spawnfunc(ammo_lightning)      { spawnfunc_item_cells(this);          }
+SPAWNFUNC_WEAPON(weapon_lightning, WEP_ELECTRO)
+SPAWNFUNC_ITEM(ammo_lightning, ITEM_Cells)
 
 // Plasma -> Hagar
 
 // Plasma -> Hagar
-spawnfunc(weapon_plasmagun)    { spawnfunc_weapon_hagar(this);        }
-spawnfunc(ammo_cells)          { spawnfunc_item_rockets(this);        }
+SPAWNFUNC_WEAPON(weapon_plasmagun, WEP_HAGAR)
+SPAWNFUNC_ITEM(ammo_cells, ITEM_Rockets)
 
 // Rail -> Vortex
 
 // Rail -> Vortex
-spawnfunc(weapon_railgun)      { spawnfunc_weapon_vortex(this);       }
-spawnfunc(ammo_slugs)          { spawnfunc_item_cells(this);          }
+SPAWNFUNC_WEAPON(weapon_railgun, WEP_VORTEX)
+SPAWNFUNC_ITEM(ammo_slugs, ITEM_Cells)
 
 // BFG -> Crylink
 
 // BFG -> Crylink
-spawnfunc(weapon_bfg)          { spawnfunc_weapon_crylink(this);      }
-spawnfunc(ammo_bfg)            { spawnfunc_item_cells(this);          }
+SPAWNFUNC_WEAPON(weapon_bfg, WEP_CRYLINK)
+SPAWNFUNC_ITEM(ammo_bfg, ITEM_Cells)
 
 // grappling hook -> hook
 
 // grappling hook -> hook
-spawnfunc(weapon_grapplinghook) { spawnfunc_weapon_hook(this);        }
+SPAWNFUNC_WEAPON(weapon_grapplinghook, WEP_HOOK)
 
 // RL -> RL
 
 // RL -> RL
-spawnfunc(ammo_rockets)        { spawnfunc_item_rockets(this);        }
+SPAWNFUNC_ITEM(ammo_rockets, ITEM_Rockets)
 
 // Armor
 
 // Armor
-spawnfunc(item_armor_body)     { spawnfunc_item_armor_mega(this);     }
-spawnfunc(item_armor_combat)   { spawnfunc_item_armor_big(this);      }
-spawnfunc(item_armor_shard)    { spawnfunc_item_armor_small(this);    }
-spawnfunc(item_enviro)         { spawnfunc_item_invincible(this);     }
+SPAWNFUNC_ITEM(item_armor_body, ITEM_ArmorMega)
+SPAWNFUNC_ITEM(item_armor_combat, ITEM_ArmorBig)
+SPAWNFUNC_ITEM(item_armor_shard, ITEM_ArmorSmall)
+SPAWNFUNC_ITEM(item_enviro, ITEM_Shield)
 
 // medkit -> armor (we have no holdables)
 
 // medkit -> armor (we have no holdables)
-spawnfunc(holdable_medkit)        { spawnfunc_item_armor_mega(this);     }
+SPAWNFUNC_ITEM(holdable_medkit, ITEM_ArmorMega)
 
 // doubler -> strength
 
 // doubler -> strength
-spawnfunc(item_doubler)        { spawnfunc_item_strength(this); }
+SPAWNFUNC_ITEM(item_doubler, ITEM_Strength)
 
 .float wait;
 .float delay;
 
 .float wait;
 .float delay;
index 39abab09fb323836d71645578ed71eeb2453deea..d2577b46afb356fef97917bf577493f0e483fbaf 100644 (file)
@@ -9,39 +9,34 @@ spawnfunc(item_haste);
 spawnfunc(item_invis);
 
 //***********************
 spawnfunc(item_invis);
 
 //***********************
-//WORD OF PADMAN ENTITIES - So people can play wop maps with the xonotic weapons
+//WORLD OF PADMAN ENTITIES - So people can play wop maps with the xonotic weapons
 //***********************
 
 //spawnfunc(item_revival)     /* handled by buffs mutator */
 //spawnfunc(item_jumper)      /* handled by buffs mutator */
 
 //***********************
 
 //spawnfunc(item_revival)     /* handled by buffs mutator */
 //spawnfunc(item_jumper)      /* handled by buffs mutator */
 
-spawnfunc(weapon_punchy)       { spawnfunc_weapon_arc(this);                   }
-spawnfunc(weapon_nipper)       { spawnfunc_weapon_machinegun(this);    }
-spawnfunc(weapon_pumper)       { spawnfunc_weapon_shotgun(this);               }
-spawnfunc(weapon_boaster)      { spawnfunc_weapon_electro(this);               }
-spawnfunc(weapon_splasher)     { spawnfunc_weapon_vortex(this);                }
-spawnfunc(weapon_bubbleg)      { spawnfunc_weapon_hagar(this);                 }
-spawnfunc(weapon_balloony)     { spawnfunc_weapon_mortar(this);                }
-spawnfunc(weapon_betty)                { spawnfunc_weapon_devastator(this);    }
-spawnfunc(weapon_imperius)     { spawnfunc_weapon_crylink(this);               }
-
-spawnfunc(ammo_pumper)         { spawnfunc_item_shells(this);                  }
-spawnfunc(ammo_nipper)         { spawnfunc_item_bullets(this);                 }
-spawnfunc(ammo_balloony)       { spawnfunc_item_rockets(this);                 }
-spawnfunc(ammo_bubbleg)                { spawnfunc_item_rockets(this);                 }
-spawnfunc(ammo_boaster)                { spawnfunc_item_cells(this);                   }
-spawnfunc(ammo_betty)          { spawnfunc_item_rockets(this);                 }
-spawnfunc(ammo_imperius)       { spawnfunc_item_cells(this);                   }
-
-spawnfunc(item_quad)
-{
-       this.classname = "item_strength";
-       spawnfunc_item_strength(this);
-}
-spawnfunc(item_padpower)       { spawnfunc_item_quad(this);                    }
-spawnfunc(item_climber)                { spawnfunc_item_invincible(this);              }
+SPAWNFUNC_WEAPON(weapon_punchy, WEP_ARC)
+SPAWNFUNC_WEAPON(weapon_nipper, WEP_MACHINEGUN)
+SPAWNFUNC_WEAPON(weapon_pumper, WEP_SHOTGUN)
+SPAWNFUNC_WEAPON(weapon_boaster, WEP_ELECTRO)
+SPAWNFUNC_WEAPON(weapon_splasher, WEP_VORTEX)
+SPAWNFUNC_WEAPON(weapon_bubbleg, WEP_HAGAR)
+SPAWNFUNC_WEAPON(weapon_balloony, WEP_MORTAR)
+SPAWNFUNC_WEAPON(weapon_betty, WEP_DEVASTATOR)
+SPAWNFUNC_WEAPON(weapon_imperius, WEP_CRYLINK)
+
+SPAWNFUNC_ITEM(ammo_pumper, ITEM_Shells)
+SPAWNFUNC_ITEM(ammo_nipper, ITEM_Bullets)
+SPAWNFUNC_ITEM(ammo_balloony, ITEM_Rockets)
+SPAWNFUNC_ITEM(ammo_bubbleg, ITEM_Rockets)
+SPAWNFUNC_ITEM(ammo_boaster, ITEM_Cells)
+SPAWNFUNC_ITEM(ammo_betty, ITEM_Rockets)
+SPAWNFUNC_ITEM(ammo_imperius, ITEM_Cells)
+
+SPAWNFUNC_ITEM(item_padpower, ITEM_Strength)
+SPAWNFUNC_ITEM(item_climber, ITEM_Shield)
 spawnfunc(item_speedy)         { spawnfunc_item_haste(this);                   }
 spawnfunc(item_visionless)     { spawnfunc_item_invis(this);                   }
 spawnfunc(item_speedy)         { spawnfunc_item_haste(this);                   }
 spawnfunc(item_visionless)     { spawnfunc_item_invis(this);                   }
-spawnfunc(item_armor_padshield)        { spawnfunc_item_armor_mega(this);      }
+SPAWNFUNC_ITEM(item_armor_padshield, ITEM_ArmorMega)
 
 
-spawnfunc(holdable_floater)            { spawnfunc_item_jetpack(this);         }
+SPAWNFUNC_ITEM(holdable_floater, ITEM_Jetpack)
index f2f47c469f70ded2d439ab92b7982f6ee2c58235..6a0593282ff0beb973973c32d469107ed6fefaef 100644 (file)
@@ -27,240 +27,17 @@ entity Item_Create(string class_name, vector position)
 
 void Item_Initialize(entity item, string class_name)
 {
 
 void Item_Initialize(entity item, string class_name)
 {
-       switch (class_name)
+       FOREACH(Weapons, it.m_canonical_spawnfunc == class_name,
        {
        {
-               case "item_health_small":
-               {
-                       spawnfunc_item_health_small(item);
-                       return;
-               }
-               case "item_health_medium":
-               {
-                       spawnfunc_item_health_medium(item);
-                       return;
-               }
-               case "item_health_big":
-               case "item_health_large":
-               {
-                       spawnfunc_item_health_big(item);
-                       return;
-               }
-               case "item_health_mega":
-               {
-                       spawnfunc_item_health_mega(item);
-                       return;
-               }
-               case "item_armor_small":
-               {
-                       spawnfunc_item_armor_small(item);
-                       return;
-               }
-               case "item_armor_medium":
-               {
-                       spawnfunc_item_armor_medium(item);
-                       return;
-               }
-               case "item_armor_big":
-               case "item_armor_large":
-               {
-                       spawnfunc_item_armor_big(item);
-                       return;
-               }
-               case "item_armor_mega":
-               {
-                       spawnfunc_item_armor_mega(item);
-                       return;
-               }
-               case "item_shells":
-               {
-                       spawnfunc_item_shells(item);
-                       return;
-               }
-               case "item_bullets":
-               {
-                       spawnfunc_item_bullets(item);
-                       return;
-               }
-               case "item_rockets":
-               {
-                       spawnfunc_item_rockets(item);
-                       return;
-               }
-               case "item_cells":
-               {
-                       spawnfunc_item_cells(item);
-                       return;
-               }
-               case "item_plasma":
-               {
-                       spawnfunc_item_plasma(item);
-                       return;
-               }
-               case "item_fuel":
-               {
-                       spawnfunc_item_fuel(item);
-                       return;
-               }
-               case "weapon_blaster":
-               case "weapon_laser":
-               {
-                       spawnfunc_weapon_blaster(item);
-                       return;
-               }
-               case "weapon_shotgun":
-               {
-                       spawnfunc_weapon_shotgun(item);
-                       return;
-               }
-               case "weapon_machinegun":
-               case "weapon_uzi":
-               {
-                       spawnfunc_weapon_machinegun(item);
-                       return;
-               }
-               case "weapon_mortar":
-               case "weapon_grenadelauncher":
-               {
-                       spawnfunc_weapon_mortar(item);
-                       return;
-               }
-               case "weapon_electro":
-               {
-                       spawnfunc_weapon_electro(item);
-                       return;
-               }
-               case "weapon_crylink":
-               {
-                       spawnfunc_weapon_crylink(item);
-                       return;
-               }
-               case "weapon_vortex":
-               case "weapon_nex":
-               {
-                       spawnfunc_weapon_vortex(item);
-                       return;
-               }
-               case "weapon_hagar":
-               {
-                       spawnfunc_weapon_hagar(item);
-                       return;
-               }
-               case "weapon_devastator":
-               case "weapon_rocketlauncher":
-               {
-                       spawnfunc_weapon_devastator(item);
-                       return;
-               }
-               case "weapon_shockwave":
-               {
-                       spawnfunc_weapon_shockwave(item);
-                       return;
-               }
-               case "weapon_arc":
-               {
-                       spawnfunc_weapon_arc(item);
-                       return;
-               }
-               case "weapon_hook":
-               {
-                       spawnfunc_weapon_hook(item);
-                       return;
-               }
-               case "weapon_tuba":
-               {
-                       spawnfunc_weapon_tuba(item);
-                       return;
-               }
-               case "weapon_porto":
-               {
-                       spawnfunc_weapon_porto(item);
-                       return;
-               }
-               case "weapon_fireball":
-               {
-                       spawnfunc_weapon_fireball(item);
-                       return;
-               }
-               case "weapon_minelayer":
-               {
-                       spawnfunc_weapon_minelayer(item);
-                       return;
-               }
-               case "weapon_hlac":
-               {
-                       spawnfunc_weapon_hlac(item);
-                       return;
-               }
-               case "weapon_rifle":
-               case "weapon_campingrifle":
-               case "weapon_sniperrifle":
-               {
-                       spawnfunc_weapon_rifle(item);
-                       return;
-               }
-               case "weapon_seeker":
-               {
-                       spawnfunc_weapon_seeker(item);
-                       return;
-               }
-               case "weapon_vaporizer":
-               case "weapon_minstanex":
-               {
-                       spawnfunc_weapon_vaporizer(item);
-                       return;
-               }
-               case "weapon_hmg":
-               {
-                       spawnfunc_weapon_hmg(item);
-                       return;
-               }
-               case "weapon_rpc":
-               {
-                       spawnfunc_weapon_rpc(item);
-                       return;
-               }
-               case "item_strength":
-               {
-                       spawnfunc_item_strength(item);
-                       return;
-               }
-               case "item_invincible":
-               {
-                       spawnfunc_item_invincible(item);
-                       return;
-               }
-               case "item_fuel_regen":
-               {
-                       spawnfunc_item_fuel_regen(item);
-                       return;
-               }
-               case "item_jetpack":
-               {
-                       spawnfunc_item_jetpack(item);
-                       return;
-               }
-               case "item_vaporizer_cells":
-               {
-                       spawnfunc_item_vaporizer_cells(item);
-                       return;
-               }
-               case "item_invisibility":
-               {
-                       instagib_invisibility(item);
-                       return;
-               }
-               case "item_extralife":
-               {
-                       instagib_extralife(item);
-                       return;
-               }
-               case "item_speed":
-               {
-                       instagib_speed(item);
-                       return;
-               }
-       }
-       error("Item_Initialize: Invalid classname ", class_name);
+               weapon_defaultspawnfunc(item, it);
+               return;
+       });
+       FOREACH(Items, it.m_canonical_spawnfunc == class_name,
+       {
+               StartItem(item, it);
+               return;
+       });
+       LOG_FATALF("Item_Initialize: Invalid classname: %s", class_name);
 }
 
 entity Item_CreateLoot(string class_name, vector position, vector vel,
 }
 
 entity Item_CreateLoot(string class_name, vector position, vector vel,
@@ -304,162 +81,21 @@ void Item_SetLoot(entity item, bool loot)
        item.m_isloot = loot;
 }
 
        item.m_isloot = loot;
 }
 
-spawnfunc(item_health_small)
-{
-       StartItem(this, ITEM_HealthSmall);
-}
-
-spawnfunc(item_health_medium)
-{
-       StartItem(this, ITEM_HealthMedium);
-}
-
-spawnfunc(item_health_big)
-{
-       StartItem(this, ITEM_HealthBig);
-}
-
-spawnfunc(item_health_mega)
-{
-       StartItem(this, ITEM_HealthMega);
-}
-
-spawnfunc(item_armor_small)
-{
-       StartItem(this, ITEM_ArmorSmall);
-}
-
-spawnfunc(item_armor_medium)
-{
-       StartItem(this, ITEM_ArmorMedium);
-}
-
-spawnfunc(item_armor_big)
-{
-       StartItem(this, ITEM_ArmorBig);
-}
-
-spawnfunc(item_armor_mega)
-{
-       StartItem(this, ITEM_ArmorMega);
-}
-
-spawnfunc(item_shells)
-{
-       if (!weaponswapping && autocvar_sv_q3acompat_machineshotgunswap &&
-               (this.classname != "droppedweapon"))
-       {
-               weaponswapping = true;
-               spawnfunc_item_bullets(this);
-               weaponswapping = false;
-               return;
-       }
-       StartItem(this, ITEM_Shells);
-}
-
-spawnfunc(item_bullets)
-{
-       if (!weaponswapping && autocvar_sv_q3acompat_machineshotgunswap &&
-               (this.classname != "droppedweapon"))
-       {
-               weaponswapping = true;
-               spawnfunc_item_shells(this);
-               weaponswapping = false;
-               return;
-       }
-       StartItem(this, ITEM_Bullets);
-}
-
-spawnfunc(item_rockets)
-{
-       StartItem(this, ITEM_Rockets);
-}
-
-spawnfunc(item_cells)
-{
-       StartItem(this, ITEM_Cells);
-}
-
-spawnfunc(item_plasma)
-{
-       StartItem(this, ITEM_Plasma);
-}
-
-spawnfunc(item_fuel)
-{
-       StartItem(this, ITEM_JetpackFuel);
-}
-
-spawnfunc(item_strength)
-{
-       StartItem(this, ITEM_Strength);
-}
-
-spawnfunc(item_invincible)
-{
-       StartItem(this, ITEM_Shield);
-}
-
-spawnfunc(item_fuel_regen)
-{
-       if (start_items & ITEM_JetpackRegen.m_itemid)
-       {
-               spawnfunc_item_fuel(this);
-               return;
-       }
-       StartItem(this, ITEM_JetpackRegen);
-}
-
-spawnfunc(item_jetpack)
-{
-       if(start_items & ITEM_Jetpack.m_itemid)
-       {
-               spawnfunc_item_fuel(this);
-               return;
-       }
-       StartItem(this, ITEM_Jetpack);
-}
-
 // Compatibility spawn functions
 
 // Compatibility spawn functions
 
-spawnfunc(item_armor1)
-{
-       this.classname = "item_armor_small";
-       spawnfunc_item_armor_small(this); // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
-}
+// FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
+SPAWNFUNC_ITEM(item_armor1, ITEM_ArmorSmall)
 
 
-spawnfunc(item_armor25)
-{
-       this.classname = "item_armor_mega";
-       spawnfunc_item_armor_mega(this);
-}
+SPAWNFUNC_ITEM(item_armor25, ITEM_ArmorMega)
 
 
-spawnfunc(item_armor_large)
-{
-       this.classname = "item_armor_mega";
-       spawnfunc_item_armor_mega(this);
-}
+SPAWNFUNC_ITEM(item_armor_large, ITEM_ArmorMega)
 
 
-spawnfunc(item_health1)
-{
-       this.classname = "item_health_small";
-       spawnfunc_item_health_small(this);
-}
+SPAWNFUNC_ITEM(item_health1, ITEM_HealthSmall)
 
 
-spawnfunc(item_health25)
-{
-       this.classname = "item_health_medium";
-       spawnfunc_item_health_medium(this);
-}
+SPAWNFUNC_ITEM(item_health25, ITEM_HealthMedium)
 
 
-spawnfunc(item_health_large)
-{
-       this.classname = "item_health_big";
-       spawnfunc_item_health_big(this);
-}
+SPAWNFUNC_ITEM(item_health_large, ITEM_HealthBig)
 
 
-spawnfunc(item_health100)
-{
-       this.classname = "item_health_mega";
-       spawnfunc_item_health_mega(this);
-}
+SPAWNFUNC_ITEM(item_health100, ITEM_HealthMega)
+
+SPAWNFUNC_ITEM(item_quad, ITEM_Strength)
index 37b7d10c6fed2eb8fa6ca97457cbdd5bd3a31d7c..f7e30136551f5a5d98467e5dc0c4a8bc7dc43a09 100644 (file)
@@ -1,3 +1,4 @@
+#pragma once
 /// \file
 /// \brief Header file that describes the functions related to game items.
 /// \copyright GNU GPLv2 or any later version.
 /// \file
 /// \brief Header file that describes the functions related to game items.
 /// \copyright GNU GPLv2 or any later version.
@@ -49,27 +50,3 @@ bool Item_IsLoot(entity item);
 /// \return No return.
 void Item_SetLoot(entity item, bool loot);
 
 /// \return No return.
 void Item_SetLoot(entity item, bool loot);
 
-// Item spawn functions.
-// If a function is declared like this:
-// spawnfunc(foo);
-// You need to call it like this:
-// spawnfunc_foo(item);
-
-spawnfunc(item_health_small);
-spawnfunc(item_health_medium);
-spawnfunc(item_health_big);
-spawnfunc(item_health_mega);
-spawnfunc(item_armor_small);
-spawnfunc(item_armor_medium);
-spawnfunc(item_armor_big);
-spawnfunc(item_armor_mega);
-spawnfunc(item_shells);
-spawnfunc(item_bullets);
-spawnfunc(item_rockets);
-spawnfunc(item_cells);
-spawnfunc(item_plasma);
-spawnfunc(item_fuel);
-spawnfunc(item_strength);
-spawnfunc(item_invincible);
-spawnfunc(item_fuel_regen);
-spawnfunc(item_jetpack);
index ab837c8945b873c0982d13834693c4a1a0f1fe9e..e3c6797f367dbfe81aadd43915a56670fb1e0f67 100644 (file)
@@ -653,7 +653,7 @@ void readplayerstartcvars()
                        "g_random_start_shells"));
                SetResourceAmount(random_start_ammo, RESOURCE_BULLETS, cvar(
                        "g_random_start_bullets"));
                        "g_random_start_shells"));
                SetResourceAmount(random_start_ammo, RESOURCE_BULLETS, cvar(
                        "g_random_start_bullets"));
-               SetResourceAmount(random_start_ammo, RESOURCE_ROCKETS, 
+               SetResourceAmount(random_start_ammo, RESOURCE_ROCKETS,
                        cvar("g_random_start_rockets"));
                SetResourceAmount(random_start_ammo, RESOURCE_CELLS, cvar(
                        "g_random_start_cells"));
                        cvar("g_random_start_rockets"));
                SetResourceAmount(random_start_ammo, RESOURCE_CELLS, cvar(
                        "g_random_start_cells"));
index d5b78aa1cd064424b267ca3cfc2ce7c782714d09..244c1c62371b41edcdc45a376d3845f550e9ded3 100644 (file)
@@ -26,6 +26,8 @@ string W_Apply_Weaponreplace(string in)
 void weapon_defaultspawnfunc(entity this, Weapon e)
 {
        Weapon wpn = e;
 void weapon_defaultspawnfunc(entity this, Weapon e)
 {
        Weapon wpn = e;
+       e = wpn = wpn.m_spawnfunc_hookreplace(wpn, this);
+       this.classname = wpn.m_canonical_spawnfunc;
        if (this.classname != "droppedweapon" && this.classname != "replacedweapon")
        {
                if (e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
        if (this.classname != "droppedweapon" && this.classname != "replacedweapon")
        {
                if (e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
index 4ddf5a5159eac5adf534d6c61cafd0dc8a933445..c53b150944425aa1d96fcc84e3ecc239454091f7 100644 (file)
@@ -4,7 +4,6 @@
 #include <server/miscfunctions.qh>
 
 float internalteam;
 #include <server/miscfunctions.qh>
 
 float internalteam;
-float weaponswapping;
 entity weapon_dropevent_item;
 
 ..entity weaponentity_fld;
 entity weapon_dropevent_item;
 
 ..entity weaponentity_fld;