moved video frame synchronization to single location (screen update)
[rocksndiamonds.git] / src / tools.c
index 9f6526a3a562416d90f23745436e1592aac0ba81..7f870a64db40378ebfca13f31fa864c18ff5783f 100644 (file)
@@ -174,9 +174,6 @@ static int el_act2crm(int, int);
 static struct GadgetInfo *tool_gadget[NUM_TOOL_BUTTONS];
 static int request_gadget_id = -1;
 
-static unsigned int sync_frame_delay = 0;
-static unsigned int sync_frame_delay_value = GAME_FRAME_DELAY;
-
 static char *print_if_not_empty(int element)
 {
   static char *s = NULL;
@@ -590,6 +587,17 @@ void BackToFront()
 #endif
 }
 
+void BackToFront_WithFrameDelay(unsigned int frame_delay_value)
+{
+  unsigned int frame_delay_value_old = GetVideoFrameDelay();
+
+  SetVideoFrameDelay(frame_delay_value);
+
+  BackToFront();
+
+  SetVideoFrameDelay(frame_delay_value_old);
+}
+
 static void FadeCrossSaveBackbuffer()
 {
   BlitBitmap(backbuffer, bitmap_db_cross, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
@@ -3547,7 +3555,7 @@ void WaitForEventToContinue()
 
     DoAnimation();
 
-    WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value);
+    BackToFront();
   }
 }
 
@@ -3721,8 +3729,6 @@ static int RequestHandleEvents(unsigned int req_state)
     }
 
     BackToFront();
-
-    WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value);
   }
 
   return result;