Merge branch 'master' into releases 3.2.6.1
authorHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:57:17 +0000 (10:57 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:57:17 +0000 (10:57 +0200)
ChangeLog
src/conftime.h
src/files.c
src/init.c
src/libgame/msdos.c
src/libgame/system.c
src/libgame/system.h
src/main.h

index 52445eae5e8ef61f0547924775e85372e08e4101..41f88faf0dd22234d59f47d5786559301f09af8d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+2009-06-15
+       * version 3.2.6.1 released
+
+2009-05-31
+       * fixed bug with element_info[e].gfx_element not being initialized in
+         early game stage, causing native graphics in EMC level sets to be
+         mapped completely to EL_EMPTY (causing a blank screen when playing)
+         (this only happened when starting the program with an EMC set with
+         native graphics, but not when switching to such a set at runtime)
+
+2009-03-30
+       * deactivated blit-to-same-surface workaround again (see 2009-03-24)
+         and using self-compiled, patched SDL.dll that solves this problem
+         (interim solution until release of SDL 1.2.14 that should fix this)
+
+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
index c8c6c65664eaaa0d4d5f4fd48ed4a96da64e0a07..e3b6bfc91f60b860a302f5b0a28817ac1e4121da 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2008-11-03 21:21"
+#define COMPILE_DATE_STRING "2009-06-15 22:46"
index c32777225a076a5a2477b678b15150dbe8b2a627..bfa498816b667306e86dcf59f9ce43a6b07f0b18 100644 (file)
@@ -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) */
index 9dab9371e449ca0d78369721134f346fe34443cc..ea5ec18de985d667f2fccda3b504cdbc3f7c1fc5 100644 (file)
@@ -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();
 
@@ -6190,6 +6191,7 @@ void OpenAll()
 
   InitElementPropertiesStatic();
   InitElementPropertiesEngine(GAME_VERSION_ACTUAL);
+  InitElementPropertiesGfxElement();
 
   print_timestamp_time("[post-video]");
 
index 60728bef8b6fdb69390d4c9b1d5c879e97be0486..407752bc96b73b6f3d6e2de9cd2d5a1b811f6c2f 100644 (file)
@@ -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)
index 20ea20bed03553ee0e76107830f8dc3031045e41..d4b7f9a92b7b5147f38f93eca7ad7e028bb6b7f8 100644 (file)
@@ -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;
 }
@@ -492,7 +499,12 @@ void BlitBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap,
     return;
 
 #if 0
-  /* !!! APPARENTLY THIS HAS BEEN FIXED IN SDL 1.2.12 !!! */
+  /* !!! 2009-03-30: Fixed by using self-compiled, patched SDL.dll !!! */
+  /* (This bug still exists in the actual (as of 2009-06-15) version 1.2.13,
+     but is already fixed in SVN and should therefore finally be fixed with
+     the next official SDL release, which is probably version 1.2.14.) */
+#if 1
+  /* !!! 2009-03-24: It seems that this problem still exists in 1.2.12 !!! */
 #if defined(TARGET_SDL) && defined(PLATFORM_WIN32)
   if (src_bitmap == dst_bitmap)
   {
@@ -502,19 +514,41 @@ 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;
   }
 #endif
+#endif
 #endif
 
   sysCopyArea(src_bitmap, dst_bitmap,
index 3791f1e6523b07e16e7d70b6886f5b22a01cefc0..aa1057fd956f6b7066acc3c893333ae2b35fed60 100644 (file)
@@ -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();
index d47b40686a75dfdf113932272fd9e2b48df710fe..68f1eed082c22ec8b93d9b9e902c93f65ca9849d 100644 (file)
 #define IS_DC_STEELWALL_2(e)   ((e) >= EL_DC_STEELWALL_2_LEFT &&       \
                                 (e) <= EL_DC_STEELWALL_2_SINGLE)
 
+#if 1
+
 #if 1
 #define GFX_ELEMENT(e)         (element_info[e].gfx_element)
+#else
+#define GFX_ELEMENT(e)         (element_info[e].gfx_element ==         \
+                                (element_info[e].use_gfx_element ?     \
+                                 element_info[e].gfx_element : e)  ?   \
+                                element_info[e].gfx_element :          \
+                                element_info[e].gfx_element +          \
+                                0 * printf("::: %d: %d <-> %d\n",      \
+                                           e,                          \
+                                           element_info[e].gfx_element,      \
+                                           element_info[e].use_gfx_element ? \
+                                           element_info[e].gfx_element : e))
+#endif
+
 #else
 #define GFX_ELEMENT(e)         (element_info[e].use_gfx_element ?      \
                                 element_info[e].gfx_element : e)
 #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"