]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Remove uses of self
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 11 Oct 2015 23:37:46 +0000 (10:37 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 11 Oct 2015 23:37:46 +0000 (10:37 +1100)
30 files changed:
qcsrc/common/mutators/mutator/instagib/instagib.qc
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/hmg.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/porto.qc
qcsrc/common/weapons/weapon/rifle.qc
qcsrc/common/weapons/weapon/rpc.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/server/defs.qh
qcsrc/server/mutators/events.qh
qcsrc/server/t_items.qc
qcsrc/server/t_items.qh
qcsrc/server/weapons/spawning.qc
qcsrc/server/weapons/spawning.qh
qcsrc/server/weapons/throwing.qc

index cc6f405e66faadc8702dfd6eb72736a609ab1c54..807ec1d41a6285731bfe77c041c843f18d303d47 100644 (file)
@@ -19,25 +19,25 @@ spawnfunc(item_minst_cells)
 {
        if (!g_instagib) { remove(self); return; }
        if (!self.ammo_cells) self.ammo_cells = autocvar_g_instagib_ammo_drop;
-       StartItemA(ITEM_VaporizerCells);
+       StartItem(this, ITEM_VaporizerCells);
 }
 
 void instagib_invisibility()
 {SELFPARAM();
        self.strength_finished = autocvar_g_balance_powerup_strength_time;
-       StartItemA(ITEM_Invisibility);
+       StartItem(this, ITEM_Invisibility);
 }
 
 void instagib_extralife()
 {SELFPARAM();
        self.max_health = 1;
-       StartItemA(ITEM_ExtraLife);
+       StartItem(this, ITEM_ExtraLife);
 }
 
 void instagib_speed()
 {SELFPARAM();
        self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
-       StartItemA(ITEM_Speed);
+       StartItem(this, ITEM_Speed);
 }
 
 .float instagib_nextthink;
index 99eb17d031b89453a0d2da13ec56fd7fedb83702..cc681f8e9c328a975543a8584f3e6b2eaa16929c 100644 (file)
@@ -128,7 +128,7 @@ vector Draw_ArcBeam_callback_last_bottom; // NOTE: in same coordinate system as
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
-spawnfunc(weapon_arc) { weapon_defaultspawnfunc(WEP_ARC.m_id); }
+spawnfunc(weapon_arc) { weapon_defaultspawnfunc(this, WEP_ARC); }
 
 bool W_Arc_Beam_Send(entity this, entity to, int sf)
 {
index d7792fac4aef157ea91a93f6a8b72a54c0facb8b..f96eb77c2f3794cccd605986cc51249a51985e1c 100644 (file)
@@ -50,7 +50,7 @@ BLASTER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
-spawnfunc(weapon_blaster) { weapon_defaultspawnfunc(WEP_BLASTER.m_id); }
+spawnfunc(weapon_blaster) { weapon_defaultspawnfunc(this, WEP_BLASTER); }
 spawnfunc(weapon_laser) { spawnfunc_weapon_blaster(this); }
 
 void W_Blaster_Touch(void)
index 75d8146de4eb67b1d4fcf18b3241dc7632eaea41..9baa9149c802a4dc75f208f2c252a85912428e55 100644 (file)
@@ -66,7 +66,7 @@ CRYLINK_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
-spawnfunc(weapon_crylink) { weapon_defaultspawnfunc(WEP_CRYLINK.m_id); }
+spawnfunc(weapon_crylink) { weapon_defaultspawnfunc(this, WEP_CRYLINK); }
 
 void W_Crylink_CheckLinks(entity e)
 {
index 8c080862db500649b02d61508b1c1ae90b0c4a8d..adef0b2eefcd7b3a9cd514ff99e00da59f6d62d4 100644 (file)
@@ -64,7 +64,7 @@ DEVASTATOR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
-spawnfunc(weapon_devastator) { weapon_defaultspawnfunc(WEP_DEVASTATOR.m_id); }
+spawnfunc(weapon_devastator) { weapon_defaultspawnfunc(this, WEP_DEVASTATOR); }
 spawnfunc(weapon_rocketlauncher) { spawnfunc_weapon_devastator(this); }
 
 void W_Devastator_Unregister(void)
index 7321d38f2aed1fcd60b90b1552783013e8e59a27..137fd7807d81c08ea742ef877bc6332a9c7be215 100644 (file)
@@ -69,7 +69,7 @@ void W_Electro_ExplodeCombo(void);
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
-spawnfunc(weapon_electro) { weapon_defaultspawnfunc(WEP_ELECTRO.m_id); }
+spawnfunc(weapon_electro) { weapon_defaultspawnfunc(this, WEP_ELECTRO); }
 
 void W_Electro_TriggerCombo(vector org, float rad, entity own)
 {
index b0761b2c2ad1006623ab473ca9b7cbe912476c99..990bdfea808a3ce40e3dfa6e74173eac71cf8b7b 100644 (file)
@@ -57,7 +57,7 @@ FIREBALL_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
-spawnfunc(weapon_fireball) { weapon_defaultspawnfunc(WEP_FIREBALL.m_id); }
+spawnfunc(weapon_fireball) { weapon_defaultspawnfunc(this, WEP_FIREBALL); }
 
 void W_Fireball_Explode(void)
 {SELFPARAM();
index 37f6875b5595118009cace956d568318439194b8..16c9599239440040151bd4a65730079510e5dce5 100644 (file)
@@ -58,7 +58,7 @@ HAGAR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
-spawnfunc(weapon_hagar) { weapon_defaultspawnfunc(WEP_HAGAR.m_id); }
+spawnfunc(weapon_hagar) { weapon_defaultspawnfunc(this, WEP_HAGAR); }
 
 // NO bounce protection, as bounces are limited!
 
index 616939d1e80abd1a83c259d626f91d699ff931ed..bf719ac8ebe9463185a2fe38f9512b5ba8f9fc74 100644 (file)
@@ -50,7 +50,7 @@ HLAC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
-spawnfunc(weapon_hlac) { weapon_defaultspawnfunc(WEP_HLAC.m_id); }
+spawnfunc(weapon_hlac) { weapon_defaultspawnfunc(this, WEP_HLAC); }
 
 void W_HLAC_Touch(void)
 {SELFPARAM();
index 6707a7c32e960cc0eac5c9a01c68eb8bc42f0dd7..ac6ed0a6754e19a4b44a2a874ce8fb8edf13db54 100644 (file)
@@ -43,7 +43,7 @@ HMG_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #ifdef IMPLEMENTATION
 #ifdef SVQC
 
-spawnfunc(weapon_hmg) { weapon_defaultspawnfunc(WEP_HMG.m_id); }
+spawnfunc(weapon_hmg) { weapon_defaultspawnfunc(this, WEP_HMG); }
 
 void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, bool fire1, bool fire2)
 {
index bc79a88a313db91961d254bbb1765966ce384f31..b7a6d16db887198e7c9a6d8a54cfd529ea2dd13a 100644 (file)
@@ -71,7 +71,7 @@ HOOK_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #ifdef IMPLEMENTATION
 #ifdef SVQC
 
-spawnfunc(weapon_hook) { weapon_defaultspawnfunc(WEP_HOOK.m_id); }
+spawnfunc(weapon_hook) { weapon_defaultspawnfunc(this, WEP_HOOK); }
 
 void W_Hook_ExplodeThink(void)
 {SELFPARAM();
index 90a4471f17bbf6110bca905b19da7b0883821c20..b3dcf120bdd8c6acde2a7c2cf878650666c30a6f 100644 (file)
@@ -62,10 +62,10 @@ spawnfunc(weapon_machinegun)
        if(autocvar_sv_q3acompat_machineshotgunswap)
        if(self.classname != "droppedweapon")
        {
-               weapon_defaultspawnfunc(WEP_SHOCKWAVE.m_id);
+               weapon_defaultspawnfunc(this, WEP_SHOCKWAVE);
                return;
        }
-       weapon_defaultspawnfunc(WEP_MACHINEGUN.m_id);
+       weapon_defaultspawnfunc(this, WEP_MACHINEGUN);
 }
 spawnfunc(weapon_uzi) { spawnfunc_weapon_machinegun(this); }
 
index 548ede96606e08d786ca252624c4d0353e89e737..93e32b9e81f3a2efb65fb59ca295f80c055d2c5d 100644 (file)
@@ -59,7 +59,7 @@ void W_MineLayer_Think(void);
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
-spawnfunc(weapon_minelayer) { weapon_defaultspawnfunc(WEP_MINE_LAYER.m_id); }
+spawnfunc(weapon_minelayer) { weapon_defaultspawnfunc(this, WEP_MINE_LAYER); }
 
 void W_MineLayer_Stick(entity to)
 {SELFPARAM();
index c1995745816ba1d7059743728ab81244d8f06309..46f26b049d37cac2c8a98a30c0aa03c75f8a817f 100644 (file)
@@ -58,7 +58,7 @@ MORTAR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #ifdef IMPLEMENTATION
 #ifdef SVQC
 
-spawnfunc(weapon_mortar) { weapon_defaultspawnfunc(WEP_MORTAR.m_id); }
+spawnfunc(weapon_mortar) { weapon_defaultspawnfunc(this, WEP_MORTAR); }
 spawnfunc(weapon_grenadelauncher) { spawnfunc_weapon_mortar(this); }
 
 void W_Mortar_Grenade_Explode(void)
index b17476632b9681f5c0cc0bc6ed229d4d3a60bbd0..a4acb98d847f6e61e8760accbd8ba6fa7adcb2fb 100644 (file)
@@ -43,7 +43,7 @@ PORTO_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #ifdef SVQC
 #include "../../triggers/trigger/jumppads.qh"
 
-spawnfunc(weapon_porto) { weapon_defaultspawnfunc(WEP_PORTO.m_id); }
+spawnfunc(weapon_porto) { weapon_defaultspawnfunc(this, WEP_PORTO); }
 
 void W_Porto_Success(void)
 {SELFPARAM();
index 49b3931566fd829e61e31a77253d5f5a8bfa2f25..c78e76736c3bd8d44642ebe6cf7db5590cd0941b 100644 (file)
@@ -49,7 +49,7 @@ RIFLE_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
-spawnfunc(weapon_rifle) { weapon_defaultspawnfunc(WEP_RIFLE.m_id); }
+spawnfunc(weapon_rifle) { weapon_defaultspawnfunc(this, WEP_RIFLE); }
 spawnfunc(weapon_campingrifle) { spawnfunc_weapon_rifle(this); }
 spawnfunc(weapon_sniperrifle) { spawnfunc_weapon_rifle(this); }
 
index 71ddaa6b58acd7f77bde45fbca2cb917c70123bf..28016f08ebf63633a041c6a5624758848a9a531a 100644 (file)
@@ -47,7 +47,7 @@ RPC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
-spawnfunc(weapon_rpc) { weapon_defaultspawnfunc(WEP_RPC.m_id); }
+spawnfunc(weapon_rpc) { weapon_defaultspawnfunc(this, WEP_RPC); }
 
 void W_RocketPropelledChainsaw_Explode()
 {SELFPARAM();
index 645bd9eb9b4475ec31156c64cf358614ec59cf13..ad35d72f805f248d101f41bd4a5dd0d924261d67 100644 (file)
@@ -86,7 +86,7 @@ SEEKER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
-spawnfunc(weapon_seeker) { weapon_defaultspawnfunc(WEP_SEEKER.m_id); }
+spawnfunc(weapon_seeker) { weapon_defaultspawnfunc(this, WEP_SEEKER); }
 
 // ============================
 // Begin: Missile functions, these are general functions to be manipulated by other code
index cc4daf0486732f99be82c67237c5eb1aba086496..6f71e4d5ce4a9320bdd05ccae4715b2ac1eab175 100644 (file)
@@ -90,10 +90,10 @@ spawnfunc(weapon_shockwave)
        if(autocvar_sv_q3acompat_machineshotgunswap)
        if(self.classname != "droppedweapon")
        {
-               weapon_defaultspawnfunc(WEP_MACHINEGUN.m_id);
+               weapon_defaultspawnfunc(this, WEP_MACHINEGUN);
                return;
        }
-       weapon_defaultspawnfunc(WEP_SHOCKWAVE.m_id);
+       weapon_defaultspawnfunc(this, WEP_SHOCKWAVE);
 }
 
 const float MAX_SHOCKWAVE_HITS = 10;
index a5cb397737267127c620db7a4e7269fb31a7f7d1..9d1cc5adeee2b02074f0ddf70b7a5d0e52ce0431 100644 (file)
@@ -54,7 +54,7 @@ SHOTGUN_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
-spawnfunc(weapon_shotgun) { weapon_defaultspawnfunc(WEP_SHOTGUN.m_id); }
+spawnfunc(weapon_shotgun) { weapon_defaultspawnfunc(this, WEP_SHOTGUN); }
 
 void W_Shotgun_Attack(Weapon thiswep, float isprimary)
 {SELFPARAM();
index 66ea8f7b5165151bdb4040bb01883068dd452bf1..2936b5e78bc7f18bece68ab1e4090dee7f820ae9 100644 (file)
@@ -56,7 +56,7 @@ float W_Tuba_MarkClientOnlyFieldsAsUsed() {
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
-spawnfunc(weapon_tuba) { weapon_defaultspawnfunc(WEP_TUBA.m_id); }
+spawnfunc(weapon_tuba) { weapon_defaultspawnfunc(this, WEP_TUBA); }
 
 bool W_Tuba_HasPlayed(entity pl, string melody, int instrument, bool ignorepitch, float mintempo, float maxtempo)
 {
index f7aceee20f3f531f0519610d3a1de5e511ad2b17..25499065d29a2b7af41b2ddcb2dd2017aa8288b6 100644 (file)
@@ -57,7 +57,7 @@ VAPORIZER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
-spawnfunc(weapon_vaporizer) { weapon_defaultspawnfunc(WEP_VAPORIZER.m_id); }
+spawnfunc(weapon_vaporizer) { weapon_defaultspawnfunc(this, WEP_VAPORIZER); }
 spawnfunc(weapon_minstanex) { spawnfunc_weapon_vaporizer(this); }
 
 void W_RocketMinsta_Explosion(vector loc)
index c51028b620b82eafe98006f14786b3662715ba1a..a2cb19d0a6a1392492d39652e22d868b56984e1e 100644 (file)
@@ -61,7 +61,7 @@ VORTEX_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
-spawnfunc(weapon_vortex) { weapon_defaultspawnfunc(WEP_VORTEX.m_id); }
+spawnfunc(weapon_vortex) { weapon_defaultspawnfunc(this, WEP_VORTEX); }
 spawnfunc(weapon_nex) { spawnfunc_weapon_vortex(this); }
 
 void SendCSQCVortexBeamParticle(float charge) {
index 4a7edc2b94a782fb900fa7554760c522b171d8ed..d418b03f8a342aeadffe4e20aa5f952b1e44337b 100644 (file)
@@ -180,7 +180,7 @@ const int WS_READY                  = 4; // idle frame
 // there is 2 weapon tics that can run in one server frame
 const int W_TICSPERFRAME = 2;
 
-void weapon_defaultspawnfunc(float wpn);
+void weapon_defaultspawnfunc(entity this, Weapon e);
 
 float gameover;
 float intermission_running;
index 1492b9f6af3d07a06aa8a782a8d4a846ea60bea0..7b77dad27a0a9bf47c1594afbb525a7c9d16c67f 100644 (file)
@@ -177,7 +177,10 @@ MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint);
  * checks if the current item may be spawned (self.items and self.weapons may be read and written to, as well as the ammo_ fields)
  * return error to request removal
  */
-MUTATOR_HOOKABLE(FilterItem, EV_NO_ARGS);
+#define EV_FilterItem(i, o) \
+    /** the current item */ i(entity, __self) \
+    /**/
+MUTATOR_HOOKABLE(FilterItem, EV_FilterItem);
 
 /** return error to request removal */
 #define EV_TurretSpawn(i, o) \
index 89d6b06caf07ff80ef2631e2ab1c33f27c75709a..f705d375cfd4a7c67a716342e301f6fc1c1834c0 100644 (file)
@@ -785,23 +785,24 @@ void Item_Touch (void)
        }
 }
 
-void Item_Reset()
-{SELFPARAM();
-       Item_Show(self, !self.state);
-       setorigin (self, self.origin);
+void Item_Reset(entity this)
+{
+       Item_Show(this, !this.state);
+       setorigin(this, this.origin);
 
-       if(self.classname != "droppedweapon")
+       if (this.classname != "droppedweapon")
        {
-               self.think = Item_Think;
-               self.nextthink = time;
+               this.think = Item_Think;
+               this.nextthink = time;
 
-               if(self.waypointsprite_attached)
-                       WaypointSprite_Kill(self.waypointsprite_attached);
+               if (this.waypointsprite_attached)
+                       WaypointSprite_Kill(this.waypointsprite_attached);
 
-               if((self.flags & FL_POWERUP) || (self.weapons & WEPSET_SUPERWEAPONS)) // do not spawn powerups initially!
-                       Item_ScheduleInitialRespawn(self);
+               if ((this.flags & FL_POWERUP) || (this.weapons & WEPSET_SUPERWEAPONS)) // do not spawn powerups initially!
+                       Item_ScheduleInitialRespawn(this);
        }
 }
+void Item_Reset_self() { SELFPARAM(); Item_Reset(this); }
 
 void Item_FindTeam()
 {SELFPARAM();
@@ -833,7 +834,7 @@ void Item_FindTeam()
                        head.effects &= ~EF_NODRAW;
                }
 
-               Item_Reset();
+               Item_Reset(self);
        }
 }
 
@@ -973,86 +974,86 @@ void Item_Damage(entity inflictor, entity attacker, float damage, int deathtype,
                RemoveItem();
 }
 
-void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, float defaultrespawntimejitter, string itemname, float itemid, float weaponid, float itemflags, float(entity player, entity item) pickupevalfunc, float pickupbasevalue)
-{SELFPARAM();
+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)
+{
        startitem_failed = false;
 
-       if(self.model == "")
-               self.model = itemmodel;
+       if(this.model == "")
+               this.model = itemmodel;
 
-       if(self.model == "")
+       if(this.model == "")
     {
         error(strcat("^1Tried to spawn ", itemname, " with no model!\n"));
         return;
     }
 
-       if(self.item_pickupsound == "")
-               self.item_pickupsound = pickupsound;
+       if(this.item_pickupsound == "")
+               this.item_pickupsound = pickupsound;
 
-       if(!self.respawntime) // both need to be set
+       if(!this.respawntime) // both need to be set
        {
-               self.respawntime = defaultrespawntime;
-               self.respawntimejitter = defaultrespawntimejitter;
+               this.respawntime = defaultrespawntime;
+               this.respawntimejitter = defaultrespawntimejitter;
        }
 
-       self.items = itemid;
-       self.weapon = weaponid;
+       this.items = itemid;
+       this.weapon = weaponid;
 
-       if(!self.fade_end)
+       if(!this.fade_end)
        {
-               self.fade_start = autocvar_g_items_mindist;
-               self.fade_end = autocvar_g_items_maxdist;
+               this.fade_start = autocvar_g_items_mindist;
+               this.fade_end = autocvar_g_items_maxdist;
        }
 
        if(weaponid)
-               self.weapons = WepSet_FromWeapon(weaponid);
+               this.weapons = WepSet_FromWeapon(weaponid);
 
-       self.flags = FL_ITEM | itemflags;
+       this.flags = FL_ITEM | itemflags;
 
-       if(MUTATOR_CALLHOOK(FilterItem)) // error means we do not want the item
+       if(MUTATOR_CALLHOOK(FilterItem, this)) // error means we do not want the item
        {
                startitem_failed = true;
-               remove(self);
+               remove(this);
                return;
        }
 
        // is it a dropped weapon?
-       if (self.classname == "droppedweapon")
+       if (this.classname == "droppedweapon")
        {
-               self.reset = SUB_Remove;
+               this.reset = SUB_Remove;
                // it's a dropped weapon
-               self.movetype = MOVETYPE_TOSS;
+               this.movetype = MOVETYPE_TOSS;
 
                // Savage: remove thrown items after a certain period of time ("garbage collection")
-               self.think = RemoveItem;
-               self.nextthink = time + 20;
+               this.think = RemoveItem;
+               this.nextthink = time + 20;
 
-               self.takedamage = DAMAGE_YES;
-               self.event_damage = Item_Damage;
+               this.takedamage = DAMAGE_YES;
+               this.event_damage = Item_Damage;
 
-               if(self.strength_finished || self.invincible_finished || self.superweapons_finished)
+               if(this.strength_finished || this.invincible_finished || this.superweapons_finished)
                /*
-               if(self.items == 0)
-               if(!(self.weapons & ~WEPSET_SUPERWEAPONS)) // only superweapons
-               if(self.ammo_nails == 0)
-               if(self.ammo_cells == 0)
-               if(self.ammo_rockets == 0)
-               if(self.ammo_shells == 0)
-               if(self.ammo_fuel == 0)
-               if(self.health == 0)
-               if(self.armorvalue == 0)
+               if(this.items == 0)
+               if(!(this.weapons & ~WEPSET_SUPERWEAPONS)) // only superweapons
+               if(this.ammo_nails == 0)
+               if(this.ammo_cells == 0)
+               if(this.ammo_rockets == 0)
+               if(this.ammo_shells == 0)
+               if(this.ammo_fuel == 0)
+               if(this.health == 0)
+               if(this.armorvalue == 0)
                */
                {
                        // if item is worthless after a timer, have it expire then
-                       self.nextthink = max(self.strength_finished, self.invincible_finished, self.superweapons_finished);
+                       this.nextthink = max(this.strength_finished, this.invincible_finished, this.superweapons_finished);
                }
 
                // don't drop if in a NODROP zone (such as lava)
-               traceline(self.origin, self.origin, MOVE_NORMAL, self);
+               traceline(this.origin, this.origin, MOVE_NORMAL, this);
                if (trace_dpstartcontents & DPCONTENTS_NODROP)
                {
                        startitem_failed = true;
-                       remove(self);
+                       remove(this);
                        return;
                }
        }
@@ -1061,145 +1062,156 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
                if(!have_pickup_item())
                {
                        startitem_failed = true;
-                       remove (self);
+                       remove (this);
                        return;
                }
 
-               if(self.angles != '0 0 0')
-                       self.SendFlags |= ISF_ANGLES;
+               if(this.angles != '0 0 0')
+                       this.SendFlags |= ISF_ANGLES;
 
-               self.reset = Item_Reset;
+               this.reset = Item_Reset_self;
                // it's a level item
-               if(self.spawnflags & 1)
-                       self.noalign = 1;
-               if (self.noalign)
-                       self.movetype = MOVETYPE_NONE;
+               if(this.spawnflags & 1)
+                       this.noalign = 1;
+               if (this.noalign)
+                       this.movetype = MOVETYPE_NONE;
                else
-                       self.movetype = MOVETYPE_TOSS;
+                       this.movetype = MOVETYPE_TOSS;
                // do item filtering according to game mode and other things
-               if (!self.noalign)
+               if (!this.noalign)
                {
                        // first nudge it off the floor a little bit to avoid math errors
-                       setorigin(self, self.origin + '0 0 1');
+                       setorigin(this, this.origin + '0 0 1');
                        // set item size before we spawn a spawnfunc_waypoint
-                       if((itemflags & FL_POWERUP) || self.health || self.armorvalue)
-                               setsize (self, '-16 -16 0', '16 16 48');
+                       if((itemflags & FL_POWERUP) || this.health || this.armorvalue)
+                               setsize (this, '-16 -16 0', '16 16 48');
                        else
-                               setsize (self, '-16 -16 0', '16 16 32');
-                       self.SendFlags |= ISF_SIZE;
+                               setsize (this, '-16 -16 0', '16 16 32');
+                       this.SendFlags |= ISF_SIZE;
                        // note droptofloor returns false if stuck/or would fall too far
-                       droptofloor();
-                       waypoint_spawnforitem(self);
+                       WITH(entity, self, this, droptofloor());
+                       waypoint_spawnforitem(this);
                }
 
                /*
                 * can't do it that way, as it would break maps
                 * TODO make a target_give like entity another way, that perhaps has
                 * the weapon name in a key
-               if(self.targetname)
+               if(this.targetname)
                {
                        // target_give not yet supported; maybe later
-                       print("removed targeted ", self.classname, "\n");
+                       print("removed targeted ", this.classname, "\n");
                        startitem_failed = true;
-                       remove (self);
+                       remove (this);
                        return;
                }
                */
 
                if(autocvar_spawn_debug >= 2)
                {
-                       entity otheritem;
-                       for(otheritem = findradius(self.origin, 3); otheritem; otheritem = otheritem.chain)
+                       for(entity otheritem = findradius(this.origin, 3); otheritem; otheritem = otheritem.chain)
                        {
                            // why not flags & fl_item?
                                if(otheritem.is_item)
                                {
-                                       LOG_TRACE("XXX Found duplicated item: ", itemname, vtos(self.origin));
+                                       LOG_TRACE("XXX Found duplicated item: ", itemname, vtos(this.origin));
                                        LOG_TRACE(" vs ", otheritem.netname, vtos(otheritem.origin), "\n");
                                        error("Mapper sucks.");
                                }
                        }
-                       self.is_item = true;
+                       this.is_item = true;
                }
 
                weaponsInMap |= WepSet_FromWeapon(weaponid);
 
-               precache_model (self.model);
-               precache_sound (self.item_pickupsound);
+               precache_model(this.model);
+               precache_sound(this.item_pickupsound);
 
-               if((itemflags & (FL_POWERUP | FL_WEAPON)) || (itemid & (IT_HEALTH | IT_ARMOR | IT_KEY1 | IT_KEY2)))
-                       self.target = "###item###"; // for finding the nearest item using find()
+               if ((itemflags & (FL_POWERUP | FL_WEAPON)) || (itemid & (IT_HEALTH | IT_ARMOR | IT_KEY1 | IT_KEY2)))
+                       this.target = "###item###"; // for finding the nearest item using find()
 
-               Item_ItemsTime_SetTime(self, 0);
+               Item_ItemsTime_SetTime(this, 0);
        }
 
-       self.bot_pickup = true;
-       self.bot_pickupevalfunc = pickupevalfunc;
-       self.bot_pickupbasevalue = pickupbasevalue;
-       self.mdl = self.model;
-       self.netname = itemname;
-       self.touch = Item_Touch;
-       setmodel(self, MDL_Null); // precision set below
-       //self.effects |= EF_LOWPRECISION;
+       this.bot_pickup = true;
+       this.bot_pickupevalfunc = pickupevalfunc;
+       this.bot_pickupbasevalue = pickupbasevalue;
+       this.mdl = this.model;
+       this.netname = itemname;
+       this.touch = Item_Touch;
+       setmodel(this, MDL_Null); // precision set below
+       //this.effects |= EF_LOWPRECISION;
 
-       if((itemflags & FL_POWERUP) || self.health || self.armorvalue)
+       if((itemflags & FL_POWERUP) || this.health || this.armorvalue)
        {
-               self.pos1 = '-16 -16 0';
-               self.pos2 = '16 16 48';
+               this.pos1 = '-16 -16 0';
+               this.pos2 = '16 16 48';
        }
        else
        {
-               self.pos1 = '-16 -16 0';
-               self.pos2 = '16 16 32';
+               this.pos1 = '-16 -16 0';
+               this.pos2 = '16 16 32';
        }
-       setsize (self, self.pos1, self.pos2);
+       setsize (this, this.pos1, this.pos2);
 
-       self.SendFlags |= ISF_SIZE;
+       this.SendFlags |= ISF_SIZE;
 
        if(itemflags & FL_POWERUP)
-               self.ItemStatus |= ITS_ANIMATE1;
+               this.ItemStatus |= ITS_ANIMATE1;
 
-       if(self.armorvalue || self.health)
-               self.ItemStatus |= ITS_ANIMATE2;
+       if(this.armorvalue || this.health)
+               this.ItemStatus |= ITS_ANIMATE2;
 
        if(itemflags & FL_WEAPON)
        {
-               if (self.classname != "droppedweapon") // if dropped, colormap is already set up nicely
-                       self.colormap = 1024; // color shirt=0 pants=0 grey
+               if (this.classname != "droppedweapon") // if dropped, colormap is already set up nicely
+                       this.colormap = 1024; // color shirt=0 pants=0 grey
                else
-                       self.gravity = 1;
+                       this.gravity = 1;
 
-               self.ItemStatus |= ITS_ANIMATE1;
-               self.ItemStatus |= ISF_COLORMAP;
+               this.ItemStatus |= ITS_ANIMATE1;
+               this.ItemStatus |= ISF_COLORMAP;
        }
 
-       self.state = 0;
-       if(self.team) // broken, no idea why.
+       this.state = 0;
+       if(this.team) // broken, no idea why.
        {
-               if(!self.cnt)
-                       self.cnt = 1; // item probability weight
+               if(!this.cnt)
+                       this.cnt = 1; // item probability weight
 
-               self.effects |= EF_NODRAW; // marker for item team search
-               InitializeEntity(self, Item_FindTeam, INITPRIO_FINDTARGET);
+               this.effects |= EF_NODRAW; // marker for item team search
+               InitializeEntity(this, Item_FindTeam, INITPRIO_FINDTARGET);
        }
        else
-               Item_Reset();
+               Item_Reset(this);
 
-       Net_LinkEntity(self, !((itemflags & FL_POWERUP) || self.health || self.armorvalue), 0, ItemSend);
+       Net_LinkEntity(this, !((itemflags & FL_POWERUP) || this.health || this.armorvalue), 0, ItemSend);
 
        // call this hook after everything else has been done
-       if(MUTATOR_CALLHOOK(Item_Spawn, self))
+       if (MUTATOR_CALLHOOK(Item_Spawn, this))
        {
                startitem_failed = true;
-               remove(self);
+               remove(this);
                return;
        }
 }
 
-void StartItemA (entity a)
-{SELFPARAM();
-    self.itemdef = a;
-    StartItem(strzone(a.m_model.model_str()), a.m_sound, a.m_respawntime(), a.m_respawntimejitter(), a.m_name, a.m_itemid, 0, a.m_itemflags, a.m_pickupevalfunc, a.m_botvalue);
+void StartItem(entity this, entity a)
+{
+    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
+       0, // weaponid
+       a.m_itemflags, // itemflags
+       a.m_pickupevalfunc, // pickupevalfunc
+       a.m_botvalue // pickupbasevalue
+       );
 }
 
 spawnfunc(item_rockets)
@@ -1208,7 +1220,7 @@ spawnfunc(item_rockets)
                self.ammo_rockets = g_pickup_rockets;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_ammo_anyway;
-    StartItemA (ITEM_Rockets);
+    StartItem(this, ITEM_Rockets);
 }
 
 spawnfunc(item_bullets)
@@ -1227,7 +1239,7 @@ spawnfunc(item_bullets)
                self.ammo_nails = g_pickup_nails;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_ammo_anyway;
-    StartItemA (ITEM_Bullets);
+    StartItem(this, ITEM_Bullets);
 }
 
 spawnfunc(item_cells)
@@ -1236,7 +1248,7 @@ spawnfunc(item_cells)
                self.ammo_cells = g_pickup_cells;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_ammo_anyway;
-       StartItemA (ITEM_Cells);
+       StartItem(this, ITEM_Cells);
 }
 
 spawnfunc(item_plasma)
@@ -1245,7 +1257,7 @@ spawnfunc(item_plasma)
                self.ammo_plasma = g_pickup_plasma;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_ammo_anyway;
-       StartItemA (ITEM_Plasma);
+       StartItem(this, ITEM_Plasma);
 }
 
 spawnfunc(item_shells)
@@ -1264,7 +1276,7 @@ spawnfunc(item_shells)
                self.ammo_shells = g_pickup_shells;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_ammo_anyway;
-       StartItemA (ITEM_Shells);
+       StartItem(this, ITEM_Shells);
 }
 
 spawnfunc(item_armor_small)
@@ -1275,7 +1287,7 @@ spawnfunc(item_armor_small)
                self.max_armorvalue = g_pickup_armorsmall_max;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_armorsmall_anyway;
-       StartItemA (ITEM_ArmorSmall);
+       StartItem(this, ITEM_ArmorSmall);
 }
 
 spawnfunc(item_armor_medium)
