From: Samual Lenks Date: Mon, 9 Dec 2013 06:16:46 +0000 (-0500) Subject: EVEN FURTHER cleanup of shockwave blast function :D X-Git-Tag: xonotic-v0.8.0~152^2~277 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=42a8db58da56fddf0cd16b54c7126074e28f3c2c;p=xonotic%2Fxonotic-data.pk3dir.git EVEN FURTHER cleanup of shockwave blast function :D --- diff --git a/qcsrc/common/weapons/w_shockwave.qc b/qcsrc/common/weapons/w_shockwave.qc index a9dee985d..8d7652361 100644 --- a/qcsrc/common/weapons/w_shockwave.qc +++ b/qcsrc/common/weapons/w_shockwave.qc @@ -407,9 +407,25 @@ void W_Shockwave_Attack() if((head == self) && (distance_to_head <= WEP_CVAR(shockwave, blast_jump_radius))) { + // ======================== + // BLAST JUMP CALCULATION + // ======================== + // calculate importance of distance and accuracy for this attack - multiplier_from_accuracy = (1 - (distance_to_head ? min(1, (distance_to_head / WEP_CVAR(shockwave, blast_jump_radius))) : 0)); - multiplier_from_distance = (1 - (distance_to_hit ? min(1, (distance_to_hit / distance_to_end)) : 0)); + multiplier_from_accuracy = (1 - + (distance_to_head ? + min(1, (distance_to_head / WEP_CVAR(shockwave, blast_jump_radius))) + : + 0 + ) + ); + multiplier_from_distance = (1 - + (distance_to_hit ? + min(1, (distance_to_hit / distance_to_end)) + : + 0 + ) + ); multiplier = max( WEP_CVAR(shockwave, blast_jump_multiplier_min), @@ -436,7 +452,6 @@ void W_Shockwave_Attack() * WEP_CVAR(shockwave, blast_jump_force_velocitybias) ); - final_force = normalize((CENTER_OR_VIEWOFS(head) - attack_hitpos) + vel); // now multiply the direction by force units @@ -468,8 +483,25 @@ void W_Shockwave_Attack() } else if(distance_to_head <= WEP_CVAR(shockwave, blast_splash_radius)) { - multiplier_from_accuracy = (1 - (distance_to_head ? min(1, (distance_to_head / WEP_CVAR(shockwave, blast_splash_radius))) : 0)); - multiplier_from_distance = (1 - (distance_to_hit ? min(1, (distance_to_hit / distance_to_end)) : 0)); + // ========================== + // BLAST SPLASH CALCULATION + // ========================== + + // calculate importance of distance and accuracy for this attack + multiplier_from_accuracy = (1 - + (distance_to_head ? + min(1, (distance_to_head / WEP_CVAR(shockwave, blast_splash_radius))) + : + 0 + ) + ); + multiplier_from_distance = (1 - + (distance_to_hit ? + min(1, (distance_to_hit / distance_to_end)) + : + 0 + ) + ); multiplier = max( WEP_CVAR(shockwave, blast_splash_multiplier_min), @@ -522,6 +554,10 @@ void W_Shockwave_Attack() { if((head != self) && head.takedamage) { + // ======================== + // BLAST CONE CALCULATION + // ======================== + // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc) center = CENTER_OR_VIEWOFS(head); @@ -542,8 +578,22 @@ void W_Shockwave_Attack() if((distance_to_target <= WEP_CVAR(shockwave, blast_distance)) && (W_Shockwave_Attack_IsVisible(head, nearest_on_line, w_shotorg, attack_endpos))) { - multiplier_from_accuracy = (1 - W_Shockwave_Attack_CheckSpread(nearest_to_attacker, nearest_on_line, w_shotorg, attack_endpos)); - multiplier_from_distance = (1 - (distance_to_hit ? min(1, (distance_to_target / distance_to_end)) : 0)); + // calculate importance of distance and accuracy for this attack + multiplier_from_accuracy = (1 - + W_Shockwave_Attack_CheckSpread( + nearest_to_attacker, + nearest_on_line, + w_shotorg, + attack_endpos + ) + ); + multiplier_from_distance = (1 - + (distance_to_hit ? + min(1, (distance_to_target / distance_to_end)) + : + 0 + ) + ); multiplier = max( WEP_CVAR(shockwave, blast_multiplier_min), @@ -596,7 +646,16 @@ void W_Shockwave_Attack() final_force = shockwave_hit_force[i]; final_damage = shockwave_hit_damage[i]; - Damage(head, self, self, final_damage, WEP_SHOCKWAVE, head.origin, final_force); + Damage( + head, + self, + self, + final_damage, + WEP_SHOCKWAVE, + head.origin, + final_force + ); + #ifdef DEBUG_SHOCKWAVE print(sprintf( "SHOCKWAVE by %s: damage = %f, force = %f.\n",