X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fevents.c;h=4755d51ff57dc975ba1a27f91d45f02f7847fe2f;hb=9c4b703ca8d2d27df28d74f40e5f2c7515b1ca51;hp=846527641a28506f152f75fd380bc3ff52bc4252;hpb=098a2e44080c6286cc4252287922fd9abfeee4dc;p=rocksndiamonds.git diff --git a/src/events.c b/src/events.c index 84652764..4755d51f 100644 --- a/src/events.c +++ b/src/events.c @@ -2187,7 +2187,7 @@ static void HandleTileCursor(int dx, int dy, int button) (dx < 0 ? MB_LEFTBUTTON : dx > 0 ? MB_RIGHTBUTTON : MB_RELEASED)); } - else + else if (!tile_cursor.moving) { int old_xpos = tile_cursor.xpos; int old_ypos = tile_cursor.ypos; @@ -2242,6 +2242,8 @@ void HandleJoystick() static unsigned int joytest_delay = 0; static unsigned int joytest_delay_value = GADGET_FRAME_DELAY; static int joytest_last = 0; + int delay_value_first = GADGET_FRAME_DELAY_FIRST; + int delay_value = GADGET_FRAME_DELAY; int joystick = HandleJoystickForAllPlayers(); int keyboard = key_joystick_mapping; int joy = (joystick | keyboard); @@ -2254,6 +2256,7 @@ void HandleJoystick() int newbutton = (AnyJoystickButton() == JOY_BUTTON_NEW_PRESSED); int dx = (left ? -1 : right ? 1 : 0); int dy = (up ? -1 : down ? 1 : 0); + boolean use_delay_value_first = (joytest != joytest_last); if (HandleGlobalAnimClicks(-1, -1, newbutton)) { @@ -2263,10 +2266,18 @@ void HandleJoystick() if (level.game_engine_type == GAME_ENGINE_TYPE_MM) { - // when playing MM style levels, also use delay for keyboard events if (game_status == GAME_MODE_PLAYING) + { + // when playing MM style levels, also use delay for keyboard events joytest |= keyboard; + // only use first delay value for new events, but not for changed events + use_delay_value_first = (!joytest != !joytest_last); + + // only use delay after the initial keyboard event + delay_value = 0; + } + // for any joystick or keyboard event, enable playfield tile cursor if (dx || dy || button) SetTileCursorEnabled(TRUE); @@ -2281,7 +2292,7 @@ void HandleJoystick() { /* first start with longer delay, then continue with shorter delay */ joytest_delay_value = - (joytest != joytest_last ? GADGET_FRAME_DELAY_FIRST : GADGET_FRAME_DELAY); + (use_delay_value_first ? delay_value_first : delay_value); } joytest_last = joytest;