fixed synchronization problem when configuring game controller
[rocksndiamonds.git] / src / screens.c
index 98c7b68ace401ba8fd957d093e854df88b90b466..533cf4c4ce2cb84338297ff56d9de7ec122911a5 100644 (file)
@@ -8630,11 +8630,6 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick)
     { 282, 210, MARKER_AXIS_Y, "righty",       },
   };
 
-  unsigned int event_frame_delay = 0;
-  unsigned int event_frame_delay_value = GAME_FRAME_DELAY;
-
-  ResetDelayCounter(&event_frame_delay);
-
   if (!bitmaps_initialized)
   {
     controller = LoadCustomImage("joystick/controller.png");
@@ -8766,6 +8761,12 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick)
 
       screen_initialized = TRUE;
 
+      unsigned int event_frame_delay = 0;
+      unsigned int event_frame_delay_value = GAME_FRAME_DELAY;
+
+      // reset frame delay counter directly after updating screen
+      ResetDelayCounter(&event_frame_delay);
+
       while (NextValidEvent(&event))
       {
        switch (event.type)
@@ -9745,9 +9746,8 @@ static void CreateScreenMenubuttons(void)
     int type = GD_TYPE_NORMAL_BUTTON;
     boolean checked = FALSE;
 
-    // do not use touch buttons if touch controls are disabled
-    if (is_touch_button &&
-       strEqual(setup.touch.control_type, TOUCH_CONTROL_OFF))
+    // do not use touch buttons if overlay touch buttons are disabled
+    if (is_touch_button && !setup.touch.overlay_buttons)
       continue;
 
     event_mask = menubutton_info[i].event_mask;