changed simple "printf()" debug output to new debug log function
authorHolger Schemel <info@artsoft.org>
Wed, 16 Sep 2020 22:53:03 +0000 (00:53 +0200)
committerHolger Schemel <info@artsoft.org>
Wed, 16 Sep 2020 22:53:03 +0000 (00:53 +0200)
src/game.c
src/game_sp/DDScrollBuffer.c
src/game_sp/MainGameLoop.c
src/init.c
src/libgame/misc.c
src/libgame/sdl.c
src/libgame/setup.c
src/netserv.c
src/screens.c
src/tape.c
src/tools.c

index c926738df7c2a3c7f724a83c76d817a14bce78d3..ee3e97891eca48f6ce918a4a5bbae434c8b1c6f7 100644 (file)
@@ -2635,7 +2635,10 @@ static void DisplayGameControlValues(void)
        element = value;
        graphic = el2panelimg(value);
 
-       // printf("::: %d, '%s' [%d]\n", element, EL_NAME(element), size);
+#if 0
+       Debug("game:DisplayGameControlValues", "%d, '%s' [%d]",
+             element, EL_NAME(element), size);
+#endif
 
        if (element >= EL_GRAPHIC_1 && element <= EL_GRAPHIC_8 && size == 0)
          size = TILESIZE;
@@ -11657,9 +11660,9 @@ static void GameActionsExt(void)
     byte mapped_action[MAX_PLAYERS];
 
 #if DEBUG_PLAYER_ACTIONS
-    printf(":::");
+    Print(":::");
     for (i = 0; i < MAX_PLAYERS; i++)
-      printf(" %d, ", stored_player[i].effective_action);
+      Print(" %d, ", stored_player[i].effective_action);
 #endif
 
     for (i = 0; i < MAX_PLAYERS; i++)
@@ -11669,19 +11672,19 @@ static void GameActionsExt(void)
       stored_player[i].effective_action = mapped_action[i];
 
 #if DEBUG_PLAYER_ACTIONS
-    printf(" =>");
+    Print(" =>");
     for (i = 0; i < MAX_PLAYERS; i++)
-      printf(" %d, ", stored_player[i].effective_action);
-    printf("\n");
+      Print(" %d, ", stored_player[i].effective_action);
+    Print("\n");
 #endif
   }
 #if DEBUG_PLAYER_ACTIONS
   else
   {
-    printf(":::");
+    Print(":::");
     for (i = 0; i < MAX_PLAYERS; i++)
-      printf(" %d, ", stored_player[i].effective_action);
-    printf("\n");
+      Print(" %d, ", stored_player[i].effective_action);
+    Print("\n");
   }
 #endif
 #endif
index 13c773a164e99e2432ad67cc4d0d045184fb1a71..6976f939b875f2fda62338796de4e22e17c3ef5a 100644 (file)
@@ -234,7 +234,7 @@ void UpdatePlayfield(boolean force_redraw)
   }
 
 #if DEBUG_REDRAW
-  printf("::: FRAME %d: %d redrawn\n", FrameCounter, num_redrawn);
+  Debug("game:playing:SP", "FRAME %d: %d redrawn", FrameCounter, num_redrawn);
 #endif
 }
 
index e1a20b102466cfcf641c694ffa8bfc9b5125b15a..c6d2d6dcfec6fa5c62aecaed377fa71343533ce9 100644 (file)
@@ -99,7 +99,7 @@ void subCalculateScreenScrollPos(void)
   {
     subGetRandomNumber();
 
-    // printf("::: ExplosionShake [%d]\n", FrameCounter);
+    // Debug("game:playing:SP", "ExplosionShake [%d]", FrameCounter);
   }
 
   ScreenScrollXPos = MurphyScreenXPos - (SCR_FIELDX / 2) * TILESIZE;
