]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Items: use Model references instead of strings
authorTimePath <andrew.hardaker1995@gmail.com>
Mon, 12 Oct 2015 04:39:25 +0000 (15:39 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 12 Oct 2015 04:39:25 +0000 (15:39 +1100)
16 files changed:
qcsrc/common/effects/all.qh
qcsrc/common/items/inventory.qh
qcsrc/common/items/item/armor.qc
qcsrc/common/items/item/health.qc
qcsrc/common/items/item/pickup.qh
qcsrc/common/items/item/powerup.qc
qcsrc/common/mutators/mutator/instagib/items.qc
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/weapon.qh
qcsrc/lib/misc.qh
qcsrc/lib/oo.qh
qcsrc/server/_all.qh
qcsrc/server/defs.qh
qcsrc/server/t_items.qc
qcsrc/server/t_items.qh
qcsrc/server/weapons/spawning.qc

index 7046af11bc03c3ce93eae4989d3ef1f280f7f77f..9d95733cdf96e10666fd29ad26ead9f0b0d3d6bb 100644 (file)
@@ -15,27 +15,7 @@ REGISTER_REGISTRY(RegisterEffects)
 #define EFFECT(istrail, name, realname) \
     REGISTER(RegisterEffects, EFFECT, Effects, name, m_id, Create_Effect_Entity(realname, istrail));
 
-void RegisterEffects_First()
-{
-    #ifdef SVQC
-    #define dedi (server_is_dedicated ? "a dedicated " : "")
-    #else
-    #define dedi ""
-    #endif
-
-    LOG_TRACEF("Beginning effect initialization on %s%s program...\n", dedi, PROGNAME);
-    #undef dedi
-}
-
-void RegisterEffects_Done()
-{
-    LOG_TRACE("Effects initialization successful!\n");
-}
-
-// NOW we actually activate the declarations
-ACCUMULATE_FUNCTION(RegisterEffects, RegisterEffects_First)
 EFFECT(0, Null, string_null)
 #include "all.inc"
-ACCUMULATE_FUNCTION(RegisterEffects, RegisterEffects_Done)
 
 #endif
index a6d266ae5fba57d3d50727b25cb41d1fe1c396e2..f9193868f71a58be33b5f99b1d1e03d4fd89f7db 100644 (file)
@@ -44,7 +44,7 @@ bool Inventory_Send(entity this, entity to, int sf)
 {
     WriteByte(MSG_ENTITY, ENT_CLIENT_INVENTORY);
     entity e = self.owner;
-    if (IS_SPEC(e)) e = e.enemy;
+    if (/*IS_SPEC(e)*/ (e.classname == "spectator")) e = e.enemy;
     Inventory data = e.inventory;
     Inventory_Write(data);
     return true;
@@ -53,7 +53,7 @@ bool Inventory_Send(entity this, entity to, int sf)
 void Inventory_new(entity e)
 {
     Inventory inv = new(Inventory), bak = new(Inventory);
-    inv.classname = "inventory", bak.classname = "inventory";
+    inv.classname = bak.classname = "inventory";
     inv.inventory = bak;
     inv.drawonlytoclient = e;
     Net_LinkEntity((inv.owner = e).inventory = inv, false, 0, Inventory_Send);
index 13a774ebcec18f693120f19e7b89982d688fe788..bea60a49e1837e8883fcfaa440bd895e61805740 100644 (file)
@@ -5,13 +5,14 @@
 
 #ifndef MENUQC
 MODEL(ArmorSmall_ITEM, Item_Model("item_armor_small.md3"));
+SOUND(ArmorSmall, "misc/armor1.wav");
 #endif
 
 REGISTER_ITEM(ArmorSmall, Armor) {
 #ifndef MENUQC
     this.m_model                =   MDL_ArmorSmall_ITEM;
+    this.m_sound                =   SND_ArmorSmall;
 #endif
-    this.m_sound                =   "misc/armor1.wav";
     this.m_name                 =   "5 Armor";
     this.m_icon                 =   "armor";
 #ifdef SVQC
@@ -24,13 +25,14 @@ REGISTER_ITEM(ArmorSmall, Armor) {
 
 #ifndef MENUQC
 MODEL(ArmorMedium_ITEM, Item_Model("item_armor_medium.md3"));
+SOUND(ArmorMedium, "misc/armor10.wav");
 #endif
 
 REGISTER_ITEM(ArmorMedium, Armor) {
 #ifndef MENUQC
     this.m_model                =   MDL_ArmorMedium_ITEM;
+    this.m_sound                =   SND_ArmorMedium;
 #endif
-    this.m_sound                =   "misc/armor10.wav";
     this.m_name                 =   "25 Armor";
     this.m_icon                 =   "armor";
 #ifdef SVQC
@@ -43,13 +45,14 @@ REGISTER_ITEM(ArmorMedium, Armor) {
 
 #ifndef MENUQC
 MODEL(ArmorLarge_ITEM, Item_Model("item_armor_big.md3"));
+SOUND(ArmorLarge, "misc/armor17_5.wav");
 #endif
 
 REGISTER_ITEM(ArmorLarge, Armor) {
 #ifndef MENUQC
     this.m_model                =   MDL_ArmorLarge_ITEM;
+    this.m_sound                =   SND_ArmorLarge;
 #endif
-    this.m_sound                =   "misc/armor17_5.wav";
     this.m_name                 =   "50 Armor";
     this.m_icon                 =   "armor";
     this.m_color                =   '0 1 0';
@@ -64,13 +67,14 @@ REGISTER_ITEM(ArmorLarge, Armor) {
 
 #ifndef MENUQC
 MODEL(ArmorMega_ITEM, Item_Model("item_armor_large.md3"));
+SOUND(ArmorMega, "misc/armor25.wav");
 #endif
 
 REGISTER_ITEM(ArmorMega, Armor) {
 #ifndef MENUQC
     this.m_model                =   MDL_ArmorMega_ITEM;
+    this.m_sound                =   SND_ArmorMega;
 #endif
-    this.m_sound                =   "misc/armor25.wav";
     this.m_name                 =   "100 Armor";
     this.m_icon                 =   "item_large_armor";
     this.m_color                =   '0 1 0';
index b81bde7afc22d1b0bd2152f990d5746725e215b3..de075a2022816aa7716767f91a1bbe8d0a0b3bca 100644 (file)
@@ -5,13 +5,14 @@
 
 #ifndef MENUQC
 MODEL(HealthSmall_ITEM, Item_Model("g_h1.md3"));
+SOUND(HealthSmall, "misc/minihealth.ogg");
 #endif
 
 REGISTER_ITEM(HealthSmall, Health) {
 #ifndef MENUQC
     this.m_model                =   MDL_HealthSmall_ITEM;
+    this.m_sound                =   SND_HealthSmall;
 #endif
-    this.m_sound                =   "misc/minihealth.wav";
     this.m_name                 =   "5 Health";
     this.m_icon                 =   "health";
 #ifdef SVQC
@@ -24,13 +25,14 @@ REGISTER_ITEM(HealthSmall, Health) {
 
 #ifndef MENUQC
 MODEL(HealthMedium_ITEM, Item_Model("g_h25.md3"));
+SOUND(HealthMedium, "misc/mediumhealth.ogg");
 #endif
 
 REGISTER_ITEM(HealthMedium, Health) {
 #ifndef MENUQC
     this.m_model                =   MDL_HealthMedium_ITEM;
+    this.m_sound                =   SND_HealthMedium;
 #endif
-    this.m_sound                =   "misc/mediumhealth.wav";
     this.m_name                 =   "25 Health";
     this.m_icon                 =   "health";
 #ifdef SVQC
@@ -43,13 +45,14 @@ REGISTER_ITEM(HealthMedium, Health) {
 
 #ifndef MENUQC
 MODEL(HealthLarge_ITEM, Item_Model("g_h50.md3"));
+SOUND(HealthLarge, "misc/mediumhealth.ogg");
 #endif
 
 REGISTER_ITEM(HealthLarge, Health) {
 #ifndef MENUQC
     this.m_model                =   MDL_HealthLarge_ITEM;
+    this.m_sound                =   SND_HealthLarge;
 #endif
-    this.m_sound                =   "misc/mediumhealth.wav";
     this.m_name                 =   "50 Health";
     this.m_icon                 =   "health";
     this.m_color                =   '1 0 0';
@@ -64,13 +67,14 @@ REGISTER_ITEM(HealthLarge, Health) {
 
 #ifndef MENUQC
 MODEL(HealthMega_ITEM, Item_Model("g_h100.md3"));
+SOUND(HealthMega, "misc/megahealth.ogg");
 #endif
 
 REGISTER_ITEM(HealthMega, Health) {
 #ifndef MENUQC
     this.m_model                =   MDL_HealthMega_ITEM;
+    this.m_sound                =   SND_HealthMega;
 #endif
-    this.m_sound                =   "misc/megahealth.wav";
     this.m_name                 =   "100 Health";
     this.m_icon                 =   "item_mega_health";
     this.m_color                =   '1 0 0';
index 6f60337c195a7ab7d79c43a04f5ec937e771ab67..67d17a307ff4a4756dafe82df163b1c8d4a17ebf 100644 (file)
@@ -4,8 +4,8 @@
 CLASS(Pickup, GameItem)
 #ifndef MENUQC
     ATTRIB(Pickup, m_model, Model, NULL)
+    ATTRIB(Pickup, m_sound, Sound, SND_ITEMPICKUP)
 #endif
-    ATTRIB(Pickup, m_sound, string, "misc/itempickup.wav")
     ATTRIB(Pickup, m_name, string, string_null)
     METHOD(Pickup, show, void(entity this));
     void Pickup_show(entity this) { LOG_INFOF("%s: %s\n", etos(this), this.m_name); }
@@ -13,34 +13,15 @@ CLASS(Pickup, GameItem)
     ATTRIB(Pickup, m_botvalue, int, 0)
     ATTRIB(Pickup, m_itemflags, int, 0)
     ATTRIB(Pickup, m_itemid, int, 0)
+    float generic_pickupevalfunc(entity player, entity item);
     ATTRIB(Pickup, m_pickupevalfunc, float(entity player, entity item), generic_pickupevalfunc)
     ATTRIB(Pickup, m_respawntime, float(), func_null)
     ATTRIB(Pickup, m_respawntimejitter, float(), func_null)
-    METHOD(Pickup, giveTo, bool(entity this, entity item, entity player));
-    bool Pickup_giveTo(entity this, entity item, entity player) { return Item_GiveTo(item, player); }
+    float Item_GiveTo(entity item, entity player);
+    METHOD(Pickup, giveTo, bool(entity this, entity item, entity player))
+    { return Item_GiveTo(item, player); }
     bool ITEM_HANDLE(Pickup, entity this, entity item, entity player);
 #endif
 ENDCLASS(Pickup)
 
-#ifdef SVQC
-// For g_pickup_respawntime
-#include "../../../server/defs.qh"
-// Getters to dynamically retrieve the values of g_pickup_respawntime*
-GETTER(float, g_pickup_respawntime_weapon)
-GETTER(float, g_pickup_respawntime_superweapon)
-GETTER(float, g_pickup_respawntime_ammo)
-GETTER(float, g_pickup_respawntime_short)
-GETTER(float, g_pickup_respawntime_medium)
-GETTER(float, g_pickup_respawntime_long)
-GETTER(float, g_pickup_respawntime_powerup)
-GETTER(float, g_pickup_respawntimejitter_weapon)
-GETTER(float, g_pickup_respawntimejitter_superweapon)
-GETTER(float, g_pickup_respawntimejitter_ammo)
-GETTER(float, g_pickup_respawntimejitter_short)
-GETTER(float, g_pickup_respawntimejitter_medium)
-GETTER(float, g_pickup_respawntimejitter_long)
-GETTER(float, g_pickup_respawntimejitter_powerup)
-
-#endif
-
 #endif
index a1b2f14037fcc7394325624c56beb7406f5d5041..a1cf732c15f3c36d841c869d28538155287169b3 100644 (file)
@@ -6,13 +6,14 @@
 
 #ifndef MENUQC
 MODEL(Strength_ITEM, Item_Model("g_strength.md3"));
+SOUND(Strength, "misc/powerup.ogg");
 #endif
 
 REGISTER_ITEM(Strength, Powerup) {
 #ifndef MENUQC
     this.m_model            =   MDL_Strength_ITEM;
+    this.m_sound            =   SND_Strength;
 #endif
-    this.m_sound            =   "misc/powerup.wav";
     this.m_name             =   "Strength Powerup";
     this.m_icon             =   "strength";
     this.m_color            =   '0 0 1';
@@ -23,13 +24,14 @@ REGISTER_ITEM(Strength, Powerup) {
 
 #ifndef MENUQC
 MODEL(Shield_ITEM, Item_Model("g_invincible.md3"));
+SOUND(Shield, "misc/powerup_shield.ogg");
 #endif
 
 REGISTER_ITEM(Shield, Powerup) {
 #ifndef MENUQC
     this.m_model            =   MDL_Shield_ITEM;
+    this.m_sound            =   SND_Shield;
 #endif
-    this.m_sound            =   "misc/powerup_shield.wav";
     this.m_name             =   "Shield";
     this.m_icon             =   "shield";
     this.m_color            =   '1 0 1';
index 2d804f758b0397ab39cacb8446158c0970aeac92..ec2e25e338b7074298bb2d7f709bbac418086084 100644 (file)
@@ -9,13 +9,14 @@ GETTER(float, instagib_respawntimejitter_ammo)
 
 #ifndef MENUQC
 MODEL(VaporizerCells_ITEM, Item_Model("a_cells.md3"));
+SOUND(VaporizerCells, "misc/itempickup.ogg");
 #endif
 
 REGISTER_ITEM(VaporizerCells, Ammo) {
 #ifndef MENUQC
     this.m_model                =   MDL_VaporizerCells_ITEM;
+    this.m_sound                =   SND_VaporizerCells;
 #endif
-    this.m_sound                =   "misc/itempickup.wav";
     this.m_name                 =   "Vaporizer Ammo";
     this.m_icon                 =   "ammo_supercells";
 #ifdef SVQC
@@ -28,13 +29,14 @@ REGISTER_ITEM(VaporizerCells, Ammo) {
 
 #ifndef MENUQC
 MODEL(ExtraLife_ITEM, Item_Model("g_h100.md3"));
+SOUND(ExtraLife, "misc/megahealth.ogg");
 #endif
 
 REGISTER_ITEM(ExtraLife, Powerup) {
 #ifndef MENUQC
     this.m_model                =   MDL_ExtraLife_ITEM;
+    this.m_sound                =   SND_ExtraLife;
 #endif
-    this.m_sound                =   "misc/megahealth.wav";
     this.m_name                 =   "Extra life";
     this.m_icon                 =   "item_mega_health";
     this.m_color                =   '1 0 0';
@@ -45,13 +47,14 @@ REGISTER_ITEM(ExtraLife, Powerup) {
 
 #ifndef MENUQC
 MODEL(Invisibility_ITEM, Item_Model("g_strength.md3"));
+SOUND(Invisibility, "misc/powerup.ogg");
 #endif
 
 REGISTER_ITEM(Invisibility, Powerup) {
 #ifndef MENUQC
     this.m_model            =   MDL_Invisibility_ITEM;
+    this.m_sound            =   SND_Invisibility;
 #endif
-    this.m_sound            =   "misc/powerup.wav";
     this.m_name             =   "Invisibility";
     this.m_icon             =   "strength";
     this.m_color            =   '0 0 1';
@@ -62,13 +65,14 @@ REGISTER_ITEM(Invisibility, Powerup) {
 
 #ifndef MENUQC
 MODEL(Speed_ITEM, Item_Model("g_invincible.md3"));
+SOUND(Speed, "misc/powerup_shield.ogg");
 #endif
 
 REGISTER_ITEM(Speed, Powerup) {
 #ifndef MENUQC
     this.m_model            =   MDL_Speed_ITEM;
+    this.m_sound            =   SND_Speed;
 #endif
-    this.m_sound            =   "misc/powerup_shield.wav";
     this.m_name             =   "Speed";
     this.m_icon             =   "shield";
     this.m_color            =   '1 0 1';
index e3f6c7e7ccdaf63aac741030160ee334e68241eb..6ba62eb2f42afd3127adaea103c39b3b21239cb2 100644 (file)
@@ -35,6 +35,7 @@ WepSet ReadWepSet();
 
 REGISTRY(Weapons, 72) // Increase as needed. Can be up to 72.
 REGISTER_REGISTRY(RegisterWeapons)
+STATIC_INIT(WeaponPickup) { FOREACH(Weapons, true, LAMBDA(it.m_pickup = NEW(WeaponPickup, it))); }
 entity get_weaponinfo(int id);
 
 
index a4eb7b71d02ba8f4b139b6c5e23f8edd2f14ffc1..7c090a1de307a2a9031f4eb14ab6b1b2f304f721 100644 (file)
@@ -44,6 +44,8 @@ CLASS(Weapon, Object)
     /** M: wepname   : human readable name */
     ATTRIB(Weapon, message, string, "AOL CD Thrower");
 
+    ATTRIB(Weapon, m_pickup, entity, NULL);
+
     /** (SERVER) setup weapon data */
     METHOD(Weapon, wr_setup, void(Weapon this)) {}
     /** (SERVER) logic to run every frame */
@@ -87,6 +89,26 @@ CLASS(Weapon, Object)
        }
 ENDCLASS(Weapon)
 
+#include "../items/all.qh"
+CLASS(WeaponPickup, Pickup)
+#ifndef MENUQC
+    ATTRIB(WeaponPickup, m_sound, Sound, SND_WEAPONPICKUP)
+#endif
+#ifdef SVQC
+    float weapon_pickupevalfunc(entity player, entity item);
+    ATTRIB(WeaponPickup, m_pickupevalfunc, float(entity player, entity item), weapon_pickupevalfunc)
+#endif
+    CONSTRUCTOR(WeaponPickup, Weapon w) {
+        CONSTRUCT(WeaponPickup);
+#ifndef MENUQC
+        this.m_model = w.m_model;
+#endif
+#ifdef SVQC
+        this.m_botvalue = w.bot_pickupbasevalue;
+#endif
+    }
+ENDCLASS(WeaponPickup)
+
 CLASS(OffhandWeapon, Object)
     METHOD(OffhandWeapon, offhand_think, void(OffhandWeapon this, entity player, bool key_pressed)) {}
 ENDCLASS(OffhandWeapon)
index 8a6e117a774d30ca00ada81cc6ea8caf770d1672..938e2e6aca98fe671c737c0859ae4e88d1ed2c1d 100644 (file)
@@ -25,7 +25,7 @@
 
 #define GET(name) name##get
 #define GETTER(type, name) type GET(name)() { return name; }
-
+#define PROPERTY(type, name) type name; GETTER(type, name)
 #define LAMBDA(...) { __VA_ARGS__ ; }
 
 // Can't wrap with do-while as block may contain continue or break
index 0615282c3e1a7f7031aa1571eb8e51f5d9ce8e53..ed2029aec74fe87549cfa4b15251b43872b1c270 100644 (file)
@@ -123,7 +123,7 @@ STATIC_INIT(RegisterClasses) { RegisterClasses(); }
     class(cname) .type name[cnt];
 
 #define ENDCLASS(cname) \
-    [[last]] INIT(cname) { return this; }
+    INIT(cname) { return this; }
 
 #define SUPER(cname) (cname##_vtbl.vtblbase)
 #define super (this.vtblbase.vtblbase)
index eeb06e7a692f9f86ad283bb5a2e84731f308c152..3693726bbd90418ec2161c1304b12b2d929a3237 100644 (file)
@@ -1,14 +1,13 @@
 #ifndef SERVER_ALL_H
 #define SERVER_ALL_H
 
+#include "../common/effects/all.qh"
+#include "../common/models/all.qh"
+#include "../common/sounds/all.qh"
+
 #include "autocvars.qh"
 #include "constants.qh"
 #include "defs.qh"
 #include "miscfunctions.qh"
 
-
-#include "../common/effects/all.qh"
-#include "../common/models/all.qh"
-#include "../common/sounds/all.qh"
-
 #endif
index d418b03f8a342aeadffe4e20aa5f952b1e44337b..bfe75dc785272b063161776b085b86da922d03d6 100644 (file)
@@ -25,20 +25,20 @@ float g_warmup_limit;
 float g_warmup_allguns;
 float g_warmup_allow_timeout;
 float warmup_stage;
-float g_pickup_respawntime_weapon;
-float g_pickup_respawntime_superweapon;
-float g_pickup_respawntime_ammo;
-float g_pickup_respawntime_short;
-float g_pickup_respawntime_medium;
-float g_pickup_respawntime_long;
-float g_pickup_respawntime_powerup;
-float g_pickup_respawntimejitter_weapon;
-float g_pickup_respawntimejitter_superweapon;
-float g_pickup_respawntimejitter_ammo;
-float g_pickup_respawntimejitter_short;
-float g_pickup_respawntimejitter_medium;
-float g_pickup_respawntimejitter_long;
-float g_pickup_respawntimejitter_powerup;
+PROPERTY(float, g_pickup_respawntime_weapon)
+PROPERTY(float, g_pickup_respawntime_superweapon)
+PROPERTY(float, g_pickup_respawntime_ammo)
+PROPERTY(float, g_pickup_respawntime_short)
+PROPERTY(float, g_pickup_respawntime_medium)
+PROPERTY(float, g_pickup_respawntime_long)
+PROPERTY(float, g_pickup_respawntime_powerup)
+PROPERTY(float, g_pickup_respawntimejitter_weapon)
+PROPERTY(float, g_pickup_respawntimejitter_superweapon)
+PROPERTY(float, g_pickup_respawntimejitter_ammo)
+PROPERTY(float, g_pickup_respawntimejitter_short)
+PROPERTY(float, g_pickup_respawntimejitter_medium)
+PROPERTY(float, g_pickup_respawntimejitter_long)
+PROPERTY(float, g_pickup_respawntimejitter_powerup)
 float g_jetpack;
 
 float sv_clones;
@@ -148,6 +148,7 @@ const float MAX_DAMAGEEXTRARADIUS = 16;
 // string overrides entity
 .string item_pickupsound;
 .entity item_pickupsound_ent;
+.entity item_model_ent;
 
 // definitions for weaponsystem
 // more WEAPONTODO: move these to their proper files
index f705d375cfd4a7c67a716342e301f6fc1c1834c0..750f4e7023a730ca033e98c7eef86a53696d61a9 100644 (file)
@@ -974,21 +974,17 @@ void Item_Damage(entity inflictor, entity attacker, float damage, int deathtype,
                RemoveItem();
 }
 
-void _StartItem(entity this, string itemmodel, string pickupsound, float defaultrespawntime, float defaultrespawntimejitter, string itemname, float itemid, float weaponid, float itemflags, float(entity player, entity item) pickupevalfunc, float pickupbasevalue)
+void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter, string itemname, float itemid, float weaponid, float itemflags)
 {
-       startitem_failed = false;
-
-       if(this.model == "")
-               this.model = itemmodel;
+       Model itemmodel = def.m_model;
+    Sound pickupsound = def.m_sound;
+       float(entity player, entity item) pickupevalfunc = def.m_pickupevalfunc;
+       float pickupbasevalue = def.m_botvalue;
 
-       if(this.model == "")
-    {
-        error(strcat("^1Tried to spawn ", itemname, " with no model!\n"));
-        return;
-    }
+       startitem_failed = false;
 
-       if(this.item_pickupsound == "")
-               this.item_pickupsound = pickupsound;
+       this.item_model_ent = itemmodel;
+    this.item_pickupsound_ent = pickupsound;
 
        if(!this.respawntime) // both need to be set
        {
@@ -1136,7 +1132,7 @@ void _StartItem(entity this, string itemmodel, string pickupsound, float default
        this.bot_pickup = true;
        this.bot_pickupevalfunc = pickupevalfunc;
        this.bot_pickupbasevalue = pickupbasevalue;
-       this.mdl = this.model;
+       this.mdl = this.model ? this.model : strzone(this.item_model_ent.model_str());
        this.netname = itemname;
        this.touch = Item_Touch;
        setmodel(this, MDL_Null); // precision set below
@@ -1196,21 +1192,17 @@ void _StartItem(entity this, string itemmodel, string pickupsound, float default
        }
 }
 
-void StartItem(entity this, entity a)
+void StartItem(entity this, GameItem def)
 {
-    this.itemdef = a;
     _StartItem(
        this,
-       strzone(a.m_model.model_str()), // itemmodel
-       a.m_sound, // pickupsound
-       a.m_respawntime(), // defaultrespawntime
-       a.m_respawntimejitter(), // defaultrespawntimejitter
-       a.m_name, // itemname
-       a.m_itemid, // itemid
+       this.itemdef = def,
+       def.m_respawntime(), // defaultrespawntime
+       def.m_respawntimejitter(), // defaultrespawntimejitter
+       def.m_name, // itemname
+       def.m_itemid, // itemid
        0, // weaponid
-       a.m_itemflags, // itemflags
-       a.m_pickupevalfunc, // pickupevalfunc
-       a.m_botvalue // pickupbasevalue
+       def.m_itemflags // itemflags
        );
 }
 
index 0812d425f1e4a662d7eef8f0588d4312e2cc988c..870f847bf84e3ad9f1d63c67848232f17615c23d 100644 (file)
@@ -112,7 +112,7 @@ float commodity_pickupevalfunc(entity player, entity item);
 
 .float is_item;
 .entity itemdef;
-void _StartItem(entity this, string itemmodel, string pickupsound, float defaultrespawntime, float defaultrespawntimejitter, string itemname, float itemid, float weaponid, float itemflags, float(entity player, entity item) pickupevalfunc, float pickupbasevalue);
+void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter, string itemname, float itemid, float weaponid, float itemflags);
 
 
 void target_items_use (void);
index 64ee71457dd923324474f6b04770a32a32dab402..6351c3031e65c05e99dd3ea3f38a0f1bd163491c 100644 (file)
@@ -170,20 +170,17 @@ void weapon_defaultspawnfunc(entity this, Weapon e)
        if (this.team)
                f |= FL_NO_WEAPON_STAY;
 
+       GameItem def = e.m_pickup;
        _StartItem(
                this,
-               strzone(e.m_model.model_str()), // itemmodel
-               string_null, // pickupsound
+               this.itemdef = def,
                this.respawntime, // defaultrespawntime
                this.respawntimejitter, // defaultrespawntimejitter
                e.message, // itemname
                0, // itemid
                e.weapon, // weaponid
-               f, // itemflags
-               weapon_pickupevalfunc, // pickupevalfunc
-               e.bot_pickupbasevalue // pickupbasevalue
+               f // itemflags
        );
-       this.item_pickupsound_ent = SND_WEAPONPICKUP;
        #if 0 // WEAPONTODO
        if (this.modelindex) { // don't precache if this was removed
                e.wr_init(e);