Skip setting control if keynum is -1 (for KEY_PAUSE) handling

This commit is contained in:
mazmazz 2018-12-20 18:27:44 -05:00
parent 6f8b126586
commit e20c70d5fb

View file

@ -1346,10 +1346,10 @@ static INT32 G_FilterKeyByVersion(INT32 numctrl, INT32 keyidx, INT32 player, INT
*keynum2 = 0; *keynum2 = 0;
} }
else else
return 0; return -1; // skip setting control
} }
else if (keyidx == 1 && *keynum2 == KEY_PAUSE) else if (keyidx == 1 && *keynum2 == KEY_PAUSE)
return 0; return -1; // skip setting control
#if !defined (DC) && !defined (_PSP) && !defined (GP2X) && !defined (_NDS) && !defined(WMINPUT) && !defined(_WII) #if !defined (DC) && !defined (_PSP) && !defined (GP2X) && !defined (_NDS) && !defined(WMINPUT) && !defined(_WII)
if (GETMAJOREXECVERSION(cv_execversion.value) < 27 && ( // v2.1.22 if (GETMAJOREXECVERSION(cv_execversion.value) < 27 && ( // v2.1.22
@ -1460,26 +1460,34 @@ static void setcontrol(INT32 (*gc)[2])
keynum2 = G_KeyStringtoNum(COM_Argv(3)); keynum2 = G_KeyStringtoNum(COM_Argv(3));
keynum = G_FilterKeyByVersion(numctrl, 0, player, &keynum1, &keynum2); keynum = G_FilterKeyByVersion(numctrl, 0, player, &keynum1, &keynum2);
(void)G_CheckDoubleUsage(keynum, true); if (keynum >= 0)
// if keynum was rejected, try it again with keynum2
if (!keynum && keynum2)
{ {
keynum1 = keynum2; // push down keynum2
keynum2 = 0;
keynum = G_FilterKeyByVersion(numctrl, 0, player, &keynum1, &keynum2);
(void)G_CheckDoubleUsage(keynum, true); (void)G_CheckDoubleUsage(keynum, true);
// if keynum was rejected, try it again with keynum2
if (!keynum && keynum2)
{
keynum1 = keynum2; // push down keynum2
keynum2 = 0;
keynum = G_FilterKeyByVersion(numctrl, 0, player, &keynum1, &keynum2);
if (keynum >= 0)
(void)G_CheckDoubleUsage(keynum, true);
}
} }
gc[numctrl][0] = keynum; if (keynum >= 0)
gc[numctrl][0] = keynum;
if (keynum2) if (keynum2)
{ {
keynum = G_FilterKeyByVersion(numctrl, 1, player, &keynum1, &keynum2); keynum = G_FilterKeyByVersion(numctrl, 1, player, &keynum1, &keynum2);
if (keynum != gc[numctrl][0]) if (keynum >= 0)
gc[numctrl][1] = keynum; {
else if (keynum != gc[numctrl][0])
gc[numctrl][1] = 0; gc[numctrl][1] = keynum;
else
gc[numctrl][1] = 0;
}
} }
else else
gc[numctrl][1] = 0; gc[numctrl][1] = 0;