From 05f76199786f8ee219be936c4fbefd27d37b1e34 Mon Sep 17 00:00:00 2001 From: terencehill Date: Fri, 12 Feb 2021 18:26:15 +0100 Subject: [PATCH] Fix speed award not updated when the timelimit is reached --- qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc | 2 +- qcsrc/common/gamemodes/gamemode/race/sv_race.qc | 2 +- qcsrc/server/client.qc | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc b/qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc index 144788917..bca0d1077 100644 --- a/qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc +++ b/qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc @@ -302,7 +302,7 @@ MUTATOR_HOOKFUNCTION(cts, GetPressedKeys) speedaward_uid = player.crypto_idfp; speedaward_lastupdate = time; } - if (speedaward_speed > speedaward_lastsent && time - speedaward_lastupdate > 1) + if (speedaward_speed > speedaward_lastsent && (time - speedaward_lastupdate > 1 || intermission_running)) { string rr = CTS_RECORD; race_send_speedaward(MSG_ALL); diff --git a/qcsrc/common/gamemodes/gamemode/race/sv_race.qc b/qcsrc/common/gamemodes/gamemode/race/sv_race.qc index a69a43522..8148dda2d 100644 --- a/qcsrc/common/gamemodes/gamemode/race/sv_race.qc +++ b/qcsrc/common/gamemodes/gamemode/race/sv_race.qc @@ -348,7 +348,7 @@ MUTATOR_HOOKFUNCTION(rc, GetPressedKeys) speedaward_uid = player.crypto_idfp; speedaward_lastupdate = time; } - if (speedaward_speed > speedaward_lastsent && time - speedaward_lastupdate > 1) + if (speedaward_speed > speedaward_lastsent && (time - speedaward_lastupdate > 1 || intermission_running)) { string rr = RACE_RECORD; race_send_speedaward(MSG_ALL); diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 0777297a2..d8154ee84 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1707,6 +1707,13 @@ void SetZoomState(entity this, float newzoom) void GetPressedKeys(entity this) { MUTATOR_CALLHOOK(GetPressedKeys, this); + if (game_stopped) + { + CS(this).pressedkeys = 0; + STAT(PRESSED_KEYS, this) = 0; + return; + } + int keys = STAT(PRESSED_KEYS, this); keys = BITSET(keys, KEY_FORWARD, CS(this).movement.x > 0); keys = BITSET(keys, KEY_BACKWARD, CS(this).movement.x < 0); @@ -2761,12 +2768,12 @@ void PlayerPostThink (entity this) DrownPlayer(this); UpdateChatBubble(this); if (CS(this).impulse) ImpulseCommands(this); + GetPressedKeys(this); if (game_stopped) { CSQCMODEL_AUTOUPDATE(this); return; } - GetPressedKeys(this); } else if (IS_OBSERVER(this) && STAT(PRESSED_KEYS, this)) { -- 2.39.2