index 41e891cc641d3d1db748fb7c8b7f4147d76ea6c5..d126103a47d662fa6b7c4ece63852b4aa142632d 100644 (file)
@@ -1879,7 +1879,10 @@ static void InitGraphicCompatibilityInfo(void)
        // process all images which default to same image as "global.door"
        if (strEqual(fi->default_filename, fi_global_door->default_filename))
        {
-         // printf("::: special treatment needed for token '%s'\n", fi->token);
+#if 0
+         Debug("init:InitGraphicCompatibilityInfo",
+               "special treatment needed for token '%s'", fi->token);
+#endif
 
          graphic_info[i].bitmaps = graphic_info[IMG_GLOBAL_DOOR].bitmaps;
          graphic_info[i].bitmap  = graphic_info[IMG_GLOBAL_DOOR].bitmap;
@@ -6008,11 +6011,12 @@ void ReloadCustomArtwork(int force_reload)
   if (gfx_new_identifier != NULL || force_reload_gfx)
   {
 #if 0
-    printf("RELOADING GRAPHICS '%s' -> '%s' ['%s', '%s']\n",
-          artwork.gfx_current_identifier,
-          gfx_new_identifier,
-          artwork.gfx_current->identifier,
-          leveldir_current->graphics_set);
+    Debug("init:ReloadCustomArtwork",
+         "RELOADING GRAPHICS '%s' -> '%s' ['%s', '%s']",
+         artwork.gfx_current_identifier,
+         gfx_new_identifier,
+         artwork.gfx_current->identifier,
+         leveldir_current->graphics_set);
 #endif
 
     InitImages();
index b1ea74e078f22d7e01dbf225d13692f7f74e3b0c..c5067fb9b8e78a3aa0e1e162b4a284d536f21e61 100644 (file)
@@ -2255,12 +2255,12 @@ static void dumpList(ListNode *node_first)
 
   while (node)
   {
-    printf("['%s' (%d)]\n", node->key,
-          ((struct ListNodeInfo *)node->content)->num_references);
+    Debug("internal:dumpList", "['%s' (%d)]", node->key,
+         ((struct ListNodeInfo *)node->content)->num_references);
     node = node->next;
   }
 
-  printf("[%d nodes]\n", getNumNodes(node_first));
+  Debug("internal:dumpList", "[%d nodes]", getNumNodes(node_first));
 }
 #endif
 
@@ -3861,12 +3861,12 @@ void debug_print_timestamp(int counter_nr, char *message)
   counter[counter_nr][1] = counter[counter_nr][0];
 
   if (message)
-    Error(ERR_DEBUG, "%s%s%s %.3f %s",
-          debug_print_timestamp_get_padding(counter_nr * indent_size),
-          message,
-          debug_print_timestamp_get_padding(padding_size - strlen(message)),
-          timestamp_interval / 1000,
-          unit);
+    Debug("time", "%s%s%s %.3f %s",
+         debug_print_timestamp_get_padding(counter_nr * indent_size),
+         message,
+         debug_print_timestamp_get_padding(padding_size - strlen(message)),
+         timestamp_interval / 1000,
+         unit);
 }
 
 #if 0
index 794bad30a1f836748679d342b8914b2d1d9cc7d8..ece4e3f7c0b7beb98a1608a01eead8ec3b671ab3 100644 (file)
@@ -84,8 +84,8 @@ static void UpdateScreenExt(SDL_Rect *rect, boolean with_frame_delay)
     static int LastFrameCounter = 0;
     boolean changed = (FrameCounter != LastFrameCounter);
 
-    printf("::: FrameCounter == %d [%s]\n", FrameCounter,
-          (changed ? "-" : "SAME FRAME UPDATED"));
+    Debug("internal:frame", "FrameCounter == %d [%s]", FrameCounter,
+         (changed ? "-" : "SAME FRAME UPDATED"));
 
     LastFrameCounter = FrameCounter;
 