@@ -1286,7 +1298,7 @@ spawnfunc(item_armor_medium)
                self.max_armorvalue = g_pickup_armormedium_max;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_armormedium_anyway;
-       StartItemA (ITEM_ArmorMedium);
+       StartItem(this, ITEM_ArmorMedium);
 }
 
 spawnfunc(item_armor_big)
@@ -1297,7 +1309,7 @@ spawnfunc(item_armor_big)
                self.max_armorvalue = g_pickup_armorbig_max;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_armorbig_anyway;
-       StartItemA (ITEM_ArmorLarge);
+       StartItem(this, ITEM_ArmorLarge);
 }
 
 spawnfunc(item_armor_large)
@@ -1308,7 +1320,7 @@ spawnfunc(item_armor_large)
                self.max_armorvalue = g_pickup_armorlarge_max;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_armorlarge_anyway;
-       StartItemA (ITEM_ArmorMega);
+       StartItem(this, ITEM_ArmorMega);
 }
 
 spawnfunc(item_health_small)
@@ -1319,7 +1331,7 @@ spawnfunc(item_health_small)
                self.health = g_pickup_healthsmall;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_healthsmall_anyway;
-       StartItemA (ITEM_HealthSmall);
+       StartItem(this, ITEM_HealthSmall);
 }
 
 spawnfunc(item_health_medium)
