Don't let chat/console eat inputs from anyone besides player 1

This commit is contained in:
TehRealSalt 2018-10-08 00:14:29 -04:00
parent 42766db48c
commit 3101eb1a18
2 changed files with 59 additions and 1 deletions

View File

@ -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

View File

@ -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