From: Holger Schemel Date: Wed, 16 Sep 2020 22:53:03 +0000 (+0200) Subject: changed simple "printf()" debug output to new debug log function X-Git-Tag: 4.2.0.3~28 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=a99a1803e5097bc598b4c6f73259715da148ab27;p=rocksndiamonds.git changed simple "printf()" debug output to new debug log function --- diff --git a/src/game.c b/src/game.c index c926738d..ee3e9789 100644 --- a/src/game.c +++ b/src/game.c @@ -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 diff --git a/src/game_sp/DDScrollBuffer.c b/src/game_sp/DDScrollBuffer.c index 13c773a1..6976f939 100644 --- a/src/game_sp/DDScrollBuffer.c +++ b/src/game_sp/DDScrollBuffer.c @@ -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 } diff --git a/src/game_sp/MainGameLoop.c b/src/game_sp/MainGameLoop.c index e1a20b10..c6d2d6dc 100644 --- a/src/game_sp/MainGameLoop.c +++ b/src/game_sp/MainGameLoop.c @@ -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; diff --git a/src/init.c b/src/init.c index 41e891cc..d126103a 100644 --- a/src/init.c +++ b/src/init.c @@ -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(); diff --git a/src/libgame/misc.c b/src/libgame/misc.c index b1ea74e0..c5067fb9 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -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 diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 794bad30..ece4e3f7 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -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; diff --git a/src/libgame/setup.c b/src/libgame/setup.c index f42945fb..206db77e 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -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) diff --git a/src/netserv.c b/src/netserv.c index 77ed714a..e94304d2 100644 --- a/src/netserv.c +++ b/src/netserv.c @@ -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, diff --git a/src/screens.c b/src/screens.c index 2917ac72..421238be 100644 --- a/src/screens.c +++ b/src/screens.c @@ -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; diff --git a/src/tape.c b/src/tape.c index 1d88941f..5e7bca15 100644 --- a/src/tape.c +++ b/src/tape.c @@ -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; diff --git a/src/tools.c b/src/tools.c index 520627ae..b3eacd95 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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();