From 5d25c2fc3934b3d7e6b02465361569d3a0033bae Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 17 Aug 2003 02:41:00 +0200 Subject: [PATCH] rnd-20030817-1-src --- CHANGES | 3 ++- src/conftime.h | 2 +- src/files.c | 6 ++--- src/game.c | 7 +++--- src/init.c | 55 ++++++++++++++++++++++++++++++++++++++++---- src/libgame/setup.c | 54 +++++++++++++++++++++++-------------------- src/libgame/system.h | 12 +++++----- src/tools.c | 2 ++ 8 files changed, 97 insertions(+), 44 deletions(-) diff --git a/CHANGES b/CHANGES index 0825e0a0..31671462 100644 --- a/CHANGES +++ b/CHANGES @@ -1,7 +1,8 @@ Release Version 3.0.1 [?? ??? ????] ----------------------------------- - - fixed bug with missing graphic for active red disk bomb - fixed bug which caused a crash at startup under Solaris + - fixed bug which caused the DOS version not finding its files + - fixed bug with missing graphic for active red disk bomb - added custom element property for dropping collected elements - added another 128 custom elements for those who can't get enough diff --git a/src/conftime.h b/src/conftime.h index fab6f3d6..b22f073a 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-08-16 20:51]" +#define COMPILE_DATE_STRING "[2003-08-17 02:36]" diff --git a/src/files.c b/src/files.c index 30bd8666..358333a4 100644 --- a/src/files.c +++ b/src/files.c @@ -1971,9 +1971,9 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->fullscreen = FALSE; si->ask_on_escape = TRUE; - si->graphics_set = getStringCopy(GRAPHICS_SUBDIR); - si->sounds_set = getStringCopy(SOUNDS_SUBDIR); - si->music_set = getStringCopy(MUSIC_SUBDIR); + si->graphics_set = getStringCopy(GFX_CLASSIC_SUBDIR); + si->sounds_set = getStringCopy(SND_CLASSIC_SUBDIR); + si->music_set = getStringCopy(MUS_CLASSIC_SUBDIR); si->override_level_graphics = FALSE; si->override_level_sounds = FALSE; si->override_level_music = FALSE; diff --git a/src/game.c b/src/game.c index 5956c7d8..1aef43ab 100644 --- a/src/game.c +++ b/src/game.c @@ -1237,7 +1237,7 @@ void InitGame() if (CAN_CHANGE(element)) { content = element_info[element].change.target_element; - is_player = (ELEM_IS_PLAYER(content) || content == EL_SP_MURPHY); + is_player = ELEM_IS_PLAYER(content); if (is_player && (found_rating < 3 || element < found_element)) { @@ -1252,7 +1252,7 @@ void InitGame() for(yy=0; yy < 3; yy++) for(xx=0; xx < 3; xx++) { content = element_info[element].content[xx][yy]; - is_player = (ELEM_IS_PLAYER(content) || content == EL_SP_MURPHY); + is_player = ELEM_IS_PLAYER(content); if (is_player && (found_rating < 2 || element < found_element)) { @@ -1267,7 +1267,7 @@ void InitGame() continue; content = element_info[element].change.content[xx][yy]; - is_player = (ELEM_IS_PLAYER(content) || content == EL_SP_MURPHY); + is_player = ELEM_IS_PLAYER(content); if (is_player && (found_rating < 1 || element < found_element)) { @@ -6586,6 +6586,7 @@ void ScrollFigure(struct PlayerInfo *player, int mode) if (Feld[jx][jy] == EL_EXIT_OPEN || Feld[jx][jy] == EL_SP_EXIT_OPEN) { + DrawPlayer(player); /* needed here only to cleanup last field */ RemoveHero(player); if (local_player->friends_still_needed == 0 || diff --git a/src/init.c b/src/init.c index bb214b60..947d0ef0 100644 --- a/src/init.c +++ b/src/init.c @@ -548,6 +548,34 @@ void InitElementGraphicInfo() } } +#if 1 + /* now set all undefined/invalid graphics to -1 to set to default after it */ + for (i=0; i= 0 && special < NUM_SPECIAL_GFX_ARGS) element_info[element].special_graphic[special] = graphic; } + +#if 1 + /* now set all undefined/invalid graphics to default */ + for (i=0; i < MAX_NUM_ELEMENTS; i++) + for (j=0; j < NUM_SPECIAL_GFX_ARGS; j++) + if (graphic_info[element_info[i].special_graphic[j]].bitmap == NULL) + element_info[i].special_graphic[j] = + element_info[i].graphic[ACTION_DEFAULT]; +#endif } static int get_element_from_token(char *token) @@ -878,8 +915,9 @@ static void InitGraphicInfo() int src_x, src_y; int first_frame, last_frame; -#if 0 - printf("::: image: '%s'\n", image->token); +#if 1 + if (strcmp(image->token, "dynamite.EDITOR") == 0) + printf("::: image: '%s' [%d]\n", image->token, i); #endif #if 0 @@ -892,6 +930,11 @@ static void InitGraphicInfo() /* now check if no animation frames are outside of the loaded image */ +#if 1 + if (graphic_info[i].bitmap == NULL) + printf("::: graphic_info['%s'].bitmap == NULL\n", image->token); +#endif + if (graphic_info[i].bitmap == NULL) continue; /* skip check for optional images that are undefined */ @@ -1774,6 +1817,7 @@ void InitElementPropertiesStatic() EL_PLAYER_2, EL_PLAYER_3, EL_PLAYER_4, + EL_SP_MURPHY, -1 }; @@ -3497,6 +3541,7 @@ void OpenAll() InitEventFilter(FilterMouseMotionEvents); InitElementPropertiesStatic(); + InitElementPropertiesEngine(GAME_VERSION_ACTUAL); InitGfx(); diff --git a/src/libgame/setup.c b/src/libgame/setup.c index f0fbd60f..2a5eb1ab 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -270,19 +270,19 @@ static char *getDefaultMusicDir(char *music_subdir) static char *getDefaultArtworkSet(int type) { - return (type == TREE_TYPE_GRAPHICS_DIR ? GRAPHICS_SUBDIR : - type == TREE_TYPE_SOUNDS_DIR ? SOUNDS_SUBDIR : - type == TREE_TYPE_MUSIC_DIR ? MUSIC_SUBDIR : ""); + return (type == TREE_TYPE_GRAPHICS_DIR ? GFX_CLASSIC_SUBDIR : + type == TREE_TYPE_SOUNDS_DIR ? SND_CLASSIC_SUBDIR : + type == TREE_TYPE_MUSIC_DIR ? MUS_CLASSIC_SUBDIR : ""); } static char *getDefaultArtworkDir(int type) { return (type == TREE_TYPE_GRAPHICS_DIR ? - getDefaultGraphicsDir(GRAPHICS_SUBDIR) : + getDefaultGraphicsDir(GFX_CLASSIC_SUBDIR) : type == TREE_TYPE_SOUNDS_DIR ? - getDefaultSoundsDir(SOUNDS_SUBDIR) : + getDefaultSoundsDir(SND_CLASSIC_SUBDIR) : type == TREE_TYPE_MUSIC_DIR ? - getDefaultMusicDir(MUSIC_SUBDIR) : ""); + getDefaultMusicDir(MUS_CLASSIC_SUBDIR) : ""); } static char *getUserGraphicsDir() @@ -448,7 +448,7 @@ char *getSetupFilename() return filename; } -static char *getCorrectedImageBasename(char *basename) +static char *getCorrectedArtworkBasename(char *basename) { char *basename_corrected = basename; @@ -463,7 +463,7 @@ static char *getCorrectedImageBasename(char *basename) /* if corrected filename is still longer than standard MS-DOS filename size (8 characters + 1 dot + 3 characters file extension), shorten filename by writing file extension after 8th basename character */ - if (strlen(basename_corrected) > 8+1+3) + if (strlen(basename_corrected) > 8 + 1 + 3) { static char *msdos_filename = NULL; @@ -471,7 +471,9 @@ static char *getCorrectedImageBasename(char *basename) free(msdos_filename); msdos_filename = getStringCopy(basename_corrected); - strncpy(&msdos_filename[8], &basename[strlen(basename) - 1+3], 1+3 + 1); + strncpy(&msdos_filename[8], &basename[strlen(basename) - (1+3)], 1+3 +1); + + basename_corrected = msdos_filename; } } #endif @@ -487,7 +489,7 @@ char *getCustomImageFilename(char *basename) if (filename != NULL) free(filename); - basename = getCorrectedImageBasename(basename); + basename = getCorrectedArtworkBasename(basename); if (!setup.override_level_graphics) { @@ -524,7 +526,7 @@ char *getCustomImageFilename(char *basename) } /* 4th try: look for default artwork in new default artwork directory */ - filename = getPath2(getDefaultGraphicsDir(GRAPHICS_SUBDIR), basename); + filename = getPath2(getDefaultGraphicsDir(GFX_CLASSIC_SUBDIR), basename); if (fileExists(filename)) return filename; @@ -546,6 +548,8 @@ char *getCustomSoundFilename(char *basename) if (filename != NULL) free(filename); + basename = getCorrectedArtworkBasename(basename); + if (!setup.override_level_sounds) { /* 1st try: look for special artwork in current level series directory */ @@ -581,7 +585,7 @@ char *getCustomSoundFilename(char *basename) } /* 4th try: look for default artwork in new default artwork directory */ - filename = getPath2(getDefaultSoundsDir(SOUNDS_SUBDIR), basename); + filename = getPath2(getDefaultSoundsDir(SND_CLASSIC_SUBDIR), basename); if (fileExists(filename)) return filename; @@ -665,7 +669,7 @@ char *getCustomMusicDirectory(void) } /* 4th try: look for default artwork in new default artwork directory */ - directory = getStringCopy(getDefaultMusicDir(MUSIC_SUBDIR)); + directory = getStringCopy(getDefaultMusicDir(MUS_CLASSIC_SUBDIR)); if (fileExists(directory)) return directory; @@ -2169,7 +2173,7 @@ void LoadArtworkInfo() getTreeInfoFromIdentifier(artwork.gfx_first, setup.graphics_set); if (artwork.gfx_current == NULL) artwork.gfx_current = - getTreeInfoFromIdentifier(artwork.gfx_first, GRAPHICS_SUBDIR); + getTreeInfoFromIdentifier(artwork.gfx_first, GFX_CLASSIC_SUBDIR); if (artwork.gfx_current == NULL) artwork.gfx_current = getFirstValidTreeInfoEntry(artwork.gfx_first); @@ -2177,7 +2181,7 @@ void LoadArtworkInfo() getTreeInfoFromIdentifier(artwork.snd_first, setup.sounds_set); if (artwork.snd_current == NULL) artwork.snd_current = - getTreeInfoFromIdentifier(artwork.snd_first, SOUNDS_SUBDIR); + getTreeInfoFromIdentifier(artwork.snd_first, SND_CLASSIC_SUBDIR); if (artwork.snd_current == NULL) artwork.snd_current = getFirstValidTreeInfoEntry(artwork.snd_first); @@ -2185,7 +2189,7 @@ void LoadArtworkInfo() getTreeInfoFromIdentifier(artwork.mus_first, setup.music_set); if (artwork.mus_current == NULL) artwork.mus_current = - getTreeInfoFromIdentifier(artwork.mus_first, MUSIC_SUBDIR); + getTreeInfoFromIdentifier(artwork.mus_first, MUS_CLASSIC_SUBDIR); if (artwork.mus_current == NULL) artwork.mus_current = getFirstValidTreeInfoEntry(artwork.mus_first); @@ -2272,7 +2276,7 @@ void LoadLevelArtworkInfo() getTreeInfoFromIdentifier(artwork.gfx_first, setup.graphics_set); if (artwork.gfx_current == NULL) artwork.gfx_current = - getTreeInfoFromIdentifier(artwork.gfx_first, GRAPHICS_SUBDIR); + getTreeInfoFromIdentifier(artwork.gfx_first, GFX_CLASSIC_SUBDIR); if (artwork.gfx_current == NULL) artwork.gfx_current = getFirstValidTreeInfoEntry(artwork.gfx_first); } @@ -2283,7 +2287,7 @@ void LoadLevelArtworkInfo() getTreeInfoFromIdentifier(artwork.snd_first, setup.sounds_set); if (artwork.snd_current == NULL) artwork.snd_current = - getTreeInfoFromIdentifier(artwork.snd_first, SOUNDS_SUBDIR); + getTreeInfoFromIdentifier(artwork.snd_first, SND_CLASSIC_SUBDIR); if (artwork.snd_current == NULL) artwork.snd_current = getFirstValidTreeInfoEntry(artwork.snd_first); } @@ -2294,7 +2298,7 @@ void LoadLevelArtworkInfo() getTreeInfoFromIdentifier(artwork.mus_first, setup.music_set); if (artwork.mus_current == NULL) artwork.mus_current = - getTreeInfoFromIdentifier(artwork.mus_first, MUSIC_SUBDIR); + getTreeInfoFromIdentifier(artwork.mus_first, MUS_CLASSIC_SUBDIR); if (artwork.mus_current == NULL) artwork.mus_current = getFirstValidTreeInfoEntry(artwork.mus_first); } @@ -2336,9 +2340,9 @@ static void SaveUserLevelInfo() ldi.first_level = 1; ldi.sort_priority = LEVELCLASS_USER_START; ldi.readonly = FALSE; - setString(&ldi.graphics_set, GRAPHICS_SUBDIR); - setString(&ldi.sounds_set, SOUNDS_SUBDIR); - setString(&ldi.music_set, MUSIC_SUBDIR); + setString(&ldi.graphics_set, GFX_CLASSIC_SUBDIR); + setString(&ldi.sounds_set, SND_CLASSIC_SUBDIR); + setString(&ldi.music_set, MUS_CLASSIC_SUBDIR); #else ldi.name = getStringCopy(getLoginName()); ldi.author = getStringCopy(getRealName()); @@ -2346,9 +2350,9 @@ static void SaveUserLevelInfo() ldi.first_level = 1; ldi.sort_priority = LEVELCLASS_USER_START; ldi.readonly = FALSE; - ldi.graphics_set = getStringCopy(GRAPHICS_SUBDIR); - ldi.sounds_set = getStringCopy(SOUNDS_SUBDIR); - ldi.music_set = getStringCopy(MUSIC_SUBDIR); + ldi.graphics_set = getStringCopy(GFX_CLASSIC_SUBDIR); + ldi.sounds_set = getStringCopy(SND_CLASSIC_SUBDIR); + ldi.music_set = getStringCopy(MUS_CLASSIC_SUBDIR); #endif fprintf(file, "%s\n\n", getFormattedSetupEntry(TOKEN_STR_FILE_IDENTIFIER, diff --git a/src/libgame/system.h b/src/libgame/system.h index f51df054..a9f1efa1 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -207,13 +207,13 @@ #define DOCS_DIRECTORY "docs" #if !defined(PLATFORM_MSDOS) -#define GRAPHICS_SUBDIR "gfx_classic" -#define SOUNDS_SUBDIR "snd_classic" -#define MUSIC_SUBDIR "mus_classic" +#define GFX_CLASSIC_SUBDIR "gfx_classic" +#define SND_CLASSIC_SUBDIR "snd_classic" +#define MUS_CLASSIC_SUBDIR "mus_classic" #else -#define GRAPHICS_SUBDIR "gfx_orig" -#define SOUNDS_SUBDIR "snd_orig" -#define MUSIC_SUBDIR "mus_orig" +#define GFX_CLASSIC_SUBDIR "gfx_orig" +#define SND_CLASSIC_SUBDIR "snd_orig" +#define MUS_CLASSIC_SUBDIR "mus_orig" #endif diff --git a/src/tools.c b/src/tools.c index 9b5873b5..45d37436 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1882,6 +1882,8 @@ boolean Request(char *text, unsigned int req_state) SetDrawBackgroundMask(REDRAW_FIELD | REDRAW_DOOR_1); + SetMouseCursor(CURSOR_DEFAULT); + while(result < 0) { if (PendingEvent()) -- 2.34.1