Fixes keypad joystick emulation with glvideo

* This prevents resetting the joystick to the origin too soon when key is being held down
    * Verified doesn't affect legacy X11 xvideo input processing
This commit is contained in:
Aaron Culliney 2014-09-21 15:01:02 -07:00
parent c3ac3e8f1c
commit 5e9e98bf88

View File

@ -289,12 +289,26 @@ void c_keys_handle_input(int scancode, int pressed)
// and allow regular PC arrow keys to manipulate joystick...
key_pressed[SCODE_U] || key_pressed[SCODE_D] || key_pressed[SCODE_L] || key_pressed[SCODE_R]);
if (key_pressed[ SCODE_KPAD_C ] || (auto_recenter && joy_axis_unpressed))
if (key_pressed[ SCODE_KPAD_C ])
{
joy_x = HALF_JOY_RANGE;
joy_y = HALF_JOY_RANGE;
}
if (auto_recenter) {
static int unpressed_count = 0;
if (joy_axis_unpressed) {
++unpressed_count;
if (unpressed_count > 2) {
unpressed_count = 0;
joy_x = HALF_JOY_RANGE;
joy_y = HALF_JOY_RANGE;
}
} else {
unpressed_count = 0;
}
}
if (key_pressed[ SCODE_KPAD_UL ] || key_pressed[ SCODE_KPAD_U ] || key_pressed[ SCODE_KPAD_UR ] ||/* regular arrow up */key_pressed[ SCODE_U ])
{
if (joy_y > joy_step)