@@ -1330,7 +1342,7 @@ spawnfunc(item_health_medium)
                self.health = g_pickup_healthmedium;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_healthmedium_anyway;
-    StartItemA (ITEM_HealthMedium);
+    StartItem(this, ITEM_HealthMedium);
 }
 
 spawnfunc(item_health_large)
@@ -1341,7 +1353,7 @@ spawnfunc(item_health_large)
                self.health = g_pickup_healthlarge;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_healthlarge_anyway;
-       StartItemA (ITEM_HealthLarge);
+       StartItem(this, ITEM_HealthLarge);
 }
 
 spawnfunc(item_health_mega)
@@ -1352,7 +1364,7 @@ spawnfunc(item_health_mega)
         self.health = g_pickup_healthmega;
     if(!self.pickup_anyway)
         self.pickup_anyway = g_pickup_healthmega_anyway;
-    StartItemA (ITEM_HealthMega);
+    StartItem(this, ITEM_HealthMega);
 }
 
 // support old misnamed entities
@@ -1366,14 +1378,14 @@ spawnfunc(item_strength)
 {
                if(!self.strength_finished)
                        self.strength_finished = autocvar_g_balance_powerup_strength_time;
-               StartItemA (ITEM_Strength);
+               StartItem(this, ITEM_Strength);
 }
 
 spawnfunc(item_invincible)
 {
                if(!self.invincible_finished)
                        self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
-               StartItemA (ITEM_Shield);
+               StartItem(this, ITEM_Shield);
 }
 
 // compatibility:
