diff --git a/source/core/inputstate.cpp b/source/core/inputstate.cpp index c0b55dec5..156930ad4 100644 --- a/source/core/inputstate.cpp +++ b/source/core/inputstate.cpp @@ -80,32 +80,14 @@ void InputState::GetMouseDelta(ControlInfo * hidInput) // //========================================================================== -static int exclKeys[] = { KEY_VOLUMEDOWN, KEY_VOLUMEUP }; - void InputState::AddEvent(const event_t *ev) { if (ev->type == EV_KeyDown || ev->type == EV_KeyUp) { int key = ev->data1; bool state = ev->type == EV_KeyDown; - bool ignore = false; KeyStatus[key] = (uint8_t)state; - - // Check if key is to be excluded from setting AnyKeyStatus. - for (int i = 0; i < 2; i++) - { - if (exclKeys[i] == key) - { - ignore = true; - break; - } - } - if (key > KEY_LASTJOYBUTTON && key < KEY_PAD_LTHUMB_RIGHT) - { - ignore = true; - } - - if (state && !ignore) + if (state && !(key > KEY_LASTJOYBUTTON && key < KEY_PAD_LTHUMB_RIGHT)) AnyKeyStatus = true; } } diff --git a/source/core/inputstate.h b/source/core/inputstate.h index 0d82c8154..3fc113158 100644 --- a/source/core/inputstate.h +++ b/source/core/inputstate.h @@ -127,14 +127,3 @@ inline void resetForcedSyncInput() { gamesetinput = false; } - -inline bool specialKeyEvent(event_t* ev) -{ - if (ev->type == EV_KeyDown || ev->type == EV_KeyUp) - { - int key = ev->data1; - if (key == KEY_VOLUMEDOWN || key == KEY_VOLUMEUP || (key > KEY_LASTJOYBUTTON && key < KEY_PAD_LTHUMB_RIGHT)) return true; - } - return false; -} - diff --git a/wadsrc/static/zscript/engine/base.zs b/wadsrc/static/zscript/engine/base.zs index c84922460..9f0648736 100644 --- a/wadsrc/static/zscript/engine/base.zs +++ b/wadsrc/static/zscript/engine/base.zs @@ -200,11 +200,14 @@ struct System native if (ev.type == InputEvent.Type_KeyDown || ev.type == InputEvent.Type_KeyUp) { int key = ev.KeyScan; - if (key == InputEvent.KEY_VOLUMEDOWN || key == InputEvent.KEY_VOLUMEUP || (key > InputEvent.KEY_LASTJOYBUTTON && key < InputEvent.KEY_PAD_LTHUMB_RIGHT)) return true; + let binding = Bindings.GetBinding(key); + bool volumekeys = key == InputEvent.KEY_VOLUMEDOWN || key == InputEvent.KEY_VOLUMEUP; + bool gamepadkeys = key > InputEvent.KEY_LASTJOYBUTTON && key < InputEvent.KEY_PAD_LTHUMB_RIGHT; + bool altkeys = key == InputEvent.KEY_LALT || key == InputEvent.KEY_RALT; + if (volumekeys || gamepadkeys || altkeys || binding ~== "screenshot") return true; } return false; } - } struct MusPlayingInfo native