Update button states during wipes

- All inputs create input events that get stored in a very
  small buffer
- Normally, the game listens for some inputs and then
  immediately processes them and updates the button state
  in-game
- However, during wipes the processing step would not
  happen and it would just let the events pile up
- Because the buffer is small though, it would quickly
  fill up and lose some events
- This would lead to button states getting stuck on some
  controllers if you released a button during a wipe
  - If you spun an analog stick around, this would cause
    it to happen more frequently, because there is a new
    event for every slight change of an analog stick's
    position
This commit is contained in:
James R 2024-03-03 17:42:20 -08:00
parent dd85f2968f
commit 3be8a72155
4 changed files with 14 additions and 5 deletions

View file

@ -5920,9 +5920,9 @@ static void Local_Maketic(INT32 realtics)
INT32 i;
I_OsPolling(); // I_Getevent
D_ProcessEvents(); // menu responder, cons responder,
// game responder calls HU_Responder, AM_Responder,
// and G_MapEventsToControls
D_ProcessEvents(true); // menu responder, cons responder,
// game responder calls HU_Responder, AM_Responder,
// and G_MapEventsToControls
if (!dedicated) rendergametic = gametic;

View file

@ -264,7 +264,7 @@ void HandleGamepadDeviceEvents(event_t *ev)
// D_ProcessEvents
// Send all the events of the given timestamp down the responder chain
//
void D_ProcessEvents(void)
void D_ProcessEvents(boolean callresponders)
{
event_t *ev;
int i;
@ -298,6 +298,9 @@ void D_ProcessEvents(void)
// update keys current state
G_MapEventsToControls(ev);
if (!callresponders)
continue; // eat
// Menu input
#ifdef HAVE_THREADS
I_lock_mutex(&k_menu_mutex);

View file

@ -50,7 +50,7 @@ void D_PostEvent(const event_t *ev);
void D_PostEvent_end(void); // delimiter for locking memory
#endif
void D_ProcessEvents(void);
void D_ProcessEvents(boolean callresponders);
const char *D_Home(void);

View file

@ -553,6 +553,12 @@ void F_RunWipe(UINT8 wipemode, UINT8 wipetype, boolean drawMenu, const char *col
}
I_OsPolling();
// The event buffer is rather small so we need to
// process these events immediately, to make sure
// inputs don't get stuck (would happen a lot with
// some controllers that send a lot of analog
// events).
D_ProcessEvents(false);
I_UpdateNoBlit();
if (drawMenu && rendermode != render_none)