rnd-20061028-1-src
[rocksndiamonds.git] / src / tools.c
index f6441aa09f642e09c758435eaa345639a5d91c15..ddc8353b5c9da4a33b9d0caa3d3911f3690ac87d 100644 (file)
@@ -533,9 +533,8 @@ void FadeExt(int fade_mask, int fade_mode)
 {
   void (*draw_border_function)(void) = NULL;
   Bitmap *bitmap = (fade_mode == FADE_MODE_CROSSFADE ? bitmap_db_cross : NULL);
-  int fade_delay = menu.fade_delay;
-  int post_delay = (fade_mode == FADE_MODE_FADE_OUT ? menu.post_delay : 0);
   int x, y, width, height;
+  int fade_delay, post_delay;
 
   if (fade_mask & REDRAW_FIELD)
   {
@@ -544,6 +543,9 @@ void FadeExt(int fade_mask, int fade_mode)
     width  = FULL_SXSIZE;
     height = FULL_SYSIZE;
 
+    fade_delay = menu.fade_delay;
+    post_delay = (fade_mode == FADE_MODE_FADE_OUT ? menu.post_delay : 0);
+
     draw_border_function = DrawMaskedBorder_FIELD;
   }
   else         /* REDRAW_ALL */
@@ -552,6 +554,9 @@ void FadeExt(int fade_mask, int fade_mode)
     y = 0;
     width  = WIN_XSIZE;
     height = WIN_YSIZE;
+
+    fade_delay = title.fade_delay_final;
+    post_delay = (fade_mode == FADE_MODE_FADE_OUT ? title.post_delay_final : 0);
   }
 
   redraw_mask |= fade_mask;
@@ -622,21 +627,46 @@ void SetPanelBackground()
   SetDoorBackgroundBitmap(bitmap_db_panel);
 }
 
-void DrawBackground(int dst_x, int dst_y, int width, int height)
+void DrawBackground(int x, int y, int width, int height)
 {
-#if 1
-  ClearRectangleOnBackground(drawto, dst_x, dst_y, width, height);
+  /* !!! "drawto" might still point to playfield buffer here (see below) !!! */
+  /* (when entering hall of fame after playing) */
+#if 0
+  ClearRectangleOnBackground(drawto, x, y, width, height);
 #else
-  ClearRectangleOnBackground(backbuffer, dst_x, dst_y, width, height);
+  ClearRectangleOnBackground(backbuffer, x, y, width, height);
 #endif
 
   redraw_mask |= REDRAW_FIELD;
 }
 
+void DrawBackgroundForFont(int x, int y, int width, int height, int font_nr)
+{
+  struct FontBitmapInfo *font = getFontBitmapInfo(font_nr);
+
+  if (font->bitmap == NULL)
+    return;
+
+  DrawBackground(x, y, width, height);
+}
+
+void DrawBackgroundForGraphic(int x, int y, int width, int height, int graphic)
+{
+  struct GraphicInfo *g = &graphic_info[graphic];
+
+  if (g->bitmap == NULL)
+    return;
+
+  DrawBackground(x, y, width, height);
+}
+
 void ClearWindow()
 {
+  /* !!! "drawto" might still point to playfield buffer here (see above) !!! */
+  /* (when entering hall of fame after playing) */
   DrawBackground(REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
 
+  /* !!! maybe this should be done before clearing the background !!! */
   if (setup.soft_scrolling && game_status == GAME_MODE_PLAYING)
   {
     ClearRectangle(fieldbuffer, 0, 0, FXSIZE, FYSIZE);