From 0448c027347ae76facf5475a21884ca2476f035f Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 9 Oct 2007 00:22:05 +0200 Subject: [PATCH] rnd_jue-3.2.5 --- ChangeLog | 10 ++++++- Makefile | 63 ++++++++++++++++++++++++++------------------ src/Makefile | 2 +- src/conftime.h | 2 +- src/game_em/Makefile | 2 +- src/init.c | 12 +++++---- src/libgame/image.c | 8 ++++++ src/libgame/misc.c | 5 ++++ src/libgame/setup.c | 12 ++++++--- src/libgame/system.c | 12 +++++---- src/libgame/system.h | 1 + src/libgame/x11.c | 15 +++++++++++ src/main.c | 1 + src/screens.c | 3 +++ src/tools.c | 12 ++++++++- 15 files changed, 116 insertions(+), 44 deletions(-) diff --git a/ChangeLog b/ChangeLog index 89bd8d79..58278f94 100644 --- 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) diff --git a/Makefile b/Makefile index 8fb5f1d9..ea1154ef 100644 --- 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 diff --git a/src/Makefile b/src/Makefile index 19d54bb0..6b82fb50 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 33a791ff..44ea4b95 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-10-03 23:58" +#define COMPILE_DATE_STRING "2007-10-09 00:21" diff --git a/src/game_em/Makefile b/src/game_em/Makefile index 4fc21cd0..aec69d09 100644 --- a/src/game_em/Makefile +++ b/src/game_em/Makefile @@ -1,7 +1,7 @@ # ============================================================================= # Rocks'n'Diamonds Makefile (game_em) # ----------------------------------------------------------------------------- -# (c) 1995-2006 Holger Schemel +# (c) 1995-2005 Holger Schemel # ----------------------------------------------------------------------------- # Emerald Mine for X11 © 2000,2001 David Tritscher # ============================================================================= diff --git a/src/init.c b/src/init.c index c0afcfff..9c89ceb5 100644 --- a/src/init.c +++ b/src/init.c @@ -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"); diff --git a/src/libgame/image.c b/src/libgame/image.c index 85a73a54..8ccf1fcb 100644 --- a/src/libgame/image.c +++ b/src/libgame/image.c @@ -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) */ } diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 1cbb1c94..9d23c75f 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -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) diff --git a/src/libgame/setup.c b/src/libgame/setup.c index d69c6537..9d095724 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -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); diff --git a/src/libgame/system.c b/src/libgame/system.c index ed856965..7a6618eb 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -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; } diff --git a/src/libgame/system.h b/src/libgame/system.h index 9b077498..28e5a2ea 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -656,6 +656,7 @@ struct OptionInfo boolean network; boolean verbose; boolean debug; + boolean debug_x11_sync; }; struct ScreenModeInfo diff --git a/src/libgame/x11.c b/src/libgame/x11.c index 12f4e1e4..fe022c5b 100644 --- a/src/libgame/x11.c +++ b/src/libgame/x11.c @@ -22,6 +22,13 @@ 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); diff --git a/src/main.c b/src/main.c index a86ed447..aae4944a 100644 --- a/src/main.c +++ b/src/main.c @@ -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" diff --git a/src/screens.c b/src/screens.c index 18d560b7..0d162f25 100644 --- a/src/screens.c +++ b/src/screens.c @@ -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); diff --git a/src/tools.c b/src/tools.c index 5bf10171..b26add56 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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; -- 2.34.1