rnd-20030106-1-src
authorHolger Schemel <info@artsoft.org>
Mon, 6 Jan 2003 02:00:34 +0000 (03:00 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:39:29 +0000 (10:39 +0200)
16 files changed:
src/cartoons.c
src/conf_gfx.c
src/conf_gfx.h
src/conftime.h
src/editor.c
src/game.c
src/init.c
src/libgame/gadgets.c
src/libgame/system.c
src/libgame/system.h
src/libgame/text.c
src/libgame/x11.h
src/main.h
src/screens.c
src/tape.c
src/tools.c

index 0278ed6d946ea366d3916bf2d1f2bc1f29042f43..45de45be169d868d9fee68bbd293e61b2c69791b 100644 (file)
@@ -54,7 +54,7 @@
 struct ToonInfo toons[NUM_TOONS] =
 {
   {
-    IMG_MENU_TOONS,
+    IMG_GLOBAL_TOONS,
     DWARF_XSIZE, DWARF_YSIZE,
     DWARF_X, DWARF_Y,
     DWARF_FRAMES,
@@ -65,7 +65,7 @@ struct ToonInfo toons[NUM_TOONS] =
     ANIMPOS_DOWN
   },
   {
-    IMG_MENU_TOONS,
+    IMG_GLOBAL_TOONS,
     DWARF_XSIZE, DWARF_YSIZE,
     DWARF_X, DWARF2_Y,
     DWARF_FRAMES,
@@ -76,7 +76,7 @@ struct ToonInfo toons[NUM_TOONS] =
     ANIMPOS_DOWN
   },
   {
-    IMG_MENU_TOONS,
+    IMG_GLOBAL_TOONS,
     JUMPER_XSIZE, JUMPER_YSIZE,
     JUMPER_X, JUMPER_Y,
     JUMPER_FRAMES,
@@ -87,7 +87,7 @@ struct ToonInfo toons[NUM_TOONS] =
     ANIMPOS_DOWN
   },
   {
-    IMG_MENU_TOONS,
+    IMG_GLOBAL_TOONS,
     CLOWN_XSIZE, CLOWN_YSIZE,
     CLOWN_X, CLOWN_Y,
     CLOWN_FRAMES,
@@ -98,7 +98,7 @@ struct ToonInfo toons[NUM_TOONS] =
     ANIMPOS_ANY
   },
   {
-    IMG_MENU_TOONS,
+    IMG_GLOBAL_TOONS,
     BIRD_XSIZE, BIRD_YSIZE,
     BIRD1_X, BIRD1_Y,
     BIRD_FRAMES,
@@ -109,7 +109,7 @@ struct ToonInfo toons[NUM_TOONS] =
     ANIMPOS_UPPER
   },
   {
-    IMG_MENU_TOONS,
+    IMG_GLOBAL_TOONS,
     BIRD_XSIZE, BIRD_YSIZE,
     BIRD2_X, BIRD2_Y,
     BIRD_FRAMES,
index 72e5e04a6ed26b8905cf1bbcddae0de851546a47..20f71882790df95fe0b0c5f4f02ec078789565cd 100644 (file)
@@ -2583,14 +2583,17 @@ struct ConfigInfo image_config[] =
   /* images not associated to game elements (used for menu screens etc.) */
   /* keyword to stop parser: "NO_MORE_ELEMENT_IMAGES" <-- do not change! */
 
-  { "menu.frame",                              "RocksScreen.pcx"       },
-  { "menu.background",                         UNDEFINED_FILENAME      },
-  { "menu.door",                               "RocksDoor.pcx"         },
-  { "menu.toons",                              "RocksToons.pcx"        },
-  { "menu.font_big",                           "RocksFontBig.pcx"      },
-  { "menu.font_small",                         "RocksFontSmall.pcx"    },
-  { "menu.font_medium",                                "RocksFontMedium.pcx"   },
-  { "menu.font_em",                            "RocksFontEM.pcx"       },
+  { "global.border",                           "RocksScreen.pcx"       },
+  { "global.door",                             "RocksDoor.pcx"         },
+  { "global.toons",                            "RocksToons.pcx"        },
+
+  { "font.big",                                        "RocksFontBig.pcx"      },
+  { "font.medium",                             "RocksFontMedium.pcx"   },
+  { "font.small",                              "RocksFontSmall.pcx"    },
+  { "font.em",                                 "RocksFontEM.pcx"       },
+
+  { "background.default",                      UNDEFINED_FILENAME      },
+  { "background.door",                         UNDEFINED_FILENAME      },
 
   { "info.font_em_1",                          "RocksFontEM.pcx"       },
   { "info.font_em_1.xpos",                     "0"                     },
index 9d29cde6209ae3f20f6ab228d6759d2f10046e51..526687044a044fcbe11c2f21e4cc6aee3e75a7d0 100644 (file)
 #define IMG_CUSTOM_125                         733
 #define IMG_CUSTOM_126                         734
 #define IMG_CUSTOM_127                         735
-#define IMG_MENU_FRAME                         736
-#define IMG_MENU_BACKGROUND                    737
-#define IMG_MENU_DOOR                          738
-#define IMG_MENU_TOONS                         739
-#define IMG_MENU_FONT_BIG                      740
-#define IMG_MENU_FONT_SMALL                    741
-#define IMG_MENU_FONT_MEDIUM                   742
-#define IMG_MENU_FONT_EM                       743
-#define IMG_INFO_FONT_EM_1                     744
-#define IMG_INFO_FONT_EM_2                     745
-#define IMG_INFO_FONT_EM_3                     746
-#define IMG_INFO_FONT_EM_4                     747
-#define IMG_INFO_FONT_EM_5                     748
+#define IMG_GLOBAL_BORDER                      736
+#define IMG_GLOBAL_DOOR                                737
+#define IMG_GLOBAL_TOONS                       738
+#define IMG_FONT_BIG                           739
+#define IMG_FONT_MEDIUM                                740
+#define IMG_FONT_SMALL                         741
+#define IMG_FONT_EM                            742
+#define IMG_BACKGROUND_DEFAULT                 743
+#define IMG_BACKGROUND_DOOR                    744
+#define IMG_INFO_FONT_EM_1                     745
+#define IMG_INFO_FONT_EM_2                     746
+#define IMG_INFO_FONT_EM_3                     747
+#define IMG_INFO_FONT_EM_4                     748
+#define IMG_INFO_FONT_EM_5                     749
 
-#define NUM_IMAGE_FILES                                749
+#define NUM_IMAGE_FILES                                750
 
 #endif /* CONF_GFX_H */
index da59e80bb8a6796ae622479b16da3dd2973ffa08..5f9f105d4f3701f82e10174ddacf1bb55450ca7f 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2003-01-05 21:26]"
+#define COMPILE_DATE_STRING "[2003-01-06 02:55]"
index 60be1aaba58d9c370f8951f270ba5055b4f480b0..cd81ccbd5946670048632a1beba2ae4f3206a22c 100644 (file)
@@ -1606,7 +1606,7 @@ static void ScrollMiniLevel(int from_x, int from_y, int scroll)
 
 static void CreateControlButtons()
 {
-  Bitmap *gd_bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
+  Bitmap *gd_bitmap = new_graphic_info[IMG_GLOBAL_DOOR].bitmap;
   struct GadgetInfo *gi;
   unsigned long event_mask;
   int i;
@@ -1827,7 +1827,7 @@ static void CreateCounterButtons()
 
     for (j=0; j<2; j++)
     {
-      Bitmap *gd_bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
+      Bitmap *gd_bitmap = new_graphic_info[IMG_GLOBAL_DOOR].bitmap;
       struct GadgetInfo *gi;
       int id = (j == 0 ?
                counterbutton_info[i].gadget_id_down :
@@ -2049,7 +2049,7 @@ static void CreateTextInputGadgets()
 
   for (i=0; i<ED_NUM_TEXTINPUT; i++)
   {
-    Bitmap *gd_bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
+    Bitmap *gd_bitmap = new_graphic_info[IMG_GLOBAL_DOOR].bitmap;
     int gd_x, gd_y;
     struct GadgetInfo *gi;
     unsigned long event_mask;
@@ -2096,7 +2096,7 @@ static void CreateScrollbarGadgets()
   for (i=0; i<ED_NUM_SCROLLBARS; i++)
   {
     int id = scrollbar_info[i].gadget_id;
-    Bitmap *gd_bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
+    Bitmap *gd_bitmap = new_graphic_info[IMG_GLOBAL_DOOR].bitmap;
     int gd_x1, gd_x2, gd_y1, gd_y2;
     struct GadgetInfo *gi;
     int items_max, items_visible, item_position;
@@ -2161,7 +2161,7 @@ static void CreateScrollbarGadgets()
 
 static void CreateCheckbuttonGadgets()
 {
-  Bitmap *gd_bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
+  Bitmap *gd_bitmap = new_graphic_info[IMG_GLOBAL_DOOR].bitmap;
   struct GadgetInfo *gi;
   unsigned long event_mask;
   int gd_x1, gd_x2, gd_x3, gd_x4, gd_y;
@@ -2440,7 +2440,7 @@ void DrawLevelEd()
   }
 
   /* copy default editor door content to main double buffer */
-  BlitBitmap(new_graphic_info[IMG_MENU_DOOR].bitmap, drawto,
+  BlitBitmap(new_graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
             DOOR_GFX_PAGEX6, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
 
   /* draw mouse button brush elements */
@@ -2458,7 +2458,7 @@ void DrawLevelEd()
   DrawSpecialEditorDoor();
 
   /* draw new control window */
-  BlitBitmap(new_graphic_info[IMG_MENU_DOOR].bitmap, drawto,
+  BlitBitmap(new_graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
             DOOR_GFX_PAGEX8, 236, EXSIZE, EYSIZE, EX, EY);
 
   redraw_mask |= REDRAW_ALL;
@@ -2650,7 +2650,7 @@ static void PickDrawingElement(int button, int element)
 
 static void DrawDrawingWindow()
 {
-  SetBackgroundBitmap(NULL);
+  SetMainBackgroundBitmap(NULL);
   ClearWindow();
   UnmapLevelEditorWindowGadgets();
 
@@ -2710,7 +2710,7 @@ static void DrawLevelInfoWindow()
   int font_color = FC_GREEN;
   int i, x, y;
 
-  SetBackgroundBitmap(new_graphic_info[IMG_MENU_BACKGROUND].bitmap);
+  SetMainBackgroundBitmap(new_graphic_info[IMG_BACKGROUND_DEFAULT].bitmap);
   ClearWindow();
   UnmapLevelEditorWindowGadgets();
 
@@ -2943,7 +2943,7 @@ static void DrawPropertiesWindow()
     { -1, NULL, NULL }
   };
 
-  SetBackgroundBitmap(new_graphic_info[IMG_MENU_BACKGROUND].bitmap);
+  SetMainBackgroundBitmap(new_graphic_info[IMG_BACKGROUND_DEFAULT].bitmap);
   ClearWindow();
   UnmapLevelEditorWindowGadgets();
 
index 17473731b737bf0b128d41559df8682fb5d84eb5..7754a4c0ca185578b5d20567e2cd68a63a1fdd9f 100644 (file)
@@ -974,7 +974,7 @@ void InitGame()
   FadeToFront();
 
   /* copy default game door content to main double buffer */
-  BlitBitmap(new_graphic_info[IMG_MENU_DOOR].bitmap, drawto,
+  BlitBitmap(new_graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
             DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
 
   if (level_nr < 100)
@@ -6969,7 +6969,7 @@ void CreateGameButtons()
 
   for (i=0; i<NUM_GAME_BUTTONS; i++)
   {
-    Bitmap *gd_bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
+    Bitmap *gd_bitmap = new_graphic_info[IMG_GLOBAL_DOOR].bitmap;
     struct GadgetInfo *gi;
     int button_type;
     boolean checked;
index a77779d9e8f9f99a8a98ef609bc55c9fdc16350e..a10e8e6bf80ad5b0f277531c85fddf3ae54e2bad 100644 (file)
@@ -215,12 +215,15 @@ static void ReinitializeGraphics()
   InitGraphicInfo();           /* initialize graphic info from config file */
 
   InitFontInfo(bitmap_font_initial,
-              new_graphic_info[IMG_MENU_FONT_BIG].bitmap,
-              new_graphic_info[IMG_MENU_FONT_MEDIUM].bitmap,
-              new_graphic_info[IMG_MENU_FONT_SMALL].bitmap,
-              new_graphic_info[IMG_MENU_FONT_EM].bitmap);
+              new_graphic_info[IMG_FONT_BIG].bitmap,
+              new_graphic_info[IMG_FONT_MEDIUM].bitmap,
+              new_graphic_info[IMG_FONT_SMALL].bitmap,
+              new_graphic_info[IMG_FONT_EM].bitmap);
 
-  SetBackgroundBitmap(NULL);
+  SetMainBackgroundBitmap(new_graphic_info[IMG_BACKGROUND_DEFAULT].bitmap);
+  SetDoorBackgroundBitmap(new_graphic_info[IMG_BACKGROUND_DOOR].bitmap ?
+                         new_graphic_info[IMG_BACKGROUND_DOOR].bitmap :
+                         new_graphic_info[IMG_BACKGROUND_DEFAULT].bitmap);
 
   InitGadgets();
   InitToons();
@@ -483,7 +486,7 @@ void InitGfxBackground()
   fieldbuffer = bitmap_db_field;
   SetDrawtoField(DRAW_BACKBUFFER);
 
-  BlitBitmap(new_graphic_info[IMG_MENU_FRAME].bitmap, backbuffer,
+  BlitBitmap(new_graphic_info[IMG_GLOBAL_BORDER].bitmap, backbuffer,
             0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
   ClearRectangle(backbuffer, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
   ClearRectangle(bitmap_db_door, 0, 0, 3 * DXSIZE, DYSIZE + VYSIZE);
@@ -780,7 +783,7 @@ static void InitGraphicInfo()
   int src_x, src_y;
   int first_frame, last_frame;
   int i;
-#if defined(TARGET_X11_NATIVE)
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
   Pixmap src_pixmap;
   XGCValues clip_gc_values;
   unsigned long clip_gc_valuemask;
@@ -808,7 +811,7 @@ static void InitGraphicInfo()
     i++;
   }
 
-#if defined(TARGET_X11_NATIVE)
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
   if (clipmasks_initialized)
   {
     for (i=0; i<NUM_IMAGE_FILES; i++)
@@ -933,7 +936,7 @@ static void InitGraphicInfo()
            src_x, src_y);
     }
 
-#if defined(TARGET_X11_NATIVE)
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
     /* currently we need only a tile clip mask from the first frame */
     getGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
 
@@ -960,7 +963,7 @@ static void InitGraphicInfo()
 #endif
   }
 
-#if defined(TARGET_X11_NATIVE)
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
   if (copy_clipmask_gc)
     XFreeGC(display, copy_clipmask_gc);
 #endif
index 9dfea83896e25a33d61c3a90899d8e28e40a158d..2c06d4bda99a31cdae41f239b992092fc0981a92 100644 (file)
@@ -202,15 +202,16 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
          BlitBitmapOnBackground(gd->bitmap, drawto,
                                 gd->x, gd->y + gi->border.size,
                                 gi->width, design_body,
-                                xpos, ypos + gi->border.size
-                                + i * design_body);
+                                xpos,
+                                ypos + gi->border.size + i * design_body);
 
        /* remaining middle part of gadget */
        if (step_size_remain > 0)
          BlitBitmapOnBackground(gd->bitmap, drawto,
                                 gd->x,  gd->y + gi->border.size,
                                 gi->width, step_size_remain,
-                                xpos, ypos + gi->border.size
+                                xpos,
+                                ypos + gi->border.size
                                 + num_steps * design_body);
 
        /* lower part of gadget */
@@ -234,33 +235,37 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
        int step_size_remain = size_body - num_steps * design_body;
 
        /* clear scrollbar area */
-       ClearRectangle(backbuffer, gi->x, gi->y, gi->width, gi->height);
+       ClearRectangleOnBackground(backbuffer, gi->x, gi->y,
+                                  gi->width, gi->height);
 
        /* left part of gadget */
-       BlitBitmap(gd->bitmap, drawto,
-                  gd->x, gd->y,
-                  gi->border.size, gi->height,
-                  xpos, ypos);
+       BlitBitmapOnBackground(gd->bitmap, drawto,
+                              gd->x, gd->y,
+                              gi->border.size, gi->height,
+                              xpos, ypos);
 
        /* middle part of gadget */
        for (i=0; i<num_steps; i++)
-         BlitBitmap(gd->bitmap, drawto,
-                    gd->x + gi->border.size, gd->y,
-                    design_body, gi->height,
-                    xpos + gi->border.size + i * design_body, ypos);
+         BlitBitmapOnBackground(gd->bitmap, drawto,
+                                gd->x + gi->border.size, gd->y,
+                                design_body, gi->height,
+                                xpos + gi->border.size + i * design_body,
+                                ypos);
 
        /* remaining middle part of gadget */
        if (step_size_remain > 0)
-         BlitBitmap(gd->bitmap, drawto,
-                    gd->x + gi->border.size, gd->y,
-                    step_size_remain, gi->height,
-                    xpos + gi->border.size + num_steps * design_body, ypos);
+         BlitBitmapOnBackground(gd->bitmap, drawto,
+                                gd->x + gi->border.size, gd->y,
+                                step_size_remain, gi->height,
+                                xpos + gi->border.size
+                                + num_steps * design_body,
+                                ypos);
 
        /* right part of gadget */
-       BlitBitmap(gd->bitmap, drawto,
-                  gd->x + design_full - gi->border.size, gd->y,
-                  gi->border.size, gi->height,
-                  xpos + size_full - gi->border.size, ypos);
+       BlitBitmapOnBackground(gd->bitmap, drawto,
+                              gd->x + design_full - gi->border.size, gd->y,
+                              gi->border.size, gi->height,
+                              xpos + size_full - gi->border.size, ypos);
       }
       break;
 
index c071fee890f37242231dc8c7bbcaaadfe2da8dc7..ff7d8e545dd9f6c0c422eea8036cbe5247c1e453 100644 (file)
@@ -155,7 +155,11 @@ void InitGfxFieldInfo(int sx, int sy, int sxsize, int sysize,
   gfx.full_sxsize = full_sxsize;
   gfx.full_sysize = full_sysize;
 
+  gfx.background_bitmap = NULL;
+  gfx.background_bitmap_mask = REDRAW_NONE;
+
   SetDrawDeactivationMask(REDRAW_NONE);                /* do not deactivate drawing */
+  SetDrawBackgroundMask(REDRAW_NONE);          /* deactivate masked drawing */
 }
 
 void InitGfxDoor1Info(int dx, int dy, int dxsize, int dysize)
@@ -186,9 +190,88 @@ void SetDrawDeactivationMask(int draw_deactivation_mask)
   gfx.draw_deactivation_mask = draw_deactivation_mask;
 }
 
-void SetBackgroundBitmap(Bitmap *background_bitmap)
+void SetDrawBackgroundMask(int draw_background_mask)
+{
+  gfx.draw_background_mask = draw_background_mask;
+}
+
+static void DrawBitmapFromTile(Bitmap *bitmap, Bitmap *tile,
+                              int dest_x, int dest_y, int width, int height)
+{
+  int bitmap_xsize = width;
+  int bitmap_ysize = height;
+  int tile_xsize = tile->width;
+  int tile_ysize = tile->height;
+  int tile_xsteps = (bitmap_xsize + tile_xsize - 1) / tile_xsize;
+  int tile_ysteps = (bitmap_ysize + tile_ysize - 1) / tile_ysize;
+  int x, y;
+
+  for (y=0; y < tile_ysteps; y++)
+  {
+    for (x=0; x < tile_xsteps; x++)
+    {
+      int draw_x = dest_x + x * tile_xsize;
+      int draw_y = dest_y + y * tile_ysize;
+      int draw_xsize = MIN(tile_xsize, bitmap_xsize - x * tile_xsize);
+      int draw_ysize = MIN(tile_ysize, bitmap_ysize - y * tile_ysize);
+
+      BlitBitmap(tile, bitmap, 0, 0, draw_xsize, draw_ysize, draw_x, draw_y);
+    }
+  }
+}
+
+void SetBackgroundBitmap(Bitmap *background_bitmap_tile, int mask)
+{
+  static Bitmap *main_bitmap_tile = NULL;
+  static Bitmap *door_bitmap_tile = NULL;
+
+  if (mask == REDRAW_FIELD)
+  {
+    if (background_bitmap_tile == main_bitmap_tile)
+      return;          /* main background tile has not changed */
+
+    main_bitmap_tile = background_bitmap_tile;
+  }
+  else if (mask == REDRAW_DOOR_1)
+  {
+    if (background_bitmap_tile == door_bitmap_tile)
+      return;  /* main background tile has not changed */
+
+    door_bitmap_tile = background_bitmap_tile;
+  }
+  else         /* should not happen */
+    return;
+
+  if (background_bitmap_tile)
+    gfx.background_bitmap_mask |= mask;
+  else
+    gfx.background_bitmap_mask &= ~mask;
+
+  if (gfx.background_bitmap == NULL)
+    gfx.background_bitmap = CreateBitmap(video.width, video.height,
+                                        DEFAULT_DEPTH);
+
+  if (background_bitmap_tile == NULL)  /* empty background requested */
+    return;
+
+  if (mask == REDRAW_FIELD)
+    DrawBitmapFromTile(gfx.background_bitmap, background_bitmap_tile,
+                      gfx.real_sx, gfx.real_sy,
+                      gfx.full_sxsize, gfx.full_sysize);
+  else
+    DrawBitmapFromTile(gfx.background_bitmap, background_bitmap_tile,
+                      gfx.dx, gfx.dy,
+                      gfx.dxsize, gfx.dysize);
+}
+
+void SetMainBackgroundBitmap(Bitmap *background_bitmap_tile)
 {
-  gfx.background_bitmap = background_bitmap;
+  SetBackgroundBitmap(background_bitmap_tile, REDRAW_FIELD);
+}
+
+void SetDoorBackgroundBitmap(Bitmap *background_bitmap_tile)
+{
+  SetBackgroundBitmap(background_bitmap_tile, REDRAW_DOOR_1);
 }
 
 
@@ -287,6 +370,9 @@ inline Bitmap *CreateBitmap(int width, int height, int depth)
   new_bitmap->line_gc[1] = window->line_gc[1];
 #endif
 
+  new_bitmap->width = width;
+  new_bitmap->height = height;
+
   return new_bitmap;
 }
 
@@ -359,33 +445,36 @@ inline void CloseWindow(DrawWindow *window)
 #endif
 }
 
-inline boolean DrawingDeactivated(int x, int y, int width, int height)
+static inline boolean CheckDrawingArea(int x, int y, int width, int height,
+                                      int draw_mask)
 {
-  if (gfx.draw_deactivation_mask != REDRAW_NONE)
-  {
-    if (gfx.draw_deactivation_mask & REDRAW_ALL)
-      return TRUE;
-    else if ((gfx.draw_deactivation_mask & REDRAW_FIELD) &&
-            x < gfx.sx + gfx.sxsize)
-      return TRUE;
-    else if ((gfx.draw_deactivation_mask & REDRAW_DOORS) &&
-            x > gfx.dx)
-    {
-      if ((gfx.draw_deactivation_mask & REDRAW_DOOR_1) &&
-         y < gfx.dy + gfx.dysize)
-       return TRUE;
-      else if ((gfx.draw_deactivation_mask & REDRAW_DOOR_2) &&
-              y > gfx.vy)
-       return TRUE;
-    }
-  }
+  if (draw_mask == REDRAW_NONE)
+    return FALSE;
+
+  if (draw_mask & REDRAW_ALL)
+    return TRUE;
+
+  if ((draw_mask & REDRAW_FIELD) && x < gfx.real_sx + gfx.full_sxsize)
+    return TRUE;
+
+  if ((draw_mask & REDRAW_DOOR_1) && x >= gfx.dx && y < gfx.dy + gfx.dysize)
+    return TRUE;
+
+  if ((draw_mask & REDRAW_DOOR_2) && x >= gfx.dx && y >= gfx.vy)
+    return TRUE;
 
   return FALSE;
 }
 
+inline boolean DrawingDeactivated(int x, int y, int width, int height)
+{
+  return CheckDrawingArea(x, y, width, height, gfx.draw_deactivation_mask);
+}
+
 inline boolean DrawingOnBackground(int x, int y)
 {
-  return (gfx.background_bitmap != NULL && x < gfx.sx + gfx.sxsize);
+  return ((gfx.draw_background_mask & gfx.background_bitmap_mask) &&
+         CheckDrawingArea(x, y, 1, 1, gfx.draw_background_mask));
 }
 
 inline void BlitBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap,
@@ -420,11 +509,11 @@ inline void ClearRectangle(Bitmap *bitmap, int x, int y, int width, int height)
 inline void ClearRectangleOnBackground(Bitmap *bitmap, int x, int y,
                                       int width, int height)
 {
-  if (!DrawingOnBackground(x, y))
-    ClearRectangle(bitmap, x, y, width, height);
-  else
+  if (DrawingOnBackground(x, y))
     BlitBitmap(gfx.background_bitmap, bitmap,
               x - gfx.real_sx, y - gfx.real_sy, width, height, x, y);
+  else
+    ClearRectangle(bitmap, x, y, width, height);
 }
 
 #if 0
@@ -483,14 +572,10 @@ inline void BlitBitmapOnBackground(Bitmap *src_bitmap, Bitmap *dst_bitmap,
                                   int width, int height,
                                   int dst_x, int dst_y)
 {
-  if (!DrawingOnBackground(src_x, src_y))
-    BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y, width, height,
-              dst_x, dst_y);
-  else
+  if (DrawingOnBackground(src_x, src_y))
   {
     /* draw background */
-    BlitBitmap(gfx.background_bitmap, dst_bitmap,
-              dst_x - gfx.real_sx, dst_y - gfx.real_sy, width, height,
+    BlitBitmap(gfx.background_bitmap, dst_bitmap, dst_x, dst_y, width, height,
               dst_x, dst_y);
 
     /* draw foreground */
@@ -499,6 +584,9 @@ inline void BlitBitmapOnBackground(Bitmap *src_bitmap, Bitmap *dst_bitmap,
     BlitBitmapMasked(src_bitmap, dst_bitmap, src_x, src_y, width, height,
                     dst_x, dst_y);
   }
+  else
+    BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y, width, height,
+              dst_x, dst_y);
 }
 
 inline void DrawSimpleWhiteLine(Bitmap *bitmap, int from_x, int from_y,
index 3577e35913b1831af8ad1c5f006d2d137b170a4d..754ecc3be7397eb7be3f2a9026149f37f2bacbdc 100644 (file)
@@ -296,9 +296,11 @@ struct GfxInfo
   int vx, vy;
   int vxsize, vysize;
 
-  boolean draw_deactivation_mask;
+  int draw_deactivation_mask;
+  int draw_background_mask;
 
   Bitmap *background_bitmap;
+  int background_bitmap_mask;
 };
 
 struct FontInfo
@@ -565,8 +567,10 @@ void InitGfxFieldInfo(int, int, int, int, int, int, int, int);
 void InitGfxDoor1Info(int, int, int, int);
 void InitGfxDoor2Info(int, int, int, int);
 void InitGfxScrollbufferInfo(int, int);
-void SetDrawDeactivationMask(int );
-void SetBackgroundBitmap(Bitmap *);
+void SetDrawDeactivationMask(int);
+void SetDrawBackgroundMask(int);
+void SetMainBackgroundBitmap(Bitmap *);
+void SetDoorBackgroundBitmap(Bitmap *);
 
 inline void InitVideoDisplay(void);
 inline void CloseVideoDisplay(void);
index 1a5dcefe2a543122fef6521c260b0d863065ff2f..5328f18b28200c8eee5e50adcff86aea78e74da1 100644 (file)
@@ -25,6 +25,7 @@
 #define NUM_FONT_COLORS                4
 #define NUM_FONT_CHARS         (FONT_LINES_PER_FONT * FONT_CHARS_PER_LINE)
 
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
 static GC      tile_clip_gc = None;
 static Pixmap  tile_clipmask[NUM_FONTS][NUM_FONT_COLORS][NUM_FONT_CHARS];
 
@@ -40,7 +41,6 @@ static struct
 
 static void InitFontClipmasks()
 {
-#if defined(TARGET_X11_NATIVE)
   static boolean clipmasks_initialized = FALSE;
   boolean fonts_initialized = TRUE;
   XGCValues clip_gc_values;
@@ -105,9 +105,8 @@ static void InitFontClipmasks()
   XFreeGC(display, copy_clipmask_gc);
 
   clipmasks_initialized = TRUE;
-
-#endif /* TARGET_X11_NATIVE */
 }
+#endif /* TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND */
 
 void InitFontInfo(Bitmap *bitmap_initial,
                  Bitmap *bitmap_big, Bitmap *bitmap_medium,
@@ -119,7 +118,9 @@ void InitFontInfo(Bitmap *bitmap_initial,
   font.bitmap_small = bitmap_small;
   font.bitmap_tile = bitmap_tile;
 
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
   InitFontClipmasks();
+#endif
 }
 
 int getFontWidth(int font_size, int font_type)
@@ -295,6 +296,7 @@ void DrawTextExt(DrawBuffer *bitmap, int x, int y, char *text,
                   dest_x - gfx.real_sx, dest_y - gfx.real_sy,
                   font_width, font_height, dest_x, dest_y);
 
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
        /* use special font tile clipmasks, if available */
        if (font_size == FS_BIG || font_size == FS_MEDIUM)
        {
@@ -310,6 +312,10 @@ void DrawTextExt(DrawBuffer *bitmap, int x, int y, char *text,
          SetClipOrigin(font_bitmap, font_bitmap->stored_clip_gc,
                        dest_x - src_x, dest_y - src_y);
        }
+#else
+       SetClipOrigin(font_bitmap, font_bitmap->stored_clip_gc,
+                     dest_x - src_x, dest_y - src_y);
+#endif
 
        BlitBitmapMasked(font_bitmap, bitmap, src_x, src_y,
                         font_width, font_height, dest_x, dest_y);
index c42f25cc54fe4d896277a192c5348b01351e2d2f..c643dc72255e8ca587d5106fad00f61ca5a2293b 100644 (file)
 #define TARGET_STRING          "X11"
 #endif
 
+#if defined(PLATFORM_UNIX)
+/* This triggers some stuff that is needed because X11 (XSetClipOrigin(),
+   to be precise) is often very slow when preparing a masked XCopyArea()
+   for big Pixmaps.
+   To prevent this, small (tile-sized) mask Pixmaps are created which will
+   then be set much faster with XSetClipOrigin() and speed things up a lot. */
+#define TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND
+#endif
+
 #define FULLSCREEN_STATUS      FULLSCREEN_NOT_AVAILABLE
 
 
index 37fcb08bc6ca75734a5f16832f52554813a55bc7..72d6c23daefb3c227402e50aa81d391d7a2fd0b2 100644 (file)
@@ -1655,7 +1655,7 @@ struct NewGraphicInfo
   int anim_mode;
   boolean anim_global_sync;
 
-#if defined(TARGET_X11_NATIVE)
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
   Pixmap clip_mask;            /* single-graphic-only clip mask for X11 */
   GC clip_gc;                  /* single-graphic-only clip gc for X11 */
 #endif
index 67b8bd2326956c5f4cbf86ed837e4fedc436ffb6..6b827227a475f18092487526206245d940529f86 100644 (file)
@@ -71,7 +71,10 @@ static void HandleChooseTree(int, int, int, int, int, TreeInfo **);
 static struct GadgetInfo *screen_gadget[NUM_SCREEN_GADGETS];
 static int setup_mode = SETUP_MODE_MAIN;
 
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
 static Bitmap *scrollbar_bitmap[4];
+#endif
+
 
 static void drawCursorExt(int xpos, int ypos, int color, int graphic)
 {
@@ -132,7 +135,7 @@ static void ToggleFullscreenIfNeeded()
     setup.fullscreen = video.fullscreen_enabled;
 
     /* redraw background to newly created backbuffer */
-    BlitBitmap(new_graphic_info[IMG_MENU_FRAME].bitmap, backbuffer,
+    BlitBitmap(new_graphic_info[IMG_GLOBAL_BORDER].bitmap, backbuffer,
               0,0, WIN_XSIZE,WIN_YSIZE, 0,0);
 
     /* restore old door content */
@@ -151,10 +154,13 @@ void DrawMainMenu()
 
   UnmapAllGadgets();
   FadeSounds();
+
   KeyboardAutoRepeatOn();
   ActivateJoystick();
+
   SetDrawDeactivationMask(REDRAW_NONE);
-  SetBackgroundBitmap(new_graphic_info[IMG_MENU_BACKGROUND].bitmap);
+  SetDrawBackgroundMask(REDRAW_FIELD);
+
   audio.sound_deactivated = FALSE;
 
   /* needed if last screen was the playing screen, invoked from level editor */
@@ -195,10 +201,11 @@ void DrawMainMenu()
   GetPlayerConfig();
   LoadLevel(level_nr);
 
-  SetBackgroundBitmap(new_graphic_info[IMG_MENU_BACKGROUND].bitmap);
+  SetMainBackgroundBitmap(new_graphic_info[IMG_BACKGROUND_DEFAULT].bitmap);
   ClearWindow();
 
   DrawHeadline();
+
   DrawText(SX + 32,    SY + 2*32, name_text, FS_BIG, FC_GREEN);
   DrawText(SX + 6*32,  SY + 2*32, setup.player_name, FS_BIG, FC_RED);
   DrawText(SX + 32,    SY + 3*32, "Level:", FS_BIG, FC_GREEN);
@@ -2829,10 +2836,10 @@ static struct
 
 static struct
 {
-#if 0
-  int gfx_unpressed, gfx_pressed;
-#else
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
   Bitmap **gfx_unpressed, **gfx_pressed;
+#else
+  int gfx_unpressed, gfx_pressed;
 #endif
   int x, y;
   int width, height;
@@ -2842,10 +2849,10 @@ static struct
 } scrollbar_info[NUM_SCREEN_SCROLLBARS] =
 {
   {
-#if 0
-    IMG_SCROLLBAR_BLUE, IMG_SCROLLBAR_RED,
-#else
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
     &scrollbar_bitmap[0], &scrollbar_bitmap[1],
+#else
+    IMG_SCROLLBAR_BLUE, IMG_SCROLLBAR_RED,
 #endif
     SX + SC_SCROLL_VERTICAL_XPOS, SY + SC_SCROLL_VERTICAL_YPOS,
     SC_SCROLL_VERTICAL_XSIZE, SC_SCROLL_VERTICAL_YSIZE,
@@ -2917,7 +2924,7 @@ static void CreateScreenScrollbars()
   for (i=0; i<NUM_SCREEN_SCROLLBARS; i++)
   {
     Bitmap *gd_bitmap_unpressed, *gd_bitmap_pressed;
-#if 0
+#if !defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
     int gfx_unpressed, gfx_pressed;
 #endif
     int gd_x1, gd_x2, gd_y1, gd_y2;
@@ -2933,7 +2940,14 @@ static void CreateScreenScrollbars()
 
     event_mask = GD_EVENT_MOVING | GD_EVENT_OFF_BORDERS;
 
-#if 0
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
+    gd_bitmap_unpressed = *scrollbar_info[i].gfx_unpressed;
+    gd_bitmap_pressed   = *scrollbar_info[i].gfx_pressed;
+    gd_x1 = 0;
+    gd_y1 = 0;
+    gd_x2 = 0;
+    gd_y2 = 0;
+#else
     gfx_unpressed = scrollbar_info[i].gfx_unpressed;
     gfx_pressed   = scrollbar_info[i].gfx_pressed;
     gd_bitmap_unpressed = new_graphic_info[gfx_unpressed].bitmap;
@@ -2942,13 +2956,6 @@ static void CreateScreenScrollbars()
     gd_y1 = new_graphic_info[gfx_unpressed].src_y;
     gd_x2 = new_graphic_info[gfx_pressed].src_x;
     gd_y2 = new_graphic_info[gfx_pressed].src_y;
-#else
-    gd_bitmap_unpressed = *scrollbar_info[i].gfx_unpressed;
-    gd_bitmap_pressed   = *scrollbar_info[i].gfx_pressed;
-    gd_x1 = 0;
-    gd_y1 = 0;
-    gd_x2 = 0;
-    gd_y2 = 0;
 #endif
 
     gi = CreateGadget(GDI_CUSTOM_ID, id,
@@ -2979,39 +2986,26 @@ static void CreateScreenScrollbars()
 
 void CreateScreenGadgets()
 {
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
   int i;
 
   for (i=0; i<4; i++)
   {
     scrollbar_bitmap[i] = CreateBitmap(TILEX, TILEY, DEFAULT_DEPTH);
 
-#if defined(TARGET_X11_NATIVE)
     /* copy pointers to clip mask and GC */
     scrollbar_bitmap[i]->clip_mask =
       new_graphic_info[IMG_SCROLLBAR_BLUE + i].clip_mask;
     scrollbar_bitmap[i]->stored_clip_gc =
       new_graphic_info[IMG_SCROLLBAR_BLUE + i].clip_gc;
-#endif
 
     BlitBitmap(new_graphic_info[IMG_SCROLLBAR_BLUE + i].bitmap,
               scrollbar_bitmap[i],
               new_graphic_info[IMG_SCROLLBAR_BLUE + i].src_x,
               new_graphic_info[IMG_SCROLLBAR_BLUE + i].src_y,
               TILEX, TILEY, 0, 0);
-
-#ifdef TARGET_SDL
-    SDL_SetColorKey(scrollbar_bitmap[i]->surface, SDL_SRCCOLORKEY,
-                   SDL_MapRGB(scrollbar_bitmap[i]->surface->format,
-                              0x00, 0x00, 0x00));
-    if ((scrollbar_bitmap[i]->surface_masked =
-        SDL_DisplayFormat(scrollbar_bitmap[i]->surface)) == NULL)
-    {
-      SetError("SDL_DisplayFormat(): %s", SDL_GetError());
-      Error(ERR_EXIT, "CreateScreenGadgets() failed: %s", GetError());
-    }
-    SDL_SetColorKey(scrollbar_bitmap[i]->surface, 0, 0);
-#endif
   }
+#endif
 
   CreateScreenScrollbuttons();
   CreateScreenScrollbars();
@@ -3021,16 +3015,16 @@ void FreeScreenGadgets()
 {
   int i;
 
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
   for (i=0; i<4; i++)
   {
-#if defined(TARGET_X11_NATIVE)
     /* prevent freeing clip mask and GC twice */
     scrollbar_bitmap[i]->clip_mask = None;
     scrollbar_bitmap[i]->stored_clip_gc = None;
-#endif
 
     FreeBitmap(scrollbar_bitmap[i]);
   }
+#endif
 
   for (i=0; i<NUM_SCREEN_GADGETS; i++)
     FreeGadget(screen_gadget[i]);
index 709e1520ac38a26c5a1f5b33233606dbdc4bb492..3a96d18312479c7785fafa2e4195d733dceec8a5 100644 (file)
@@ -168,7 +168,7 @@ void DrawVideoDisplay(unsigned long state, unsigned long value)
   {
     int cx = DOOR_GFX_PAGEX3, cy = DOOR_GFX_PAGEY2;
 
-    BlitBitmap(new_graphic_info[IMG_MENU_DOOR].bitmap, drawto,
+    BlitBitmap(new_graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
               cx + VIDEO_REC_LABEL_XPOS,
               cy + VIDEO_REC_LABEL_YPOS,
               VIDEO_PBEND_LABEL_XSIZE,
@@ -189,7 +189,7 @@ void DrawVideoDisplay(unsigned long state, unsigned long value)
        cx = DOOR_GFX_PAGEX3;   /* i gerade => STATE_OFF / PRESS_ON */
 
       if (video_pos[pos][part_label][0] && value != VIDEO_DISPLAY_SYMBOL_ONLY)
-       BlitBitmap(new_graphic_info[IMG_MENU_DOOR].bitmap, drawto,
+       BlitBitmap(new_graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
                   cx + video_pos[pos][part_label][xpos],
                   cy + video_pos[pos][part_label][ypos],
                   video_pos[pos][part_label][xsize],
@@ -197,7 +197,7 @@ void DrawVideoDisplay(unsigned long state, unsigned long value)
                   VX + video_pos[pos][part_label][xpos],
                   VY + video_pos[pos][part_label][ypos]);
       if (video_pos[pos][part_symbol][0] && value != VIDEO_DISPLAY_LABEL_ONLY)
-       BlitBitmap(new_graphic_info[IMG_MENU_DOOR].bitmap, drawto,
+       BlitBitmap(new_graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
                   cx + video_pos[pos][part_symbol][xpos],
                   cy + video_pos[pos][part_symbol][ypos],
                   video_pos[pos][part_symbol][xsize],
@@ -211,7 +211,7 @@ void DrawVideoDisplay(unsigned long state, unsigned long value)
   {
     int cx = DOOR_GFX_PAGEX4, cy = DOOR_GFX_PAGEY2;
 
-    BlitBitmap(new_graphic_info[IMG_MENU_DOOR].bitmap, drawto,
+    BlitBitmap(new_graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
               cx + VIDEO_PLAY_SYMBOL_XPOS,
               cy + VIDEO_PLAY_SYMBOL_YPOS,
               VIDEO_PLAY_SYMBOL_XSIZE - 2,
@@ -224,7 +224,7 @@ void DrawVideoDisplay(unsigned long state, unsigned long value)
   {
     int cx = DOOR_GFX_PAGEX6, cy = DOOR_GFX_PAGEY1;
 
-    BlitBitmap(new_graphic_info[IMG_MENU_DOOR].bitmap, drawto,
+    BlitBitmap(new_graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
               cx + VIDEO_PBEND_LABEL_XPOS,
               cy + VIDEO_PBEND_LABEL_YPOS,
               VIDEO_PBEND_LABEL_XSIZE,
@@ -268,10 +268,10 @@ void DrawVideoDisplay(unsigned long state, unsigned long value)
 
 void DrawCompleteVideoDisplay()
 {
-  BlitBitmap(new_graphic_info[IMG_MENU_DOOR].bitmap, drawto,
+  BlitBitmap(new_graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
             DOOR_GFX_PAGEX3, DOOR_GFX_PAGEY2,
             gfx.vxsize, gfx.vysize, gfx.vx, gfx.vy);
-  BlitBitmap(new_graphic_info[IMG_MENU_DOOR].bitmap, drawto,
+  BlitBitmap(new_graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
             DOOR_GFX_PAGEX4 + VIDEO_CONTROL_XPOS,
             DOOR_GFX_PAGEY2 + VIDEO_CONTROL_YPOS,
             VIDEO_CONTROL_XSIZE, VIDEO_CONTROL_YSIZE,
@@ -840,7 +840,7 @@ void CreateTapeButtons()
 
   for (i=0; i<NUM_TAPE_BUTTONS; i++)
   {
-    Bitmap *gd_bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
+    Bitmap *gd_bitmap = new_graphic_info[IMG_GLOBAL_DOOR].bitmap;
     struct GadgetInfo *gi;
     int gd_xoffset, gd_yoffset;
     int gd_x1, gd_x2, gd_y;
index ecc1e12780d289c39c2c1b98333561249a889c6c..d6be4813de6f8ca061360d42f66cbe1932a9f71f 100644 (file)
@@ -362,32 +362,13 @@ void FadeToFront()
   BackToFront();
 }
 
-void DrawBackground(int x, int y, int width, int height)
+void DrawBackground(int dest_x, int dest_y, int width, int height)
 {
-  /* some sanity checks */
-  if (x < REAL_SX)
-  {
-    width -= (REAL_SX - x);
-    x = REAL_SX;
-  }
-
-  if (y < REAL_SY)
-  {
-    height -= (REAL_SY - y);
-    y = REAL_SY;
-  }
-
-  if (width > FULL_SXSIZE)
-    width = FULL_SXSIZE;
-
-  if (height > FULL_SYSIZE)
-    height = FULL_SYSIZE;
-
-  if (DrawingOnBackground(x, y) && game_status != PLAYING)
-    BlitBitmap(gfx.background_bitmap, backbuffer, x - REAL_SX, y - REAL_SY,
-              width, height, x, y);
+  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, x, y, width, height);
+    ClearRectangle(backbuffer, dest_x, dest_y, width, height);
 
   redraw_mask |= REDRAW_FIELD;
 }
@@ -1990,8 +1971,10 @@ boolean Request(char *text, unsigned int req_state)
             DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE,
             DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1);
 
+  SetDrawBackgroundMask(REDRAW_FIELD | REDRAW_DOOR_1);
+
   /* clear door drawing field */
-  ClearRectangle(drawto, DX, DY, DXSIZE, DYSIZE);
+  DrawBackground(DX, DY, DXSIZE, DYSIZE);
 
   /* write text for request */
   for(ty=0; ty < MAX_REQUEST_LINES; ty++)
@@ -2019,8 +2002,8 @@ boolean Request(char *text, unsigned int req_state)
     strncpy(text_line, text, tl);
     text_line[tl] = 0;
 
-    DrawTextExt(drawto, DX + 50 - (tl * 14)/2, DY + 8 + ty * 16,
-               text_line, FS_SMALL, FC_YELLOW, FONT_OPAQUE);
+    DrawText(DX + 50 - (tl * 14)/2, DY + 8 + ty * 16,
+            text_line, FS_SMALL, FC_YELLOW);
 
     text += tl + (tc == ' ' ? 1 : 0);
   }
@@ -2054,7 +2037,11 @@ boolean Request(char *text, unsigned int req_state)
 #endif
 
   if (!(req_state & REQUEST_WAIT_FOR))
-    return(FALSE);
+  {
+    SetDrawBackgroundMask(REDRAW_FIELD);
+
+    return FALSE;
+  }
 
   if (game_status != MAINMENU)
     InitAnimation();
@@ -2063,6 +2050,8 @@ boolean Request(char *text, unsigned int req_state)
 
   request_gadget_id = -1;
 
+  SetDrawBackgroundMask(REDRAW_FIELD | REDRAW_DOOR_1);
+
   while(result < 0)
   {
     if (PendingEvent())
@@ -2198,6 +2187,8 @@ boolean Request(char *text, unsigned int req_state)
 
   RemapAllGadgets();
 
+  SetDrawBackgroundMask(REDRAW_FIELD);
+
 #if defined(PLATFORM_UNIX)
   /* continue network game after request */
   if (options.network &&
@@ -2206,7 +2197,7 @@ boolean Request(char *text, unsigned int req_state)
     SendToServer_ContinuePlaying();
 #endif
 
-  return(result);
+  return result;
 }
 
 unsigned int OpenDoor(unsigned int door_state)
@@ -2310,7 +2301,7 @@ unsigned int MoveDoor(unsigned int door_state)
 
     for(x=start; x<=DXSIZE; x+=stepsize)
     {
-      Bitmap *bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
+      Bitmap *bitmap = new_graphic_info[IMG_GLOBAL_DOOR].bitmap;
       GC gc = bitmap->stored_clip_gc;
 
       if (!(door_state & DOOR_NO_DELAY))
@@ -2416,10 +2407,10 @@ unsigned int MoveDoor(unsigned int door_state)
 void DrawSpecialEditorDoor()
 {
   /* draw bigger toolbox window */
-  BlitBitmap(new_graphic_info[IMG_MENU_DOOR].bitmap, drawto,
+  BlitBitmap(new_graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
             DOOR_GFX_PAGEX7, 0, EXSIZE + 8, 8,
             EX - 4, EY - 12);
-  BlitBitmap(new_graphic_info[IMG_MENU_FRAME].bitmap, drawto,
+  BlitBitmap(new_graphic_info[IMG_GLOBAL_BORDER].bitmap, drawto,
             EX - 4, VY - 4, EXSIZE + 8, EYSIZE - VYSIZE + 4,
             EX - 4, EY - 4);
 
@@ -2429,7 +2420,7 @@ void DrawSpecialEditorDoor()
 void UndrawSpecialEditorDoor()
 {
   /* draw normal tape recorder window */
-  BlitBitmap(new_graphic_info[IMG_MENU_FRAME].bitmap, drawto,
+  BlitBitmap(new_graphic_info[IMG_GLOBAL_BORDER].bitmap, drawto,
             EX - 4, EY - 12, EXSIZE + 8, EYSIZE - VYSIZE + 12,
             EX - 4, EY - 12);
 
@@ -2559,7 +2550,7 @@ void CreateToolButtons()
 
   for (i=0; i<NUM_TOOL_BUTTONS; i++)
   {
-    Bitmap *gd_bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
+    Bitmap *gd_bitmap = new_graphic_info[IMG_GLOBAL_DOOR].bitmap;
     Bitmap *deco_bitmap = None;
     int deco_x = 0, deco_y = 0, deco_xpos = 0, deco_ypos = 0;
     struct GadgetInfo *gi;