Clear weapon slot only once per tic

In case an input is pressed and released before the next G_BuildTiccmd call.
This commit is contained in:
ceski 2024-09-25 13:38:59 -07:00
parent 7b260243e0
commit ddb24e3316
3 changed files with 6 additions and 6 deletions

View File

@ -903,7 +903,7 @@ void G_BuildTiccmd(ticcmd_t* cmd)
// [FG] prev/next weapon keys and buttons // [FG] prev/next weapon keys and buttons
next_weapon = 0; next_weapon = 0;
WS_ClearSharedEvent(); WS_UpdateStateTic();
// [FG] double click acts as "use" // [FG] double click acts as "use"
if (dclick) if (dclick)

View File

@ -331,14 +331,16 @@ boolean WS_HoldOverride(void)
} }
// //
// WS_ClearSharedEvent // WS_UpdateStateTic
// //
void WS_ClearSharedEvent(void) void WS_UpdateStateTic(void)
{ {
if (shared_event.restored) if (shared_event.restored)
{ {
ResetSharedEvent(); ResetSharedEvent();
} }
state.current_slot = NULL;
} }
static void RestoreSharedEvent(void) static void RestoreSharedEvent(void)
@ -425,7 +427,6 @@ static boolean UpdateSelection(const event_t *ev)
{ {
state.selected = false; state.selected = false;
state.input_key = -1; state.input_key = -1;
state.current_slot = NULL;
} }
break; break;
@ -723,7 +724,6 @@ weapontype_t WS_SlotWeapon(void)
const weapontype_t current_weapon = CurrentWeapon(player); const weapontype_t current_weapon = CurrentWeapon(player);
const weapontype_t *slot_weapons = state.current_slot->weapons; const weapontype_t *slot_weapons = state.current_slot->weapons;
const int num_weapons = state.current_slot->num_weapons; const int num_weapons = state.current_slot->num_weapons;
state.current_slot = NULL;
if (!demo_compatibility) if (!demo_compatibility)
{ {

View File

@ -45,7 +45,7 @@ void WS_UpdateState(const struct event_s *ev);
boolean WS_Override(void); boolean WS_Override(void);
boolean WS_HoldOverride(void); boolean WS_HoldOverride(void);
void WS_ClearSharedEvent(void); void WS_UpdateStateTic(void);
boolean WS_Responder(const struct event_s *ev); boolean WS_Responder(const struct event_s *ev);
boolean WS_SlotSelected(void); boolean WS_SlotSelected(void);