+ SetOverlayActive(show_grid);
+
+ if (show_grid)
+ SetOverlayEnabled(TRUE);
+}
+
+boolean GetOverlayEnabled(void)
+{
+ return overlay.enabled;
+}
+
+boolean GetOverlayActive(void)
+{
+ return overlay.active;
+}
+
+void SetDrawDeactivationMask(int draw_deactivation_mask)
+{
+ gfx.draw_deactivation_mask = draw_deactivation_mask;
+}
+
+int GetDrawDeactivationMask(void)
+{
+ return gfx.draw_deactivation_mask;
+}
+
+void SetDrawBackgroundMask(int draw_background_mask)
+{
+ gfx.draw_background_mask = draw_background_mask;
+}
+
+void SetBackgroundBitmap(Bitmap *background_bitmap_tile, int mask,
+ int x, int y, int width, int height)
+{
+ if (background_bitmap_tile != NULL)
+ gfx.background_bitmap_mask |= mask;
+ else
+ gfx.background_bitmap_mask &= ~mask;
+
+ if (background_bitmap_tile == NULL) // empty background requested
+ return;
+
+ if (mask == REDRAW_ALL)
+ BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap,
+ x, y, width, height,
+ 0, 0, video.width, video.height);
+ else if (mask == REDRAW_FIELD)
+ BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap,
+ x, y, width, height,
+ gfx.real_sx, gfx.real_sy, gfx.full_sxsize, gfx.full_sysize);
+ else if (mask == REDRAW_DOOR_1)
+ BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap,
+ x, y, width, height,
+ gfx.dx, gfx.dy, gfx.dxsize, gfx.dysize);
+}
+
+
+// ============================================================================
+// video functions
+// ============================================================================
+
+static int GetRealDepth(int depth)