index f42945fbe81c797e0aa20aa00762173c549c65a4..206db77e4de949a765822011b9ddd738a68917ca 100644 (file)
@@ -1361,19 +1361,19 @@ void dumpTreeInfo(TreeInfo *node, int depth)
 {
   int i;
 
-  printf("Dumping TreeInfo:\n");
+  Print("Dumping TreeInfo:\n");
 
   while (node)
   {
     for (i = 0; i < (depth + 1) * 3; i++)
-      printf(" ");
+      Print(" ");
 
-    printf("'%s' / '%s'\n", node->identifier, node->name);
+    Print("'%s' / '%s'\n", node->identifier, node->name);
 
     /*
     // use for dumping artwork info tree
-    printf("subdir == '%s' ['%s', '%s'] [%d])\n",
-          node->subdir, node->fullpath, node->basepath, node->in_user_dir);
+    Print("subdir == '%s' ['%s', '%s'] [%d])\n",
+         node->subdir, node->fullpath, node->basepath, node->in_user_dir);
     */
 
     if (node->node_group != NULL)
index 77ed714a74d8aabf72e8087429cff30d59a029f4..e94304d29cc9e14adb5f19d3ab460931413b0791 100644 (file)
@@ -385,19 +385,19 @@ void dumpNetworkBuffer(struct NetworkBuffer *nb)
 {
   int i;
 
-  printf("::: network buffer maximum size: %d\n", nb->max_size);
-  printf("::: network buffer size:         %d\n", nb->size);
-  printf("::: network buffer position    : %d\n", nb->pos);
+  Print("::: network buffer maximum size: %d\n", nb->max_size);
+  Print("::: network buffer size:         %d\n", nb->size);
+  Print("::: network buffer position    : %d\n", nb->pos);
 
   for (i = 0; i < nb->size; i++)
   {
     if ((i % 16) == 0)
-      printf("\n::: ");
+      Print("\n::: ");
 
-    printf("%02x ", nb->buffer[i]);
+    Print("%02x ", nb->buffer[i]);
   }
 
-  printf("\n");
+  Print("\n");
 }
 
 static void SendNetworkBufferToAllButOne(struct NetworkBuffer *nb,
index 2917ac72ce3daada7afc78771278d21d17223c56..421238bebf31da5c0e423d6764cb15d1efe4b75d 100644 (file)
@@ -928,10 +928,10 @@ static int getTitleSound(struct TitleControlInfo *tci)
   int sound_local = base + nr;
 
 #if 0
-  printf("::: %d, %d, %d: %d ['%s'], %d ['%s']\n",
-        nr, initial, is_image,
-        sound_global, getSoundListEntry(sound_global)->filename,
-        sound_local, getSoundListEntry(sound_local)->filename);
+  Debug("screens:getTitleSound", "%d, %d, %d: %d ['%s'], %d ['%s']",
+       nr, initial, is_image,
+       sound_global, getSoundListEntry(sound_global)->filename,
+       sound_local, getSoundListEntry(sound_local)->filename);
 #endif
 
   if (!strEqual(getSoundListEntry(sound_local)->filename, UNDEFINED_FILENAME))
@@ -958,10 +958,10 @@ static int getTitleMusic(struct TitleControlInfo *tci)
   int music_local = base + nr;
 
 #if 0
-  printf("::: %d, %d, %d: %d ['%s'], %d ['%s']\n",
-        nr, initial, is_image,
-        music_global, getMusicListEntry(music_global)->filename,
-        music_local, getMusicListEntry(music_local)->filename);
+  Debug("screens:getTitleMusic", "%d, %d, %d: %d ['%s'], %d ['%s']",
+       nr, initial, is_image,
+       music_global, getMusicListEntry(music_global)->filename,
+       music_local, getMusicListEntry(music_local)->filename);
 #endif
 
   if (!strEqual(getMusicListEntry(music_local)->filename, UNDEFINED_FILENAME))
@@ -1326,10 +1326,11 @@ static boolean insideTextPosRect(struct TextPosInfo *rect, int x, int y)
   int rect_y = ALIGNED_TEXT_YPOS(rect);
 
 #if 0
-  printf("::: insideTextPosRect: (%d, %d), (%d, %d) [%d, %d] (%d, %d) => %d\n",
-        x, y, rect_x, rect_y, rect->x, rect->y, rect->width, rect->height,
-        (x >= rect_x && x < rect_x + rect->width &&
-         y >= rect_y && y < rect_y + rect->height));
+  Debug("screens:insideTextPosRect",
+       "(%d, %d), (%d, %d) [%d, %d] (%d, %d) => %d",
+       x, y, rect_x, rect_y, rect->x, rect->y, rect->width, rect->height,
+       (x >= rect_x && x < rect_x + rect->width &&
+        y >= rect_y && y < rect_y + rect->height));
 #endif
 
   return (x >= rect_x && x < rect_x + rect->width &&
@@ -5951,10 +5952,10 @@ static void execSetupTouch(void)
 static void execSetupArtwork(void)
 {
 #if 0
-  printf("::: '%s', '%s', '%s'\n",
-        artwork.gfx_current->subdir,
-        artwork.gfx_current->fullpath,
-        artwork.gfx_current->basepath);
+  Debug("screens:execSetupArtwork", "'%s', '%s', '%s'",
+       artwork.gfx_current->subdir,
+       artwork.gfx_current->fullpath,
+       artwork.gfx_current->basepath);
 #endif
 
   setup.graphics_set = artwork.gfx_current->identifier;
index 1d88941fedd31905322b33d03ae8d7828bd4b166..5e7bca1539bc172b7bdbc83b123e78f61d2a883b 100644 (file)
@@ -894,10 +894,10 @@ byte *TapePlayAction(void)
     action[i] = tape.pos[tape.counter].action[i];
 
 #if DEBUG_TAPE_WHEN_PLAYING
-  printf("%05d", FrameCounter);
+  Print("%05d", FrameCounter);
   for (i = 0; i < MAX_TAPE_ACTIONS; i++)
-    printf("   %08x", action[i]);
-  printf("\n");
+    Print("   %08x", action[i]);
+  Print("\n");
 #endif
 
   tape.set_centered_player = FALSE;
index 520627aed08cfa1ce8d8d7d7b668edba93f1e7fe..b3eacd95c820c533847ab7fc21e61b45ed01d7c1 100644 (file)
@@ -5348,7 +5348,7 @@ unsigned int MoveDoor(unsigned int door_state)
          if (width > door_rect->width)
            width = door_rect->width;
 
-         // printf("::: k == %d [%d] \n", k, start_step);
+         // Debug("tools:MoveDoor", "k == %d [%d]", k, start_step);
        }
 
        if (pos->step_yoffset < 0)      // door part on bottom side
@@ -9508,7 +9508,7 @@ void ChangeViewportPropertiesIfNeeded(void)
     init_gfx_buffers = TRUE;
     init_gadgets_and_anims = TRUE;
 
-    // printf("::: video: init_video_buffer, init_gfx_buffers\n");
+    // Debug("tools:viewport", "video: init_video_buffer, init_gfx_buffers");
   }
 
   if (new_scr_fieldx != SCR_FIELDX ||
@@ -9519,7 +9519,7 @@ void ChangeViewportPropertiesIfNeeded(void)
     SCR_FIELDX = new_scr_fieldx;
     SCR_FIELDY = new_scr_fieldy;
 
-    // printf("::: new_scr_fieldx != SCR_FIELDX ...\n");
+    // Debug("tools:viewport", "new_scr_fieldx != SCR_FIELDX ...");
   }
 
   if (new_sx != SX ||
@@ -9589,7 +9589,7 @@ void ChangeViewportPropertiesIfNeeded(void)
 
     if (new_tilesize_var != TILESIZE_VAR)
     {
-      // printf("::: new_tilesize_var != TILESIZE_VAR\n");
+      // Debug("tools:viewport", "new_tilesize_var != TILESIZE_VAR");
 
       // changing tile size invalidates scroll values of engine snapshots
       FreeEngineSnapshotSingle();
@@ -9623,13 +9623,13 @@ void ChangeViewportPropertiesIfNeeded(void)
     init_gfx_buffers = TRUE;
     init_gadgets_and_anims = TRUE;
 
-    // printf("::: viewports: init_gfx_buffers\n");
-    // printf("::: viewports: init_gadgets_and_anims\n");
+    // Debug("tools:viewport", "viewports: init_gfx_buffers");
+    // Debug("tools:viewport", "viewports: init_gadgets_and_anims");
   }
 
   if (init_gfx_buffers)
   {
-    // printf("::: init_gfx_buffers\n");
+    // Debug("tools:viewport", "init_gfx_buffers");
 
     SCR_FIELDX = new_scr_fieldx_buffers;
     SCR_FIELDY = new_scr_fieldy_buffers;
@@ -9645,7 +9645,7 @@ void ChangeViewportPropertiesIfNeeded(void)
 
   if (init_video_buffer)
   {
-    // printf("::: init_video_buffer\n");
+    // Debug("tools:viewport", "init_video_buffer");
 
     FreeAllImageTextures();    // needs old renderer to free the textures
 
@@ -9655,7 +9655,7 @@ void ChangeViewportPropertiesIfNeeded(void)
 
   if (init_gadgets_and_anims)
   {
-    // printf("::: init_gadgets_and_anims\n");
+    // Debug("tools:viewport", "init_gadgets_and_anims");
 
     InitGadgets();
     InitGlobalAnimations();