From 118b78256fb31a6f889261268605f8988b6f13da Mon Sep 17 00:00:00 2001 From: Jaime Moreira Date: Sat, 26 Aug 2023 19:08:26 -0400 Subject: [PATCH] Fixed g_swap_speed behaviour with extreme values When its value was between 0 and 1, rounded down to 0. Did the same when bigger than 65535. Both cases locked up the entire weapon animation. --- src/game/player/weapon.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/game/player/weapon.c b/src/game/player/weapon.c index 173fc763..b7f30623 100644 --- a/src/game/player/weapon.c +++ b/src/game/player/weapon.c @@ -605,7 +605,9 @@ Weapon_Generic(edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, int *fire_frames, void (*fire)(edict_t *ent)) { int n; - const unsigned short int change_speed = (g_swap_speed->value > 0)?(unsigned short int)g_swap_speed->value:1; + const unsigned short int change_speed = (g_swap_speed->value > 1)? + (g_swap_speed->value < USHRT_MAX)? (unsigned short int)g_swap_speed->value : 1 + : 1; if (!ent || !fire_frames || !fire) {