From 836bf45aa198f1bb7a4a0fa8bba2ac800d7bd5e9 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 16 Jul 2017 04:54:51 +1000 Subject: [PATCH] Port buttons_old to ClientState --- qcsrc/common/physics/player.qh | 1 - qcsrc/ecs/systems/physics.qc | 1 - qcsrc/ecs/systems/sv_physics.qc | 4 +++- qcsrc/server/client.qh | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/qcsrc/common/physics/player.qh b/qcsrc/common/physics/player.qh index a9fbde9b0..e3e563ebe 100644 --- a/qcsrc/common/physics/player.qh +++ b/qcsrc/common/physics/player.qh @@ -18,7 +18,6 @@ #endif .vector movement_old; -.float buttons_old; .vector v_angle_old; .string lastclassname; diff --git a/qcsrc/ecs/systems/physics.qc b/qcsrc/ecs/systems/physics.qc index f4fa0e609..8a324281a 100644 --- a/qcsrc/ecs/systems/physics.qc +++ b/qcsrc/ecs/systems/physics.qc @@ -17,7 +17,6 @@ void sys_phys_update(entity this, float dt) sys_phys_fix(this, dt); if (sys_phys_override(this, dt)) { return; } sys_phys_monitor(this, dt); - this.buttons_old = PHYS_INPUT_BUTTON_MASK(this); PHYS_CS(this).movement_old = PHYS_CS(this).movement; this.v_angle_old = this.v_angle; diff --git a/qcsrc/ecs/systems/sv_physics.qc b/qcsrc/ecs/systems/sv_physics.qc index ed3d3eaa8..1a69c75fc 100644 --- a/qcsrc/ecs/systems/sv_physics.qc +++ b/qcsrc/ecs/systems/sv_physics.qc @@ -24,12 +24,14 @@ void sys_phys_monitor(entity this, float dt) int buttons = PHYS_INPUT_BUTTON_MASK(this); anticheat_physics(this); if (sv_maxidle > 0) { - if (buttons != this.buttons_old + if (buttons != CS(this).buttons_old || CS(this).movement != CS(this).movement_old || this.v_angle != this.v_angle_old) { CS(this).parm_idlesince = time; } } PM_check_nickspam(this); PM_check_punch(this, dt); + + CS(this).buttons_old = PHYS_INPUT_BUTTON_MASK(this); } void sys_phys_ai(entity this) diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index fa1529818..4178ca9e6 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -75,6 +75,7 @@ CLASS(Client, Object) ATTRIB(Client, pm_frametime, float, this.pm_frametime); ATTRIB(Client, pressedkeys, int, this.pressedkeys); ATTRIB(Client, movement_old, vector, this.movement_old); + ATTRIB(Client, buttons_old, int, this.buttons_old); METHOD(Client, m_unwind, bool(Client this)); -- 2.39.2