fixed forced screen redraw in every frame (again)
[rocksndiamonds.git] / src / tools.c
index cee9fae4b12280e7f050ae465b091e93e89550b0..552eef2fbb5faa9234f13d0dda57b0cc117a22e5 100644 (file)
@@ -293,6 +293,9 @@ static void DrawMaskedBorderExt_Rect(int x, int y, int width, int height,
 {
   Bitmap *bitmap = getGlobalBorderBitmapFromGameStatus();
 
+  if (x == -1 && y == -1)
+    return;
+
   if (blit_to_screen)
     BlitToScreenMasked(bitmap, x, y, width, height, x, y);
   else
@@ -503,8 +506,14 @@ static void PrintFrameTimeDebugging()
 
 void BackToFront()
 {
+  static int last_redraw_mask = REDRAW_NONE;
+
+  // force screen redraw in every frame to continue drawing global animations
+  // (but always use the last redraw mask to prevent unwanted side effects)
   if (redraw_mask == REDRAW_NONE)
-    return;
+    redraw_mask = last_redraw_mask;
+
+  last_redraw_mask = redraw_mask;
 
 #if 1
   // masked border now drawn immediately when blitting backbuffer to window
@@ -549,9 +558,6 @@ void BackToFront()
 
   redraw_mask = REDRAW_NONE;
 
-  // force screen redraw in every frame to continue drawing global animations
-  redraw_mask = REDRAW_ALL;
-
 #if DEBUG_FRAME_TIME
   PrintFrameTimeDebugging();
 #endif
@@ -4228,7 +4234,7 @@ unsigned int MoveDoor(unsigned int door_state)
     { DX, DY, DXSIZE, DYSIZE },
     { VX, VY, VXSIZE, VYSIZE }
   };
-  static int door1 = DOOR_OPEN_1;
+  static int door1 = DOOR_CLOSE_1;
   static int door2 = DOOR_CLOSE_2;
   unsigned int door_delay = 0;
   unsigned int door_delay_value;