From: TimePath Date: Sun, 11 Oct 2015 23:37:46 +0000 (+1100) Subject: Remove uses of self X-Git-Tag: xonotic-v0.8.2~1760^2~11 X-Git-Url: http://de.git.xonotic.org/?a=commitdiff_plain;h=547a4228c0f88d9b226efe1026ee6085309c0c89;hp=3ae1efa7401791e42e3171f4db2cc2d38adde088;p=xonotic%2Fxonotic-data.pk3dir.git Remove uses of self --- diff --git a/qcsrc/common/mutators/mutator/instagib/instagib.qc b/qcsrc/common/mutators/mutator/instagib/instagib.qc index cc6f405e6..807ec1d41 100644 --- a/qcsrc/common/mutators/mutator/instagib/instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/instagib.qc @@ -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; diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 99eb17d03..cc681f8e9 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -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) { diff --git a/qcsrc/common/weapons/weapon/blaster.qc b/qcsrc/common/weapons/weapon/blaster.qc index d7792fac4..f96eb77c2 100644 --- a/qcsrc/common/weapons/weapon/blaster.qc +++ b/qcsrc/common/weapons/weapon/blaster.qc @@ -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) diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index 75d8146de..9baa9149c 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -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) { diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 8c080862d..adef0b2ee 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -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) diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 7321d38f2..137fd7807 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -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) { diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index b0761b2c2..990bdfea8 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -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(); diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index 37f6875b5..16c959923 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -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! diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index 616939d1e..bf719ac8e 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -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(); diff --git a/qcsrc/common/weapons/weapon/hmg.qc b/qcsrc/common/weapons/weapon/hmg.qc index 6707a7c32..ac6ed0a67 100644 --- a/qcsrc/common/weapons/weapon/hmg.qc +++ b/qcsrc/common/weapons/weapon/hmg.qc @@ -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) { diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index bc79a88a3..b7a6d16db 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -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(); diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index 90a4471f1..b3dcf120b 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -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); } diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index 548ede966..93e32b9e8 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -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(); diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index c19957458..46f26b049 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -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) diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index b17476632..a4acb98d8 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -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(); diff --git a/qcsrc/common/weapons/weapon/rifle.qc b/qcsrc/common/weapons/weapon/rifle.qc index 49b393156..c78e76736 100644 --- a/qcsrc/common/weapons/weapon/rifle.qc +++ b/qcsrc/common/weapons/weapon/rifle.qc @@ -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); } diff --git a/qcsrc/common/weapons/weapon/rpc.qc b/qcsrc/common/weapons/weapon/rpc.qc index 71ddaa6b5..28016f08e 100644 --- a/qcsrc/common/weapons/weapon/rpc.qc +++ b/qcsrc/common/weapons/weapon/rpc.qc @@ -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(); diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index 645bd9eb9..ad35d72f8 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -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 diff --git a/qcsrc/common/weapons/weapon/shockwave.qc b/qcsrc/common/weapons/weapon/shockwave.qc index cc4daf048..6f71e4d5c 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -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; diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index a5cb39773..9d1cc5ade 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -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(); diff --git a/qcsrc/common/weapons/weapon/tuba.qc b/qcsrc/common/weapons/weapon/tuba.qc index 66ea8f7b5..2936b5e78 100644 --- a/qcsrc/common/weapons/weapon/tuba.qc +++ b/qcsrc/common/weapons/weapon/tuba.qc @@ -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) { diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index f7aceee20..25499065d 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -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) diff --git a/qcsrc/common/weapons/weapon/vortex.qc b/qcsrc/common/weapons/weapon/vortex.qc index c51028b62..a2cb19d0a 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -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) { diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 4a7edc2b9..d418b03f8 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -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; diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 1492b9f6a..7b77dad27 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -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) \ diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 89d6b06ca..f705d375c 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -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) diff --git a/qcsrc/server/t_items.qh b/qcsrc/server/t_items.qh index 8195d250d..0812d425f 100644 --- a/qcsrc/server/t_items.qh +++ b/qcsrc/server/t_items.qh @@ -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); diff --git a/qcsrc/server/weapons/spawning.qc b/qcsrc/server/weapons/spawning.qc index be2ca6b50..64ee71457 100644 --- a/qcsrc/server/weapons/spawning.qc +++ b/qcsrc/server/weapons/spawning.qc @@ -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 } diff --git a/qcsrc/server/weapons/spawning.qh b/qcsrc/server/weapons/spawning.qh index e9cfad94e..fd66a8e87 100644 --- a/qcsrc/server/weapons/spawning.qh +++ b/qcsrc/server/weapons/spawning.qh @@ -3,5 +3,5 @@ string W_Apply_Weaponreplace(string in); -void weapon_defaultspawnfunc(float wpn); +void weapon_defaultspawnfunc(entity this, Weapon e); #endif diff --git a/qcsrc/server/weapons/throwing.qc b/qcsrc/server/weapons/throwing.qc index 83025da9a..1f5dd27fd 100644 --- a/qcsrc/server/weapons/throwing.qc +++ b/qcsrc/server/weapons/throwing.qc @@ -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;