From 73369679f59a6a8b5227d4da4169929a5362e3ce Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Thu, 10 Jan 2019 04:04:26 -0600 Subject: [PATCH 1/5] Fix player 2 not being able to play while the chat is open Also attempts to fix the d-pad typing characters into the chat box. --- src/g_input.c | 2 +- src/hu_stuff.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/g_input.c b/src/g_input.c index d7b7be91..871c1e60 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -120,7 +120,7 @@ void G_MapEventsToControls(event_t *ev) case ev_joystick2: // buttons are virtual keys i = ev->data1; - if (i >= JOYAXISSET || menuactive || CON_Ready() || chat_on) + if (i >= JOYAXISSET || menuactive) break; if (ev->data2 != INT32_MAX) joy2xmove[i] = ev->data2; if (ev->data3 != INT32_MAX) joy2ymove[i] = ev->data3; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index f66aa07b..f28f3c8a 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1179,6 +1179,10 @@ boolean HU_Responder(event_t *ev) || ev->data1 == KEY_LALT || ev->data1 == KEY_RALT) return true; + // Ignore joystick hats + if (ev->data1 >= KEY_HAT1 && ev->data1 <= KEY_HAT1 + 3) + return false; + c = (INT32)ev->data1; // I know this looks very messy but this works. If it ain't broke, don't fix it! From 92a60b32de4cd236915745cf2d6fc96e53723572 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Thu, 10 Jan 2019 06:06:18 -0600 Subject: [PATCH 2/5] Enable d-pad on the vote screen, allow aborting connection with more joy buttons --- src/d_clisrv.c | 3 ++- src/g_game.c | 20 ++++++++++++++++++++ src/g_game.h | 1 + src/y_inter.c | 4 ++-- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index be639034..75956d65 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2076,7 +2076,8 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic I_OsPolling(); key = I_GetKey(); - if (key == KEY_ESCAPE || key == KEY_JOY1+1) + // For some reason, gamekeydown[gamecontrol[gc_brake][0]] is always true here, so we're just going to check the second to fourth buttons. + if (key == KEY_ESCAPE || key == KEY_JOY1+1 || key == KEY_JOY1+2 || key == KEY_JOY1+3) { CONS_Printf(M_GetText("Network game synchronization aborted.\n")); // M_StartMessage(M_GetText("Network game synchronization aborted.\n\nPress ESC\n"), NULL, MM_NOTHING); diff --git a/src/g_game.c b/src/g_game.c index 23f41564..32e252fb 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1177,6 +1177,26 @@ boolean InputDown(INT32 gc, UINT8 p) } } +// Returns true if the hat is pressed for the specified player +// 0 is up, 1 is down, 2 is left, 3 is right +// Basically a hack needed to allow the d-pad on the vote screen. +boolean HatDown(UINT8 dir, UINT8 p) +{ + if (p == 1 && gamekeydown[KEY_HAT1 + dir]) + return true; + + if (p == 2 && gamekeydown[KEY_2HAT1 + dir]) + return true; + + if (p == 3 && gamekeydown[KEY_3HAT1 + dir]) + return true; + + if (p == 4 && gamekeydown[KEY_4HAT1 + dir]) + return true; + + return false; +} + INT32 JoyAxis(axis_input_e axissel, UINT8 p) { switch (p) diff --git a/src/g_game.h b/src/g_game.h index 720d561f..52f7f60d 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -99,6 +99,7 @@ INT16 G_ClipAimingPitch(INT32 *aiming); INT16 G_SoftwareClipAimingPitch(INT32 *aiming); boolean InputDown(INT32 gc, UINT8 p); +boolean HatDown(UINT8 dir, UINT8 p); INT32 JoyAxis(axis_input_e axissel, UINT8 p); extern angle_t localangle, localangle2, localangle3, localangle4; diff --git a/src/y_inter.c b/src/y_inter.c index 379d5cd3..6073f93e 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1318,13 +1318,13 @@ void Y_VoteTicker(void) && !voteclient.playerinfo[i].delay && pickedvote == -1 && votes[p] == -1) { - if (InputDown(gc_aimforward, i+1) || JoyAxis(AXISAIM, i+1) < 0) + if (InputDown(gc_aimforward, i+1) || JoyAxis(AXISAIM, i+1) < 0 || HatDown(0, i+1)) { voteclient.playerinfo[i].selection--; pressed = true; } - if ((InputDown(gc_aimbackward, i+1) || JoyAxis(AXISAIM, i+1) > 0) && !pressed) + if ((InputDown(gc_aimbackward, i+1) || JoyAxis(AXISAIM, i+1) > 0 || HatDown(1, i+1)) && !pressed) { voteclient.playerinfo[i].selection++; pressed = true; From 622509682a08482060f96409e2dc6c8380224c6b Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Fri, 11 Jan 2019 02:38:49 -0600 Subject: [PATCH 3/5] Fix chat toggle not working --- src/hu_stuff.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 89149a3f..4bd0994c 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1184,8 +1184,10 @@ boolean HU_Responder(event_t *ev) || ev->data1 == KEY_LALT || ev->data1 == KEY_RALT) return true; - // Ignore joystick hats - if (ev->data1 >= KEY_HAT1 && ev->data1 <= KEY_HAT1 + 3) + // Ignore joystick hats, except when the talk key is bound + if (ev->data1 >= KEY_HAT1 && ev->data1 <= KEY_HAT1+3 + && (ev->data1 != gamecontrol[gc_talkkey][0] + && ev->data1 != gamecontrol[gc_talkkey][1])) return false; c = (INT32)ev->data1; From 31ccae60c9281c6ca9efb63440f14b0ec9056210 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Sat, 12 Jan 2019 05:37:07 -0600 Subject: [PATCH 4/5] Revert "Enable d-pad on the vote screen" Partial revert of commit 92a60b32de4cd236915745cf2d6fc96e53723572. --- src/g_game.c | 20 -------------------- src/g_game.h | 1 - src/y_inter.c | 4 ++-- 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 7d3aec1a..1e0c7e46 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1180,26 +1180,6 @@ boolean InputDown(INT32 gc, UINT8 p) } } -// Returns true if the hat is pressed for the specified player -// 0 is up, 1 is down, 2 is left, 3 is right -// Basically a hack needed to allow the d-pad on the vote screen. -boolean HatDown(UINT8 dir, UINT8 p) -{ - if (p == 1 && gamekeydown[KEY_HAT1 + dir]) - return true; - - if (p == 2 && gamekeydown[KEY_2HAT1 + dir]) - return true; - - if (p == 3 && gamekeydown[KEY_3HAT1 + dir]) - return true; - - if (p == 4 && gamekeydown[KEY_4HAT1 + dir]) - return true; - - return false; -} - INT32 JoyAxis(axis_input_e axissel, UINT8 p) { switch (p) diff --git a/src/g_game.h b/src/g_game.h index aff15ce4..14dc12d0 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -100,7 +100,6 @@ INT16 G_ClipAimingPitch(INT32 *aiming); INT16 G_SoftwareClipAimingPitch(INT32 *aiming); boolean InputDown(INT32 gc, UINT8 p); -boolean HatDown(UINT8 dir, UINT8 p); INT32 JoyAxis(axis_input_e axissel, UINT8 p); extern angle_t localangle, localangle2, localangle3, localangle4; diff --git a/src/y_inter.c b/src/y_inter.c index 6073f93e..379d5cd3 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1318,13 +1318,13 @@ void Y_VoteTicker(void) && !voteclient.playerinfo[i].delay && pickedvote == -1 && votes[p] == -1) { - if (InputDown(gc_aimforward, i+1) || JoyAxis(AXISAIM, i+1) < 0 || HatDown(0, i+1)) + if (InputDown(gc_aimforward, i+1) || JoyAxis(AXISAIM, i+1) < 0) { voteclient.playerinfo[i].selection--; pressed = true; } - if ((InputDown(gc_aimbackward, i+1) || JoyAxis(AXISAIM, i+1) > 0 || HatDown(1, i+1)) && !pressed) + if ((InputDown(gc_aimbackward, i+1) || JoyAxis(AXISAIM, i+1) > 0) && !pressed) { voteclient.playerinfo[i].selection++; pressed = true; From dead0475ce3798300b14da09a689f5e4e5a8efe0 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Sun, 13 Jan 2019 19:22:54 -0600 Subject: [PATCH 5/5] Allow any key to abort network connection, ignore non-keyboard keys in chat --- src/d_clisrv.c | 4 ++-- src/hu_stuff.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 75956d65..9f65fdf8 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2076,8 +2076,8 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic I_OsPolling(); key = I_GetKey(); - // For some reason, gamekeydown[gamecontrol[gc_brake][0]] is always true here, so we're just going to check the second to fourth buttons. - if (key == KEY_ESCAPE || key == KEY_JOY1+1 || key == KEY_JOY1+2 || key == KEY_JOY1+3) + // Any key can be used to abort network connection + if (key != KEY_NULL) { CONS_Printf(M_GetText("Network game synchronization aborted.\n")); // M_StartMessage(M_GetText("Network game synchronization aborted.\n\nPress ESC\n"), NULL, MM_NOTHING); diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 4bd0994c..fd3bf436 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1184,8 +1184,8 @@ boolean HU_Responder(event_t *ev) || ev->data1 == KEY_LALT || ev->data1 == KEY_RALT) return true; - // Ignore joystick hats, except when the talk key is bound - if (ev->data1 >= KEY_HAT1 && ev->data1 <= KEY_HAT1+3 + // Ignore non-keyboard keys, except when the talk key is bound + if (ev->data1 >= KEY_MOUSE1 && (ev->data1 != gamecontrol[gc_talkkey][0] && ev->data1 != gamecontrol[gc_talkkey][1])) return false;