From: Holger Schemel Date: Sun, 2 Jul 2017 21:55:00 +0000 (+0200) Subject: added slightly larger delay after first joystick movement on menu screens X-Git-Tag: 4.0.1.0~34 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=1c772a2dcd5e189fb7d6c20be9540aa37ed9de0b;p=rocksndiamonds.git added slightly larger delay after first joystick movement on menu screens --- diff --git a/src/events.c b/src/events.c index a870bf74..dccf5003 100644 --- a/src/events.c +++ b/src/events.c @@ -2010,10 +2010,23 @@ void HandleJoystick() case GAME_MODE_INFO: { static unsigned int joystickmove_delay = 0; + static unsigned int joystickmove_delay_value = GADGET_FRAME_DELAY; + static int joystick_last = 0; if (joystick && !button && - !DelayReached(&joystickmove_delay, GADGET_FRAME_DELAY)) + !DelayReached(&joystickmove_delay, joystickmove_delay_value)) + { + /* delay joystick actions if buttons/axes continually pressed */ newbutton = dx = dy = 0; + } + else + { + /* start with longer delay, then continue with shorter delay */ + if (joystick != joystick_last) + joystickmove_delay_value = GADGET_FRAME_DELAY_FIRST; + else + joystickmove_delay_value = GADGET_FRAME_DELAY; + } if (game_status == GAME_MODE_TITLE) HandleTitleScreen(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); @@ -2027,6 +2040,9 @@ void HandleJoystick() HandleSetupScreen(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); else if (game_status == GAME_MODE_INFO) HandleInfoScreen(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); + + joystick_last = joystick; + break; }