X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fevents.c;h=dccf50030d251c58bf543a94ee820a4dec3372a9;hb=1c772a2dcd5e189fb7d6c20be9540aa37ed9de0b;hp=a870bf7433f4156337d627d82632ecf2ebf53a14;hpb=b62e4322b0b7d01aac9340adaddba753e04c9c51;p=rocksndiamonds.git 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; }