From 3a98ec2c06b0355364b5747da91af9f673e295ca Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 26 Mar 2009 10:55:51 +0100 Subject: [PATCH] rnd-20090326-1-src * extended backwards compatibility mode to allow already fixed bug with change actions (see "2008-02-05") for existing levels (especially the Zelda and Zelda II levels and other cool stuff by Alan Bond like FMV) * reactivated workaround to prevent program crashes due to blitting to the same SDL surface that apparently only occurs on Windows systems (this is no final solution; this problem needs further investigation) * version number set to 3.2.6.1 * version 3.2.6.0 released --- ChangeLog | 16 ++++++++++++++++ src/Makefile | 2 +- src/conftime.h | 2 +- src/files.c | 27 +++++++++++++++++++++++++++ src/game_em/Makefile | 2 +- src/init.c | 1 + src/libgame/msdos.c | 2 +- src/libgame/system.c | 38 +++++++++++++++++++++++++++++++++----- src/libgame/system.h | 3 +++ src/main.h | 2 +- 10 files changed, 85 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 52445eae..befc3128 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2009-03-26 + * extended backwards compatibility mode to allow already fixed bug with + change actions (see "2008-02-05") for existing levels (especially the + Zelda and Zelda II levels and other cool stuff by Alan Bond like FMV) + +2009-03-24 + * reactivated workaround to prevent program crashes due to blitting to + the same SDL surface that apparently only occurs on Windows systems + (this is no final solution; this problem needs further investigation) + +2008-11-05 + * version number set to 3.2.6.1 + +2008-11-04 + * version 3.2.6.0 released + 2008-10-11 * fixed behaviour of player option "no centering when relocating" which was incorrect when disabled and relocation target inside visible area diff --git a/src/Makefile b/src/Makefile index bd5538ea..365c417c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -144,7 +144,7 @@ CONFIG_GAME_DIR = $(CONFIG_RO_GAME_DIR) $(CONFIG_RW_GAME_DIR) CONFIG_GAME = $(CONFIG_GAME_DIR) $(CONFIG_SCORE_ENTRIES) $(CONFIG_SPECIAL) CONFIG = $(CONFIG_GAME) $(JOYSTICK) -# DEBUG = -DDEBUG -g +DEBUG = -DDEBUG -g # PROFILING = $(PROFILING_FLAGS) # OPTIONS = $(DEBUG) -Wall # only for debugging purposes diff --git a/src/conftime.h b/src/conftime.h index c8c6c656..cf283497 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2008-11-03 21:21" +#define COMPILE_DATE_STRING "2009-03-26 10:48" diff --git a/src/files.c b/src/files.c index c3277722..bfa49881 100644 --- a/src/files.c +++ b/src/files.c @@ -6345,6 +6345,32 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) change->target_element = EL_PLAYER_1; } +#if 1 + /* try to detect and fix "Zelda" style levels, which are broken with 3.2.5 */ + if (level->game_version < VERSION_IDENT(3,2,5,0)) + { + /* This is needed to fix a problem that was caused by a bugfix in function + game.c/CheckTriggeredElementChangeExt() introduced with 3.2.5 that + corrects the behaviour when a custom element changes to another custom + element with a higher element number that has change actions defined. + Normally, only one change per frame is allowed for custom elements. + Therefore, it is checked if a custom element already changed in the + current frame; if it did, subsequent changes are suppressed. + Unfortunately, this is only checked for element changes, but not for + change actions, which are still executed. As the function above loops + through all custom elements from lower to higher, an element change + resulting in a lower CE number won't be checked again, while a target + element with a higher number will also be checked, and potential change + actions will get executed for this CE, too (which is wrong), while + further changes are ignored (which is correct). As this bugfix breaks + Zelda II (and introduces graphical bugs to Zelda I, and also breaks a + few other levels like Alan Bond's "FMV"), allow the previous, incorrect + behaviour for existing levels and tapes that make use of this bug */ + + level->use_action_after_change_bug = TRUE; + } +#else + /* !!! THIS DOES NOT FIX "Zelda I" (GRAPHICALLY) AND "Alan's FMV" LEVELS */ /* try to detect and fix "Zelda II" levels, which are broken with 3.2.5 */ { int element = EL_CUSTOM_16; @@ -6371,6 +6397,7 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) strncmp(ei->description, "scanline - row 1", 16) == 0) level->use_action_after_change_bug = TRUE; } +#endif /* not centering level after relocating player was default only in 3.2.3 */ if (level->game_version == VERSION_IDENT(3,2,3,0)) /* (no pre-releases) */ diff --git a/src/game_em/Makefile b/src/game_em/Makefile index aec69d09..4fc21cd0 100644 --- a/src/game_em/Makefile +++ b/src/game_em/Makefile @@ -1,7 +1,7 @@ # ============================================================================= # Rocks'n'Diamonds Makefile (game_em) # ----------------------------------------------------------------------------- -# (c) 1995-2005 Holger Schemel +# (c) 1995-2006 Holger Schemel # ----------------------------------------------------------------------------- # Emerald Mine for X11 © 2000,2001 David Tritscher # ============================================================================= diff --git a/src/init.c b/src/init.c index 9dab9371..32ec0892 100644 --- a/src/init.c +++ b/src/init.c @@ -5500,6 +5500,7 @@ void InitGfx() bitmap_db_field); InitGfxDoor1Info(DX, DY, DXSIZE, DYSIZE); InitGfxDoor2Info(VX, VY, VXSIZE, VYSIZE); + InitGfxWindowInfo(WIN_XSIZE, WIN_YSIZE); InitGfxScrollbufferInfo(FXSIZE, FYSIZE); InitGfxCustomArtworkInfo(); diff --git a/src/libgame/msdos.c b/src/libgame/msdos.c index 60728bef..407752bc 100644 --- a/src/libgame/msdos.c +++ b/src/libgame/msdos.c @@ -440,7 +440,7 @@ Pixmap XCreatePixmap(Display *display, Drawable d, unsigned int width, BITMAP *bitmap = NULL; if (gfx_capabilities & GFX_HW_VRAM_BLIT && - width == gfx.scrollbuffer_width && height == gfx.scrollbuffer_height) + width == gfx.scrollbuffer_width && height == gfx.scrollbuffer_height) bitmap = create_video_bitmap(width, height); if (bitmap == NULL) diff --git a/src/libgame/system.c b/src/libgame/system.c index 20ea20be..f05fffa0 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -189,9 +189,16 @@ void InitGfxDoor2Info(int vx, int vy, int vxsize, int vysize) gfx.vysize = vysize; } +void InitGfxWindowInfo(int win_xsize, int win_ysize) +{ + gfx.win_xsize = win_xsize; + gfx.win_ysize = win_ysize; +} + void InitGfxScrollbufferInfo(int scrollbuffer_width, int scrollbuffer_height) { /* currently only used by MSDOS code to alloc VRAM buffer, if available */ + /* 2009-03-24: also (temporarily?) used for overlapping blit workaround */ gfx.scrollbuffer_width = scrollbuffer_width; gfx.scrollbuffer_height = scrollbuffer_height; } @@ -491,8 +498,8 @@ void BlitBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap, if (DrawingDeactivated(dst_x, dst_y, width, height)) return; -#if 0 - /* !!! APPARENTLY THIS HAS BEEN FIXED IN SDL 1.2.12 !!! */ +#if 1 + /* !!! 2009-03-24: It seems that this problem still exists with 1.2.12 !!! */ #if defined(TARGET_SDL) && defined(PLATFORM_WIN32) if (src_bitmap == dst_bitmap) { @@ -502,15 +509,36 @@ void BlitBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap, recent SDL libraries, but apparently does not work in 1.2.11 directly */ static Bitmap *tmp_bitmap = NULL; + static int tmp_bitmap_xsize = 0; + static int tmp_bitmap_ysize = 0; + + /* start with largest static bitmaps for initial bitmap size ... */ + if (tmp_bitmap_xsize == 0 && tmp_bitmap_ysize == 0) + { + tmp_bitmap_xsize = MAX(gfx.win_xsize, gfx.scrollbuffer_width); + tmp_bitmap_ysize = MAX(gfx.win_ysize, gfx.scrollbuffer_height); + } + + /* ... and allow for later re-adjustments due to custom artwork bitmaps */ + if (src_bitmap->width > tmp_bitmap_xsize || + src_bitmap->height > tmp_bitmap_ysize) + { + tmp_bitmap_xsize = MAX(tmp_bitmap_xsize, src_bitmap->width); + tmp_bitmap_ysize = MAX(tmp_bitmap_ysize, src_bitmap->height); + + FreeBitmap(tmp_bitmap); + + tmp_bitmap = NULL; + } if (tmp_bitmap == NULL) - tmp_bitmap = CreateBitmap(MAX(FXSIZE, WIN_XSIZE), - MAX(FYSIZE, WIN_YSIZE), DEFAULT_DEPTH); + tmp_bitmap = CreateBitmap(tmp_bitmap_xsize, tmp_bitmap_ysize, + DEFAULT_DEPTH); sysCopyArea(src_bitmap, tmp_bitmap, src_x, src_y, width, height, dst_x, dst_y, BLIT_OPAQUE); sysCopyArea(tmp_bitmap, dst_bitmap, - src_x, src_y, width, height, dst_x, dst_y, BLIT_OPAQUE); + dst_x, dst_y, width, height, dst_x, dst_y, BLIT_OPAQUE); return; } diff --git a/src/libgame/system.h b/src/libgame/system.h index 3791f1e6..aa1057fd 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -726,6 +726,8 @@ struct GfxInfo int vx, vy; int vxsize, vysize; + int win_xsize, win_ysize; + int draw_deactivation_mask; int draw_background_mask; @@ -1144,6 +1146,7 @@ void ClosePlatformDependentStuff(void); void InitGfxFieldInfo(int, int, int, int, int, int, int, int, Bitmap *); void InitGfxDoor1Info(int, int, int, int); void InitGfxDoor2Info(int, int, int, int); +void InitGfxWindowInfo(int, int); void InitGfxScrollbufferInfo(int, int); void InitGfxDrawBusyAnimFunction(void (*draw_busy_anim_function)(void)); void InitGfxCustomArtworkInfo(); diff --git a/src/main.h b/src/main.h index d47b4068..93d3259d 100644 --- a/src/main.h +++ b/src/main.h @@ -1992,7 +1992,7 @@ #define PROGRAM_VERSION_MAJOR 3 #define PROGRAM_VERSION_MINOR 2 #define PROGRAM_VERSION_PATCH 6 -#define PROGRAM_VERSION_BUILD 0 +#define PROGRAM_VERSION_BUILD 1 #define PROGRAM_TITLE_STRING "Rocks'n'Diamonds" #define PROGRAM_AUTHOR_STRING "Holger Schemel" -- 2.34.1