]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/shockwave.qc
Remove weapon SELFPARAM
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / shockwave.qc
index 6c6e8e736ff7aa8ade5eec892a8993bf0ae4fa2d..a39e7697b96dcb07c6127f3d86d9cd665bee4636 100644 (file)
@@ -112,8 +112,8 @@ float shockwave_hit_damage[MAX_SHOCKWAVE_HITS];
 vector shockwave_hit_force[MAX_SHOCKWAVE_HITS];
 
 // MELEE ATTACK MODE
-void W_Shockwave_Melee_Think()
-{SELFPARAM();
+void W_Shockwave_Melee_Think(entity this)
+{
        // declarations
        float i, f, swing, swing_factor, swing_damage, meleetime, is_player;
        entity target_victim;
@@ -241,9 +241,9 @@ void W_Shockwave_Melee(Weapon thiswep, entity actor, .entity weaponentity, int f
 
        entity meleetemp = new_pure(meleetemp);
        meleetemp.owner = meleetemp.realowner = actor;
-       meleetemp.think = W_Shockwave_Melee_Think;
+       setthink(meleetemp, W_Shockwave_Melee_Think);
        meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor();
-       W_SetupShot_Range(actor, true, 0, "", 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
+       W_SetupShot_Range(actor, true, 0, SND_Null, 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
 }
 
 // SHOCKWAVE ATTACK MODE
@@ -276,11 +276,12 @@ float W_Shockwave_Attack_CheckSpread(
 }
 
 float W_Shockwave_Attack_IsVisible(
+       entity actor,
        entity head,
        vector nearest_on_line,
        vector sw_shotorg,
        vector attack_endpos)
-{SELFPARAM();
+{entity this = actor;
        vector nearest_to_attacker = head.WarpZone_findradius_nearest;
        vector center = (head.origin + (head.mins + head.maxs) * 0.5);
        vector corner;
@@ -339,8 +340,8 @@ float W_Shockwave_Attack_CheckHit(
        return true;
 }
 
-void W_Shockwave_Send()
-{SELFPARAM();
+void W_Shockwave_Send(entity actor)
+{
        WriteHeader(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE);
        WriteCoord(MSG_BROADCAST, w_shotorg.x);
        WriteCoord(MSG_BROADCAST, w_shotorg.y);
@@ -351,11 +352,11 @@ void W_Shockwave_Send()
        WriteShort(MSG_BROADCAST, WEP_CVAR(shockwave, blast_distance));
        WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_max), 255));
        WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_min), 255));
-       WriteByte(MSG_BROADCAST, etof(self));
+       WriteByte(MSG_BROADCAST, etof(actor));
 }
 
-void W_Shockwave_Attack()
-{SELFPARAM();
+void W_Shockwave_Attack(entity actor)
+{entity this = actor;
        // declarations
        float multiplier, multiplier_from_accuracy, multiplier_from_distance;
        float final_damage;
@@ -365,7 +366,7 @@ void W_Shockwave_Attack()
        float i, queue = 0;
 
        // set up the shot direction
-       W_SetupShot(self, false, 3, SND(LASERGUN_FIRE), CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage));
+       W_SetupShot(self, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage));
        vector attack_endpos = (w_shotorg + (w_shotdir * WEP_CVAR(shockwave, blast_distance)));
        WarpZone_TraceLine(w_shotorg, attack_endpos, MOVE_NOMONSTERS, self);
        vector attack_hitpos = trace_endpos;
@@ -374,7 +375,7 @@ void W_Shockwave_Attack()
        //entity transform = WarpZone_trace_transform;
 
        // do the firing effect now
-       W_Shockwave_Send();
+       W_Shockwave_Send(self);
        Damage_DamageInfo(
                attack_hitpos,
                WEP_CVAR(shockwave, blast_splash_damage),
@@ -570,7 +571,7 @@ void W_Shockwave_Attack()
                        vector nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line);
 
                        if((vlen(head.WarpZone_findradius_dist) <= WEP_CVAR(shockwave, blast_distance))
-                               && (W_Shockwave_Attack_IsVisible(head, nearest_on_line, w_shotorg, attack_endpos)))
+                               && (W_Shockwave_Attack_IsVisible(self, head, nearest_on_line, w_shotorg, attack_endpos)))
                        {
                                // calculate importance of distance and accuracy for this attack
                                multiplier_from_accuracy = (1 -
@@ -671,12 +672,13 @@ void W_Shockwave_Attack()
        }
 }
 
-METHOD(Shockwave, wr_aim, void(entity thiswep))
+METHOD(Shockwave, wr_aim, void(entity thiswep, entity actor))
 {
+    entity this = actor;
     if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
-        { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false); }
+        { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false); }
     else
-        { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false); }
+        { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false); }
 }
 METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
 {
@@ -686,7 +688,7 @@ METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponent
         {
             if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime)))
             {
-                W_Shockwave_Attack();
+                W_Shockwave_Attack(actor);
                 actor.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor();
                 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
             }
@@ -703,11 +705,11 @@ METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponent
         }
     }
 }
-METHOD(Shockwave, wr_checkammo1, bool(entity thiswep))
+METHOD(Shockwave, wr_checkammo1, bool(entity thiswep, entity actor))
 {
     return true; // infinite ammo
 }
-METHOD(Shockwave, wr_checkammo2, bool(entity thiswep))
+METHOD(Shockwave, wr_checkammo2, bool(entity thiswep, entity actor))
 {
     // shockwave has infinite ammo
     return true;
@@ -852,7 +854,7 @@ void Net_ReadShockwaveParticle()
        shockwave.sw_time = time;
 }
 
-METHOD(Shockwave, wr_impacteffect, void(entity thiswep))
+METHOD(Shockwave, wr_impacteffect, void(entity thiswep, entity actor))
 {
     // handled by Net_ReadShockwaveParticle
     //vector org2;