]> 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 0ef52fbd9d69051b328ab0b4008c8802f8329af6..a39e7697b96dcb07c6127f3d86d9cd665bee4636 100644 (file)
@@ -1,77 +1,81 @@
 #ifndef IMPLEMENTATION
-REGISTER_WEAPON(
-/* WEP_##id  */ SHOCKWAVE,
-/* function  */ W_Shockwave,
-/* ammotype  */ ammo_none,
-/* impulse   */ 2,
-/* flags     */ WEP_FLAG_NORMAL | WEP_TYPE_HITSCAN | WEP_FLAG_CANCLIMB | WEP_FLAG_MUTATORBLOCKED,
-/* rating    */ BOT_PICKUP_RATING_LOW,
-/* color     */ '0.5 0.25 0',
-/* modelname */ "shotgun",
-/* simplemdl */ "foobar",
-/* crosshair */ "gfx/crosshairshotgun 0.7",
-/* wepimg    */ "weaponshotgun",
-/* refname   */ "shockwave",
-/* wepname   */ _("Shockwave")
-);
-
-#define SHOCKWAVE_SETTINGS(w_cvar,w_prop) SHOCKWAVE_SETTINGS_LIST(w_cvar, w_prop, SHOCKWAVE, shockwave)
-#define SHOCKWAVE_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
-       w_cvar(id, sn, NONE, blast_animtime) \
-       w_cvar(id, sn, NONE, blast_damage) \
-       w_cvar(id, sn, NONE, blast_distance) \
-       w_cvar(id, sn, NONE, blast_edgedamage) \
-       w_cvar(id, sn, NONE, blast_force) \
-       w_cvar(id, sn, NONE, blast_force_forwardbias) \
-       w_cvar(id, sn, NONE, blast_force_zscale) \
-       w_cvar(id, sn, NONE, blast_jump_damage) \
-       w_cvar(id, sn, NONE, blast_jump_edgedamage) \
-       w_cvar(id, sn, NONE, blast_jump_force) \
-       w_cvar(id, sn, NONE, blast_jump_force_velocitybias) \
-       w_cvar(id, sn, NONE, blast_jump_force_zscale) \
-       w_cvar(id, sn, NONE, blast_jump_multiplier_accuracy) \
-       w_cvar(id, sn, NONE, blast_jump_multiplier_distance) \
-       w_cvar(id, sn, NONE, blast_jump_multiplier_min) \
-       w_cvar(id, sn, NONE, blast_jump_radius) \
-       w_cvar(id, sn, NONE, blast_multiplier_accuracy) \
-       w_cvar(id, sn, NONE, blast_multiplier_distance) \
-       w_cvar(id, sn, NONE, blast_multiplier_min) \
-       w_cvar(id, sn, NONE, blast_refire) \
-       w_cvar(id, sn, NONE, blast_splash_damage) \
-       w_cvar(id, sn, NONE, blast_splash_edgedamage) \
-       w_cvar(id, sn, NONE, blast_splash_force) \
-       w_cvar(id, sn, NONE, blast_splash_force_forwardbias) \
-       w_cvar(id, sn, NONE, blast_splash_multiplier_accuracy) \
-       w_cvar(id, sn, NONE, blast_splash_multiplier_distance) \
-       w_cvar(id, sn, NONE, blast_splash_multiplier_min) \
-       w_cvar(id, sn, NONE, blast_splash_radius) \
-       w_cvar(id, sn, NONE, blast_spread_max) \
-       w_cvar(id, sn, NONE, blast_spread_min) \
-       w_cvar(id, sn, NONE, melee_animtime) \
-       w_cvar(id, sn, NONE, melee_damage) \
-       w_cvar(id, sn, NONE, melee_delay) \
-       w_cvar(id, sn, NONE, melee_force) \
-       w_cvar(id, sn, NONE, melee_multihit) \
-       w_cvar(id, sn, NONE, melee_no_doubleslap) \
-       w_cvar(id, sn, NONE, melee_nonplayerdamage) \
-       w_cvar(id, sn, NONE, melee_range) \
-       w_cvar(id, sn, NONE, melee_refire) \
-       w_cvar(id, sn, NONE, melee_swing_side) \
-       w_cvar(id, sn, NONE, melee_swing_up) \
-       w_cvar(id, sn, NONE, melee_time) \
-       w_cvar(id, sn, NONE, melee_traces) \
-       w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
-       w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
-       w_prop(id, sn, string, weaponreplace, weaponreplace) \
-       w_prop(id, sn, float,  weaponstart, weaponstart) \
-       w_prop(id, sn, float,  weaponstartoverride, weaponstartoverride) \
-       w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
-
-#ifdef SVQC
-SHOCKWAVE_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
+CLASS(Shockwave, Weapon)
+/* ammotype  */ //ATTRIB(Shockwave, ammo_field, .int, ammo_none)
+/* impulse   */ ATTRIB(Shockwave, impulse, int, 2)
+/* flags     */ ATTRIB(Shockwave, spawnflags, int, WEP_FLAG_NORMAL | WEP_TYPE_HITSCAN | WEP_FLAG_CANCLIMB | WEP_FLAG_MUTATORBLOCKED);
+/* rating    */ ATTRIB(Shockwave, bot_pickupbasevalue, float, BOT_PICKUP_RATING_LOW);
+/* color     */ ATTRIB(Shockwave, wpcolor, vector, '0.5 0.25 0');
+/* modelname */ ATTRIB(Shockwave, mdl, string, "shotgun");
+#ifndef MENUQC
+/* model     */ ATTRIB(Shockwave, m_model, Model, MDL_SHOCKWAVE_ITEM);
 #endif
