From 6d06ba238902736bb99714dc8122bb32a286577a Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Wed, 25 Apr 2007 23:35:54 +0200 Subject: [PATCH] rnd-20070425-1-src --- Makefile | 4 +++ src/Makefile | 7 ++++- src/conf_gfx.c | 2 ++ src/conf_var.c | 4 +++ src/conftime.h | 2 +- src/game.h | 1 + src/game_em/graphics.c | 66 ++++++++++++++++++++++-------------------- src/libgame/misc.c | 13 +++++++++ src/libgame/misc.h | 1 + src/libgame/sound.c | 2 +- src/libgame/system.h | 4 +-- src/main.h | 2 +- src/screens.c | 7 ++++- src/tools.c | 2 ++ 14 files changed, 79 insertions(+), 38 deletions(-) diff --git a/Makefile b/Makefile index 7e91482d..a7a30e7d 100644 --- a/Makefile +++ b/Makefile @@ -91,6 +91,10 @@ cross-msdos: cross-win32: @PATH=$(CROSS_PATH_WIN32)/bin:${PATH} $(MAKE_CMD) PLATFORM=cross-win32 +cross-win32-jue: + @PATH=$(CROSS_PATH_WIN32)/bin:${PATH} $(MAKE_CMD) PLATFORM=cross-win32 \ + SPECIAL_ICON=jue + clean: @$(MAKE_CMD) clean diff --git a/src/Makefile b/src/Makefile index d13e68bc..8d8df942 100644 --- a/src/Makefile +++ b/src/Makefile @@ -214,7 +214,12 @@ RNDLIBS = $(LIBGAME) $(GAME_EM) ICONBASE = windows_icon ifeq ($(PLATFORM),cross-win32) -ICON32X32 = ../graphics/$(ICONBASE)_32x32.bmp +ifdef SPECIAL_ICON +ICONSUFFIX = 32x32_$(SPECIAL_ICON) +else +ICONSUFFIX = 32x32 +endif +ICON32X32 = ../graphics/$(ICONBASE)_$(ICONSUFFIX).bmp ICON = $(ICONBASE).o endif diff --git a/src/conf_gfx.c b/src/conf_gfx.c index a94e3461..0ea0ef86 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -6315,6 +6315,8 @@ struct ConfigInfo image_config[] = { "game.forced_scroll_delay_value", "-1" }, + { "game.use_native_emc_graphics_engine", "false" }, + { "[player].boring_delay_fixed", "1000" }, { "[player].boring_delay_random", "1000" }, { "[player].sleeping_delay_fixed", "2000" }, diff --git a/src/conf_var.c b/src/conf_var.c index 5766be74..dbe6c460 100644 --- a/src/conf_var.c +++ b/src/conf_var.c @@ -4948,6 +4948,10 @@ struct TokenIntPtrInfo image_config_vars[] = "game.forced_scroll_delay_value", &game.forced_scroll_delay_value }, + { + "game.use_native_emc_graphics_engine", + &game.use_native_emc_graphics_engine + }, { "[player].boring_delay_fixed", &game.player_boring_delay_fixed diff --git a/src/conftime.h b/src/conftime.h index 8935086c..6b7e2e54 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-04-24 02:01" +#define COMPILE_DATE_STRING "2007-04-25 23:33" diff --git a/src/game.h b/src/game.h index 05aa8300..d6814708 100644 --- a/src/game.h +++ b/src/game.h @@ -115,6 +115,7 @@ struct GameInfo struct GameButtonInfo button; /* values for graphics engine customization */ + boolean use_native_emc_graphics_engine; int forced_scroll_delay_value; int scroll_delay_value; diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index 3ffdb105..f33d4db8 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -144,17 +144,31 @@ void blitscreen(void) BackToFront_EM(); } -static void DrawLevelField_EM(int x, int y, int sx, int sy, - boolean draw_masked) +static struct GraphicInfo_EM *getObjectGraphic(int x, int y) { 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 + if (!game.use_native_emc_graphics_engine) + getGraphicSourceObjectExt_EM(tile, frame, &g->bitmap, &g->src_x, &g->src_y, + x - 2, y - 2); + return g; +} + +static struct GraphicInfo_EM *getPlayerGraphic(int player_nr, int anim) +{ + struct GraphicInfo_EM *g = &graphic_info_em_player[player_nr][anim][frame]; + if (!game.use_native_emc_graphics_engine) + getGraphicSourcePlayerExt_EM(player_nr, anim, frame, + &g->bitmap, &g->src_x, &g->src_y); + return g; +} + +static void DrawLevelField_EM(int x, int y, int sx, int sy, + boolean draw_masked) +{ + struct GraphicInfo_EM *g = getObjectGraphic(x, y); int src_x = g->src_x + g->src_offset_x; int src_y = g->src_y + g->src_offset_y; int dst_x = sx * TILEX + g->dst_offset_x; @@ -193,14 +207,7 @@ static void DrawLevelField_EM(int x, int y, int sx, int sy, static void DrawLevelFieldCrumbled_EM(int x, int y, int sx, int sy, int crm, boolean draw_masked) { - 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 - + struct GraphicInfo_EM *g = getObjectGraphic(x, y); int left = screen_x / TILEX; int top = screen_y / TILEY; int i; @@ -259,13 +266,7 @@ static void DrawLevelFieldCrumbled_EM(int x, int y, int sx, int sy, static void DrawLevelPlayer_EM(int x1, int y1, int player_nr, int anim, boolean draw_masked) { - struct GraphicInfo_EM *g = &graphic_info_em_player[player_nr][anim][frame]; - -#if USE_EXTENDED_GRAPHICS_ENGINE - getGraphicSourcePlayerExt_EM(player_nr, anim, frame, - &g->bitmap, &g->src_x, &g->src_y); -#endif - + struct GraphicInfo_EM *g = getPlayerGraphic(player_nr, anim); int src_x = g->src_x, src_y = g->src_y; int dst_x, dst_y; @@ -343,11 +344,10 @@ 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 + if (!game.use_native_emc_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); for (y = top; y < top + MAX_BUF_YSIZE; y++) { @@ -359,6 +359,7 @@ static void animscreen(void) struct GraphicInfo_EM *g = &graphic_info_em_object[tile][frame]; int obj = g->unique_identifier; int crm = 0; + boolean redraw_screen_tile = FALSE; /* re-calculate crumbled state of this tile */ if (g->has_crumbled_graphics) @@ -380,12 +381,15 @@ static void animscreen(void) } } + redraw_screen_tile = (screentiles[sy][sx] != obj || + crumbled_state[sy][sx] != crm); + + /* !!! TEST ONLY -- CHANGE THIS !!! */ + if (!game.use_native_emc_graphics_engine) + redraw_screen_tile = TRUE; + /* only redraw screen tiles if they (or their crumbled state) changed */ -#if USE_EXTENDED_GRAPHICS_ENGINE - // if (screentiles[sy][sx] != obj || crumbled_state[sy][sx] != crm) -#else - if (screentiles[sy][sx] != obj || crumbled_state[sy][sx] != crm) -#endif + if (redraw_screen_tile) { DrawLevelField_EM(x, y, sx, sy, FALSE); DrawLevelFieldCrumbled_EM(x, y, sx, sy, crm, FALSE); diff --git a/src/libgame/misc.c b/src/libgame/misc.c index cfee3b2d..f94cc376 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -950,6 +950,19 @@ void checked_free(void *ptr) free(ptr); } +void clear_mem(void *ptr, unsigned long size) +{ +#if defined(PLATFORM_WIN32) + /* for unknown reason, memset() sometimes crashes when compiled with MinGW */ + char *cptr = (char *)ptr; + + while (size--) + *cptr++ = 0; +#else + memset(ptr, 0, size); +#endif +} + /* ------------------------------------------------------------------------- */ /* various helper functions */ diff --git a/src/libgame/misc.h b/src/libgame/misc.h index 3d011184..36544b4d 100644 --- a/src/libgame/misc.h +++ b/src/libgame/misc.h @@ -121,6 +121,7 @@ void *checked_malloc(unsigned long); void *checked_calloc(unsigned long); void *checked_realloc(void *, unsigned long); void checked_free(void *); +void clear_mem(void *, unsigned long); void swap_numbers(int *, int *); void swap_number_pairs(int *, int *, int *, int *); diff --git a/src/libgame/sound.c b/src/libgame/sound.c index 51b62efc..c10575b8 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -2110,7 +2110,7 @@ void PlaySoundExt(int nr, int volume, int stereo_position, int state) else if (stereo_position > SOUND_MAX_RIGHT) stereo_position = SOUND_MAX_RIGHT; - memset(&snd_ctrl, 0, sizeof(SoundControl)); /* to make valgrind happy */ + clear_mem(&snd_ctrl, sizeof(SoundControl)); /* to make valgrind happy */ snd_ctrl.active = TRUE; snd_ctrl.nr = nr; diff --git a/src/libgame/system.h b/src/libgame/system.h index 32da6cc1..4d3ca648 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -48,8 +48,8 @@ #define FULLSCREEN_NOT_AVAILABLE FALSE #define FULLSCREEN_AVAILABLE TRUE -#define CREATE_SPECIAL_EDITION FALSE -#define CREATE_SPECIAL_EDITION_RND_JUE FALSE +#define CREATE_SPECIAL_EDITION TRUE +#define CREATE_SPECIAL_EDITION_RND_JUE TRUE /* default input keys */ #define DEFAULT_KEY_LEFT KSYM_Left diff --git a/src/main.h b/src/main.h index 550d93c6..223013de 100644 --- a/src/main.h +++ b/src/main.h @@ -1960,7 +1960,7 @@ #if CREATE_SPECIAL_EDITION_RND_JUE #undef PROGRAM_TITLE_STRING -#define PROGRAM_TITLE_STRING "Rocks'n'Diamonds - Version Jue" +#define PROGRAM_TITLE_STRING "R'n'D - Version Jue" #undef PROGRAM_UNIX_DATADIR_STRING #define PROGRAM_UNIX_DATADIR_STRING ".rocksndiamonds-jue" #endif diff --git a/src/screens.c b/src/screens.c index 4784307b..527fbd05 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1316,7 +1316,8 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading) FadeSetLeaveScreen(); -#if 1 + /* (does not work well when changing to editor, which fades out itself) */ +#if 0 FadeOut(redraw_mask); #endif @@ -1342,6 +1343,10 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading) return; } +#if 1 + FadeOut(redraw_mask); +#endif + /* needed if last screen was the editor screen */ UndrawSpecialEditorDoor(); diff --git a/src/tools.c b/src/tools.c index 66b11c62..014ae9ce 100644 --- a/src/tools.c +++ b/src/tools.c @@ -6078,7 +6078,9 @@ void ResetGfxAnimation_EM(int x, int y, int tile) void SetGfxAnimation_EM(int tile, int frame_em, int x, int y) { +#if 0 int element = object_mapping[tile].element_rnd; +#endif int action = object_mapping[tile].action; int direction = object_mapping[tile].direction; boolean is_backside = object_mapping[tile].is_backside; -- 2.34.1