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.
This commit is contained in:
Jaime Moreira 2023-06-29 11:37:36 -04:00
parent a43de22013
commit 8e46e411bc

View file

@ -699,7 +699,7 @@ Weapon_Generic(edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST,
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;
@ -716,16 +716,12 @@ Weapon_Generic(edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST,
}
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;
@ -733,10 +729,6 @@ Weapon_Generic(edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST,
}
ent->client->ps.gunframe += change_speed;
if (ent->client->ps.gunframe > FRAME_ACTIVATE_LAST)
{
ent->client->ps.gunframe = FRAME_ACTIVATE_LAST;
}
return;
}