+/* crosshair */ ATTRIB(Shockwave, w_crosshair, string, "gfx/crosshairshotgun");
+/* crosshair */ ATTRIB(Shockwave, w_crosshair_size, float, 0.7);
+/* wepimg    */ ATTRIB(Shockwave, model2, string, "weaponshotgun");
+/* refname   */ ATTRIB(Shockwave, netname, string, "shockwave");
+/* wepname   */ ATTRIB(Shockwave, m_name, string, _("Shockwave"));
+
+#define X(BEGIN, P, END, class, prefix) \
+       BEGIN(class) \
+               P(class, prefix, blast_animtime, float, NONE) \
+               P(class, prefix, blast_damage, float, NONE) \
+               P(class, prefix, blast_distance, float, NONE) \
+               P(class, prefix, blast_edgedamage, float, NONE) \
+               P(class, prefix, blast_force, float, NONE) \
+               P(class, prefix, blast_force_forwardbias, float, NONE) \
+               P(class, prefix, blast_force_zscale, float, NONE) \
+               P(class, prefix, blast_jump_damage, float, NONE) \
+               P(class, prefix, blast_jump_edgedamage, float, NONE) \
+               P(class, prefix, blast_jump_force, float, NONE) \
+               P(class, prefix, blast_jump_force_velocitybias, float, NONE) \
+               P(class, prefix, blast_jump_force_zscale, float, NONE) \
+               P(class, prefix, blast_jump_multiplier_accuracy, float, NONE) \
+               P(class, prefix, blast_jump_multiplier_distance, float, NONE) \
+               P(class, prefix, blast_jump_multiplier_min, float, NONE) \
+               P(class, prefix, blast_jump_radius, float, NONE) \
+               P(class, prefix, blast_multiplier_accuracy, float, NONE) \
+               P(class, prefix, blast_multiplier_distance, float, NONE) \
+               P(class, prefix, blast_multiplier_min, float, NONE) \
+               P(class, prefix, blast_refire, float, NONE) \
+               P(class, prefix, blast_splash_damage, float, NONE) \
+               P(class, prefix, blast_splash_edgedamage, float, NONE) \
+               P(class, prefix, blast_splash_force, float, NONE) \
+               P(class, prefix, blast_splash_force_forwardbias, float, NONE) \
+               P(class, prefix, blast_splash_multiplier_accuracy, float, NONE) \
+               P(class, prefix, blast_splash_multiplier_distance, float, NONE) \
+               P(class, prefix, blast_splash_multiplier_min, float, NONE) \
+               P(class, prefix, blast_splash_radius, float, NONE) \
+               P(class, prefix, blast_spread_max, float, NONE) \
+               P(class, prefix, blast_spread_min, float, NONE) \
+               P(class, prefix, melee_animtime, float, NONE) \
+               P(class, prefix, melee_damage, float, NONE) \
+               P(class, prefix, melee_delay, float, NONE) \
+               P(class, prefix, melee_force, float, NONE) \
+               P(class, prefix, melee_multihit, float, NONE) \
+               P(class, prefix, melee_no_doubleslap, float, NONE) \
+               P(class, prefix, melee_nonplayerdamage, float, NONE) \
+               P(class, prefix, melee_range, float, NONE) \
+               P(class, prefix, melee_refire, float, NONE) \
+               P(class, prefix, melee_swing_side, float, NONE) \
+               P(class, prefix, melee_swing_up, float, NONE) \
+               P(class, prefix, melee_time, float, NONE) \
+               P(class, prefix, melee_traces, float, NONE) \
+               P(class, prefix, switchdelay_raise, float, NONE) \
+        P(class, prefix, switchdelay_drop, float, NONE) \
+        P(class, prefix, weaponreplace, string, NONE) \
+        P(class, prefix, weaponstart, float, NONE) \
+        P(class, prefix, weaponstartoverride, float, NONE) \
+        P(class, prefix, weaponthrowable, float, NONE) \
+       END()
+    W_PROPS(X, Shockwave, shockwave)
+#undef X
+
+ENDCLASS(Shockwave)
+REGISTER_WEAPON(SHOCKWAVE, shockwave, NEW(Shockwave));
+
+
 #ifdef CSQC
