]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a button for dodging (not documented in menu yet)
authorMario <mario@smbclan.net>
Tue, 15 Nov 2016 09:13:38 +0000 (19:13 +1000)
committerMario <mario@smbclan.net>
Tue, 15 Nov 2016 09:13:38 +0000 (19:13 +1000)
defaultXonotic.cfg
qcsrc/common/mutators/mutator/dodging/sv_dodging.qc
qcsrc/common/physics/player.qh

index 18cdf29c13efd828310418658d71fc8283896663..7322bd42de0fd4bcafe4ea446a6ed53be7326f50 100644 (file)
@@ -36,6 +36,8 @@ alias +hook +button6
 alias -hook -button6
 alias +jetpack +button10
 alias -jetpack -button10
+alias +dodge +button11
+alias -dodge -button11
 alias use "impulse 21"
 
 // for backwards compatibility
index d20814ce7c045f04390645e8b156842b5236338e..fb1502dbc2102d3ec5c24c91f8f4ca705e673281 100644 (file)
@@ -109,13 +109,13 @@ bool check_close_to_ground(entity this, float threshold)
        return IS_ONGROUND(this) ? true : false;
 }
 
-float PM_dodging_checkpressedkeys(entity this)
+bool PM_dodging_checkpressedkeys(entity this)
 {
        if(!PHYS_DODGING)
                return false;
 
-       float frozen_dodging = (PHYS_FROZEN(this) && PHYS_DODGING_FROZEN(this));
-       float frozen_no_doubletap = (frozen_dodging && !PHYS_DODGING_FROZEN_NODOUBLETAP);
+       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)
@@ -138,7 +138,9 @@ float PM_dodging_checkpressedkeys(entity this)
                if(!(PHYS_DODGING_PRESSED_KEYS(this) & KEY_##BTN) || frozen_no_doubletap) {             \
                                tap_direction_##RESULT;                                                                                                 \
                                if ((time - this.last_##BTN##_KEY_time) < PHYS_DODGING_TIMEOUT(this) || frozen_no_doubletap)    \
-                                       dodge_detected = true;                                                                                                  \
+                                       dodge_detected = true;                                                                                          \
+                               if(PHYS_INPUT_BUTTON_DODGE(this))                                                                               \
+                                       dodge_detected = true;                                                                                          \
                                this.last_##BTN##_KEY_time = time;                                                                              \
                }
        X(x < 0, BACKWARD,      x--);
index 5c0b104178b0a385ee2509f9aa814f0d2b1c705c..39cc573ee99d9bc96cff1177dd1b3c457d26cfa1 100644 (file)
@@ -121,6 +121,7 @@ STATIC_INIT(PHYS_INPUT_BUTTON_HOOK)
 #define PHYS_INPUT_BUTTON_PRYDON(s)         PHYS_INPUT_BUTTON_BUTTON_PRYDON(s)
 #define PHYS_INPUT_BUTTON_ZOOMSCRIPT(s)     PHYS_INPUT_BUTTON_BUTTON9(s)
 #define PHYS_INPUT_BUTTON_JETPACK(s)        PHYS_INPUT_BUTTON_BUTTON10(s)
+#define PHYS_INPUT_BUTTON_DODGE(s)                     PHYS_INPUT_BUTTON_BUTTON11(s)
 
 #ifdef CSQC
 STATIC_INIT(PHYS_INPUT_BUTTON_JETPACK)
@@ -128,6 +129,12 @@ STATIC_INIT(PHYS_INPUT_BUTTON_JETPACK)
        localcmd("alias +jetpack +button10\n");
     localcmd("alias -jetpack -button10\n");
 }
+
+STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
+{
+    localcmd("alias +dodge +button11\n");
+    localcmd("alias -dodge -button11\n");
+}
 #endif
 
 // if more buttons are needed, start using impulse bits as buttons