From 8da08295743b5a375f8cabe26cc1d48249c89b42 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 4 Feb 2020 23:09:11 +0100 Subject: [PATCH] removed test/debug code for EM graphics engine This commit removes the testing and debugging capabilities for the native Emerald Mine graphics engine (that can, but does not have to be used with the native Emerald Mine game engine). The main purpose of this test code was to check if the R'n'D "graphicsinfo.conf" style graphics definitions, when used with the native Emerald Mine engine, map exactly to this engine's hard-coded graphics definitions, to be able to flexibly use R'n'D style graphics definitions also for the native Emerald Mine game engine. To test a given "graphicsinfo.conf" file against the internal graphics definitions of the native Emerald Mine engine, its definitions have to match an "objects" and "players" graphics file which is hard-coded in the R'n'D graphics configuration file "conf_gfx.c" using the tokens "emc_object" and "emc_sprite". (To prevent the game from using them in non-debugging context, it normally refers to existing default artwork instead of the test graphics files mentioned above.) When testing or debugging, set these file names to "emc_objects.png" and "emc_players.png" and enable upscaling to double size (assuming the tiles in the test artwork have their original 16x16 pixel size). Also set "DEBUG_EM_GFX" to "TRUE" in "src/tools.c". Then recompile. When starting, the program performs the test, outputs all graphics definitions that differ from the hard-coded internal definitions and exits. To perform the test against the correct artwork, select the artwork to test against before running the test. Usually the test is executed using the graphics set "gfx_classic_emc.aga" from the Emerald Mine Club level package, which uses the original artwork that is also used by the game "Emerald Mine for X11". (To perform the test described above, use a version of the code prior to this commit.) --- src/conf_gfx.c | 16 ----- src/engines.h | 1 - src/game_em/init.c | 8 +-- src/init.c | 17 ----- src/tools.c | 152 --------------------------------------------- 5 files changed, 2 insertions(+), 192 deletions(-) diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 44a37390..a607b377 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -5654,22 +5654,6 @@ struct ConfigInfo image_config[] = // keyword to stop parser: "NO_MORE_ELEMENT_IMAGES" <-- do not change! -#if 1 - // !!! TEMPORARILY STORED HERE -- PROBABLY TO BE CHANGED !!! - - // (for testing, change filename back to "emc_objects dot png") - { "emc_object", "RocksEMC.png" }, -#if 0 - { "emc_object.scale_up_factor", "2" }, -#endif - - // (for testing, change filename back to "emc_players dot png") - { "emc_sprite", "RocksEMC.png" }, -#if 0 - { "emc_sprite.scale_up_factor", "2" }, -#endif -#endif - { "sp_frame_horizontal", "RocksSP.png" }, { "sp_frame_horizontal.xpos", "7" }, { "sp_frame_horizontal.ypos", "14" }, diff --git a/src/engines.h b/src/engines.h index f59217b6..bce30217 100644 --- a/src/engines.h +++ b/src/engines.h @@ -25,7 +25,6 @@ // functions and definitions exported from main program to game_em // ============================================================================ -void SetBitmaps_EM(Bitmap **); void UpdateEngineValues(int, int, int, int); boolean getTeamMode_EM(void); diff --git a/src/game_em/init.c b/src/game_em/init.c index 29d18fd2..fc84fbf3 100644 --- a/src/game_em/init.c +++ b/src/game_em/init.c @@ -18,12 +18,8 @@ struct GameInfo_EM game_em; int open_all(void) { - Bitmap *emc_bitmaps[2]; - - SetBitmaps_EM(emc_bitmaps); - - objBitmap = emc_bitmaps[0]; - sprBitmap = emc_bitmaps[1]; + objBitmap = NULL; + sprBitmap = NULL; return 0; } diff --git a/src/init.c b/src/init.c index 19c91ca7..272cc8b9 100644 --- a/src/init.c +++ b/src/init.c @@ -318,23 +318,6 @@ void InitImageTextures(void) CreateImageTextures(texture_graphics[i]); } -#if 1 -// !!! FIX THIS (CHANGE TO USING NORMAL ELEMENT GRAPHIC DEFINITIONS) !!! -void SetBitmaps_EM(Bitmap **em_bitmap) -{ - em_bitmap[0] = graphic_info[IMG_EMC_OBJECT].bitmap; - em_bitmap[1] = graphic_info[IMG_EMC_SPRITE].bitmap; -} -#endif - -#if 0 -// !!! FIX THIS (CHANGE TO USING NORMAL ELEMENT GRAPHIC DEFINITIONS) !!! -void SetBitmaps_SP(Bitmap **sp_bitmap) -{ - *sp_bitmap = graphic_info[IMG_SP_OBJECTS].bitmap; -} -#endif - static int getFontBitmapID(int font_nr) { int special = -1; diff --git a/src/tools.c b/src/tools.c index 62f7314b..ee3bf6a5 100644 --- a/src/tools.c +++ b/src/tools.c @@ -23,8 +23,6 @@ #include "screens.h" -// select level set with EMC X11 graphics before activating EM GFX debugging -#define DEBUG_EM_GFX FALSE #define DEBUG_FRAME_TIME FALSE // tool button identifiers @@ -8578,19 +8576,6 @@ void InitGraphicInfo_EM(void) { int i, j, p; -#if DEBUG_EM_GFX - int num_em_gfx_errors = 0; - - if (graphic_info_em_object[0][0].bitmap == NULL) - { - // EM graphics not yet initialized in em_open_all() - - return; - } - - printf("::: [4 errors can be ignored (1 x 'bomb', 3 x 'em_dynamite']\n"); -#endif - // always start with reliable default values for (i = 0; i < TILE_MAX; i++) { @@ -8808,13 +8793,6 @@ void InitGraphicInfo_EM(void) special_animation && j == 4 ? 3 : effective_action != action ? 0 : j); - -#if DEBUG_EM_GFX - Bitmap *debug_bitmap = g_em->bitmap; - int debug_src_x = g_em->src_x; - int debug_src_y = g_em->src_y; -#endif - int frame = getAnimationFrame(g->anim_frames, g->anim_delay, g->anim_mode, @@ -8910,74 +8888,6 @@ void InitGraphicInfo_EM(void) bit 5 - 0 ( 6 bit): graphic height */ g_em->unique_identifier = (graphic << 16) | (frame << 12) | (g_em->width << 6) | g_em->height; - -#if DEBUG_EM_GFX - - // skip check for EMC elements not contained in original EMC artwork - if (element == EL_EMC_FAKE_ACID) - continue; - - if (g_em->bitmap != debug_bitmap || - g_em->src_x != debug_src_x || - g_em->src_y != debug_src_y || - g_em->src_offset_x != 0 || - g_em->src_offset_y != 0 || - g_em->dst_offset_x != 0 || - g_em->dst_offset_y != 0 || - g_em->width != TILEX || - g_em->height != TILEY) - { - static int last_i = -1; - - if (i != last_i) - { - printf("\n"); - last_i = i; - } - - printf("::: EMC GFX ERROR for element %d -> %d ('%s', '%s', %d)", - i, element, element_info[element].token_name, - element_action_info[effective_action].suffix, direction); - - if (element != effective_element) - printf(" [%d ('%s')]", - effective_element, - element_info[effective_element].token_name); - - printf("\n"); - - if (g_em->bitmap != debug_bitmap) - printf(" %d (%d): different bitmap! (0x%08x != 0x%08x)\n", - j, is_backside, (int)(g_em->bitmap), (int)(debug_bitmap)); - - if (g_em->src_x != debug_src_x || - g_em->src_y != debug_src_y) - printf(" frame %d (%c): %d,%d (%d,%d) should be %d,%d (%d,%d)\n", - j, (is_backside ? 'B' : 'F'), - g_em->src_x, g_em->src_y, - g_em->src_x / 32, g_em->src_y / 32, - debug_src_x, debug_src_y, - debug_src_x / 32, debug_src_y / 32); - - if (g_em->src_offset_x != 0 || - g_em->src_offset_y != 0 || - g_em->dst_offset_x != 0 || - g_em->dst_offset_y != 0) - printf(" %d (%d): offsets %d,%d and %d,%d should be all 0\n", - j, is_backside, - g_em->src_offset_x, g_em->src_offset_y, - g_em->dst_offset_x, g_em->dst_offset_y); - - if (g_em->width != TILEX || - g_em->height != TILEY) - printf(" %d (%d): size %d,%d should be %d,%d\n", - j, is_backside, - g_em->width, g_em->height, TILEX, TILEY); - - num_em_gfx_errors++; - } -#endif - } } @@ -9045,13 +8955,6 @@ void InitGraphicInfo_EM(void) Bitmap *src_bitmap; int src_x, src_y; int sync_frame = j; - -#if DEBUG_EM_GFX - Bitmap *debug_bitmap = g_em->bitmap; - int debug_src_x = g_em->src_x; - int debug_src_y = g_em->src_y; -#endif - int frame = getAnimationFrame(g->anim_frames, g->anim_delay, g->anim_mode, @@ -9069,64 +8972,9 @@ void InitGraphicInfo_EM(void) g_em->dst_offset_y = 0; g_em->width = TILEX; g_em->height = TILEY; - -#if DEBUG_EM_GFX - - // skip check for EMC elements not contained in original EMC artwork - if (element == EL_PLAYER_3 || - element == EL_PLAYER_4) - continue; - - if (g_em->bitmap != debug_bitmap || - g_em->src_x != debug_src_x || - g_em->src_y != debug_src_y) - { - static int last_i = -1; - - if (i != last_i) - { - printf("\n"); - last_i = i; - } - - printf("::: EMC GFX ERROR for p/a %d/%d -> %d ('%s', '%s', %d)", - p, i, element, element_info[element].token_name, - element_action_info[effective_action].suffix, direction); - - if (element != effective_element) - printf(" [%d ('%s')]", - effective_element, - element_info[effective_element].token_name); - - printf("\n"); - - if (g_em->bitmap != debug_bitmap) - printf(" %d: different bitmap! (0x%08x != 0x%08x)\n", - j, (int)(g_em->bitmap), (int)(debug_bitmap)); - - if (g_em->src_x != debug_src_x || - g_em->src_y != debug_src_y) - printf(" frame %d: %d,%d (%d,%d) should be %d,%d (%d,%d)\n", - j, - g_em->src_x, g_em->src_y, - g_em->src_x / 32, g_em->src_y / 32, - debug_src_x, debug_src_y, - debug_src_x / 32, debug_src_y / 32); - - num_em_gfx_errors++; - } -#endif - } } } - -#if DEBUG_EM_GFX - printf("\n"); - printf("::: [%d errors found]\n", num_em_gfx_errors); - - exit(0); -#endif } static void CheckSaveEngineSnapshot_EM(byte action[MAX_PLAYERS], int frame, -- 2.34.1