Only toggle keyboardTyping when input key is valid

Fixes unintended toggles to virtual keyboard
This commit is contained in:
Eidolon 2023-11-05 11:45:07 -06:00
parent 0201d90d21
commit 518366d567

View file

@ -237,7 +237,7 @@ void M_MenuTypingInput(INT32 key)
if (!menutyping.keyboardtyping) // controller inputs
{
// we pressed a keyboard input that's not any of our buttons
if (M_IsTypingKey(key) && menucmd[pid].dpad_lr == 0 && menucmd[pid].dpad_ud == 0
if (key >= 0 && M_IsTypingKey(key) && menucmd[pid].dpad_lr == 0 && menucmd[pid].dpad_ud == 0
&& !(menucmd[pid].buttons & MBT_A)
&& !(menucmd[pid].buttons & MBT_B)
&& !(menucmd[pid].buttons & MBT_C)
@ -252,7 +252,7 @@ void M_MenuTypingInput(INT32 key)
else // Keyboard inputs.
{
// On the flipside, if we're pressing any keyboard input, switch to controller inputs.
if (!M_IsTypingKey(key) && (
if (key >= 0 && !M_IsTypingKey(key) && (
M_MenuButtonPressed(pid, MBT_A)
|| M_MenuButtonPressed(pid, MBT_B)
|| M_MenuButtonPressed(pid, MBT_C)