]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/arc.qc
Purge WITHSELF from all non-engine functions
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / arc.qc
index 0881da496323b6cdb1bdb8487714bc7e6919aec5..ba75c98c5ce1bc7520196c2cc08bb0c635f511f7 100644 (file)
@@ -231,8 +231,8 @@ void Arc_Player_SetHeat(entity player)
        //dprint("Heat: ",ftos(player.arc_heat_percent*100),"%\n");
 }
 
-void W_Arc_Bolt_Explode()
-{SELFPARAM();
+void W_Arc_Bolt_Explode(entity this)
+{
        self.event_damage = func_null;
        RadiusDamage(self, self.realowner, WEP_CVAR(arc, bolt_damage), WEP_CVAR(arc, bolt_edgedamage), WEP_CVAR(arc, bolt_radius), world, world, WEP_CVAR(arc, bolt_force), self.projectiledeathtype, other);
 
@@ -241,7 +241,7 @@ void W_Arc_Bolt_Explode()
 
 void W_Arc_Bolt_Explode_use(entity this, entity actor, entity trigger)
 {
-       WITHSELF(this, W_Arc_Bolt_Explode());
+       WITHSELF(this, W_Arc_Bolt_Explode(this));
 }
 
 void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
@@ -256,17 +256,18 @@ void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float dam
        this.angles = vectoangles(this.velocity);
 
        if(this.health <= 0)
-               W_PrepareExplosionByDamage(this, attacker, this.think);
+               W_PrepareExplosionByDamage(this, attacker, getthink(this));
 }
 
-void W_Arc_Bolt_Touch()
-{SELFPARAM();
-       PROJECTILE_TOUCH;
+void W_Arc_Bolt_Touch(entity this)
+{
+       PROJECTILE_TOUCH(this);
        self.use(this, NULL, NULL);
 }
 
-void W_Arc_Attack_Bolt(Weapon thiswep)
-{SELFPARAM();
+void W_Arc_Attack_Bolt(Weapon thiswep, entity actor)
+{
+    entity this = actor;
        entity missile;
 
        W_DecreaseAmmo(thiswep, self, WEP_CVAR(arc, bolt_ammo));
@@ -286,9 +287,9 @@ void W_Arc_Attack_Bolt(Weapon thiswep)
        missile.event_damage = W_Arc_Bolt_Damage;
        missile.damagedbycontents = true;
 
-       missile.touch = W_Arc_Bolt_Touch;
+       settouch(missile, W_Arc_Bolt_Touch);
        missile.use = W_Arc_Bolt_Explode_use;
-       missile.think = adaptor_think2use_hittype_splash;
+       setthink(missile, adaptor_think2use_hittype_splash);
        missile.nextthink = time + WEP_CVAR(arc, bolt_lifetime);
        PROJECTILE_MAKETRIGGER(missile);
        missile.projectiledeathtype = WEP_ARC.m_id | HITTYPE_SECONDARY;
@@ -307,8 +308,8 @@ void W_Arc_Attack_Bolt(Weapon thiswep)
        MUTATOR_CALLHOOK(EditProjectile, self, missile);
 }
 
-void W_Arc_Beam_Think()
-{SELFPARAM();
+void W_Arc_Beam_Think(entity this)
+{
        if(self != self.owner.arc_beam)
        {
                remove(self);
@@ -372,15 +373,14 @@ void W_Arc_Beam_Think()
                }
 
                if(self == self.owner.arc_beam) { self.owner.arc_beam = world; }
-               setself(self.owner);
+               entity own = self.owner;
                Weapon w = WEP_ARC;
-               if(!w.wr_checkammo1(w, self) && !w.wr_checkammo2(w, self))
-               if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+               if(!w.wr_checkammo1(w, own) && !w.wr_checkammo2(w, own))
+               if(!(own.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        // note: this doesn't force the switch
-                       W_SwitchToOtherWeapon(self);
+                       W_SwitchToOtherWeapon(own);
                }
-               setself(this);
                remove(self);
                return;
        }
@@ -675,8 +675,8 @@ void W_Arc_Beam_Think()
        self.nextthink = time;
 }
 
-void W_Arc_Beam(float burst)
-{SELFPARAM();
+void W_Arc_Beam(float burst, entity actor)
+{entity this = actor;
 
        // only play fire sound if 1 sec has passed since player let go the fire button
        if(time - self.beam_prev > 1)
@@ -684,7 +684,7 @@ void W_Arc_Beam(float burst)
 
        entity beam = self.arc_beam = new(W_Arc_Beam);
        beam.solid = SOLID_NOT;
-       beam.think = W_Arc_Beam_Think;
+       setthink(beam, W_Arc_Beam_Think);
        beam.owner = self;
        beam.movetype = MOVETYPE_NONE;
        beam.bot_dodge = true;
@@ -692,11 +692,10 @@ void W_Arc_Beam(float burst)
        beam.beam_bursting = burst;
        Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
 
-       WITHSELF(beam, beam.think());
+       WITHSELF(beam, getthink(beam)(beam));
 }
-
-void Arc_Smoke()
-{SELFPARAM();
+void Arc_Smoke(entity actor)
+{entity this = actor;
        makevectors(self.v_angle);
        W_SetupShot_Range(self,true,0,SND_Null,0,0,0);
 
@@ -731,9 +730,9 @@ void Arc_Smoke()
        }
 }
 
-METHOD(Arc, wr_aim, void(entity thiswep))
+METHOD(Arc, wr_aim, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     if(WEP_CVAR(arc, beam_botaimspeed))
     {
         PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(
@@ -758,7 +757,7 @@ METHOD(Arc, wr_aim, void(entity thiswep))
 METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
     Arc_Player_SetHeat(actor);
-    Arc_Smoke();
+    Arc_Smoke(actor);
 
     bool beam_fire2 = ((fire & 2) && !WEP_CVAR(arc, bolt));
 
@@ -780,7 +779,7 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i
         {
             if(weapon_prepareattack(thiswep, actor, weaponentity, boolean(beam_fire2), 0))
             {
-                W_Arc_Beam(boolean(beam_fire2));
+                W_Arc_Beam(boolean(beam_fire2), actor);
 
                 if(!actor.arc_BUTTON_ATCK_prev)
                 {
@@ -796,7 +795,7 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i
     {
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(arc, bolt_refire)))
         {
-            W_Arc_Attack_Bolt(thiswep);
+            W_Arc_Attack_Bolt(thiswep, actor);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready);
         }
     }
@@ -806,7 +805,7 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i
         sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
         weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
         int slot = weaponslot(weaponentity);
-        ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
+        ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor(actor);
     }
     actor.arc_BUTTON_ATCK_prev = false;
 
@@ -817,7 +816,7 @@ METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, i
         W_Arc_Attack2();
         actor.arc_count = autocvar_g_balance_arc_secondary_count;
         weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
-        actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
+        actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor(actor);
     }
     #endif
 }
@@ -854,17 +853,17 @@ METHOD(Arc, wr_killmessage, Notification(entity thiswep))
     else
         return WEAPON_ARC_MURDER;
 }
-METHOD(Arc, wr_drop, void(entity thiswep))
+METHOD(Arc, wr_drop, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     weapon_dropevent_item.arc_overheat = self.arc_overheat;
     weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
     self.arc_overheat = 0;
     self.arc_cooldown = 0;
 }
-METHOD(Arc, wr_pickup, void(entity thiswep))
+METHOD(Arc, wr_pickup, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     if ( !client_hasweapon(self, thiswep, false, false) &&
         weapon_dropevent_item.arc_overheat > time )
     {
@@ -876,9 +875,9 @@ METHOD(Arc, wr_pickup, void(entity thiswep))
 #ifdef CSQC
 bool autocvar_cl_arcbeam_teamcolor = true;
 
-METHOD(Arc, wr_impacteffect, void(entity thiswep))
+METHOD(Arc, wr_impacteffect, void(entity thiswep, entity actor))
 {
-    SELFPARAM();
+    entity this = actor;
     if(w_deathtype & HITTYPE_SECONDARY)
     {
         vector org2;