From 13b0e9c3c59f203ba5596dd8f2e23c42fc33debb Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 2 Dec 2018 21:18:28 +0000 Subject: [PATCH] make menu respond to joystick axis events without joyscale having to be 0 --- src/m_menu.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index dfe8bbec..2d7f5eed 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2117,26 +2117,32 @@ boolean M_Responder(event_t *ev) { if (ev->type == ev_joystick && ev->data1 == 0 && joywait < I_GetTime()) { - if (ev->data3 == -1) + if (ev->data3 != INT32_MAX) { - ch = KEY_UPARROW; - joywait = I_GetTime() + NEWTICRATE/7; - } - else if (ev->data3 == 1) - { - ch = KEY_DOWNARROW; - joywait = I_GetTime() + NEWTICRATE/7; + if (ev->data3 < 0) + { + ch = KEY_UPARROW; + joywait = I_GetTime() + NEWTICRATE/7; + } + else if (ev->data3 > 0) + { + ch = KEY_DOWNARROW; + joywait = I_GetTime() + NEWTICRATE/7; + } } - if (ev->data2 == -1) + if (ev->data2 != INT32_MAX) { - ch = KEY_LEFTARROW; - joywait = I_GetTime() + NEWTICRATE/17; - } - else if (ev->data2 == 1) - { - ch = KEY_RIGHTARROW; - joywait = I_GetTime() + NEWTICRATE/17; + if (ev->data2 < 0) + { + ch = KEY_LEFTARROW; + joywait = I_GetTime() + NEWTICRATE/17; + } + else if (ev->data2 > 0) + { + ch = KEY_RIGHTARROW; + joywait = I_GetTime() + NEWTICRATE/17; + } } } else if (ev->type == ev_mouse && mousewait < I_GetTime())