From a7b74f182679d4bd1a61b5ae840ec48409d09056 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 17 Feb 2014 21:44:56 +0100 Subject: [PATCH] rnd-20140217-1-src --- src/conf_gfx.c | 37 ++++++- src/conf_gfx.h | 10 +- src/conftime.h | 2 +- src/tools.c | 257 ++++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 297 insertions(+), 9 deletions(-) diff --git a/src/conf_gfx.c b/src/conf_gfx.c index e8cc66ed..91354076 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -79,6 +79,10 @@ struct ConfigTypeInfo image_config_suffix[] = struct ConfigInfo image_config[] = { + // ========================================================================== + // image definitions for game elements (for in-game and editor graphics) + // ========================================================================== + /* images for Boulder Dash style elements and actions */ { "bd_wall", "RocksDC.png" }, @@ -4366,7 +4370,11 @@ struct ConfigInfo image_config[] = #include "conf_cus.c" /* include auto-generated data structure definitions */ #include "conf_grp.c" /* include auto-generated data structure definitions */ - /* images not associated to game elements (used for menu screens etc.) */ + + // ========================================================================== + // image definitions not associated with game elements (menu screens etc.) + // ========================================================================== + /* keyword to stop parser: "NO_MORE_ELEMENT_IMAGES" <-- do not change! */ #if 1 @@ -5316,6 +5324,28 @@ struct ConfigInfo image_config[] = { "titlescreen_4", UNDEFINED_FILENAME }, { "titlescreen_5", UNDEFINED_FILENAME }, + { "door_1.wing_left", "RocksDoor.png" }, + { "door_1.wing_left.x", "0" }, + { "door_1.wing_left.y", "0" }, + { "door_1.wing_left.width", "100" }, + { "door_1.wing_left.height", "280" }, + { "door_1.wing_right", "RocksDoor.png" }, + { "door_1.wing_right.x", "100" }, + { "door_1.wing_right.y", "0" }, + { "door_1.wing_right.width", "100" }, + { "door_1.wing_right.height", "280" }, + + { "door_2.wing_left", "RocksDoor.png" }, + { "door_2.wing_left.x", "0" }, + { "door_2.wing_left.y", "280" }, + { "door_2.wing_left.width", "100" }, + { "door_2.wing_left.height", "100" }, + { "door_2.wing_right", "RocksDoor.png" }, + { "door_2.wing_right.x", "100" }, + { "door_2.wing_right.y", "280" }, + { "door_2.wing_right.width", "100" }, + { "door_2.wing_right.height", "100" }, + { "door_2.top_border_correction", "RocksDoor.png" }, { "door_2.top_border_correction.x", "600" }, { "door_2.top_border_correction.y", "0" }, @@ -5326,6 +5356,11 @@ struct ConfigInfo image_config[] = of "image_config[]"; so far this bug could not be found and fixed */ { "last_image_entry_bug", UNDEFINED_FILENAME }, + + // ========================================================================== + // non-image definitions + // ========================================================================== + /* the following directives are not associated with an image, but probably make sense to be defined in "graphicsinfo.conf", too */ diff --git a/src/conf_gfx.h b/src/conf_gfx.h index 875588a8..015040f9 100644 --- a/src/conf_gfx.h +++ b/src/conf_gfx.h @@ -1868,9 +1868,13 @@ #define IMG_TITLESCREEN_3 1847 #define IMG_TITLESCREEN_4 1848 #define IMG_TITLESCREEN_5 1849 -#define IMG_DOOR_2_TOP_BORDER_CORRECTION 1850 -#define IMG_LAST_IMAGE_ENTRY_BUG 1851 +#define IMG_DOOR_1_WING_LEFT 1850 +#define IMG_DOOR_1_WING_RIGHT 1851 +#define IMG_DOOR_2_WING_LEFT 1852 +#define IMG_DOOR_2_WING_RIGHT 1853 +#define IMG_DOOR_2_TOP_BORDER_CORRECTION 1854 +#define IMG_LAST_IMAGE_ENTRY_BUG 1855 -#define NUM_IMAGE_FILES 1852 +#define NUM_IMAGE_FILES 1856 #endif /* CONF_GFX_H */ diff --git a/src/conftime.h b/src/conftime.h index e0e5e7fd..b2460ff0 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2014-02-13 21:54" +#define COMPILE_DATE_STRING "2014-02-17 21:41" diff --git a/src/tools.c b/src/tools.c index 49d42960..e6b6b719 100644 --- a/src/tools.c +++ b/src/tools.c @@ -5267,6 +5267,8 @@ unsigned int MoveDoor(unsigned int door_state) door_delay_value = (door_state & DOOR_ACTION_1 ? door_1.step_delay : door_2.step_delay); + // door_delay_value *= 4; // !!! TEST ONLY !!! + if (setup.quick_doors) { stepsize = 20; /* must be chosen to always draw last frame */ @@ -5320,8 +5322,10 @@ unsigned int MoveDoor(unsigned int door_state) for (k = start; k <= end && !(door_1_done && door_2_done); k += stepsize) { int x = k; +#if 1 Bitmap *bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; GC gc = bitmap->stored_clip_gc; +#endif if (door_state & DOOR_ACTION_1) { @@ -5329,6 +5333,15 @@ unsigned int MoveDoor(unsigned int door_state) int p = (door_state & DOOR_OPEN_1 ? end - a : a); int i = p + door_skip; +#if 1 + struct GraphicInfo *g_left = &graphic_info[IMG_DOOR_1_WING_LEFT]; + struct GraphicInfo *g_right = &graphic_info[IMG_DOOR_1_WING_RIGHT]; + Bitmap *bm_left = g_left->bitmap; + Bitmap *bm_right = g_right->bitmap; + GC gc_left = bm_left->stored_clip_gc; + GC gc_right = bm_right->stored_clip_gc; +#endif + if (door_1.anim_mode & ANIM_STATIC_PANEL) { BlitBitmap(bitmap_db_door, drawto, @@ -5346,9 +5359,29 @@ unsigned int MoveDoor(unsigned int door_state) if (door_1.anim_mode & ANIM_HORIZONTAL && x <= DXSIZE) { +#if 1 + int src1_x = g_right->src_x; + int src1_y = g_right->src_y; + int src2_x = g_left->src_x + g_left->width - i; + int src2_y = g_left->src_y; + int dst1_x = DX + DXSIZE - i; + int dst1_y = DY; + int dst2_x = DX; + int dst2_y = DY; + int width = i; + int height = DYSIZE; + + SetClipOrigin(bm_right, gc_right, dst1_x - src1_x, dst1_y - src1_y); + BlitBitmapMasked(bm_right, drawto, src1_x, src1_y, width, height, + dst1_x, dst1_y); + + SetClipOrigin(bm_left, gc_left, dst2_x - src2_x, dst2_y - src2_y); + BlitBitmapMasked(bm_left, drawto, src2_x, src2_y, width, height, + dst2_x, dst2_y); +#else int src1_x = DXSIZE, src1_y = DOOR_GFX_PAGEY1; - int dst1_x = DX + DXSIZE - i, dst1_y = DY; int src2_x = DXSIZE - i, src2_y = DOOR_GFX_PAGEY1; + int dst1_x = DX + DXSIZE - i, dst1_y = DY; int dst2_x = DX, dst2_y = DY; int width = i, height = DYSIZE; @@ -5359,12 +5392,33 @@ unsigned int MoveDoor(unsigned int door_state) SetClipOrigin(bitmap, gc, dst2_x - src2_x, dst2_y - src2_y); BlitBitmapMasked(bitmap, drawto, src2_x, src2_y, width, height, dst2_x, dst2_y); +#endif } else if (door_1.anim_mode & ANIM_VERTICAL && x <= DYSIZE) { +#if 1 + int src1_x = g_right->src_x; + int src1_y = g_right->src_y; + int src2_x = g_left->src_x; + int src2_y = g_left->src_y + g_left->height - i; + int dst1_x = DX; + int dst1_y = DY + DYSIZE - i; + int dst2_x = DX; + int dst2_y = DY; + int width = DXSIZE; + int height = i; + + SetClipOrigin(bm_right, gc_right, dst1_x - src1_x, dst1_y - src1_y); + BlitBitmapMasked(bm_right, drawto, src1_x, src1_y, width, height, + dst1_x, dst1_y); + + SetClipOrigin(bm_left, gc_left, dst2_x - src2_x, dst2_y - src2_y); + BlitBitmapMasked(bm_left, drawto, src2_x, src2_y, width, height, + dst2_x, dst2_y); +#else int src1_x = DXSIZE, src1_y = DOOR_GFX_PAGEY1; - int dst1_x = DX, dst1_y = DY + DYSIZE - i; int src2_x = 0, src2_y = DOOR_GFX_PAGEY1 + DYSIZE - i; + int dst1_x = DX, dst1_y = DY + DYSIZE - i; int dst2_x = DX, dst2_y = DY; int width = DXSIZE, height = i; @@ -5375,11 +5429,94 @@ unsigned int MoveDoor(unsigned int door_state) SetClipOrigin(bitmap, gc, dst2_x - src2_x, dst2_y - src2_y); BlitBitmapMasked(bitmap, drawto, src2_x, src2_y, width, height, dst2_x, dst2_y); +#endif } else if (x <= DXSIZE) /* ANIM_DEFAULT */ { int j = (door_1.anim_mode == ANIM_DEFAULT ? (DXSIZE - i) / 3 : 0); +#if 1 + int src1_x = g_right->src_x; + int src1_y = g_right->src_y; + int src2_x = g_left->src_x + g_left->width - i; + int src2_y = g_left->src_y; + int dst1_x = DX + DXSIZE - i; + int dst1_y = DY; + int dst2_x = DX; + int dst2_y = DY; + int width = i; + int height1 = 63, height2 = DYSIZE / 2 - height1; + int ypos1 = 0, ypos2 = height2; + int ypos3 = DYSIZE / 2, ypos4 = DYSIZE - height2; + + SetClipOrigin(bitmap, gc, dst1_x - src1_x, dst1_y - src1_y + j); + BlitBitmapMasked(bitmap, drawto, + src1_x, src1_y + ypos1, width, height2, + dst1_x, dst1_y + ypos1 + j); + BlitBitmapMasked(bitmap, drawto, + src1_x, src1_y + ypos3, width, height1, + dst1_x, dst1_y + ypos3 + j); + SetClipOrigin(bitmap, gc, dst2_x - src2_x, dst2_y - src2_y - j); + BlitBitmapMasked(bitmap, drawto, + src2_x, src2_y + ypos1 + j, width, height2 - j, + dst2_x, dst2_y + ypos1); + BlitBitmapMasked(bitmap, drawto, + src2_x, src2_y + ypos3, width, height1, + dst2_x, dst2_y + ypos3 - j); + + SetClipOrigin(bitmap, gc, dst2_x - src2_x, dst2_y - src2_y - j); + BlitBitmapMasked(bitmap, drawto, + src2_x, src2_y + ypos2, width, height1, + dst2_x, dst2_y + ypos2 - j); + BlitBitmapMasked(bitmap, drawto, + src2_x, src2_y + ypos4, width, height2, + dst2_x, dst2_y + ypos4 - j); + SetClipOrigin(bitmap, gc, dst1_x - src1_x, dst1_y - src1_y + j); + BlitBitmapMasked(bitmap, drawto, + src1_x, src1_y + ypos2, width, height1, + dst1_x, dst1_y + ypos2 + j); + BlitBitmapMasked(bitmap, drawto, + src1_x, src1_y + ypos4, width, height2 - j, + dst1_x, dst1_y + ypos4 + j); +#else + int src1_x = DXSIZE, src1_y = DOOR_GFX_PAGEY1; + int src2_x = DXSIZE - i, src2_y = DOOR_GFX_PAGEY1; + int dst1_x = DX + DXSIZE - i, dst1_y = DY; + int dst2_x = DX, dst2_y = DY; + int width = i, height = DYSIZE; + int ypos1 = 63, ypos2 = 77, ypos3 = 140, ypos4 = 203; + + SetClipOrigin(bitmap, gc, dst1_x - src1_x, dst1_y - src1_y + j); + BlitBitmapMasked(bitmap, drawto, + src1_x, src1_y, width, ypos2, + dst1_x, dst1_y + j); + BlitBitmapMasked(bitmap, drawto, + src1_x, src1_y + ypos3, width, ypos1, + dst1_x, dst1_y + ypos3 + j); + SetClipOrigin(bitmap, gc, dst2_x - src2_x, dst2_y - src2_y - j); + BlitBitmapMasked(bitmap, drawto, + src2_x, src2_y + j, width, ypos2 - j, + dst2_x, dst2_y); + BlitBitmapMasked(bitmap, drawto, + src2_x, src2_y + ypos3, width, ypos1, + dst2_x, dst2_y + ypos3 - j); + + SetClipOrigin(bitmap, gc, dst2_x - src2_x, dst2_y - src2_y - j); + BlitBitmapMasked(bitmap, drawto, + src2_x, src2_y + ypos2, width, ypos1, + dst2_x, dst2_y + ypos2 - j); + BlitBitmapMasked(bitmap, drawto, + src2_x, src2_y + ypos4, width, ypos2, + dst2_x, dst2_y + ypos4 - j); + SetClipOrigin(bitmap, gc, dst1_x - src1_x, dst1_y - src1_y + j); + BlitBitmapMasked(bitmap, drawto, + src1_x, src1_y + ypos2, width, ypos1, + dst1_x, dst1_y + ypos2 + j); + BlitBitmapMasked(bitmap, drawto, + src1_x, src1_y + ypos4, width, ypos2 - j, + dst1_x, dst1_y + ypos4 + j); + + /* SetClipOrigin(bitmap, gc, DX - i, (DY + j) - DOOR_GFX_PAGEY1); BlitBitmapMasked(bitmap, drawto, DXSIZE, DOOR_GFX_PAGEY1, i, 77, @@ -5409,6 +5546,8 @@ unsigned int MoveDoor(unsigned int door_state) BlitBitmapMasked(bitmap, drawto, DXSIZE, DOOR_GFX_PAGEY1 + 203, i, 77 - j, DX + DXSIZE - i, DY + 203 + j); + */ +#endif } redraw_mask |= REDRAW_DOOR_1; @@ -5421,6 +5560,15 @@ unsigned int MoveDoor(unsigned int door_state) int p = (door_state & DOOR_OPEN_2 ? door_size - a : a); int i = p + door_skip; +#if 1 + struct GraphicInfo *g_left = &graphic_info[IMG_DOOR_2_WING_LEFT]; + struct GraphicInfo *g_right = &graphic_info[IMG_DOOR_2_WING_RIGHT]; + Bitmap *bm_left = g_left->bitmap; + Bitmap *bm_right = g_right->bitmap; + GC gc_left = bm_left->stored_clip_gc; + GC gc_right = bm_right->stored_clip_gc; +#endif + if (door_2.anim_mode & ANIM_STATIC_PANEL) { BlitBitmap(bitmap_db_door, drawto, @@ -5438,9 +5586,29 @@ unsigned int MoveDoor(unsigned int door_state) if (door_2.anim_mode & ANIM_HORIZONTAL && x <= VXSIZE) { +#if 1 + int src1_x = g_right->src_x; + int src1_y = g_right->src_y; + int src2_x = g_left->src_x + g_left->width - i; + int src2_y = g_left->src_y; + int dst1_x = VX + VXSIZE - i; + int dst1_y = VY; + int dst2_x = VX; + int dst2_y = VY; + int width = i; + int height = VYSIZE; + + SetClipOrigin(bm_right, gc_right, dst1_x - src1_x, dst1_y - src1_y); + BlitBitmapMasked(bm_right, drawto, src1_x, src1_y, width, height, + dst1_x, dst1_y); + + SetClipOrigin(bm_left, gc_left, dst2_x - src2_x, dst2_y - src2_y); + BlitBitmapMasked(bm_left, drawto, src2_x, src2_y, width, height, + dst2_x, dst2_y); +#else int src1_x = VXSIZE, src1_y = DOOR_GFX_PAGEY2; - int dst1_x = VX + VXSIZE - i, dst1_y = VY; int src2_x = VXSIZE - i, src2_y = DOOR_GFX_PAGEY2; + int dst1_x = VX + VXSIZE - i, dst1_y = VY; int dst2_x = VX, dst2_y = VY; int width = i, height = VYSIZE; @@ -5451,12 +5619,33 @@ unsigned int MoveDoor(unsigned int door_state) SetClipOrigin(bitmap, gc, dst2_x - src2_x, dst2_y - src2_y); BlitBitmapMasked(bitmap, drawto, src2_x, src2_y, width, height, dst2_x, dst2_y); +#endif } else if (door_2.anim_mode & ANIM_VERTICAL && x <= VYSIZE) { +#if 1 + int src1_x = g_right->src_x; + int src1_y = g_right->src_y; + int src2_x = g_left->src_x; + int src2_y = g_left->src_y + g_left->height - i; + int dst1_x = VX; + int dst1_y = VY + VYSIZE - i; + int dst2_x = VX; + int dst2_y = VY; + int width = VXSIZE; + int height = i; + + SetClipOrigin(bm_right, gc_right, dst1_x - src1_x, dst1_y - src1_y); + BlitBitmapMasked(bm_right, drawto, src1_x, src1_y, width, height, + dst1_x, dst1_y); + + SetClipOrigin(bm_left, gc_left, dst2_x - src2_x, dst2_y - src2_y); + BlitBitmapMasked(bm_left, drawto, src2_x, src2_y, width, height, + dst2_x, dst2_y); +#else int src1_x = VXSIZE, src1_y = DOOR_GFX_PAGEY2; - int dst1_x = VX, dst1_y = VY + VYSIZE - i; int src2_x = 0, src2_y = DOOR_GFX_PAGEY2 + VYSIZE - i; + int dst1_x = VX, dst1_y = VY + VYSIZE - i; int dst2_x = VX, dst2_y = VY; int width = VXSIZE, height = i; @@ -5467,11 +5656,69 @@ unsigned int MoveDoor(unsigned int door_state) SetClipOrigin(bitmap, gc, dst2_x - src2_x, dst2_y - src2_y); BlitBitmapMasked(bitmap, drawto, src2_x, src2_y, width, height, dst2_x, dst2_y); +#endif } else if (x <= VXSIZE) /* ANIM_DEFAULT */ { int j = (door_2.anim_mode == ANIM_DEFAULT ? (VXSIZE - i) / 3 : 0); +#if 1 + int src1_x = g_right->src_x; + int src1_y = g_right->src_y; + int src2_x = g_left->src_x + g_left->width - i; + int src2_y = g_left->src_y; + int dst1_x = VX + VXSIZE - i; + int dst1_y = VY; + int dst2_x = VX; + int dst2_y = VY; + int width = i; + int height = VYSIZE / 2; + int ypos1 = 0, ypos2 = VYSIZE / 2; + + SetClipOrigin(bitmap, gc, dst1_x - src1_x, dst1_y - src1_y + j); + BlitBitmapMasked(bitmap, drawto, + src1_x, src1_y + ypos1, width, height, + dst1_x, dst1_y + ypos1 + j); + SetClipOrigin(bitmap, gc, dst2_x - src2_x, dst2_y - src2_y - j); + BlitBitmapMasked(bitmap, drawto, + src2_x, src2_y + ypos1 + j, width, height - j, + dst2_x, dst2_y + ypos1); + + SetClipOrigin(bitmap, gc, dst2_x - src2_x, dst2_y - src2_y - j); + BlitBitmapMasked(bitmap, drawto, + src2_x, src2_y + ypos2, width, height, + dst2_x, dst2_y + ypos2 - j); + SetClipOrigin(bitmap, gc, dst1_x - src1_x, dst1_y - src1_y + j); + BlitBitmapMasked(bitmap, drawto, + src1_x, src1_y + ypos2, width, height - j, + dst1_x, dst1_y + ypos2 + j); +#else + int src1_x = VXSIZE, src1_y = DOOR_GFX_PAGEY2; + int src2_x = VXSIZE - i, src2_y = DOOR_GFX_PAGEY2; + int dst1_x = VX + VXSIZE - i, dst1_y = VY; + int dst2_x = VX, dst2_y = VY; + int width = i, height = VYSIZE; + int ypos = VYSIZE / 2; + + SetClipOrigin(bitmap, gc, dst1_x - src1_x, dst1_y - src1_y + j); + BlitBitmapMasked(bitmap, drawto, + src1_x, src1_y, width, ypos, + dst1_x, dst1_y + j); + SetClipOrigin(bitmap, gc, dst2_x - src2_x, dst2_y - src1_y - j); + BlitBitmapMasked(bitmap, drawto, + src2_x, src2_y + j, width, ypos - j, + dst2_x, dst2_y); + + SetClipOrigin(bitmap, gc, dst2_x - src2_x, dst2_y - src1_y - j); + BlitBitmapMasked(bitmap, drawto, + src2_x, src2_y + ypos, width, ypos, + dst2_x, dst2_y + ypos - j); + SetClipOrigin(bitmap, gc, dst1_x - src1_x, dst1_y - src1_y + j); + BlitBitmapMasked(bitmap, drawto, + src1_x, src1_y + ypos, width, ypos - j, + dst1_x, dst1_y + ypos + j); + + /* SetClipOrigin(bitmap, gc, VX - i, (VY + j) - DOOR_GFX_PAGEY2); BlitBitmapMasked(bitmap, drawto, VXSIZE, DOOR_GFX_PAGEY2, i, VYSIZE / 2, @@ -5490,6 +5737,8 @@ unsigned int MoveDoor(unsigned int door_state) VXSIZE, DOOR_GFX_PAGEY2 + VYSIZE / 2, i, VYSIZE / 2 - j, VX + VXSIZE - i, VY + VYSIZE / 2 + j); + */ +#endif } redraw_mask |= REDRAW_DOOR_2; -- 2.34.1