mirror of
https://github.com/blendogames/thirtyflightsofloving.git
synced 2024-11-12 23:54:26 +00:00
Joystick can now select menu items. Added various gamepad menu interactions.
This commit is contained in:
parent
ebb29bd2ad
commit
3ee852d7e2
7 changed files with 44 additions and 1 deletions
|
@ -1070,7 +1070,8 @@ void Key_Event (int key, qboolean down, unsigned time)
|
|||
return; // ignore most autorepeats
|
||||
|
||||
// if (key >= 200 && !keybindings[key])
|
||||
if ( (key >= 200) && !keybindings[key] && (key != K_MWHEELDOWN) && (key != K_MWHEELUP)) // bitshifter's fix
|
||||
if ( (key >= 200) && !keybindings[key] && (key != K_MWHEELDOWN) && (key != K_MWHEELUP)
|
||||
&& (key != K_JOY_UP) && (key != K_JOY_DOWN)) // bitshifter's fix
|
||||
Com_Printf ("%s is unbound, hit F4 to set.\n", Key_KeynumToString (key) );
|
||||
}
|
||||
else
|
||||
|
|
|
@ -151,6 +151,10 @@ typedef enum {
|
|||
|
||||
K_MWHEELDOWN,
|
||||
K_MWHEELUP,
|
||||
|
||||
K_JOY_UP, //BC 1/30/2024 Joystick menu selection
|
||||
K_JOY_DOWN, //BC 1/30/2024 Joystick menu selection
|
||||
|
||||
} keynum_t;
|
||||
|
||||
/*
|
||||
|
|
|
@ -219,6 +219,9 @@ const char *Menu_Credits_Key (int key)
|
|||
switch (key)
|
||||
{
|
||||
#ifndef NOTTHIRTYFLIGHTS
|
||||
|
||||
case K_JOY1: //BC 1/30/2024 gamepad A button
|
||||
case K_JOY2: //BC 1/30/2024 gamepad B button
|
||||
case K_SPACE:
|
||||
case K_ENTER:
|
||||
#endif
|
||||
|
|
|
@ -489,6 +489,7 @@ const char *Menu_Main_Key (int key)
|
|||
break;
|
||||
|
||||
case K_AUX31: //BC 1/30/2024 dpad down.
|
||||
case K_JOY_DOWN: //BC 1/30/2024 joystick down.
|
||||
case K_KP_DOWNARROW:
|
||||
case K_DOWNARROW:
|
||||
if (++m_main_cursor >= MAIN_ITEMS)
|
||||
|
@ -496,6 +497,7 @@ const char *Menu_Main_Key (int key)
|
|||
return sound;
|
||||
|
||||
case K_AUX29: //BC 1/30/2024 dpad up.
|
||||
case K_JOY_UP: //BC 1/30/2024 joystick up.
|
||||
case K_KP_UPARROW:
|
||||
case K_UPARROW:
|
||||
if (--m_main_cursor < 0)
|
||||
|
|
|
@ -100,6 +100,7 @@ const char *Menu_Quit_Key (int key)
|
|||
#ifndef NOTTHIRTYFLIGHTS
|
||||
case K_BACKSPACE:
|
||||
#endif
|
||||
case K_JOY2: //BC 1/30/2024 gamepad B button
|
||||
case K_ESCAPE:
|
||||
case 'n':
|
||||
case 'N':
|
||||
|
@ -109,6 +110,7 @@ const char *Menu_Quit_Key (int key)
|
|||
UI_PopMenu ();
|
||||
break;
|
||||
|
||||
case K_JOY1: //BC 1/30/2024 gamepad A button
|
||||
case 'Y':
|
||||
case 'y':
|
||||
cls.key_dest = key_console;
|
||||
|
|
|
@ -554,6 +554,7 @@ const char *UI_DefaultMenuKey (menuframework_s *m, int key)
|
|||
UI_PopMenu ();
|
||||
return ui_menu_out_sound;
|
||||
case K_AUX29: //BC 1/30/2024 dpad up.
|
||||
case K_JOY_UP: //BC 1/30/2024 joystick up.
|
||||
case K_KP_UPARROW:
|
||||
case K_UPARROW:
|
||||
if ( m )
|
||||
|
@ -567,6 +568,7 @@ const char *UI_DefaultMenuKey (menuframework_s *m, int key)
|
|||
}
|
||||
break;
|
||||
case K_AUX31: //BC 1/30/2024 dpad down.
|
||||
case K_JOY_DOWN: //BC 1/30/2024 joystick down.
|
||||
case K_TAB:
|
||||
case K_KP_DOWNARROW:
|
||||
case K_DOWNARROW:
|
||||
|
|
|
@ -142,6 +142,7 @@ qboolean mouseparmsvalid;
|
|||
int window_center_x, window_center_y;
|
||||
RECT window_rect;
|
||||
|
||||
qboolean joystickVerticalMoved;
|
||||
|
||||
/*
|
||||
===========
|
||||
|
@ -509,6 +510,8 @@ void IN_Init (void)
|
|||
|
||||
IN_StartupMouse ();
|
||||
IN_StartupJoystick ();
|
||||
|
||||
joystickVerticalMoved = false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -970,6 +973,32 @@ void IN_JoyMove (usercmd_t *cmd)
|
|||
cmd->forwardmove += (fAxisValue * joy_forwardsensitivity->value) * speed * cl_forwardspeed->value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//BC 1/30/2024 allow joystick menu selection.
|
||||
if (fabs(fAxisValue) > joy_forwardthreshold->value)
|
||||
{
|
||||
if (fAxisValue < 0)
|
||||
{
|
||||
//joystick up.
|
||||
//Com_Printf("joystick up\n");
|
||||
Key_Event(K_JOY_UP, true, sys_msg_time);
|
||||
}
|
||||
else
|
||||
{
|
||||
//joystick down.
|
||||
Key_Event(K_JOY_DOWN, true, sys_msg_time);
|
||||
}
|
||||
|
||||
joystickVerticalMoved = true;
|
||||
}
|
||||
else if (joystickVerticalMoved == true)
|
||||
{
|
||||
joystickVerticalMoved = false;
|
||||
Key_Event(K_JOY_UP, false, 0);
|
||||
Key_Event(K_JOY_DOWN, false, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case AxisSide:
|
||||
|
|
Loading…
Reference in a new issue