struct ToonInfo toons[NUM_TOONS] =
{
{
- IMG_MENU_TOONS,
+ IMG_GLOBAL_TOONS,
DWARF_XSIZE, DWARF_YSIZE,
DWARF_X, DWARF_Y,
DWARF_FRAMES,
ANIMPOS_DOWN
},
{
- IMG_MENU_TOONS,
+ IMG_GLOBAL_TOONS,
DWARF_XSIZE, DWARF_YSIZE,
DWARF_X, DWARF2_Y,
DWARF_FRAMES,
ANIMPOS_DOWN
},
{
- IMG_MENU_TOONS,
+ IMG_GLOBAL_TOONS,
JUMPER_XSIZE, JUMPER_YSIZE,
JUMPER_X, JUMPER_Y,
JUMPER_FRAMES,
ANIMPOS_DOWN
},
{
- IMG_MENU_TOONS,
+ IMG_GLOBAL_TOONS,
CLOWN_XSIZE, CLOWN_YSIZE,
CLOWN_X, CLOWN_Y,
CLOWN_FRAMES,
ANIMPOS_ANY
},
{
- IMG_MENU_TOONS,
+ IMG_GLOBAL_TOONS,
BIRD_XSIZE, BIRD_YSIZE,
BIRD1_X, BIRD1_Y,
BIRD_FRAMES,
ANIMPOS_UPPER
},
{
- IMG_MENU_TOONS,
+ IMG_GLOBAL_TOONS,
BIRD_XSIZE, BIRD_YSIZE,
BIRD2_X, BIRD2_Y,
BIRD_FRAMES,
/* 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" },
#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 */
-#define COMPILE_DATE_STRING "[2003-01-05 21:26]"
+#define COMPILE_DATE_STRING "[2003-01-06 02:55]"
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;
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 :
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;
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;
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;
}
/* 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 */
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;
static void DrawDrawingWindow()
{
- SetBackgroundBitmap(NULL);
+ SetMainBackgroundBitmap(NULL);
ClearWindow();
UnmapLevelEditorWindowGadgets();
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();
{ -1, NULL, NULL }
};
- SetBackgroundBitmap(new_graphic_info[IMG_MENU_BACKGROUND].bitmap);
+ SetMainBackgroundBitmap(new_graphic_info[IMG_BACKGROUND_DEFAULT].bitmap);
ClearWindow();
UnmapLevelEditorWindowGadgets();
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)
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;
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();
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);
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;
i++;
}
-#if defined(TARGET_X11_NATIVE)
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
if (clipmasks_initialized)
{
for (i=0; i<NUM_IMAGE_FILES; i++)
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);
#endif
}
-#if defined(TARGET_X11_NATIVE)
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
if (copy_clipmask_gc)
XFreeGC(display, copy_clipmask_gc);
#endif
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 */
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;
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)
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);
}
new_bitmap->line_gc[1] = window->line_gc[1];
#endif
+ new_bitmap->width = width;
+ new_bitmap->height = height;
+
return new_bitmap;
}
#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,
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
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 */
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,
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
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);
#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];
static void InitFontClipmasks()
{
-#if defined(TARGET_X11_NATIVE)
static boolean clipmasks_initialized = FALSE;
boolean fonts_initialized = TRUE;
XGCValues clip_gc_values;
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,
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)
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)
{
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);
#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
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
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)
{
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 */
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 */
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);
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;
} 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,
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;
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;
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,
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();
{
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]);
{
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,
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],
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],
{
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,
{
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,
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,
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;
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;
}
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++)
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);
}
#endif
if (!(req_state & REQUEST_WAIT_FOR))
- return(FALSE);
+ {
+ SetDrawBackgroundMask(REDRAW_FIELD);
+
+ return FALSE;
+ }
if (game_status != MAINMENU)
InitAnimation();
request_gadget_id = -1;
+ SetDrawBackgroundMask(REDRAW_FIELD | REDRAW_DOOR_1);
+
while(result < 0)
{
if (PendingEvent())
RemapAllGadgets();
+ SetDrawBackgroundMask(REDRAW_FIELD);
+
#if defined(PLATFORM_UNIX)
/* continue network game after request */
if (options.network &&
SendToServer_ContinuePlaying();
#endif
- return(result);
+ return result;
}
unsigned int OpenDoor(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))
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);
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);
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;