From: Mario Date: Sat, 15 Jul 2017 18:22:47 +0000 (+1000) Subject: Port pressedkeys to ClientState X-Git-Tag: xonotic-v0.8.5~2624 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7512c4182e2b60cbc2db32e1fa41c15e476ad488;p=xonotic%2Fxonotic-data.pk3dir.git Port pressedkeys to ClientState --- diff --git a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc index 88547f7bf..8e90ef353 100644 --- a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc +++ b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc @@ -12,7 +12,6 @@ #define PHYS_DODGING_WALL autocvar_sv_dodging_wall_dodging #define PHYS_DODGING_AIR autocvar_sv_dodging_air_dodging #define PHYS_DODGING_MAXSPEED autocvar_sv_dodging_maxspeed -#define PHYS_DODGING_PRESSED_KEYS(s) (s).pressedkeys // we ran out of stats slots! TODO: re-enable this when prediction is available for dodging #if 0 @@ -33,9 +32,11 @@ #ifdef CSQC #define PHYS_DODGING_FRAMETIME (1 / (frametime <= 0 ? 60 : frametime)) #define PHYS_DODGING_TIMEOUT(s) STAT(DODGING_TIMEOUT) + #define PHYS_DODGING_PRESSED_KEYS(s) (s).pressedkeys #elif defined(SVQC) #define PHYS_DODGING_FRAMETIME sys_frametime #define PHYS_DODGING_TIMEOUT(s) s.cvar_cl_dodging_timeout + #define PHYS_DODGING_PRESSED_KEYS(s) CS(s).pressedkeys #endif #ifdef SVQC diff --git a/qcsrc/common/triggers/trigger/multi.qc b/qcsrc/common/triggers/trigger/multi.qc index 7e6311df1..808d08101 100644 --- a/qcsrc/common/triggers/trigger/multi.qc +++ b/qcsrc/common/triggers/trigger/multi.qc @@ -86,9 +86,8 @@ void multi_touch(entity this, entity toucher) } // if the trigger has pressed keys, check that the player is pressing those keys - if(this.pressedkeys) - if(IS_PLAYER(toucher)) // only for players - if(!(toucher.pressedkeys & this.pressedkeys)) + if(this.pressedkeys && IS_PLAYER(toucher)) // only for players + if(!(CS(toucher).pressedkeys & this.pressedkeys)) return; EXACTTRIGGER_TOUCH(this, toucher); diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 68f8d6a44..f3da3ca01 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1682,7 +1682,7 @@ void GetPressedKeys(entity this) keys = BITSET(keys, KEY_CROUCH, PHYS_INPUT_BUTTON_CROUCH(this)); keys = BITSET(keys, KEY_ATCK, PHYS_INPUT_BUTTON_ATCK(this)); keys = BITSET(keys, KEY_ATCK2, PHYS_INPUT_BUTTON_ATCK2(this)); - this.pressedkeys = keys; // store for other users + CS(this).pressedkeys = keys; // store for other users STAT(PRESSED_KEYS, this) = keys; } diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index 201cfff1a..53f562d86 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -73,6 +73,7 @@ CLASS(Client, Object) ATTRIB(Client, killindicator_teamchange, int, this.killindicator_teamchange); ATTRIB(Client, idlekick_lasttimeleft, float, this.idlekick_lasttimeleft); ATTRIB(Client, pm_frametime, float, this.pm_frametime); + ATTRIB(Client, pressedkeys, int, this.pressedkeys); METHOD(Client, m_unwind, bool(Client this));