Skip to content

Commit

Permalink
fix next/prev weapon without carousel (#2201)
Browse files Browse the repository at this point in the history
* fix next/prev weapon without carousel

Fixes #2196

* reset currently_active state to false in G_NextWeaponReset()
  • Loading branch information
fabiangreffrath authored Feb 13, 2025
1 parent d14083f commit b760605
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/g_nextweapon.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ typedef enum
{
nw_state_none,
nw_state_activate,
nw_state_currently_active,
nw_state_deactivate,
nw_state_cmd
} next_weapon_state_t;

static next_weapon_state_t state;
static boolean currently_active;

void G_NextWeaponUpdate(void)
{
Expand All @@ -160,14 +160,16 @@ void G_NextWeaponUpdate(void)
else if (M_InputDeactivated(input_prevweapon)
|| M_InputDeactivated(input_nextweapon))
{
if (state == nw_state_currently_active)
if (currently_active)
{
currently_active = false;
state = nw_state_deactivate;
}
}

if (weapon != wp_nochange)
{
currently_active = true;
state = nw_state_activate;
players[consoleplayer].nextweapon = weapon;
}
Expand All @@ -177,7 +179,7 @@ boolean G_NextWeaponActivate(void)
{
if (state == nw_state_activate)
{
state = nw_state_currently_active;
state = nw_state_none;
return true;
}
return false;
Expand Down Expand Up @@ -216,6 +218,7 @@ void G_NextWeaponResendCmd(void)

void G_NextWeaponReset(void)
{
currently_active = false;
state = nw_state_none;
ST_ResetCarousel();
}

0 comments on commit b760605

Please sign in to comment.