]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
as far as i can tell `if(!PHYS_DODGING) { return; }` is completely useless
authorMartin Taibr <taibr.martin@gmail.com>
Fri, 11 Aug 2017 16:15:21 +0000 (18:15 +0200)
committerMartin Taibr <taibr.martin@gmail.com>
Fri, 11 Aug 2017 16:15:21 +0000 (18:15 +0200)
the hooks are not called at all with dodging off and this doesn't allow turning off mid match either

qcsrc/common/mutators/mutator/dodging/sv_dodging.qc

index 70aac4d9a3fcda663448d035199f3d46b93dc1a0..688cab68fb9a542bb2c1d42d79ffa20e5d34afe8 100644 (file)
@@ -130,12 +130,6 @@ bool check_close_to_ground(entity this, float threshold)
 
 bool PM_dodging_checkpressedkeys(entity this)
 {
-       if(!PHYS_DODGING)
-               return false;
-
-       bool frozen_dodging = (PHYS_FROZEN(this) && PHYS_DODGING_FROZEN(this));
-       bool frozen_no_doubletap = (frozen_dodging && !PHYS_DODGING_FROZEN_NODOUBLETAP);
-
        // first check if the last dodge is far enough back in time so we can dodge again
        if ((time - this.last_dodging_time) < PHYS_DODGING_DELAY)
                return false;
@@ -155,6 +149,9 @@ bool PM_dodging_checkpressedkeys(entity this)
        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_NODOUBLETAP);
+
        float tap_direction_x = 0;
        float tap_direction_y = 0;
        bool dodge_detected = false;
@@ -203,9 +200,6 @@ bool PM_dodging_checkpressedkeys(entity this)
 
 void PM_dodging(entity this)
 {
-       if (!PHYS_DODGING)
-               return;
-
        // when swimming or dead, no dodging allowed..
        if (this.waterlevel >= WATERLEVEL_SWIMMING || IS_DEAD(this))
        {
@@ -277,8 +271,6 @@ void PM_dodging(entity this)
 void PM_dodging_GetPressedKeys(entity this)
 {
 #ifdef CSQC
-       if(!PHYS_DODGING) { return; }
-
        PM_dodging_checkpressedkeys(this);
 
        int keys = this.pressedkeys;
@@ -297,7 +289,7 @@ void PM_dodging_GetPressedKeys(entity this)
 
 MUTATOR_HOOKFUNCTION(dodging, PlayerPhysics)
 {
-    entity player = M_ARGV(0, entity);
+       entity player = M_ARGV(0, entity);
 
        // print("dodging_PlayerPhysics\n");
        PM_dodging_GetPressedKeys(player);