removed test/debug code for EM graphics engine
authorHolger Schemel <info@artsoft.org>
Tue, 4 Feb 2020 22:09:11 +0000 (23:09 +0100)
committerHolger Schemel <info@artsoft.org>
Tue, 19 May 2020 16:12:59 +0000 (18:12 +0200)
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
src/engines.h
src/game_em/init.c
src/init.c
src/tools.c

index 44a37390e787bbb92d0e3ba4f9d9a2300eaf540d..a607b377908db46b56316ed92ece1ee4b839870b 100644 (file)
@@ -5654,22 +5654,6 @@ struct ConfigInfo image_config[] =
 
   // keyword to stop parser: "NO_MORE_ELEMENT_IMAGES" <-- do not change!
 
 
   // 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"                    },
   { "sp_frame_horizontal",                     "RocksSP.png"           },
   { "sp_frame_horizontal.xpos",                        "7"                     },
   { "sp_frame_horizontal.ypos",                        "14"                    },
index f59217b64ef53ef555fb50e7adf6f17704b14a10..bce3021715d77d8fdc907af876e3af33828c320d 100644 (file)
@@ -25,7 +25,6 @@
 // functions and definitions exported from main program to game_em
 // ============================================================================
 
 // functions and definitions exported from main program to game_em
 // ============================================================================
 
-void SetBitmaps_EM(Bitmap **);
 void UpdateEngineValues(int, int, int, int);
 
 boolean getTeamMode_EM(void);
 void UpdateEngineValues(int, int, int, int);
 
 boolean getTeamMode_EM(void);
index 29d18fd22bda56d29397f9aa175f569b1b1d8af4..fc84fbf31aa282933a00f7b524198378d01d1ae6 100644 (file)
@@ -18,12 +18,8 @@ struct GameInfo_EM game_em;
 
 int open_all(void)
 {
 
 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;
 }
 
   return 0;
 }
index 19c91ca787844c09114d0f2317cb44970224c747..272cc8b97bffa317c8c41ec1d0005a540a99798f 100644 (file)
@@ -318,23 +318,6 @@ void InitImageTextures(void)
     CreateImageTextures(texture_graphics[i]);
 }
 
     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;
 static int getFontBitmapID(int font_nr)
 {
   int special = -1;
index 62f7314bb2e955eb6d1cc1ef2914979a0d0a72bc..ee3bf6a51af02bb3a10806b04ef390516240c6df 100644 (file)
@@ -23,8 +23,6 @@
 #include "screens.h"
 
 
 #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
 #define DEBUG_FRAME_TIME       FALSE
 
 // tool button identifiers
@@ -8578,19 +8576,6 @@ void InitGraphicInfo_EM(void)
 {
   int i, j, p;
 
 {
   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++)
   {
   // 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);
                        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,
       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;
         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;
        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,
        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;
        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,
 }
 
 static void CheckSaveEngineSnapshot_EM(byte action[MAX_PLAYERS], int frame,