From: Mario Date: Tue, 15 Nov 2016 09:13:38 +0000 (+1000) Subject: Add a button for dodging (not documented in menu yet) X-Git-Tag: xonotic-v0.8.2~442 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b55ee7242e6c75643e5a603f8352f550ce106963;p=xonotic%2Fxonotic-data.pk3dir.git Add a button for dodging (not documented in menu yet) --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 18cdf29c1..7322bd42d 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -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 diff --git a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc index d20814ce7..fb1502dbc 100644 --- a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc +++ b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc @@ -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--); diff --git a/qcsrc/common/physics/player.qh b/qcsrc/common/physics/player.qh index 5c0b10417..39cc573ee 100644 --- a/qcsrc/common/physics/player.qh +++ b/qcsrc/common/physics/player.qh @@ -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