rnd-20030107-2-src
[rocksndiamonds.git] / src / tools.c
index d6be4813de6f8ca061360d42f66cbe1932a9f71f..16cb3984075fd88b48bec40c43a3f39ead5e8d48 100644 (file)
@@ -362,13 +362,25 @@ void FadeToFront()
   BackToFront();
 }
 
+void SetMainBackgroundImage(int graphic)
+{
+  SetMainBackgroundBitmap(graphic == IMG_NONE ? NULL :
+                         new_graphic_info[graphic].bitmap ?
+                         new_graphic_info[graphic].bitmap :
+                         new_graphic_info[IMG_BACKGROUND_DEFAULT].bitmap);
+}
+
+void SetDoorBackgroundImage(int graphic)
+{
+  SetDoorBackgroundBitmap(graphic == IMG_NONE ? NULL :
+                         new_graphic_info[graphic].bitmap ?
+                         new_graphic_info[graphic].bitmap :
+                         new_graphic_info[IMG_BACKGROUND_DEFAULT].bitmap);
+}
+
 void DrawBackground(int dest_x, int dest_y, int width, int height)
 {
-  if (DrawingOnBackground(dest_x, dest_y) && game_status != PLAYING)
-    BlitBitmap(gfx.background_bitmap, backbuffer, dest_x, dest_y,
-              width, height, dest_x, dest_y);
-  else
-    ClearRectangle(backbuffer, dest_x, dest_y, width, height);
+  ClearRectangleOnBackground(backbuffer, dest_x, dest_y, width, height);
 
   redraw_mask |= REDRAW_FIELD;
 }
@@ -666,9 +678,10 @@ void DrawPlayer(struct PlayerInfo *player)
   {
     int px = SCREENX(next_jx), py = SCREENY(next_jy);
 
-    if (element == EL_SOKOBAN_FIELD_EMPTY ||
-       Feld[next_jx][next_jy] == EL_SOKOBAN_FIELD_FULL)
-      DrawGraphicShiftedThruMask(px, py, sxx, syy, GFX_SOKOBAN_OBJEKT, 0,
+    if ((sxx || syy) &&
+       (element == EL_SOKOBAN_FIELD_EMPTY ||
+        Feld[next_jx][next_jy] == EL_SOKOBAN_FIELD_FULL))
+      DrawGraphicShiftedThruMask(px, py, sxx, syy, IMG_SOKOBAN_OBJECT, 0,
                                 NO_CUTTING);
     else
     {
@@ -678,7 +691,7 @@ void DrawPlayer(struct PlayerInfo *player)
       int frame = 0;
 #endif
 
-      if (sxx && IS_PUSHABLE(element))
+      if ((sxx || syy) && IS_PUSHABLE(element))
       {
        graphic = el_dir_act2img(element, player->MovDir, GFX_ACTION_MOVING);
 #if 1
@@ -732,7 +745,7 @@ void DrawPlayer(struct PlayerInfo *player)
 #endif
 
     if (game.emulation == EMU_SUPAPLEX)
-      DrawGraphic(sx, sy, GFX_SP_DISK_RED, 0);
+      DrawGraphic(sx, sy, IMG_SP_DISK_RED, 0);
     else
       DrawGraphicThruMask(sx, sy, graphic, frame);
   }
@@ -1753,6 +1766,7 @@ void DrawLevel()
 {
   int x,y;
 
+  SetDrawBackgroundMask(REDRAW_NONE);
   ClearWindow();
 
   for(x=BX1; x<=BX2; x++)