From d3586818a0126eec5771fa3e8c19827f9745d416 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 9 Oct 2016 03:03:25 +1000 Subject: [PATCH] Don't overwrite the .pressedkeys field (abused by other things) --- qcsrc/server/client.qc | 8 +++++--- qcsrc/server/defs.qh | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index e42807ec5..9432b6704 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1607,7 +1607,7 @@ void SetZoomState(entity this, float z) void GetPressedKeys(entity this) { MUTATOR_CALLHOOK(GetPressedKeys, this); - int keys = this.pressedkeys; + int keys = STAT(PRESSED_KEYS, this); keys = BITSET(keys, KEY_FORWARD, this.movement.x > 0); keys = BITSET(keys, KEY_BACKWARD, this.movement.x < 0); keys = BITSET(keys, KEY_RIGHT, this.movement.y > 0); @@ -1617,7 +1617,9 @@ 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; + this.pressedkeys = keys; // store for other users + + STAT(PRESSED_KEYS, this) = keys; } /* @@ -1650,7 +1652,7 @@ void SpectateCopy(entity this, entity spectatee) this.hit_time = spectatee.hit_time; this.strength_finished = spectatee.strength_finished; this.invincible_finished = spectatee.invincible_finished; - this.pressedkeys = spectatee.pressedkeys; + STAT(PRESSED_KEYS, this) = STAT(PRESSED_KEYS, spectatee); this.weapons = spectatee.weapons; this.vortex_charge = spectatee.vortex_charge; this.vortex_chargepool_ammo = spectatee.vortex_chargepool_ammo; diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index b03496890..9c3e7bba0 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -261,7 +261,7 @@ bool independent_players; string clientstuff; .float phase; -.int pressedkeys = _STAT(PRESSED_KEYS); +.int pressedkeys; .string fog; -- 2.39.2