From 3101eb1a1865acf3ac91b33f035b6355e290225a Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 8 Oct 2018 00:14:29 -0400 Subject: [PATCH] Don't let chat/console eat inputs from anyone besides player 1 --- src/console.c | 26 ++++++++++++++++++++++++++ src/hu_stuff.c | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/src/console.c b/src/console.c index f79a6faf..2ddb9913 100644 --- a/src/console.c +++ b/src/console.c @@ -745,9 +745,35 @@ boolean CON_Responder(event_t *ev) // check for console toggle key if (ev->type != ev_console) { + INT32 i, j; + if (modeattacking || metalrecording) return false; + if (splitscreen && ev->data1 >= KEY_MOUSE1) // See also: HUD_Responder + { + for (i = 0; i < num_gamecontrols; i++) + { + for (j = 0; j < 2; j++) + { + if (gamecontrolbis[i][j] == ev->data1) + return false; + + if (splitscreen > 1) + { + if (gamecontrol3[i][j] == ev->data1) + return false; + + if (splitscreen > 2) + { + if (gamecontrol4[i][j] == ev->data1) + return false; + } + } + } + } + } + if (key == gamecontrol[gc_console][0] || key == gamecontrol[gc_console][1]) { if (consdown) // ignore repeat diff --git a/src/hu_stuff.c b/src/hu_stuff.c index e503e2a6..0879aedf 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1056,12 +1056,44 @@ static boolean justscrolledup; boolean HU_Responder(event_t *ev) { INT32 c=0; + INT32 i, j; if (ev->type != ev_keydown) return false; // only KeyDown events now... - + + // Shoot, to prevent P1 chatting from ruining the game for everyone else, it's either: + // A. completely disallow opening chat entirely in online splitscreen + // or B. iterate through all controls to make sure it's not bound to another player's + // You can see which one I chose. + // (Unless if you're sharing a keyboard, since you probably establish when you start chatting that you have dibs on it...) + // (Ahhh, the good ol days when I was a kid who couldn't afford an extra USB controller...) + + if (chat_on && splitscreen && ev->data1 >= KEY_MOUSE1) + { + for (i = 0; i < num_gamecontrols; i++) + { + for (j = 0; j < 2; j++) + { + if (gamecontrolbis[i][j] == ev->data1) + return false; + + if (splitscreen > 1) + { + if (gamecontrol3[i][j] == ev->data1) + return false; + + if (splitscreen > 2) + { + if (gamecontrol4[i][j] == ev->data1) + return false; + } + } + } + } + } + if (!chat_on) { // enter chat mode