]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/shockwave.qc
Avoid checking Arc overheat twice
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / shockwave.qc
index 94f84ba5b1b8a88fa13b78e7c7afc7aed9f703a8..2429a301775621f979893f2eab1be96c61488a46 100644 (file)
@@ -3,18 +3,6 @@
 REGISTER_NET_TEMP(TE_CSQC_SHOCKWAVEPARTICLE)
 
 #ifdef SVQC
-// enable when shockwave replaces shotgun
-#if 0
-METHOD(Shockwave, m_spawnfunc_hookreplace, Weapon(Shockwave this, entity e))
-{
-       //if(autocvar_sv_q3acompat_machineshockwaveswap) // WEAPONTODO
-       if (autocvar_sv_q3acompat_machineshotgunswap && !Item_IsLoot(e))
-       {
-               return WEP_MACHINEGUN;
-       }
-       return this;
-}
-#endif
 
 const float MAX_SHOCKWAVE_HITS = 10;
 //#define DEBUG_SHOCKWAVE
@@ -311,7 +299,7 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        );
 
        float lag = ((IS_REAL_CLIENT(actor)) ? ANTILAG_LATENCY(actor) : 0);
-       bool noantilag = ((IS_CLIENT(actor)) ? CS(actor).cvar_cl_noantilag : false);
+       bool noantilag = ((IS_CLIENT(actor)) ? CS_CVAR(actor).cvar_cl_noantilag : false);
        if(lag < 0.001)
                lag = 0;
        if(autocvar_g_antilag == 0 || noantilag)
@@ -479,7 +467,7 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity)
                        //  BLAST CONE CALCULATION
                        // ========================
 
-                       // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
+                       // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in damage.qc)
                        center = CENTER_OR_VIEWOFS(head);
 
                        // find the closest point on the enemy to the center of the attack
@@ -491,7 +479,7 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity)
                        // WEAPONTODO: replace with simpler method
 
                        vector nearest_on_line = (w_shotorg + a * w_shotdir);
-                       vector nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line);
+                       vector nearest_to_attacker = NearestPointOnBoundingBox(center + head.mins, center + head.maxs, nearest_on_line);
 
                        if((vdist(head.WarpZone_findradius_dist, <=, WEP_CVAR(shockwave, blast_distance)))
                                && (W_Shockwave_Attack_IsVisible(actor, head, nearest_on_line, w_shotorg, attack_endpos)))
@@ -666,9 +654,8 @@ void Draw_Shockwave(entity this)
        // WEAPONTODO: trace to find what we actually hit
        vector endpos = (this.sw_shotorg + (this.sw_shotdir * this.sw_distance));
 
-       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
+       vector _forward, right, up;
+       VECTOR_VECTORS(this.sw_shotdir, _forward, right, up);
 
        // WEAPONTODO: combine and simplify these calculations
        vector min_end = ((this.sw_shotorg + (this.sw_shotdir * SW_DISTTOMIN)) + (up * this.sw_spread_min));
@@ -713,14 +700,14 @@ void Draw_Shockwave(entity this)
                if(counter >= 1)
                {
                        // draw from shot origin to min spread radius
-                       R_BeginPolygon("", DRAWFLAG_NORMAL);
+                       R_BeginPolygon("", DRAWFLAG_NORMAL, false);
                        R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
                        R_PolygonVertex(new_min_end, '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
-                       R_BeginPolygon("", DRAWFLAG_NORMAL);
+                       R_BeginPolygon("", DRAWFLAG_NORMAL, false);
                        R_PolygonVertex(new_min_end, '0 0 0', sw_color, a);
                        R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
                        R_PolygonVertex(prev_max_end, '0 0 0', sw_color, a);
@@ -735,14 +722,14 @@ void Draw_Shockwave(entity this)
                if((counter + 1) == divisions)
                {
                        // draw from shot origin to min spread radius
-                       R_BeginPolygon("", DRAWFLAG_NORMAL);
+                       R_BeginPolygon("", DRAWFLAG_NORMAL, false);
                        R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
                        R_PolygonVertex(first_min_end, '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
-                       R_BeginPolygon("", DRAWFLAG_NORMAL);
+                       R_BeginPolygon("", DRAWFLAG_NORMAL, false);
                        R_PolygonVertex(first_min_end, '0 0 0', sw_color, a);
                        R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
                        R_PolygonVertex(prev_max_end, '0 0 0', sw_color, a);
@@ -760,8 +747,7 @@ NET_HANDLE(TE_CSQC_SHOCKWAVEPARTICLE, bool isNew)
 
 void Net_ReadShockwaveParticle()
 {
-       entity shockwave;
-       shockwave = spawn();
+       entity shockwave = new(shockwave_cone);
        shockwave.draw = Draw_Shockwave;
        IL_PUSH(g_drawables, shockwave);