Always swallow pad axis events when menu is active

This prevents axis events from trickling out of the menu and taking
effect in G_Responder when they aren't hitting the digital deadzone
needed to be mapped into internal menu key events.
This commit is contained in:
Eidolon 2023-01-03 14:39:15 -06:00
parent eeff182abb
commit c270cca55f

View file

@ -3224,6 +3224,7 @@ boolean M_Responder(event_t *ev)
static INT32 pjoyx = 0, pjoyy = 0;
static INT32 pmousex = 0, pmousey = 0;
static INT32 lastx = 0, lasty = 0;
boolean shouldswallowevent = false;
void (*routine)(INT32 choice); // for some casting problem
if (dedicated || (demoplayback && titledemo)
@ -3239,11 +3240,18 @@ boolean M_Responder(event_t *ev)
boolean useEventHandler = false;
if (menuactive && ev->type == ev_gamepad_axis && ev->which == 0)
{
// ALWAYS swallow gamepad axis events, to prevent trickling down to game input
// this applies even if the axis event does not get remapped
shouldswallowevent = true;
}
if (noFurtherInput)
{
// Ignore input after enter/escape/other buttons
// (but still allow shift keyup so caps doesn't get stuck)
return false;
return shouldswallowevent;
}
else if (menuactive)
{
@ -3368,7 +3376,7 @@ boolean M_Responder(event_t *ev)
}
if (!useEventHandler && ch == -1)
return false;
return shouldswallowevent;
else if (ch == gamecontrol[GC_SYSTEMMENU][0] || ch == gamecontrol[GC_SYSTEMMENU][1]) // allow remappable ESC key
ch = KEY_ESCAPE;
@ -3601,7 +3609,7 @@ boolean M_Responder(event_t *ev)
//currentMenu->lastOn = itemOn;
//if (currentMenu->prevMenu)
// M_SetupNextMenu(currentMenu->prevMenu);
return false;
return shouldswallowevent;
default:
CON_Responder(ev);