Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix next/prev weapon without carousel #2201

Merged
merged 2 commits into from
Feb 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be reset to false in G_NextWeaponReset?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most probably yes!


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();
}
Loading