-void Net_ReadShockwaveParticle(void);
+void Net_ReadShockwaveParticle();
 .vector sw_shotorg;
 .vector sw_shotdir;
 .float sw_distance;
@@ -81,17 +85,20 @@ void Net_ReadShockwaveParticle(void);
 #endif
 #endif
 #ifdef IMPLEMENTATION
+
+REGISTER_NET_TEMP(TE_CSQC_SHOCKWAVEPARTICLE)
+
 #ifdef SVQC
-void spawnfunc_weapon_shockwave(void)
-{SELFPARAM();
+spawnfunc(weapon_shockwave)
+{
        //if(autocvar_sv_q3acompat_machineshockwaveswap) // WEAPONTODO
        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;
@@ -105,15 +112,15 @@ float shockwave_hit_damage[MAX_SHOCKWAVE_HITS];
 vector shockwave_hit_force[MAX_SHOCKWAVE_HITS];
 
 // MELEE ATTACK MODE
-void W_Shockwave_Melee_Think(void)
-{SELFPARAM();
+void W_Shockwave_Melee_Think(entity this)
+{
        // declarations
        float i, f, swing, swing_factor, swing_damage, meleetime, is_player;
        entity target_victim;
        vector targpos;
 
        // check to see if we can still continue, otherwise give up now
-       if((self.realowner.deadflag != DEAD_NO) && WEP_CVAR(shockwave, melee_no_doubleslap))
+       if(IS_DEAD(self.realowner) && WEP_CVAR(shockwave, melee_no_doubleslap))
        {
                remove(self);
                return;
@@ -227,17 +234,16 @@ void W_Shockwave_Melee_Think(void)
        }
 }
 
-void W_Shockwave_Melee(void)
-{SELFPARAM();
-       sound(self, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTN_NORM);
-       weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready);
+void W_Shockwave_Melee(Weapon thiswep, entity actor, .entity weaponentity, int fire)
+{
+       sound(actor, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTN_NORM);
+       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready);
 
-       entity meleetemp;
-       meleetemp = spawn();
-       meleetemp.owner = meleetemp.realowner = self;
-       meleetemp.think = W_Shockwave_Melee_Think;
+       entity meleetemp = new_pure(meleetemp);
+       meleetemp.owner = meleetemp.realowner = actor;
+       setthink(meleetemp, W_Shockwave_Melee_Think);
        meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor();
-       W_SetupShot_Range(self, 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
@@ -270,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;
@@ -333,10 +340,9 @@ float W_Shockwave_Attack_CheckHit(
        return true;
 }
 
-void W_Shockwave_Send(void)
-{SELFPARAM();
-       WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
-       WriteByte(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE);
+void W_Shockwave_Send(entity actor)
+{
+       WriteHeader(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE);
        WriteCoord(MSG_BROADCAST, w_shotorg.x);
        WriteCoord(MSG_BROADCAST, w_shotorg.y);
        WriteCoord(MSG_BROADCAST, w_shotorg.z);
@@ -346,11 +352,11 @@ void W_Shockwave_Send(void)
        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, num_for_edict(self));
+       WriteByte(MSG_BROADCAST, etof(actor));
 }
 
-void W_Shockwave_Attack(void)
-{SELFPARAM();
+void W_Shockwave_Attack(entity actor)
+{entity this = actor;
        // declarations
        float multiplier, multiplier_from_accuracy, multiplier_from_distance;
        float final_damage;
@@ -360,7 +366,7 @@ void W_Shockwave_Attack(void)
        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;
@@ -369,7 +375,7 @@ void W_Shockwave_Attack(void)
        //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),
@@ -437,7 +443,7 @@ void W_Shockwave_Attack(void)
                                        );
 
                                // figure out the direction of force
-                               vel = normalize(combine_to_vector(head.velocity.x, head.velocity.y, 0));
+                               vel = normalize(vec3(head.velocity.x, head.velocity.y, 0));
                                vel *=
                                        (
                                                bound(0, (vlen(vel) / autocvar_sv_maxspeed), 1)
@@ -565,7 +571,7 @@ void W_Shockwave_Attack(void)
                        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 -
@@ -666,103 +672,87 @@ void W_Shockwave_Attack(void)
        }
 }
 
-bool W_Shockwave(int req)
-{SELFPARAM();
-       switch(req)
-       {
-               case WR_AIM:
-               {
-                       if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
-                               { self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false); }
-                       else
-                               { self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false); }
-
-                       return true;
-               }
-               case WR_THINK:
-               {
-                       if(self.BUTTON_ATCK)
-                       {
-                               if(time >= self.shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary
-                               {
-                                       if(weapon_prepareattack(0, WEP_CVAR(shockwave, blast_animtime)))
-                                       {
-                                               W_Shockwave_Attack();
-                                               self.shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor();
-                                               weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
-                                       }
-                               }
-                       }
-                       else if(self.BUTTON_ATCK2)
-                       {
-                               //if(self.clip_load >= 0) // we are not currently reloading
-                               if(!self.crouch) // no crouchmelee please
-                               if(weapon_prepareattack(1, WEP_CVAR(shockwave, melee_refire)))
-                               {
-                                       // attempt forcing playback of the anim by switching to another anim (that we never play) here...
-                                       weapon_thinkf(WFRAME_FIRE1, 0, W_Shockwave_Melee);
-                               }
-                       }
-
-                       return true;
-               }
-               case WR_INIT:
-               {
-                       SHOCKWAVE_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-                       return true;
-               }
-               case WR_CHECKAMMO1:
-               case WR_CHECKAMMO2:
-               {
-                       // shockwave has infinite ammo
-                       return true;
-               }
-               case WR_CONFIG:
-               {
-                       SHOCKWAVE_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-                       return true;
-               }
-               case WR_SUICIDEMESSAGE:
-               {
-                       return WEAPON_THINKING_WITH_PORTALS;
-               }
-               case WR_KILLMESSAGE:
-               {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_SHOCKWAVE_MURDER_SLAP;
-                       else
-                               return WEAPON_SHOCKWAVE_MURDER;
-               }
-       }
-       return false;
+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(self, 1000000, 0, 0.001, false); }
+    else
+        { 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))
+{
+    if(fire & 1)
+    {
+        if(time >= actor.shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary
+        {
+            if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime)))
+            {
+                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);
+            }
+        }
+    }
+    else if(fire & 2)
+    {
+        //if(actor.clip_load >= 0) // we are not currently reloading
+        if(!actor.crouch) // no crouchmelee please
+        if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(shockwave, melee_refire)))
+        {
+            // attempt forcing playback of the anim by switching to another anim (that we never play) here...
+            weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shockwave_Melee);
+        }
+    }
+}
+METHOD(Shockwave, wr_checkammo1, bool(entity thiswep, entity actor))
+{
+    return true; // infinite ammo
+}
+METHOD(Shockwave, wr_checkammo2, bool(entity thiswep, entity actor))
+{
+    // shockwave has infinite ammo
+    return true;
 }
