rnd_jue-3.2.5
authorHolger Schemel <info@artsoft.org>
Mon, 8 Oct 2007 22:22:05 +0000 (00:22 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:56:31 +0000 (10:56 +0200)
15 files changed:
ChangeLog
Makefile
src/Makefile
src/conftime.h
src/game_em/Makefile
src/init.c
src/libgame/image.c
src/libgame/misc.c
src/libgame/setup.c
src/libgame/system.c
src/libgame/system.h
src/libgame/x11.c
src/main.c
src/screens.c
src/tools.c

index 89bd8d79eb5f0609ade954c104a36291433d9c81..58278f94c7c816077893d4ed7193f7a96934bccf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,17 @@
-2007-10-04
+2007-10-09
+       * fixed nasty bug with auto-override and normal override not working on
+         program startup (especially when current level set has custom artwork)
+
+2007-10-05
        * version 3.2.5 released as special edition "R'n'D jue"
 
+2007-10-05
+       * fixed X11 crash bug when blitting masked title screens over background
+
 2007-10-04
        * changed build system to support special editions (like "R'n'D jue")
        * added (hardcoded) loading graphics for "R'n'D jue" special edition
+       * fixed X11 crash bug when scaling images with width/height less than 32
 
 2007-09-27
        * added "background.PLAYING" (only visible as two-pixel border in game)
index 8fb5f1d9b91725e60d5f596881bafb5ce99a2a72..ea1154ef1c2ea54566dc97b86ab836b3fda47884 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -100,7 +100,7 @@ clean:
 
 
 # -----------------------------------------------------------------------------
-# development only
+# development, test, distribution build and packaging targets
 # -----------------------------------------------------------------------------
 
 auto-conf:
@@ -148,53 +148,66 @@ backup_gfx:
 # prerelease:
 #      ./Scripts/make_prerelease.sh
 
-dist-unix:
+dist-clean:
+       @$(MAKE_CMD) dist-clean
+
+dist-build-unix:
+       @BUILD_DIST=TRUE $(MAKE) x11
+
+dist-build-msdos:
+       @BUILD_DIST=TRUE $(MAKE) cross-msdos
+
+dist-build-win32:
+       @BUILD_DIST=TRUE $(MAKE) cross-win32
+
+dist-build-macosx:
+       # (this is done by "dist-package-macosx" target)
+
+dist-package-unix:
        ./Scripts/make_dist.sh unix .
 
-dist-msdos:
+dist-package-msdos:
        ./Scripts/make_dist.sh dos .
 
-dist-win32:
+dist-package-win32:
        ./Scripts/make_dist.sh win .
 
-dist-macosx:
+dist-package-macosx:
        ./Scripts/make_dist.sh mac . $(MAKE)
 
-upload-unix:
+dist-upload-unix:
        ./Scripts/make_dist.sh unix . upload
 
-upload-msdos:
+dist-upload-msdos:
        ./Scripts/make_dist.sh dos . upload
 
-upload-win32:
+dist-upload-win32:
        ./Scripts/make_dist.sh win . upload
 
-upload-macosx:
+dist-upload-macosx:
        ./Scripts/make_dist.sh mac . upload
 
-dist-clean:
-       @$(MAKE_CMD) dist-clean
-
-dist-build-unix:
-       @BUILD_DIST=TRUE $(MAKE) x11
-
-dist-build-win32:
-       @BUILD_DIST=TRUE $(MAKE) cross-win32
-
-dist-build-msdos:
-       @BUILD_DIST=TRUE $(MAKE) cross-msdos
-
 dist-build-all:
        $(MAKE) clean
        $(MAKE) dist-build-unix         ; $(MAKE) dist-clean
        $(MAKE) dist-build-win32        ; $(MAKE) dist-clean
 #      $(MAKE) dist-build-msdos        ; $(MAKE) dist-clean
 
-# dist-all: dist-build-all dist-unix dist-msdos dist-win32 dist-macosx
-dist-all: dist-build-all dist-unix dist-win32 dist-macosx
+dist-package-all:
+       $(MAKE) dist-package-unix
+       $(MAKE) dist-package-win32
+       $(MAKE) dist-package-macosx
+#      $(MAKE) dist-package-msdos
+
+dist-upload-all:
+       $(MAKE) dist-upload-unix
+       $(MAKE) dist-upload-win32
+       $(MAKE) dist-upload-macosx
+#      $(MAKE) dist-upload-msdos
+
+dist-all: dist-build-all dist-package-all
 
-# upload-all: upload-unix upload-msdos upload-win32 upload-macosx
-upload-all: upload-unix upload-win32 upload-macosx
+upload-all: dist-upload-all
 
 tags:
        $(MAKE_CMD) tags
index 19d54bb0ab92144f1c5062e215fbfde3dc3c9fe3..6b82fb507336ffd46a8cb74be0b81e533352cfdc 100644 (file)
@@ -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
index 33a791ff62da3605e8560ab1fb701fbab0a6462e..44ea4b9515bf1ac62e022134981ecfcc31ccecc0 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2007-10-03 23:58"
+#define COMPILE_DATE_STRING "2007-10-09 00:21"
index 4fc21cd0f12f70d64b654b99203430597c36e5e0..aec69d091a181b622e9c068441192bc77a5534d9 100644 (file)
@@ -1,7 +1,7 @@
 # =============================================================================
 # Rocks'n'Diamonds Makefile (game_em)
 # -----------------------------------------------------------------------------
-# (c) 1995-2006 Holger Schemel <info@artsoft.org>
+# (c) 1995-2005 Holger Schemel <info@artsoft.org>
 # -----------------------------------------------------------------------------
 # Emerald Mine for X11 © 2000,2001 David Tritscher
 # =============================================================================
index c0afcfff25956f44b715ee1ae9934ed64aa2af04..9c89ceb5db0b7137d87db9969c5e95a3b46b8741 100644 (file)
@@ -5384,6 +5384,7 @@ static void InitArtworkConfig()
 static void InitMixer()
 {
   OpenAudio();
+
   StartMixer();
 }
 
@@ -5601,7 +5602,7 @@ static void InitLevelInfo()
   LoadLevelSetup_SeriesInfo();                 /* last played level info */
 }
 
