From 14f10ebaf067872a8a1412476c8923cb2414aee4 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 24 Apr 2007 02:14:30 +0200 Subject: [PATCH] rnd-20070424-1-src --- src/conftime.h | 2 +- src/engines.h | 1 + src/game_em/graphics.c | 14 +++++++- src/init.c | 6 ++++ src/libgame/setup.c | 27 +++++++++++++++ src/libgame/system.h | 15 ++++++++ src/main.h | 12 +++++-- src/screens.c | 2 +- src/tools.c | 79 ++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 153 insertions(+), 5 deletions(-) diff --git a/src/conftime.h b/src/conftime.h index 6e192a2b..8935086c 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-04-20 20:09" +#define COMPILE_DATE_STRING "2007-04-24 02:01" diff --git a/src/engines.h b/src/engines.h index 9354c652..d5415f82 100644 --- a/src/engines.h +++ b/src/engines.h @@ -33,6 +33,7 @@ extern int getGameFrameDelay_EM(int); extern void PlayLevelSound_EM(int, int, int, int); extern void InitGraphicInfo_EM(void); +void SetGfxAnimation_EM(int, int, int, int); void getGraphicSourceObjectExt_EM(int, int, Bitmap **, int *, int *, int, int); void getGraphicSourcePlayerExt_EM(int, int, int, Bitmap **, int *, int *); diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index 68f1c297..3ffdb105 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -27,7 +27,7 @@ (8 - frame) * ply[p].y) * TILEY / 8 \ - ((SCR_FIELDY - 1) * TILEY) / 2) -#define USE_EXTENDED_GRAPHICS_ENGINE 0 +#define USE_EXTENDED_GRAPHICS_ENGINE 1 int frame; /* current screen frame */ int screen_x; /* current scroll position */ @@ -195,6 +195,12 @@ static void DrawLevelFieldCrumbled_EM(int x, int y, int sx, int sy, { int tile = Draw[y][x]; struct GraphicInfo_EM *g = &graphic_info_em_object[tile][frame]; + +#if USE_EXTENDED_GRAPHICS_ENGINE + getGraphicSourceObjectExt_EM(tile, frame, &g->bitmap, &g->src_x, &g->src_y, + x - 2, y - 2); +#endif + int left = screen_x / TILEX; int top = screen_y / TILEY; int i; @@ -337,6 +343,12 @@ static void animscreen(void) { 0, +1 } }; +#if USE_EXTENDED_GRAPHICS_ENGINE + for (y = 2; y < EM_MAX_CAVE_HEIGHT - 2; y++) + for (x = 2; x < EM_MAX_CAVE_WIDTH - 2; x++) + SetGfxAnimation_EM(Draw[y][x], frame, x - 2, y - 2); +#endif + for (y = top; y < top + MAX_BUF_YSIZE; y++) { for (x = left; x < left + MAX_BUF_XSIZE; x++) diff --git a/src/init.c b/src/init.c index 148f927d..5a2ff12a 100644 --- a/src/init.c +++ b/src/init.c @@ -112,6 +112,12 @@ void InitGadgets() inline void InitElementSmallImagesScaledUp(int graphic) { +#if 0 + struct FileInfo *fi = getImageListEntryFromImageID(graphic); + + printf("::: '%s' -> '%s'\n", fi->token, fi->filename); +#endif + CreateImageWithSmallImages(graphic, graphic_info[graphic].scale_up_factor); } diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 373ffe33..7e621f43 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -602,6 +602,15 @@ char *getCustomImageFilename(char *basename) if (fileExists(filename)) return filename; +#if CREATE_SPECIAL_EDITION + free(filename); + + /* 6th try: look for fallback artwork in old default artwork directory */ + filename = getPath2(options.graphics_directory, GFX_FALLBACK_FILENAME); + if (fileExists(filename)) + return filename; +#endif + return NULL; /* cannot find specified artwork file anywhere */ } @@ -660,6 +669,15 @@ char *getCustomSoundFilename(char *basename) if (fileExists(filename)) return filename; +#if CREATE_SPECIAL_EDITION + free(filename); + + /* 6th try: look for fallback artwork in old default artwork directory */ + filename = getPath2(options.sounds_directory, SND_FALLBACK_FILENAME); + if (fileExists(filename)) + return filename; +#endif + return NULL; /* cannot find specified artwork file anywhere */ } @@ -718,6 +736,15 @@ char *getCustomMusicFilename(char *basename) if (fileExists(filename)) return filename; +#if CREATE_SPECIAL_EDITION + free(filename); + + /* 6th try: look for fallback artwork in old default artwork directory */ + filename = getPath2(options.music_directory, MUS_FALLBACK_FILENAME); + if (fileExists(filename)) + return filename; +#endif + return NULL; /* cannot find specified artwork file anywhere */ } diff --git a/src/libgame/system.h b/src/libgame/system.h index 99931593..32da6cc1 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -48,6 +48,9 @@ #define FULLSCREEN_NOT_AVAILABLE FALSE #define FULLSCREEN_AVAILABLE TRUE +#define CREATE_SPECIAL_EDITION FALSE +#define CREATE_SPECIAL_EDITION_RND_JUE FALSE + /* default input keys */ #define DEFAULT_KEY_LEFT KSYM_Left #define DEFAULT_KEY_RIGHT KSYM_Right @@ -339,15 +342,27 @@ #define CACHE_DIRECTORY "cache" #if !defined(PLATFORM_MSDOS) +#if CREATE_SPECIAL_EDITION_RND_JUE +#define GFX_CLASSIC_SUBDIR "jue0" +#define SND_CLASSIC_SUBDIR "jue0" +#define MUS_CLASSIC_SUBDIR "jue0" +#else #define GFX_CLASSIC_SUBDIR "gfx_classic" #define SND_CLASSIC_SUBDIR "snd_classic" #define MUS_CLASSIC_SUBDIR "mus_classic" +#endif #else #define GFX_CLASSIC_SUBDIR "gfx_orig" #define SND_CLASSIC_SUBDIR "snd_orig" #define MUS_CLASSIC_SUBDIR "mus_orig" #endif +#if CREATE_SPECIAL_EDITION +#define GFX_FALLBACK_FILENAME "fallback.pcx" +#define SND_FALLBACK_FILENAME "fallback.wav" +#define MUS_FALLBACK_FILENAME "fallback.wav" +#endif + /* file names and filename extensions */ #if !defined(PLATFORM_MSDOS) #define LEVELSETUP_DIRECTORY "levelsetup" diff --git a/src/main.h b/src/main.h index 76304e2a..550d93c6 100644 --- a/src/main.h +++ b/src/main.h @@ -1952,10 +1952,18 @@ #define PROGRAM_TITLE_STRING "Rocks'n'Diamonds" #define PROGRAM_AUTHOR_STRING "Holger Schemel" -#define PROGRAM_COPYRIGHT_STRING "Copyright ©1995-2006 by Holger Schemel" +#define PROGRAM_COPYRIGHT_STRING "Copyright ©1995-2007 by Holger Schemel" #define PROGRAM_EMAIL_STRING "info@artsoft.org" #define PROGRAM_WEBSITE_STRING "http://www.artsoft.org/" #define PROGRAM_GAME_BY_STRING "A Game by Artsoft Entertainment" +#define PROGRAM_UNIX_DATADIR_STRING ".rocksndiamonds" + +#if CREATE_SPECIAL_EDITION_RND_JUE +#undef PROGRAM_TITLE_STRING +#define PROGRAM_TITLE_STRING "Rocks'n'Diamonds - Version Jue" +#undef PROGRAM_UNIX_DATADIR_STRING +#define PROGRAM_UNIX_DATADIR_STRING ".rocksndiamonds-jue" +#endif #define ICON_TITLE_STRING PROGRAM_TITLE_STRING #define COOKIE_PREFIX "ROCKSNDIAMONDS" @@ -1963,7 +1971,7 @@ #define USERDATA_DIRECTORY_WIN32 PROGRAM_TITLE_STRING #define USERDATA_DIRECTORY_MACOSX PROGRAM_TITLE_STRING -#define USERDATA_DIRECTORY_UNIX ".rocksndiamonds" +#define USERDATA_DIRECTORY_UNIX PROGRAM_UNIX_DATADIR_STRING #define USERDATA_DIRECTORY_DOS "userdata" #if defined(PLATFORM_WIN32) diff --git a/src/screens.c b/src/screens.c index 4989985a..4784307b 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1529,7 +1529,7 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading) MapTapeButtons(); MapScreenMenuGadgets(SCREEN_MASK_MAIN); -#if 0 +#if 1 DrawMaskedBorder(REDRAW_ALL); #endif diff --git a/src/tools.c b/src/tools.c index ad36f123..66b11c62 100644 --- a/src/tools.c +++ b/src/tools.c @@ -6076,6 +6076,67 @@ void ResetGfxAnimation_EM(int x, int y, int tile) GfxFrame[x][y] = 0; } +void SetGfxAnimation_EM(int tile, int frame_em, int x, int y) +{ + int element = object_mapping[tile].element_rnd; + int action = object_mapping[tile].action; + int direction = object_mapping[tile].direction; + boolean is_backside = object_mapping[tile].is_backside; + boolean action_removing = (action == ACTION_DIGGING || + action == ACTION_SNAPPING || + action == ACTION_COLLECTING); + +#if 0 + printf("::: SET: %d, %d: '%s'\n", x, y, EL_NAME(element)); +#endif + +#if 1 + if (action_removing) + { +#if 0 + printf("::: %d, %d: action_removing [%s]\n", x, y, EL_NAME(element)); +#endif + + GfxFrame[x][y] = 7 - frame_em; + } + else if (action == ACTION_FALLING || + action == ACTION_MOVING || + action == ACTION_PUSHING || + action == ACTION_EATING || + action == ACTION_FILLING || + action == ACTION_EMPTYING) + { + int move_dir = + (action == ACTION_FALLING || + action == ACTION_FILLING || + action == ACTION_EMPTYING ? MV_DOWN : direction); + + if (is_backside) + { + GfxFrame[x][y]++; + + if (move_dir == MV_LEFT) + GfxFrame[x - 1][y] = GfxFrame[x][y]; + else if (move_dir == MV_RIGHT) + GfxFrame[x + 1][y] = GfxFrame[x][y]; + else if (move_dir == MV_UP) + GfxFrame[x][y - 1] = GfxFrame[x][y]; + else if (move_dir == MV_DOWN) + GfxFrame[x][y + 1] = GfxFrame[x][y]; + } + +#if 0 + printf("::: %d, %d: %s, %d, %d [%d]\n", x, y, EL_NAME(element), is_backside, + move_dir, GfxFrame[x][y]); +#endif + } + else + GfxFrame[x][y]++; +#else + GfxFrame[x][y] = 7 - frame_em; +#endif +} + void getGraphicSourceObjectExt_EM(int tile, int frame_em, Bitmap **src_bitmap, int *src_x, int *src_y, int x, int y) @@ -6097,10 +6158,28 @@ void getGraphicSourceObjectExt_EM(int tile, int frame_em, struct GraphicInfo *g = &graphic_info[graphic]; int sync_frame; +#if 0 + printf("::: GET: %d, %d: '%s'\n", x, y, EL_NAME(element)); +#endif + +#if 0 + if (GfxFrame[x][y] < 8) + printf("::: %d, %d: %d [%s]\n", x, y, GfxFrame[x][y], EL_NAME(element)); +#endif + +#if 1 + if (graphic_info[graphic].anim_global_sync) + sync_frame = FrameCounter; + else if (IN_FIELD(x, y, MAX_LEV_FIELDX, MAX_LEV_FIELDY)) + sync_frame = GfxFrame[x][y]; + else + sync_frame = 0; /* steel border */ +#else if (graphic_info[graphic].anim_global_sync) sync_frame = FrameCounter; else sync_frame = 7 - frame_em; +#endif SetRandomAnimationValue(x, y); -- 2.34.1