From aaa316e0651d6fa513cc9dc02de35909f3446a05 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 5 Oct 2016 03:59:55 +1000 Subject: [PATCH] Clean up old remote jump feature, no longer consumes extra CPU time whenever a rocket is detonated --- bal-wep-mario.cfg | 7 +- bal-wep-nexuiz25.cfg | 1 + bal-wep-overkill.cfg | 1 + bal-wep-samual.cfg | 1 + bal-wep-xdf.cfg | 1 + bal-wep-xonotic.cfg | 1 + bal-wep-xpm.cfg | 1 + qcsrc/common/weapons/weapon/devastator.qc | 83 ++++++++++++----------- 8 files changed, 55 insertions(+), 41 deletions(-) diff --git a/bal-wep-mario.cfg b/bal-wep-mario.cfg index 1470c3326..2b8bcce93 100644 --- a/bal-wep-mario.cfg +++ b/bal-wep-mario.cfg @@ -397,10 +397,11 @@ set g_balance_devastator_reload_ammo 0 set g_balance_devastator_reload_time 2 set g_balance_devastator_remote_damage 70 set g_balance_devastator_remote_edgedamage 35 -set g_balance_devastator_remote_force 450 +set g_balance_devastator_remote_force 300 set g_balance_devastator_remote_jump_damage 70 -set g_balance_devastator_remote_jump_radius 0 -set g_balance_devastator_remote_jump_velocity_z_add 400 +set g_balance_devastator_remote_jump_force 650 +set g_balance_devastator_remote_jump_radius 100 +set g_balance_devastator_remote_jump_velocity_z_add 0 set g_balance_devastator_remote_jump_velocity_z_max 1500 set g_balance_devastator_remote_jump_velocity_z_min 400 set g_balance_devastator_remote_radius 110 diff --git a/bal-wep-nexuiz25.cfg b/bal-wep-nexuiz25.cfg index d4b47594d..41c9081b9 100644 --- a/bal-wep-nexuiz25.cfg +++ b/bal-wep-nexuiz25.cfg @@ -399,6 +399,7 @@ set g_balance_devastator_remote_damage 105 set g_balance_devastator_remote_edgedamage 40 set g_balance_devastator_remote_force 600 set g_balance_devastator_remote_jump_damage 70 +set g_balance_devastator_remote_jump_force 0 set g_balance_devastator_remote_jump_radius 0 set g_balance_devastator_remote_jump_velocity_z_add 400 set g_balance_devastator_remote_jump_velocity_z_max 1500 diff --git a/bal-wep-overkill.cfg b/bal-wep-overkill.cfg index 2cf9b754e..82609a76c 100644 --- a/bal-wep-overkill.cfg +++ b/bal-wep-overkill.cfg @@ -399,6 +399,7 @@ set g_balance_devastator_remote_damage 70 set g_balance_devastator_remote_edgedamage 35 set g_balance_devastator_remote_force 300 set g_balance_devastator_remote_jump_damage 70 +set g_balance_devastator_remote_jump_force 0 set g_balance_devastator_remote_jump_radius 0 set g_balance_devastator_remote_jump_velocity_z_add 400 set g_balance_devastator_remote_jump_velocity_z_max 1500 diff --git a/bal-wep-samual.cfg b/bal-wep-samual.cfg index fe3b9ed87..99edec78b 100644 --- a/bal-wep-samual.cfg +++ b/bal-wep-samual.cfg @@ -465,6 +465,7 @@ set g_balance_devastator_remote_damage 70 set g_balance_devastator_remote_edgedamage 35 set g_balance_devastator_remote_force 400 set g_balance_devastator_remote_jump_damage 40 +set g_balance_devastator_remote_jump_force 0 set g_balance_devastator_remote_jump_radius 200 set g_balance_devastator_remote_jump_velocity_z_add 500 set g_balance_devastator_remote_jump_velocity_z_max 1500 diff --git a/bal-wep-xdf.cfg b/bal-wep-xdf.cfg index c9bdb2aa3..95ac919b6 100644 --- a/bal-wep-xdf.cfg +++ b/bal-wep-xdf.cfg @@ -399,6 +399,7 @@ set g_balance_devastator_remote_damage 70 set g_balance_devastator_remote_edgedamage 35 set g_balance_devastator_remote_force 350 set g_balance_devastator_remote_jump_damage 70 +set g_balance_devastator_remote_jump_force 0 set g_balance_devastator_remote_jump_radius 0 set g_balance_devastator_remote_jump_velocity_z_add 400 set g_balance_devastator_remote_jump_velocity_z_max 1500 diff --git a/bal-wep-xonotic.cfg b/bal-wep-xonotic.cfg index 2578d6fcc..87a00b110 100644 --- a/bal-wep-xonotic.cfg +++ b/bal-wep-xonotic.cfg @@ -399,6 +399,7 @@ set g_balance_devastator_remote_damage 70 set g_balance_devastator_remote_edgedamage 35 set g_balance_devastator_remote_force 300 set g_balance_devastator_remote_jump_damage 70 +set g_balance_devastator_remote_jump_force 0 set g_balance_devastator_remote_jump_radius 0 set g_balance_devastator_remote_jump_velocity_z_add 400 set g_balance_devastator_remote_jump_velocity_z_max 1500 diff --git a/bal-wep-xpm.cfg b/bal-wep-xpm.cfg index 2578d6fcc..87a00b110 100644 --- a/bal-wep-xpm.cfg +++ b/bal-wep-xpm.cfg @@ -399,6 +399,7 @@ set g_balance_devastator_remote_damage 70 set g_balance_devastator_remote_edgedamage 35 set g_balance_devastator_remote_force 300 set g_balance_devastator_remote_jump_damage 70 +set g_balance_devastator_remote_jump_force 0 set g_balance_devastator_remote_jump_radius 0 set g_balance_devastator_remote_jump_velocity_z_add 400 set g_balance_devastator_remote_jump_velocity_z_max 1500 diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 1fdb8d6ad..df9bd470a 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -40,6 +40,7 @@ CLASS(Devastator, Weapon) P(class, prefix, remote_edgedamage, float, NONE) \ P(class, prefix, remote_force, float, NONE) \ P(class, prefix, remote_jump_damage, float, NONE) \ + P(class, prefix, remote_jump_force, float, NONE) \ P(class, prefix, remote_jump_radius, float, NONE) \ P(class, prefix, remote_jump_velocity_z_add, float, NONE) \ P(class, prefix, remote_jump_velocity_z_max, float, NONE) \ @@ -141,50 +142,56 @@ void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) this.event_damage = func_null; this.takedamage = DAMAGE_NO; - float handled_as_rocketjump = false; + bool handled_as_rocketjump = false; + entity head = NULL; - entity head = WarpZone_FindRadius( - this.origin, - WEP_CVAR(devastator, remote_jump_radius), - false - ); - - while(head) + if(WEP_CVAR(devastator, remote_jump_radius)) { - if(head.takedamage && (head == this.realowner)) + head = WarpZone_FindRadius( + this.origin, + WEP_CVAR(devastator, remote_jump_radius), + false + ); + + while(head) { - float distance_to_head = vlen(this.origin - head.WarpZone_findradius_nearest); - if(distance_to_head <= WEP_CVAR(devastator, remote_jump_radius)) + if(head.takedamage && (head == this.realowner)) { - // we handled this as a rocketjump :) - handled_as_rocketjump = true; - - // modify velocity - head.velocity_x *= 0.9; - head.velocity_y *= 0.9; - head.velocity_z = bound( - WEP_CVAR(devastator, remote_jump_velocity_z_min), - head.velocity.z + WEP_CVAR(devastator, remote_jump_velocity_z_add), - WEP_CVAR(devastator, remote_jump_velocity_z_max) - ); - - // now do the damage - RadiusDamage( - this, - head, - WEP_CVAR(devastator, remote_jump_damage), - WEP_CVAR(devastator, remote_jump_damage), - WEP_CVAR(devastator, remote_jump_radius), - NULL, - head, - 0, - this.projectiledeathtype | HITTYPE_BOUNCE, - NULL - ); - break; + if(vdist(this.origin - head.WarpZone_findradius_nearest, <=, WEP_CVAR(devastator, remote_jump_radius))) + { + // we handled this as a rocketjump :) + handled_as_rocketjump = true; + + // modify velocity + if(WEP_CVAR(devastator, remote_jump_velocity_z_add)) + { + head.velocity_x *= 0.9; + head.velocity_y *= 0.9; + head.velocity_z = bound( + WEP_CVAR(devastator, remote_jump_velocity_z_min), + head.velocity.z + WEP_CVAR(devastator, remote_jump_velocity_z_add), + WEP_CVAR(devastator, remote_jump_velocity_z_max) + ); + } + + // now do the damage + RadiusDamage( + this, + head, + WEP_CVAR(devastator, remote_jump_damage), + WEP_CVAR(devastator, remote_jump_damage), + WEP_CVAR(devastator, remote_jump_radius), + NULL, + head, + (WEP_CVAR(devastator, remote_jump_force) ? WEP_CVAR(devastator, remote_jump_force) : 0), + this.projectiledeathtype | HITTYPE_BOUNCE, + NULL + ); + break; + } } + head = head.chain; } - head = head.chain; } RadiusDamage( -- 2.39.2