@@ -1530,7 +1542,7 @@ spawnfunc(item_fuel)
                self.ammo_fuel = g_pickup_fuel;
        if(!self.pickup_anyway)
                self.pickup_anyway = g_pickup_ammo_anyway;
-       StartItemA (ITEM_JetpackFuel);
+       StartItem(this, ITEM_JetpackFuel);
 }
 
 spawnfunc(item_fuel_regen)
@@ -1540,7 +1552,7 @@ spawnfunc(item_fuel_regen)
                spawnfunc_item_fuel(this);
                return;
        }
-       StartItemA (ITEM_JetpackRegen);
+       StartItem(this, ITEM_JetpackRegen);
 }
 
 spawnfunc(item_jetpack)
@@ -1552,7 +1564,7 @@ spawnfunc(item_jetpack)
                spawnfunc_item_fuel(this);
                return;
        }
-       StartItemA (ITEM_Jetpack);
+       StartItem(this, ITEM_Jetpack);
 }
 
 float GiveWeapon(entity e, float wpn, float op, float val)
index 8195d250d023b4e528cb40bfd67d272fde8392c0..0812d425f1e4a662d7eef8f0588d4312e2cc988c 100644 (file)
@@ -25,7 +25,7 @@ const int ISF_SIZE                            = 128;
 .float fade_end;
 
 #ifdef SVQC
