From 8319109c9f40ccab3056d7b3239aeea9c6e74414 Mon Sep 17 00:00:00 2001 From: Jaime Moreira Date: Thu, 29 Jun 2023 11:46:43 -0400 Subject: [PATCH] Snappier "g_swap_speed" behaviour Player is no longer forced to go through the last frame of activation or deactivation of a weapon before changing its state. --- src/player/weapon.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/player/weapon.c b/src/player/weapon.c index 60c37b4..6e9820f 100644 --- a/src/player/weapon.c +++ b/src/player/weapon.c @@ -705,7 +705,7 @@ Weapon_Generic(edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, int F if (ent->client->weaponstate == WEAPON_DROPPING) { - if (ent->client->ps.gunframe == FRAME_DEACTIVATE_LAST) + if (ent->client->ps.gunframe >= FRAME_DEACTIVATE_LAST - change_speed + 1) { ChangeWeapon(ent); return; @@ -722,16 +722,12 @@ Weapon_Generic(edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, int F } ent->client->ps.gunframe += change_speed; - if (ent->client->ps.gunframe > FRAME_DEACTIVATE_LAST) - { - ent->client->ps.gunframe = FRAME_DEACTIVATE_LAST; - } return; } if (ent->client->weaponstate == WEAPON_ACTIVATING) { - if (ent->client->ps.gunframe == FRAME_ACTIVATE_LAST) + if (ent->client->ps.gunframe >= FRAME_ACTIVATE_LAST - change_speed + 1) { ent->client->weaponstate = WEAPON_READY; ent->client->ps.gunframe = FRAME_IDLE_FIRST; @@ -739,10 +735,6 @@ Weapon_Generic(edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, int F } ent->client->ps.gunframe += change_speed; - if (ent->client->ps.gunframe > FRAME_ACTIVATE_LAST) - { - ent->client->ps.gunframe = FRAME_ACTIVATE_LAST; - } return; }