From: Martin Taibr Date: Sat, 12 Aug 2017 01:39:02 +0000 (+0200) Subject: first check keys, then do the tracelines X-Git-Tag: xonotic-v0.8.5~2430^2~23 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=591f5221206b93ce2e59d6603e5992558f1bb67c;p=xonotic%2Fxonotic-data.pk3dir.git first check keys, then do the tracelines --- diff --git a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc index 261dc192f..cae688eca 100644 --- a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc +++ b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc @@ -130,21 +130,6 @@ bool PM_dodging_checkpressedkeys(entity this) if ((time - this.last_dodging_time) < PHYS_DODGING_DELAY) return false; - makevectors(this.angles); - - bool wall_dodge = false; - - if(!PHYS_DODGING_AIR) - if(!is_close_to_ground(this, PHYS_DODGING_HEIGHT_THRESHOLD)) - { - wall_dodge = (PHYS_DODGING_WALL && is_close_to_wall(this, PHYS_DODGING_DISTANCE_THRESHOLD)); - if(!wall_dodge) // we're not on the ground, and wall dodging isn't allowed, end it! - return true; - } - - if(!wall_dodge && PHYS_DODGING_MAXSPEED && vdist(this.velocity, >, PHYS_DODGING_MAXSPEED)) - return false; - bool frozen_dodging = (PHYS_FROZEN(this) && PHYS_DODGING_FROZEN(this)); bool frozen_no_doubletap = (frozen_dodging && !PHYS_DODGING_FROZEN_DOUBLETAP); @@ -170,28 +155,42 @@ bool PM_dodging_checkpressedkeys(entity this) X(y > 0, RIGHT, y++); #undef X - if (dodge_detected) + if (!dodge_detected) return false; + + makevectors(this.angles); + + bool wall_dodge = false; + + if(!PHYS_DODGING_AIR) + if(!is_close_to_ground(this, PHYS_DODGING_HEIGHT_THRESHOLD)) { - this.last_dodging_time = time; + wall_dodge = (PHYS_DODGING_WALL && is_close_to_wall(this, PHYS_DODGING_DISTANCE_THRESHOLD)); + if(!wall_dodge) // we're not on the ground, and wall dodging isn't allowed, end it! + return true; + } - this.dodging_action = 1; - this.dodging_single_action = 1; + if(!wall_dodge && PHYS_DODGING_MAXSPEED && vdist(this.velocity, >, PHYS_DODGING_MAXSPEED)) + return false; - this.dodging_velocity_gain = PHYS_DODGING_HORIZ_SPEED; + this.last_dodging_time = time; - this.dodging_direction_x = tap_direction_x; - this.dodging_direction_y = tap_direction_y; + this.dodging_action = 1; + this.dodging_single_action = 1; - // normalize the dodging_direction vector.. (unlike UT99) XD - float length = this.dodging_direction_x * this.dodging_direction_x - + this.dodging_direction_y * this.dodging_direction_y; - length = sqrt(length); + this.dodging_velocity_gain = PHYS_DODGING_HORIZ_SPEED; - this.dodging_direction_x = this.dodging_direction_x * 1.0 / length; - this.dodging_direction_y = this.dodging_direction_y * 1.0 / length; - return true; - } - return false; + this.dodging_direction_x = tap_direction_x; + this.dodging_direction_y = tap_direction_y; + + // normalize the dodging_direction vector.. (unlike UT99) XD + float length = this.dodging_direction_x * this.dodging_direction_x + + this.dodging_direction_y * this.dodging_direction_y; + length = sqrt(length); + + this.dodging_direction_x = this.dodging_direction_x * 1.0 / length; + this.dodging_direction_y = this.dodging_direction_y * 1.0 / length; + + return true; } // TODO use real cvars