+METHOD(Shockwave, wr_suicidemessage, Notification(entity thiswep))
+{
+    return WEAPON_THINKING_WITH_PORTALS;
+}
+METHOD(Shockwave, wr_killmessage, Notification(entity thiswep))
+{
+    if(w_deathtype & HITTYPE_SECONDARY)
+        return WEAPON_SHOCKWAVE_MURDER_SLAP;
+    else
+        return WEAPON_SHOCKWAVE_MURDER;
+}
+
 #endif
 #ifdef CSQC
 // WEAPONTODO: add client side settings for these
 const float SW_MAXALPHA = 0.5;
 const float SW_FADETIME = 0.4;
 const float SW_DISTTOMIN = 200;
-void Draw_Shockwave()
-{SELFPARAM();
+void Draw_Shockwave(entity this)
+{
        // fading/removal control
-       float a = bound(0, (SW_MAXALPHA - ((time - self.sw_time) / SW_FADETIME)), SW_MAXALPHA);
-       if(a < ALPHA_MIN_VISIBLE) { remove(self); }
+       float a = bound(0, (SW_MAXALPHA - ((time - this.sw_time) / SW_FADETIME)), SW_MAXALPHA);
+       if(a < ALPHA_MIN_VISIBLE) { remove(this); }
 
        // WEAPONTODO: save this only once when creating the entity
-       vector sw_color = getcsqcplayercolor(self.sv_entnum); // GetTeamRGB(GetPlayerColor(self.sv_entnum));
+       vector sw_color = entcs_GetColor(this.sv_entnum - 1); // GetTeamRGB(entcs_GetTeam(this.sv_entnum));
 
        // WEAPONTODO: trace to find what we actually hit
-       vector endpos = (self.sw_shotorg + (self.sw_shotdir * self.sw_distance));
+       vector endpos = (this.sw_shotorg + (this.sw_shotdir * this.sw_distance));
 
-       vectorvectors(self.sw_shotdir);
+       vectorvectors(this.sw_shotdir);
        vector right = v_right; // save this for when we do makevectors later
        vector up = v_up; // save this for when we do makevectors later
 
        // WEAPONTODO: combine and simplify these calculations
-       vector min_end = ((self.sw_shotorg + (self.sw_shotdir * SW_DISTTOMIN)) + (up * self.sw_spread_min));
-       vector max_end = (endpos + (up * self.sw_spread_max));
-       float spread_to_min = vlen(normalize(min_end - self.sw_shotorg) - self.sw_shotdir);
-       float spread_to_max = vlen(normalize(max_end - min_end) - self.sw_shotdir);
+       vector min_end = ((this.sw_shotorg + (this.sw_shotdir * SW_DISTTOMIN)) + (up * this.sw_spread_min));
+       vector max_end = (endpos + (up * this.sw_spread_max));
+       float spread_to_min = vlen(normalize(min_end - this.sw_shotorg) - this.sw_shotdir);
+       float spread_to_max = vlen(normalize(max_end - min_end) - this.sw_shotdir);
 
        vector first_min_end = '0 0 0', prev_min_end = '0 0 0', new_min_end = '0 0 0';
        vector first_max_end = '0 0 0', prev_max_end = '0 0 0', new_max_end = '0 0 0';
@@ -779,14 +769,14 @@ void Draw_Shockwave()
 
                // first do the spread_to_min effect
                deviation = angle * spread_to_min;
-               deviation = ((self.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
+               deviation = ((this.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
                new_min_dist = SW_DISTTOMIN;
-               new_min_end = (self.sw_shotorg + (deviation * new_min_dist));
-               //te_lightning2(world, new_min_end, self.sw_shotorg);
+               new_min_end = (this.sw_shotorg + (deviation * new_min_dist));
+               //te_lightning2(world, new_min_end, this.sw_shotorg);
 
                // then calculate spread_to_max effect
                deviation = angle * spread_to_max;
-               deviation = ((self.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
+               deviation = ((this.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
                new_max_dist = vlen(new_min_end - endpos);
                new_max_end = (new_min_end + (deviation * new_max_dist));
                //te_lightning2(world, new_end, prev_min_end);
@@ -804,7 +794,7 @@ void Draw_Shockwave()
                        R_BeginPolygon("", DRAWFLAG_NORMAL);
                        R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
                        R_PolygonVertex(new_min_end, '0 0 0', sw_color, a);
-                       R_PolygonVertex(self.sw_shotorg, '0 0 0', sw_color, a);
+                       R_PolygonVertex(this.sw_shotorg, '0 0 0', sw_color, a);
                        R_EndPolygon();
 
                        // draw from min spread radius to max spread radius
@@ -826,7 +816,7 @@ void Draw_Shockwave()
                        R_BeginPolygon("", DRAWFLAG_NORMAL);
                        R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
                        R_PolygonVertex(first_min_end, '0 0 0', sw_color, a);
-                       R_PolygonVertex(self.sw_shotorg, '0 0 0', sw_color, a);
+                       R_PolygonVertex(this.sw_shotorg, '0 0 0', sw_color, a);
                        R_EndPolygon();
 
                        // draw from min spread radius to max spread radius
@@ -840,7 +830,13 @@ void Draw_Shockwave()
        }
 }
 
-void Net_ReadShockwaveParticle(void)
+NET_HANDLE(TE_CSQC_SHOCKWAVEPARTICLE, bool isNew)
+{
+       Net_ReadShockwaveParticle();
+       return true;
+}
+
+void Net_ReadShockwaveParticle()
 {
        entity shockwave;
        shockwave = spawn();
@@ -858,29 +854,13 @@ void Net_ReadShockwaveParticle(void)
        shockwave.sw_time = time;
 }
 
-bool W_Shockwave(int req)
-{SELFPARAM();
-       switch(req)
-       {
-               case WR_IMPACTEFFECT:
-               {
-                       // handled by Net_ReadShockwaveParticle
-                       //vector org2;
-                       //org2 = w_org + w_backoff * 2;
-                       //pointparticles(particleeffectnum(EFFECT_BLASTER_IMPACT), org2, w_backoff * 1000, 1);
-                       return false;
-               }
-               case WR_INIT:
-               {
-                       return false;
-               }
-               case WR_ZOOMRETICLE:
-               {
-                       // no weapon specific image for this weapon
-                       return false;
-               }
-       }
-       return false;
+METHOD(Shockwave, wr_impacteffect, void(entity thiswep, entity actor))
+{
+    // handled by Net_ReadShockwaveParticle
+    //vector org2;
+    //org2 = w_org + w_backoff * 2;
+    //pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
 }
+
 #endif
 #endif