Enable d-pad on the vote screen, allow aborting connection with more joy buttons

This commit is contained in:
wolfy852 2019-01-10 06:06:18 -06:00
parent 73369679f5
commit 92a60b32de
4 changed files with 25 additions and 3 deletions

View file

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

View file

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

View file

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

View file

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