]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/w_shockwave.qc
On second thought, undo all that shit... this system is WAYYY too hacky to
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / w_shockwave.qc
index c347be3ae4a188485ae17aca240d939980da14e4..574e996831cce4698360f788a755b1c27ef7879a 100644 (file)
@@ -1,15 +1,17 @@
 #ifdef REGISTER_WEAPON
 REGISTER_WEAPON(
-/* WEP_##id */ SHOCKWAVE,
-/* function */ W_Shockwave,
-/* ammotype */ ammo_none,
-/* impulse  */ 2,
-/* flags    */ WEP_FLAG_NORMAL | WEP_TYPE_HITSCAN,
-/* rating   */ BOT_PICKUP_RATING_LOW,
-/* color       */ '0.5 0.25 0',
-/* model    */ "shotgun",
-/* netname  */ "shockwave",
-/* fullname */ _("Shockwave")
+/* WEP_##id  */ SHOCKWAVE,
+/* function  */ W_Shockwave,
+/* ammotype  */ ammo_none,
+/* impulse   */ 2,
+/* flags     */ WEP_FLAG_NORMAL | WEP_TYPE_HITSCAN,
+/* rating    */ BOT_PICKUP_RATING_LOW,
+/* color     */ '0.5 0.25 0',
+/* modelname */ "shotgun",
+/* simplemdl */ "foobar",
+/* crosshair */ "gfx/crosshairshotgun 0.7",
+/* refname   */ "shockwave",
+/* wepname   */ _("Shockwave")
 );
 
 #define SHOCKWAVE_SETTINGS(w_cvar,w_prop) SHOCKWAVE_SETTINGS_LIST(w_cvar, w_prop, SHOCKWAVE, shockwave)
@@ -80,7 +82,7 @@ void spawnfunc_weapon_shockwave()
        weapon_defaultspawnfunc(WEP_SHOCKWAVE);
 }
 
-#define MAX_SHOCKWAVE_HITS 5
+#define MAX_SHOCKWAVE_HITS 10
 
 .float swing_prev;
 .entity swing_alreadyhit;
@@ -299,10 +301,8 @@ float W_Shockwave_Attack_CheckHit(
 {
        if(!head) { return FALSE; }
        float i;
-
-       ++queue;
        
-       for(i = 1; i <= queue; ++i)
+       for(i = 0; i <= queue; ++i)
        {
                if(shockwave_hit[i] == head)
                {
@@ -491,7 +491,7 @@ void W_Shockwave_Attack()
                                final_force_z *= WEP_CVAR(shockwave, blast_force_zscale);
 
                                // queue damage with this calculated info
-                               if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { ++queue; }
+                               if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); }
 
                                #ifdef DEBUG_SHOCKWAVE
                                print(sprintf(
@@ -534,9 +534,8 @@ void W_Shockwave_Attack()
 
                        vector nearest_on_line = (w_shotorg + a * w_shotdir);
                        vector nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line);
-                       float distance_to_target = vlen(w_shotorg - nearest_to_attacker); // WEAPONTODO: use the findradius function for this
 
-                       if((distance_to_target <= WEP_CVAR(shockwave, blast_distance)) 
+                       if((vlen(head.WarpZone_findradius_dist) <= WEP_CVAR(shockwave, blast_distance)) 
                                && (W_Shockwave_Attack_IsVisible(head, nearest_on_line, w_shotorg, attack_endpos)))
                        {
                                // calculate importance of distance and accuracy for this attack
@@ -550,7 +549,7 @@ void W_Shockwave_Attack()
                                );
                                multiplier_from_distance = (1 -
                                        (distance_to_hit ?
-                                               min(1, (distance_to_target / distance_to_end))
+                                               min(1, (vlen(head.WarpZone_findradius_dist) / distance_to_end))
                                                :
                                                0
                                        )
@@ -583,7 +582,7 @@ void W_Shockwave_Attack()
                                final_force_z *= WEP_CVAR(shockwave, blast_force_zscale);
 
                                // queue damage with this calculated info
-                               if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { ++queue; }
+                               if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); }
 
                                #ifdef DEBUG_SHOCKWAVE
                                print(sprintf(
@@ -601,7 +600,7 @@ void W_Shockwave_Attack()
                head = head.chain;
        }
 
-       for(i = 1; i <= queue; ++i)
+       for(i = 0; i <= queue; ++i)
        {
                head = shockwave_hit[i];
                final_force = shockwave_hit_force[i];
@@ -681,7 +680,7 @@ float W_Shockwave(float req)
                        precache_sound("misc/itempickup.wav");
                        precache_sound("weapons/shockwave_fire.wav");
                        precache_sound("weapons/shockwave_melee.wav");
-                       SHOCKWAVE_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP)
+                       SHOCKWAVE_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
                        return TRUE;
                }
                case WR_CHECKAMMO1: