From 994cb017022c658f115e3c9fc927d8a0cc83832c Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 6 Jan 2003 03:00:34 +0100 Subject: [PATCH] rnd-20030106-1-src --- src/cartoons.c | 12 ++-- src/conf_gfx.c | 19 +++--- src/conf_gfx.h | 29 ++++---- src/conftime.h | 2 +- src/editor.c | 20 +++--- src/game.c | 4 +- src/init.c | 23 ++++--- src/libgame/gadgets.c | 45 +++++++------ src/libgame/system.c | 150 +++++++++++++++++++++++++++++++++--------- src/libgame/system.h | 10 ++- src/libgame/text.c | 12 +++- src/libgame/x11.h | 9 +++ src/main.h | 2 +- src/screens.c | 64 ++++++++---------- src/tape.c | 16 ++--- src/tools.c | 59 +++++++---------- 16 files changed, 290 insertions(+), 186 deletions(-) diff --git a/src/cartoons.c b/src/cartoons.c index 0278ed6d..45de45be 100644 --- a/src/cartoons.c +++ b/src/cartoons.c @@ -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, diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 72e5e04a..20f71882 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -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" }, diff --git a/src/conf_gfx.h b/src/conf_gfx.h index 9d29cde6..52668704 100644 --- a/src/conf_gfx.h +++ b/src/conf_gfx.h @@ -754,20 +754,21 @@ #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 */ diff --git a/src/conftime.h b/src/conftime.h index da59e80b..5f9f105d 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-01-05 21:26]" +#define COMPILE_DATE_STRING "[2003-01-06 02:55]" diff --git a/src/editor.c b/src/editor.c index 60be1aab..cd81ccbd 100644 --- a/src/editor.c +++ b/src/editor.c @@ -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; ibitmap, 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; ibitmap, 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; diff --git a/src/libgame/system.c b/src/libgame/system.c index c071fee8..ff7d8e54 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -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, diff --git a/src/libgame/system.h b/src/libgame/system.h index 3577e359..754ecc3b 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -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); diff --git a/src/libgame/text.c b/src/libgame/text.c index 1a5dcefe..5328f18b 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -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); diff --git a/src/libgame/x11.h b/src/libgame/x11.h index c42f25cc..c643dc72 100644 --- a/src/libgame/x11.h +++ b/src/libgame/x11.h @@ -34,6 +34,15 @@ #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 diff --git a/src/main.h b/src/main.h index 37fcb08b..72d6c23d 100644 --- a/src/main.h +++ b/src/main.h @@ -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 diff --git a/src/screens.c b/src/screens.c index 67b8bd23..6b827227 100644 --- a/src/screens.c +++ b/src/screens.c @@ -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; iclip_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 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 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