-void StartItemA (entity a);
+void StartItem(entity this, entity a);
 #endif
 
 #ifdef CSQC
@@ -92,7 +92,7 @@ float Item_GiveTo(entity item, entity player);
 
 void Item_Touch (void);
 
-void Item_Reset();
+void Item_Reset(entity this);
 
 void Item_FindTeam();
 // Savage: used for item garbage-collection
@@ -112,7 +112,7 @@ float commodity_pickupevalfunc(entity player, entity item);
 
 .float is_item;
 .entity itemdef;
-void StartItem (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, 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 target_items_use (void);
index be2ca6b50f0c6d734d1903aa9470c6d19f1bb291..64ee71457dd923324474f6b04770a32a32dab402 100644 (file)
@@ -33,81 +33,75 @@ string W_Apply_Weaponreplace(string in)
        return substring(out, 1, -1);
 }
 
-void weapon_defaultspawnfunc(float wpn)
-{SELFPARAM();
-       entity e;
-       float t;
-       string s;
-       float i, j;
-       int f;
-
-       if(self.classname != "droppedweapon" && self.classname != "replacedweapon")
+void weapon_defaultspawnfunc(entity this, Weapon e)
+{
+       int wpn = e.m_id;
+       if (this.classname != "droppedweapon" && this.classname != "replacedweapon")
        {
-               e = get_weaponinfo(wpn);
-
-               if(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
+               if (e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
                {
                        objerror("Attempted to spawn a mutator-blocked weapon rejected");
                        startitem_failed = true;
                        return;
                }
 
-               s = W_Apply_Weaponreplace(e.netname);
-               MUTATOR_CALLHOOK(SetWeaponreplace, self, e, s);
+               string s = W_Apply_Weaponreplace(e.netname);
+               MUTATOR_CALLHOOK(SetWeaponreplace, this, e, s);
                s = ret_string;
-               if(s == "")
+               if (s == "")
                {
-                       remove(self);
+                       remove(this);
                        startitem_failed = true;
                        return;
                }
-               t = tokenize_console(s);
-               if(t >= 2)
+               int t = tokenize_console(s);
+               if (t >= 2)
                {
-                       self.team = --internalteam;
-                       for(i = 1; i < t; ++i)
+                       this.team = --internalteam;
+                       for (int i = 1; i < t; ++i)
                        {
                                s = argv(i);
-                               for(j = WEP_FIRST; j <= WEP_LAST; ++j)
+                               int j;
+                               for (j = WEP_FIRST; j <= WEP_LAST; ++j)
                                {
                                        e = get_weaponinfo(j);
-                                       if(e.netname == s)
+                                       if (e.netname == s)
                                        {
-                                               setself(spawn());
-                                               copyentity(this, self);
-                                               self.classname = "replacedweapon";
-                                               weapon_defaultspawnfunc(j);
+                                               entity replacement = spawn();
+                                               copyentity(this, replacement);
+                                               replacement.classname = "replacedweapon";
+                                               weapon_defaultspawnfunc(replacement, e);
                                                break;
                                        }
                                }
-                               if(j > WEP_LAST)
+                               if (j > WEP_LAST)
                                {
                                        LOG_INFO("The weapon replace list for ", this.classname, " contains an unknown weapon ", s, ". Skipped.\n");
                                }
                        }
-                       setself(this);
                }
-               if(t >= 1) // always the case!
+               if (t >= 1) // always the case!
                {
                        s = argv(0);
                        wpn = 0;
-                       for(j = WEP_FIRST; j <= WEP_LAST; ++j)
+                       int j;
+                       for (j = WEP_FIRST; j <= WEP_LAST; ++j)
                        {
                                e = get_weaponinfo(j);
-                               if(e.netname == s)
+                               if (e.netname == s)
                                {
                                        wpn = j;
                                        break;
                                }
                        }
-                       if(j > WEP_LAST)
+                       if (j > WEP_LAST)
                        {
-                               LOG_INFO("The weapon replace list for ", self.classname, " contains an unknown weapon ", s, ". Skipped.\n");
+                               LOG_INFO("The weapon replace list for ", this.classname, " contains an unknown weapon ", s, ". Skipped.\n");
                        }
                }
-               if(wpn == 0)
+               if (wpn == 0)
                {
-                       remove(self);
+                       remove(this);
                        startitem_failed = true;
                        return;
                }
@@ -115,73 +109,84 @@ void weapon_defaultspawnfunc(float wpn)
 
        e = get_weaponinfo(wpn);
 
-       if(!self.respawntime)
+       if (!this.respawntime)
        {
-               if(e.weapons & WEPSET_SUPERWEAPONS)
+               if (e.weapons & WEPSET_SUPERWEAPONS)
                {
-                       self.respawntime = g_pickup_respawntime_superweapon;
-                       self.respawntimejitter = g_pickup_respawntimejitter_superweapon;
+                       this.respawntime = g_pickup_respawntime_superweapon;
+                       this.respawntimejitter = g_pickup_respawntimejitter_superweapon;
                }
                else
                {
-                       self.respawntime = g_pickup_respawntime_weapon;
-                       self.respawntimejitter = g_pickup_respawntimejitter_weapon;
+                       this.respawntime = g_pickup_respawntime_weapon;
+                       this.respawntimejitter = g_pickup_respawntimejitter_weapon;
                }
        }
 
-       if(e.weapons & WEPSET_SUPERWEAPONS)
-               if(!self.superweapons_finished)
-                       self.superweapons_finished = autocvar_g_balance_superweapons_time;
+       if (e.weapons & WEPSET_SUPERWEAPONS)
+               if (!this.superweapons_finished)
+                       this.superweapons_finished = autocvar_g_balance_superweapons_time;
 
        // if we don't already have ammo, give us some ammo
-       if(!self.(e.ammo_field))
+       if (!this.(e.ammo_field))
        {
-               switch(e.ammo_field)
+               switch (e.ammo_field)
                {
-                       case ammo_shells:  self.ammo_shells  = cvar("g_pickup_shells_weapon");  break;
-                       case ammo_nails:   self.ammo_nails   = cvar("g_pickup_nails_weapon");   break;
-                       case ammo_rockets: self.ammo_rockets = cvar("g_pickup_rockets_weapon"); break;
-                       case ammo_cells:   self.ammo_cells   = cvar("g_pickup_cells_weapon");   break;
-                       case ammo_plasma:  self.ammo_plasma  = cvar("g_pickup_plasma_weapon");  break;
-                       case ammo_fuel:    self.ammo_fuel    = cvar("g_pickup_fuel_weapon");    break;
+                       case ammo_shells:  this.ammo_shells  = cvar("g_pickup_shells_weapon");  break;
+                       case ammo_nails:   this.ammo_nails   = cvar("g_pickup_nails_weapon");   break;
+                       case ammo_rockets: this.ammo_rockets = cvar("g_pickup_rockets_weapon"); break;
+                       case ammo_cells:   this.ammo_cells   = cvar("g_pickup_cells_weapon");   break;
+                       case ammo_plasma:  this.ammo_plasma  = cvar("g_pickup_plasma_weapon");  break;
+                       case ammo_fuel:    this.ammo_fuel    = cvar("g_pickup_fuel_weapon");    break;
                }
        }
 
        #if 0 // WEAPONTODO
-       if(e.items)
+       if (e.items)
        {
-               for(i = 0, j = 1; i < 24; ++i, j *= 2)
+               for (int i = 0, j = 1; i < 24; ++i, j <<= 1)
                {
-                       if(e.items & j)
+                       if (e.items & j)
                        {
                                ammotype = Item_CounterField(j);
-                               if(!self.ammotype)
-                                       self.ammotype = cvar(strcat("g_pickup_", Item_CounterFieldName(j), "_weapon"));
+                               if (!this.ammotype)
+                                       this.ammotype = cvar(strcat("g_pickup_", Item_CounterFieldName(j), "_weapon"));
                        }
                }
        }
        #endif
 
        // pickup anyway
-       if(g_pickup_weapons_anyway)
-               self.pickup_anyway = true;
+       if (g_pickup_weapons_anyway)
+               this.pickup_anyway = true;
 
-       f = FL_WEAPON;
+       int f = FL_WEAPON;
 
        // no weapon-stay on superweapons
-       if(e.weapons & WEPSET_SUPERWEAPONS)
+       if (e.weapons & WEPSET_SUPERWEAPONS)
                f |= FL_NO_WEAPON_STAY;
 
        // weapon stay isn't supported for teamed weapons
-       if(self.team)
+       if (this.team)
                f |= FL_NO_WEAPON_STAY;
 
-       StartItem(strzone(e.m_model.model_str()), string_null, self.respawntime, self.respawntimejitter, e.message, 0, e.weapon, f, weapon_pickupevalfunc, e.bot_pickupbasevalue);
-       self.item_pickupsound_ent = SND_WEAPONPICKUP;
+       _StartItem(
+               this,
+               strzone(e.m_model.model_str()), // itemmodel
+               string_null, // pickupsound
+               this.respawntime, // defaultrespawntime
+               this.respawntimejitter, // defaultrespawntimejitter
+               e.message, // itemname
+               0, // itemid
+               e.weapon, // weaponid
+               f, // itemflags
+               weapon_pickupevalfunc, // pickupevalfunc
+               e.bot_pickupbasevalue // pickupbasevalue
+       );
+       this.item_pickupsound_ent = SND_WEAPONPICKUP;
        #if 0 // WEAPONTODO
-       if (self.modelindex) { // don't precache if self was removed
-               Weapon w = get_weaponinfo(e.weapon);
-               w.wr_init(w);
+       if (this.modelindex) { // don't precache if this was removed
+               e.wr_init(e);
        }
        #endif
 }
index e9cfad94eb31e83bf5713f624aebfd582d5bbe9e..fd66a8e87b97c94a4a17ba7f33805692eea0054c 100644 (file)
@@ -3,5 +3,5 @@
 
 string W_Apply_Weaponreplace(string in);
 
-void weapon_defaultspawnfunc(float wpn);
+void weapon_defaultspawnfunc(entity this, Weapon e);
 #endif
index 83025da9a859869669381fc26167a9fadef66f8b..1f5dd27fd1de87f93a10471f53cbee56c759b32e 100644 (file)
@@ -34,7 +34,8 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
 {SELFPARAM();
        float thisammo, i;
        string s;
-       var .int ammotype = (get_weaponinfo(wpn)).ammo_field;
+       Weapon info = get_weaponinfo(wpn);
+       var .int ammotype = info.ammo_field;
 
        entity wep = spawn();
 
@@ -75,7 +76,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
                }
        }
 
-       WITH(entity, self, wep, weapon_defaultspawnfunc(wpn));
+       weapon_defaultspawnfunc(wep, info);
        if(startitem_failed)
                return string_null;
        wep.glowmod = own.weaponentity_glowmod;