-void InitLevelArtworkInfo()
+static void InitLevelArtworkInfo()
 {
   LoadLevelArtworkInfo();
 }
@@ -5712,6 +5713,8 @@ static boolean CheckArtworkConfigForCustomElements(char *filename)
   SetupFileHash *setup_file_hash;
   boolean redefined_ce_found = FALSE;
 
+  /* !!! CACHE THIS BY USING HASH 'filename' => 'true/false' !!! */
+
   if ((setup_file_hash = loadSetupFileHash(filename)) != NULL)
   {
     BEGIN_HASH_ITERATION(setup_file_hash, itr)
@@ -5757,10 +5760,6 @@ static void InitOverrideArtwork()
     if (filename_local != NULL && !strEqual(filename_base, filename_local))
       redefined_ce_found |= CheckArtworkConfigForCustomElements(filename_local);
 
-#if 0
-    printf("::: redefined_ce_found == %d\n", redefined_ce_found);
-#endif
-
     if (!redefined_ce_found)
     {
       gfx.override_level_graphics = TRUE;
@@ -6081,6 +6080,9 @@ void OpenAll()
   InitLevelArtworkInfo();
   print_timestamp_time("InitLevelArtworkInfo");
 
+  InitOverrideArtwork();       /* needs to know current level directory */
+  print_timestamp_time("InitOverrideArtwork");
+
   InitImages();                        /* needs to know current level directory */
   print_timestamp_time("InitImages");
 
index 85a73a54f2a29322acb80ce9e4b9fab4f779ebd7..8ccf1fcbe81350e15ed3502299e481600c109266 100644 (file)
@@ -649,7 +649,11 @@ void ZoomPixmap(Display *display, GC gc, Pixmap src_pixmap, Pixmap dst_pixmap,
 
   if (scale_down)
   {
+#if 1
+    zoom_factor = MIN(src_width / dst_width, src_height / dst_height);
+#else
     zoom_factor = src_width / dst_width;
+#endif
 
     /* adjust source image size to integer multiple of destination size */
     src_width  = dst_width  * zoom_factor;
@@ -657,7 +661,11 @@ void ZoomPixmap(Display *display, GC gc, Pixmap src_pixmap, Pixmap dst_pixmap,
   }
   else
   {
+#if 1
+    zoom_factor = MIN(dst_width / src_width, dst_height / src_height);
+#else
     zoom_factor = dst_width / src_width;
+#endif
 
     /* no adjustment needed when scaling up (some pixels may be left blank) */
   }
index 1cbb1c942813e9d3bff20bcf697fb67e37c98222..9d23c75f838c42301f3b44f07ad27d530e9f124b 100644 (file)
@@ -664,6 +664,7 @@ void GetOptions(char *argv[], void (*print_usage_function)(void))
   options.network = FALSE;
   options.verbose = FALSE;
   options.debug = FALSE;
+  options.debug_x11_sync = FALSE;
 
 #if !defined(PLATFORM_UNIX)
   if (*options_left == NULL)   /* no options given -- enable verbose mode */
@@ -789,6 +790,10 @@ void GetOptions(char *argv[], void (*print_usage_function)(void))
     {
       options.debug = TRUE;
     }
+    else if (strncmp(option, "-debug-x11-sync", option_len) == 0)
+    {
+      options.debug_x11_sync = TRUE;
+    }
     else if (strncmp(option, "-execute", option_len) == 0)
     {
       if (option_arg == NULL)
index d69c6537e238a42b925e202751fe558bf0216e2d..9d095724b4363edf088ebf8b0928f6741c4ac846 100644 (file)
@@ -670,10 +670,8 @@ char *getCustomImageFilename(char *basename)
 #if defined(CREATE_SPECIAL_EDITION)
   free(filename);
 
-  /* !!! INSERT WARNING HERE TO REPORT MISSING ARTWORK FILES !!! */
-#if 0
-  printf("::: MISSING ARTWORK FILE '%s'\n", basename);
-#endif
+  if (options.debug)
+    Error(ERR_WARN, "cannot find artwork file '%s' (using fallback)", basename);
 
   /* 6th try: look for fallback artwork in old default artwork directory */
   /* (needed to prevent errors when trying to access unused artwork files) */
@@ -743,6 +741,9 @@ char *getCustomSoundFilename(char *basename)
 #if defined(CREATE_SPECIAL_EDITION)
   free(filename);
 
+  if (options.debug)
+    Error(ERR_WARN, "cannot find artwork file '%s' (using fallback)", basename);
+
   /* 6th try: look for fallback artwork in old default artwork directory */
   /* (needed to prevent errors when trying to access unused artwork files) */
   filename = getPath2(options.sounds_directory, SND_FALLBACK_FILENAME);
@@ -811,6 +812,9 @@ char *getCustomMusicFilename(char *basename)
 #if defined(CREATE_SPECIAL_EDITION)
   free(filename);
 
+  if (options.debug)
+    Error(ERR_WARN, "cannot find artwork file '%s' (using fallback)", basename);
+
   /* 6th try: look for fallback artwork in old default artwork directory */
   /* (needed to prevent errors when trying to access unused artwork files) */
   filename = getPath2(options.music_directory, MUS_FALLBACK_FILENAME);
index ed856965d6ab7f6fce783f97c8c7414b78426072..7a6618eb9176dc7b08b8de21a9a5891c50c0e25b 100644 (file)
@@ -384,16 +384,18 @@ Bitmap *CreateBitmapStruct(void)
 Bitmap *CreateBitmap(int width, int height, int depth)
 {
   Bitmap *new_bitmap = CreateBitmapStruct();
-  int real_depth = GetRealDepth(depth);
+  int real_width  = MAX(1, width);     /* prevent zero bitmap width */
+  int real_height = MAX(1, height);    /* prevent zero bitmap height */
+  int real_depth  = GetRealDepth(depth);
 
 #if defined(TARGET_SDL)
-  SDLCreateBitmapContent(new_bitmap, width, height, real_depth);
+  SDLCreateBitmapContent(new_bitmap, real_width, real_height, real_depth);
 #else
-  X11CreateBitmapContent(new_bitmap, width, height, real_depth);
+  X11CreateBitmapContent(new_bitmap, real_width, real_height, real_depth);
 #endif
 
-  new_bitmap->width width;
-  new_bitmap->height = height;
+  new_bitmap->width  = real_width;
+  new_bitmap->height = real_height;
 
   return new_bitmap;
 }
index 9b077498a6d0c069a14573354bc3d1c86d23ceee..28e5a2eaf8a6395656e09f0ea84753d5aed7df34 100644 (file)
@@ -656,6 +656,7 @@ struct OptionInfo
   boolean network;
   boolean verbose;
   boolean debug;
+  boolean debug_x11_sync;
 };
 
 struct ScreenModeInfo
index 12f4e1e4268cabf8e8b39591d442bc67905d3f99..fe022c5bf3f8ddb1f50d9d8c7b776c4f7694894b 100644 (file)
 static void X11InitDisplay();
 static DrawWindow *X11InitWindow();
 
+static int X11DebugErrorHandler(Display *display, XErrorEvent *event)
+{
+  int x = 0;
+
+  return 1 / x;                /* !!! crash program to give backtrace in gdb !!! */
+}
+
 void X11InitVideoDisplay(void)
 {
   /* initialize X11 video */
@@ -55,6 +62,14 @@ static void X11InitDisplay()
     Error(ERR_EXIT, "cannot connect to X server %s",
          XDisplayName(options.display_name));
 
+  if (options.debug_x11_sync)
+  {
+    Error(ERR_WARN, "running in X11 synchronous mode (debug only)");
+
+    XSynchronize(display, True);
+    XSetErrorHandler(X11DebugErrorHandler);
+  }
+
   screen = DefaultScreen(display);
   visual = DefaultVisual(display, screen);
   depth  = DefaultDepth(display, screen);
index a86ed44786697fa199b13b2a539126caa2ba3103..aae4944aace422cf3f208817a530c3be47c35015 100644 (file)
@@ -5524,6 +5524,7 @@ static void print_usage()
         "      --serveronly                 only start network server\n"
         "  -v, --verbose                    verbose mode\n"
         "      --debug                      display debugging information\n"
+        "      --debug-x11-sync             enable X11 synchronous mode\n"
         "  -e, --execute COMMAND            execute batch COMMAND\n"
         "\n"
         "Valid commands for '--execute' option:\n"
index 18d560b77aed2178a498ab6ae97ce970266794c4..0d162f25ad657553682f4caef1220b34abab48f8 100644 (file)
@@ -1141,7 +1141,10 @@ void DrawTitleScreenImage(int nr, boolean initial)
   ClearRectangleOnBackground(drawto, 0, 0, WIN_XSIZE, WIN_YSIZE);
 
   if (DrawingOnBackground(dst_x, dst_y))
+  {
+    SetClipOrigin(bitmap, bitmap->stored_clip_gc, dst_x - src_x, dst_y - src_y);
     BlitBitmapMasked(bitmap, drawto, src_x, src_y, width, height, dst_x, dst_y);
+  }
   else
     BlitBitmap(bitmap, drawto, src_x, src_y, width, height, dst_x, dst_y);
 
index 5bf10171387d179ff2adb285317fedecc954e247..b26add564164aa3468f02f09a5e8bb8c9cf2fff5 100644 (file)
@@ -257,9 +257,19 @@ void DrawMaskedBorder(int redraw_mask)
 
 void BackToFront()
 {
-  int x,y;
+  int x, y;
   DrawBuffer *buffer = (drawto_field == window ? backbuffer : drawto_field);
 
+#if 0
+  printf("::: TILES TO REFRESH: %d\n", redraw_tiles);
+  for (x = 0; x < SCR_FIELDX; x++)
+    for (y = 0 ; y < SCR_FIELDY; y++)
+      if (redraw[redraw_x1 + x][redraw_y1 + y])
+       printf("::: - %d, %d [%s]\n",
+              LEVELX(x), LEVELY(y),
+              EL_NAME(Feld[LEVELX(x)][LEVELY(y)]));
+#endif
+
   if (redraw_mask & REDRAW_TILES && redraw_tiles > REDRAWTILES_THRESHOLD)
     redraw_mask |= REDRAW_FIELD;