fixed redraw/fade bugs when redefining the playfield size or position
[rocksndiamonds.git] / src / tools.c
index a04238724c35f92b03cd788de7ec1efdb411a070..ad2b3b32619ad586e3118f4e279974f3f40ec23a 100644 (file)
@@ -1052,6 +1052,10 @@ void getSizedGraphicSourceExt(int graphic, int frame, int tilesize,
   int src_y = g->src_y + (get_backside ? g->offset2_y : 0);
   int tilesize_capped = MIN(MAX(1, tilesize), TILESIZE);
 
+  // if no in-game graphics defined, always use standard graphic size
+  if (g->bitmaps[IMG_BITMAP_GAME] == NULL)
+    tilesize = TILESIZE;
+
   if (tilesize == gfx.standard_tile_size)
     src_bitmap = g->bitmaps[IMG_BITMAP_STANDARD];
   else if (tilesize == game.tile_size)
@@ -4361,8 +4365,6 @@ void DrawSpecialEditorDoor()
   int vy = VY - outer_border;
   int exsize = EXSIZE + 2 * outer_border;
 
-  CloseDoor(DOOR_CLOSE_2);
-
   /* draw bigger level editor toolbox window */
   BlitBitmap(gfx1->bitmap, drawto, gfx1->src_x, gfx1->src_y,
             top_border_width, top_border_height, ex, ey - top_border_height);
@@ -7996,6 +7998,7 @@ void ChangeViewportPropertiesIfNeeded()
   boolean init_video_buffer = FALSE;
   boolean init_gadgets_and_toons = FALSE;
   boolean init_em_graphics = FALSE;
+  boolean drawing_area_changed = FALSE;
 
   if (viewport.window.width  != WIN_XSIZE ||
       viewport.window.height != WIN_YSIZE)
@@ -8054,6 +8057,19 @@ void ChangeViewportPropertiesIfNeeded()
       init_em_graphics = TRUE;
     }
 
+    if (new_sx != SX ||
+       new_sy != SY ||
+       new_sxsize != SXSIZE ||
+       new_sysize != SYSIZE ||
+       new_real_sx != REAL_SX ||
+       new_real_sy != REAL_SY ||
+       new_full_sxsize != FULL_SXSIZE ||
+       new_full_sysize != FULL_SYSIZE)
+    {
+      if (!init_video_buffer)
+       drawing_area_changed = TRUE;
+    }
+
     SX = new_sx;
     SY = new_sy;
     DX = new_dx;
@@ -8094,6 +8110,11 @@ void ChangeViewportPropertiesIfNeeded()
 
     SCR_FIELDX = new_scr_fieldx;
     SCR_FIELDY = new_scr_fieldy;
+
+    gfx.drawing_area_changed = drawing_area_changed;
+
+    SetDrawDeactivationMask(REDRAW_NONE);
+    SetDrawBackgroundMask(REDRAW_FIELD);
   }
 
   if (init_video_buffer)
@@ -8101,9 +8122,6 @@ void ChangeViewportPropertiesIfNeeded()
     // printf("::: init_video_buffer\n");
 
     InitVideoBuffer(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen);
-
-    SetDrawDeactivationMask(REDRAW_NONE);
-    SetDrawBackgroundMask(REDRAW_FIELD);
   }
 
   if (init_gadgets_and_toons)