continue;
#if 0
- printf("::: mode == %d, anim = %d, part = %d [%d, %d, %d] [%d]\n",
- m, a, p, mode_nr, anim_nr, part_nr, control);
+ Debug("anim:InitGlobalAnimControls",
+ "mode == %d, anim = %d, part = %d [%d, %d, %d] [%d]",
+ m, a, p, mode_nr, anim_nr, part_nr, control);
#endif
#if 0
- printf("::: mode == %d, anim = %d, part = %d [%d, %d, %d] [%d]\n",
- m, a, p, mode_nr, anim_nr, part_nr, sound);
+ Debug("anim:InitGlobalAnimControls",
+ "mode == %d, anim = %d, part = %d [%d, %d, %d] [%d]",
+ m, a, p, mode_nr, anim_nr, part_nr, sound);
#endif
part->old_nr = p;
PlaySound(sound);
#if 0
- printf("::: PLAY SOUND %d.%d.%d: %d\n",
+ Debug("anim:PlayGlobalAnimSound", "PLAY SOUND %d.%d.%d: %d",
part->anim_nr, part->nr, part->mode_nr, sound);
#endif
}
StopSound(sound);
#if 0
- printf("::: STOP SOUND %d.%d.%d: %d\n",
- part->anim_nr, part->nr, part->mode_nr, sound);
+ Debug("anim:StopGlobalAnimSound", "STOP SOUND %d.%d.%d: %d",
+ part->anim_nr, part->nr, part->mode_nr, sound);
#endif
}
PlayMusic(music);
#if 0
- printf("::: PLAY MUSIC %d.%d.%d: %d\n",
- part->anim_nr, part->nr, part->mode_nr, music);
+ Debug("anim:PlayGlobalAnimMusic", "PLAY MUSIC %d.%d.%d: %d",
+ part->anim_nr, part->nr, part->mode_nr, music);
#endif
}
StopMusic();
#if 0
- printf("::: STOP MUSIC %d.%d.%d: %d\n",
- part->anim_nr, part->nr, part->mode_nr, music);
+ Debug("anim:StopGlobalAnimMusic", "STOP MUSIC %d.%d.%d: %d",
+ part->anim_nr, part->nr, part->mode_nr, music);
#endif
}
*click_consumed |= clickConsumed(part); // click was on "part"!
#if DEBUG_ANIM_EVENTS
- printf("::: => %d.%d TRIGGERED BY %s OF %d.%d\n",
- part2->old_anim_nr + 1, part2->old_nr + 1, info_text,
- part->old_anim_nr + 1, part->old_nr + 1);
+ Debug("anim:InitGlobalAnim_Triggered",
+ "%d.%d TRIGGERED BY %s OF %d.%d",
+ part2->old_anim_nr + 1, part2->old_nr + 1, info_text,
+ part->old_anim_nr + 1, part->old_nr + 1);
#endif
#if 0
- printf("::: %d.%d TRIGGER CLICKED [%d]\n", anim2_nr, part2_nr,
- part2->control_info.anim_event_action);
+ Debug("anim:InitGlobalAnim_Triggered",
+ "%d.%d TRIGGER CLICKED [%d]", anim2_nr, part2_nr,
+ part2->control_info.anim_event_action);
#endif
// after executing event action, ignore any further actions
#if 0
struct GraphicInfo *c = &part2->control_info;
- printf("::: - %d.%d: 0x%08x, 0x%08x [0x%08x]",
- anim2_nr, part2_nr, c->init_event, c->anim_event, mask);
-
if (isClickablePart(part2, mask))
- printf(" <--- TRIGGERED BY %d.%d",
- anim_nr, part_nr);
-
- printf("\n");
+ Debug("anim:InitGlobalAnim_Triggered",
+ "%d.%d: 0x%08x, 0x%08x [0x%08x] <--- TRIGGERED BY %d.%d",
+ anim2_nr, part2_nr, c->init_event, c->anim_event, mask,
+ anim_nr, part_nr);
+ else
+ Debug("anim:InitGlobalAnim_Triggered",
+ "%d.%d: 0x%08x, 0x%08x [0x%08x]",
+ anim2_nr, part2_nr, c->init_event, c->anim_event, mask);
#endif
}
}
int delay_type, char *info_text)
{
#if DEBUG_ANIM_DELAY
- printf("::: %d.%d %s\n", part->old_anim_nr + 1, part->old_nr + 1, info_text);
+ Debug("anim:HandleGlobalAnimDelay", "%d.%d %s",
+ part->old_anim_nr + 1, part->old_nr + 1, info_text);
#endif
DoGlobalAnim_DelayAction(part, delay_type);
int event_value, char *info_text)
{
#if DEBUG_ANIM_EVENTS
- printf("::: %d.%d %s\n", part->old_anim_nr + 1, part->old_nr + 1, info_text);
+ Debug("anim:HandleGlobalAnimEvent", "%d.%d %s",
+ part->old_anim_nr + 1, part->old_nr + 1, info_text);
#endif
boolean click_consumed = FALSE;
static unsigned int last_counter = -1;
unsigned int counter = Counter();
- printf("::: NEXT ANIM PART [%d, %d]\n",
- anim_sync_frame, counter - last_counter);
+ Debug("anim:HandleGlobalAnim_Part", "NEXT ANIM PART [%d, %d]",
+ anim_sync_frame, counter - last_counter);
last_counter = counter;
}
int i;
#if 0
- printf("::: HandleGlobalAnim_Main: %d, %d => %d\n",
+ Debug("anim:HandleGlobalAnim_Main", "%d, %d => %d",
anim->mode_nr, anim->nr, anim->num_parts);
- printf("::: %d, %d, %d\n", global.num_toons, setup.toons, num_toons);
+ Debug("anim:HandleGlobalAnim_Main",
+ "%d, %d, %d", global.num_toons, setup.toons, num_toons);
#endif
#if 0
- printf("::: %s(%d): %d, %d, %d [%d]\n",
- (action == ANIM_START ? "ANIM_START" :
- action == ANIM_CONTINUE ? "ANIM_CONTINUE" :
- action == ANIM_STOP ? "ANIM_STOP" : "(should not happen)"),
- anim->nr,
- anim->state & ANIM_STATE_RESTART,
- anim->state & ANIM_STATE_WAITING,
- anim->state & ANIM_STATE_RUNNING,
- anim->num_parts);
+ Debug("anim:HandleGlobalAnim_Main", "%s(%d): %d, %d, %d [%d]",
+ (action == ANIM_START ? "ANIM_START" :
+ action == ANIM_CONTINUE ? "ANIM_CONTINUE" :
+ action == ANIM_STOP ? "ANIM_STOP" : "(should not happen)"),
+ anim->nr,
+ anim->state & ANIM_STATE_RESTART,
+ anim->state & ANIM_STATE_WAITING,
+ anim->state & ANIM_STATE_RUNNING,
+ anim->num_parts);
#endif
switch (action)
if (c->anim_mode & ANIM_ALL || anim->num_parts == 0)
{
#if 0
- printf("::: HandleGlobalAnim_Main: %d, %d => %d\n",
- anim->mode_nr, anim->nr, num_parts);
+ Debug("anim:HandleGlobalAnim_Main", "%d, %d => %d",
+ anim->mode_nr, anim->nr, num_parts);
#endif
for (i = 0; i < num_parts; i++)
int i;
#if 0
- printf("::: HandleGlobalAnim_Mode: %d => %d\n",
- ctrl->nr, ctrl->num_anims);
+ Debug("anim:HandleGlobalAnim_Mode", "%d => %d", ctrl->nr, ctrl->num_anims);
#endif
for (i = 0; i < ctrl->num_anims; i++)
static void HandleGlobalAnim(int action, int game_mode)
{
#if 0
- printf("::: HandleGlobalAnim [mode == %d]\n", game_status);
+ Debug("anim:HandleGlobalAnim", "mode == %d", game_status);
#endif
HandleGlobalAnim_Mode(&global_anim_ctrl[game_mode], action);
int i;
#if 0
- printf("::: DoAnimation [%d, %d]\n", anim_sync_frame, Counter());
+ Debug("anim:DoAnimationExt", "%d, %d", anim_sync_frame, Counter());
#endif
// global animations now synchronized with frame delay of screen update
isClickablePart(part, ANIM_EVENT_ANY))
{
#if DEBUG_ANIM_EVENTS
- printf("::: => %d.%d TRIGGERED BY ANY\n",
- part->old_anim_nr + 1, part->old_nr + 1);
+ Debug("anim:InitGlobalAnim_Clicked", "%d.%d TRIGGERED BY ANY",
+ part->old_anim_nr + 1, part->old_nr + 1);
#endif
anything_clicked = part->clicked = TRUE;
isClickablePart(part, ANIM_EVENT_UNCLICK_ANY))
{
#if DEBUG_ANIM_EVENTS
- printf("::: => %d.%d TRIGGERED BY UNCLICK:ANY\n",
- part->old_anim_nr + 1, part->old_nr + 1);
+ Debug("anim:InitGlobalAnim_Clicked", "%d.%d TRIGGERED BY UNCLICK:ANY",
+ part->old_anim_nr + 1, part->old_nr + 1);
#endif
anything_clicked = part->clicked = TRUE;
isClickedPart(part, mx, my, TRUE))
{
#if 0
- printf("::: %d.%d CLICKED [%d]\n", anim_nr, part_nr,
- part->control_info.anim_event_action);
+ Debug("anim:InitGlobalAnim_Clicked", "%d.%d CLICKED [%d]",
+ anim_nr, part_nr, part->control_info.anim_event_action);
#endif
// after executing event action, ignore any further actions
if (isClickablePart(part, ANIM_EVENT_SELF))
{
#if DEBUG_ANIM_EVENTS
- printf("::: => %d.%d TRIGGERED BY SELF\n",
- part->old_anim_nr + 1, part->old_nr + 1);
+ Debug("anim:InitGlobalAnim_Clicked", "%d.%d TRIGGERED BY SELF",
+ part->old_anim_nr + 1, part->old_nr + 1);
#endif
anything_clicked = part->clicked = TRUE;
num_editor_gadgets = NUM_EDITOR_GADGETS;
- // printf("::: allocating %d gadgets ...\n", num_editor_gadgets);
+ // Debug("editor", "allocating %d gadgets ...\n", num_editor_gadgets);
level_editor_gadget =
checked_calloc(num_editor_gadgets * sizeof(struct GadgetInfo *));
{
int i;
- // printf("::: freeing %d gadgets ...\n", num_editor_gadgets);
+ // Debug("editor", "freeing %d gadgets ...\n", num_editor_gadgets);
for (i = 0; i < num_editor_gadgets; i++)
{
mode == CB_BRUSH_TO_CLIPBOARD_SMALL)
SDL_SetClipboardText(text);
else
- printf("%s", text);
+ printf("%s", text); // print brush data to console
return;
}
}
#ifdef DEBUG
else if (gi->event.type == GD_EVENT_PRESSED)
- printf("default: HandleControlButtons: GD_EVENT_PRESSED(%d)\n", id);
+ Debug("editor", "default: HandleControlButtons: GD_EVENT_PRESSED(%d)", id);
else if (gi->event.type == GD_EVENT_RELEASED)
- printf("default: HandleControlButtons: GD_EVENT_RELEASED(%d)\n", id);
+ Debug("editor", "default: HandleControlButtons: GD_EVENT_RELEASED(%d)", id);
else if (gi->event.type == GD_EVENT_MOVING)
- printf("default: HandleControlButtons: GD_EVENT_MOVING(%d)\n", id);
+ Debug("editor", "default: HandleControlButtons: GD_EVENT_MOVING(%d)", id);
else
- printf("default: HandleControlButtons: ? (id == %d)\n", id);
+ Debug("editor", "default: HandleControlButtons: ? (id == %d)", id);
#endif
break;
}
cheat_input[cheat_input_len] = '\0';
#if DEBUG_EVENTS_KEY
- Debug("event:key:special", "'%s' [%d]\n", cheat_input, cheat_input_len);
+ Debug("event:key:special", "'%s' [%d]", cheat_input, cheat_input_len);
#endif
if (game_status == GAME_MODE_MAIN)
tape.length_seconds = GetTapeLengthSeconds();
#if 0
- printf("::: tape file version: %d\n", tape.file_version);
- printf("::: tape game version: %d\n", tape.game_version);
- printf("::: tape engine version: %d\n", tape.engine_version);
+ Debug("files:LoadTapeFromFilename", "tape file version: %d",
+ tape.file_version);
+ Debug("files:LoadTapeFromFilename", "tape game version: %d",
+ tape.game_version);
+ Debug("files:LoadTapeFromFilename", "tape engine version: %d",
+ tape.engine_version);
#endif
}
#if 0
for (i = 0; i < num_list_entries; i++)
- printf("::: '%s': %d, %d, %d => %d\n",
- EL_NAME(helpanim_info[i].element),
- helpanim_info[i].element,
- helpanim_info[i].action,
- helpanim_info[i].direction,
- helpanim_info[i].delay);
+ Debug("files:LoadHelpAnimInfo", "'%s': %d, %d, %d => %d",
+ EL_NAME(helpanim_info[i].element),
+ helpanim_info[i].element,
+ helpanim_info[i].action,
+ helpanim_info[i].direction,
+ helpanim_info[i].delay);
#endif
}
#if 0
BEGIN_HASH_ITERATION(helptext_info, itr)
{
- printf("::: '%s' => '%s'\n",
- HASH_ITERATION_TOKEN(itr), HASH_ITERATION_VALUE(itr));
+ Debug("files:LoadHelpTextInfo", "'%s' => '%s'",
+ HASH_ITERATION_TOKEN(itr), HASH_ITERATION_VALUE(itr));
}
END_HASH_ITERATION(hash, itr)
#endif
StorePlayer[x][y] = Tile[x][y];
#if DEBUG_INIT_PLAYER
- if (options.debug)
- {
- printf("- player element %d activated", player->element_nr);
- printf(" (local player is %d and currently %s)\n",
- local_player->element_nr,
- local_player->active ? "active" : "not active");
- }
+ Debug("game:init:player", "- player element %d activated",
+ player->element_nr);
+ Debug("game:init:player", " (local player is %d and currently %s)",
+ local_player->element_nr,
+ local_player->active ? "active" : "not active");
}
#endif
}
#if 0
- printf("level %d: level.game_version == %06d\n", level_nr,
- level.game_version);
- printf(" tape.file_version == %06d\n",
- tape.file_version);
- printf(" tape.game_version == %06d\n",
- tape.game_version);
- printf(" tape.engine_version == %06d\n",
- tape.engine_version);
- printf(" => game.engine_version == %06d [tape mode: %s]\n",
- game.engine_version, (tape.playing ? "PLAYING" : "RECORDING"));
+ Debug("game:init:level", "level %d: level.game_version == %06d", level_nr,
+ level.game_version);
+ Debug("game:init:level", " tape.file_version == %06d",
+ tape.file_version);
+ Debug("game:init:level", " tape.game_version == %06d",
+ tape.game_version);
+ Debug("game:init:level", " tape.engine_version == %06d",
+ tape.engine_version);
+ Debug("game:init:level", " => game.engine_version == %06d [tape mode: %s]",
+ game.engine_version, (tape.playing ? "PLAYING" : "RECORDING"));
#endif
// --------------------------------------------------------------------------
if (!options.debug)
return;
- printf("%s:\n", message);
+ Debug("game:init:player", "%s:", message);
for (i = 0; i < MAX_PLAYERS; i++)
{
struct PlayerInfo *player = &stored_player[i];
- printf("- player %d: present == %d, connected == %d [%d/%d], active == %d",
- i + 1,
- player->present,
- player->connected,
- player->connected_locally,
- player->connected_network,
- player->active);
-
- if (local_player == player)
- printf(" (local player)");
-
- printf("\n");
+ Debug("game:init:player",
+ "- player %d: present == %d, connected == %d [%d/%d], active == %d%s",
+ i + 1,
+ player->present,
+ player->connected,
+ player->connected_locally,
+ player->connected_network,
+ player->active,
+ (local_player == player ? " (local player)" : ""));
}
}
#endif
#endif
#if DEBUG_INIT_PLAYER
- if (options.debug)
- printf("Reassigning players ...\n");
+ Debug("game:init:player", "Reassigning players ...");
#endif
// check if any connected player was not found in playfield
struct PlayerInfo *field_player = NULL;
#if DEBUG_INIT_PLAYER
- if (options.debug)
- printf("- looking for field player for player %d ...\n", i + 1);
+ Debug("game:init:player",
+ "- looking for field player for player %d ...", i + 1);
#endif
// assign first free player found that is present in the playfield
int jx = field_player->jx, jy = field_player->jy;
#if DEBUG_INIT_PLAYER
- if (options.debug)
- printf("- found player %d\n", field_player->index_nr + 1);
+ Debug("game:init:player", "- found player %d",
+ field_player->index_nr + 1);
#endif
player->present = FALSE;
field_player->mapped = TRUE;
#if DEBUG_INIT_PLAYER
- if (options.debug)
- printf("- map_player_action[%d] == %d\n",
- field_player->index_nr + 1, i + 1);
+ Debug("game:init:player", "- map_player_action[%d] == %d",
+ field_player->index_nr + 1, i + 1);
#endif
}
}
#endif
#if 0
- printf("::: local_player->present == %d\n", local_player->present);
+ Debug("game:init:player", "local_player->present == %d",
+ local_player->present);
#endif
// set focus to local player for network games, else to all players
int jx = player->jx, jy = player->jy;
#if DEBUG_INIT_PLAYER
- if (options.debug)
- printf("Removing player %d at (%d, %d)\n", i + 1, jx, jy);
+ Debug("game:init:player", "Removing player %d at (%d, %d)",
+ i + 1, jx, jy);
#endif
player->active = FALSE;
#ifdef DEBUG
if (group_nr == 0)
{
- printf("AmoebaToDiamond(): ax = %d, ay = %d\n", ax, ay);
- printf("AmoebaToDiamond(): This should never happen!\n");
+ Debug("game:playing:AmoebaToDiamond", "ax = %d, ay = %d", ax, ay);
+ Debug("game:playing:AmoebaToDiamond", "This should never happen!");
+
return;
}
#endif
#ifdef DEBUG
if (group_nr == 0)
{
- printf("AmoebaToDiamondBD(): ax = %d, ay = %d\n", ax, ay);
- printf("AmoebaToDiamondBD(): This should never happen!\n");
+ Debug("game:playing:AmoebaToDiamondBD", "ax = %d, ay = %d", ax, ay);
+ Debug("game:playing:AmoebaToDiamondBD", "This should never happen!");
+
return;
}
#endif
#ifdef DEBUG
if (new_group_nr == 0)
{
- printf("AmoebaReproduce(): newax = %d, neway = %d\n", newax, neway);
- printf("AmoebaReproduce(): This should never happen!\n");
+ Debug("game:playing:AmoebaReproduce", "newax = %d, neway = %d",
+ newax, neway);
+ Debug("game:playing:AmoebaReproduce", "This should never happen!");
+
return;
}
#endif
if (!CAN_CHANGE_OR_HAS_ACTION(element) &&
!CAN_CHANGE_OR_HAS_ACTION(Back[x][y]))
{
- printf("\n\n");
- printf("HandleElementChange(): %d,%d: element = %d ('%s')\n",
- x, y, element, element_info[element].token_name);
- printf("HandleElementChange(): This should never happen!\n");
- printf("\n\n");
+ Debug("game:playing:HandleElementChange", "%d,%d: element = %d ('%s')",
+ x, y, element, element_info[element].token_name);
+ Debug("game:playing:HandleElementChange", "This should never happen!");
}
#endif
int skip = WaitUntilDelayReached(&game_frame_delay, game_frame_delay_value);
- printf("::: skip == %d\n", skip);
+ Debug("game:playing:skip", "skip == %d", skip);
#else
// ---------- main game synchronization point ----------
#if DEBUG
if (ChangePage[x][y] != -1 && ChangeDelay[x][y] != 1)
{
- printf("GameActions(): x = %d, y = %d: ChangePage != -1\n", x, y);
- printf("GameActions(): This should never happen!\n");
+ Debug("game:playing:GameActions_RND", "x = %d, y = %d: ChangePage != -1",
+ x, y);
+ Debug("game:playing:GameActions_RND", "This should never happen!");
ChangePage[x][y] = -1;
}
Blocked2Moving(x, y, &oldx, &oldy);
if (!IS_MOVING(oldx, oldy))
{
- printf("GameActions(): (BLOCKED => MOVING) context corrupted!\n");
- printf("GameActions(): BLOCKED: x = %d, y = %d\n", x, y);
- printf("GameActions(): !MOVING: oldx = %d, oldy = %d\n", oldx, oldy);
- printf("GameActions(): This should never happen!\n");
+ Debug("game:playing:GameActions_RND", "(BLOCKED => MOVING) context corrupted!");
+ Debug("game:playing:GameActions_RND", "BLOCKED: x = %d, y = %d", x, y);
+ Debug("game:playing:GameActions_RND", "!MOVING: oldx = %d, oldy = %d", oldx, oldy);
+ Debug("game:playing:GameActions_RND", "This should never happen!");
}
}
#endif
int original_move_delay_value = player->move_delay_value;
#if DEBUG
- printf("THIS SHOULD ONLY HAPPEN WITH PRE-1.2 LEVEL TAPES. [%d]\n",
- tape.counter);
+ Debug("game:playing:MovePlayer",
+ "THIS SHOULD ONLY HAPPEN WITH PRE-1.2 LEVEL TAPES. [%d]",
+ tape.counter);
#endif
// scroll remaining steps with finest movement resolution
return;
#if 0
- printf("::: 0: killed == %d, active == %d, reanimated == %d\n",
- player->killed, player->active, player->reanimated);
+ Debug("game:playing:KillPlayer",
+ "0: killed == %d, active == %d, reanimated == %d",
+ player->killed, player->active, player->reanimated);
#endif
/* the following code was introduced to prevent an infinite loop when calling
player->shield_deadly_time_left = 0;
#if 0
- printf("::: 1: killed == %d, active == %d, reanimated == %d\n",
- player->killed, player->active, player->reanimated);
+ Debug("game:playing:KillPlayer",
+ "1: killed == %d, active == %d, reanimated == %d",
+ player->killed, player->active, player->reanimated);
#endif
Bang(jx, jy);
#if 0
- printf("::: 2: killed == %d, active == %d, reanimated == %d\n",
- player->killed, player->active, player->reanimated);
+ Debug("game:playing:KillPlayer",
+ "2: killed == %d, active == %d, reanimated == %d",
+ player->killed, player->active, player->reanimated);
#endif
if (player->reanimated) // killed player may have been reanimated
node = node->next;
}
- printf("::: size of engine snapshot: %d bytes\n", num_bytes);
+ Debug("game:playing:SaveEngineSnapshotBuffers",
+ "size of engine snapshot: %d bytes", num_bytes);
#endif
return buffers;
int hit_mask = 0;
#if 0
- printf("ScanPixel: start scanning at (%d, %d) [%d, %d] [%d, %d]\n",
- LX, LY, LX / TILEX, LY / TILEY, LX % TILEX, LY % TILEY);
+ Debug("game:mm:ScanPixel", "start scanning at (%d, %d) [%d, %d] [%d, %d]",
+ LX, LY, LX / TILEX, LY / TILEY, LX % TILEX, LY % TILEY);
#endif
// follow laser beam until it hits something (at least the screen border)
if (SX + LX < REAL_SX || SX + LX >= REAL_SX + FULL_SXSIZE ||
SY + LY < REAL_SY || SY + LY >= REAL_SY + FULL_SYSIZE)
{
- printf("ScanPixel: touched screen border!\n");
+ Debug("game:mm:ScanPixel", "touched screen border!");
return HIT_MASK_ALL;
}
DrawLaser(0, DL_LASER_ENABLED);
#if 0
- printf("Start scanning with LX == %d, LY == %d, XS == %d, YS == %d\n",
- LX, LY, XS, YS);
+ Debug("game:mm:ScanLaser",
+ "Start scanning with LX == %d, LY == %d, XS == %d, YS == %d",
+ LX, LY, XS, YS);
#endif
while (1)
hit_mask = ScanPixel();
#if 0
- printf("Hit something at LX == %d, LY == %d, XS == %d, YS == %d\n",
- LX, LY, XS, YS);
+ Debug("game:mm:ScanLaser",
+ "Hit something at LX == %d, LY == %d, XS == %d, YS == %d",
+ LX, LY, XS, YS);
#endif
// hit something -- check out what it was
ELY = (LY + YS) / TILEY;
#if 0
- printf("hit_mask (1) == '%x' (%d, %d) (%d, %d)\n",
- hit_mask, LX, LY, ELX, ELY);
+ Debug("game:mm:ScanLaser", "hit_mask (1) == '%x' (%d, %d) (%d, %d)",
+ hit_mask, LX, LY, ELX, ELY);
#endif
if (!IN_LEV_FIELD(ELX, ELY) || !IN_PIX_FIELD(LX, LY))
}
#if 0
- printf("hit_mask (2) == '%x' (%d, %d) (%d, %d)\n",
- hit_mask, LX, LY, ELX, ELY);
+ Debug("game:mm:ScanLaser", "hit_mask (2) == '%x' (%d, %d) (%d, %d)",
+ hit_mask, LX, LY, ELX, ELY);
#endif
element = Tile[ELX][ELY];
laser.dest_element = element;
#if 0
- printf("Hit element %d at (%d, %d) [%d, %d] [%d, %d] [%d]\n",
- element, ELX, ELY,
- LX, LY,
- LX % TILEX, LY % TILEY,
- hit_mask);
+ Debug("game:mm:ScanLaser",
+ "Hit element %d at (%d, %d) [%d, %d] [%d, %d] [%d]",
+ element, ELX, ELY,
+ LX, LY,
+ LX % TILEX, LY % TILEY,
+ hit_mask);
#endif
#if 0
if (!IN_LEV_FIELD(ELX, ELY))
- printf("WARNING! (1) %d, %d (%d)\n", ELX, ELY, element);
+ Debug("game:mm:ScanLaser", "WARNING! (1) %d, %d (%d)",
+ ELX, ELY, element);
#endif
if (element == EL_EMPTY)
#if 0
if (laser.dest_element != Tile[ELX][ELY])
{
- printf("ALARM: laser.dest_element == %d, Tile[ELX][ELY] == %d\n",
- laser.dest_element, Tile[ELX][ELY]);
+ Debug("game:mm:ScanLaser",
+ "ALARM: laser.dest_element == %d, Tile[ELX][ELY] == %d",
+ laser.dest_element, Tile[ELX][ELY]);
}
#endif
if (!end && !laser.stops_inside_element && !StepBehind())
{
#if 0
- printf("ScanLaser: Go one step back\n");
+ Debug("game:mm:ScanLaser", "Go one step back");
#endif
LX -= XS;
#if 0
if (!IN_LEV_FIELD(ELX, ELY))
- printf("WARNING! (2) %d, %d\n", ELX, ELY);
+ Debug("game:mm:ScanLaser", "WARNING! (2) %d, %d", ELX, ELY);
#endif
}
int elx, ely;
#if 0
- printf("DrawLaserExt: start_edge, num_edges, mode == %d, %d, %d\n",
- start_edge, num_edges, mode);
+ Debug("game:mm:DrawLaserExt", "start_edge, num_edges, mode == %d, %d, %d",
+ start_edge, num_edges, mode);
#endif
if (start_edge < 0)
#if 0
if (mode == DL_LASER_DISABLED)
{
- printf("DrawLaser: Delete laser from edge %d\n", start_edge);
+ Debug("game:mm:DrawLaserExt", "Delete laser from edge %d", start_edge);
}
#endif
int i;
for (i = 0; i < laser.num_beamers; i++)
- printf("-> %d\n", laser.beamer_edge[i]);
- printf("DrawLaserExt: IS_BEAMER: [%d]: Hit[%d][%d] == %d [%d]\n",
- mode, elx, ely, Hit[elx][ely], start_edge);
- printf("DrawLaserExt: IS_BEAMER: %d / %d\n",
- get_element_angle(element), laser.damage[damage_start].angle);
+ Debug("game:mm:DrawLaserExt", "-> %d", laser.beamer_edge[i]);
+
+ Debug("game:mm:DrawLaserExt", "IS_BEAMER: [%d]: Hit[%d][%d] == %d [%d]",
+ mode, elx, ely, Hit[elx][ely], start_edge);
+ Debug("game:mm:DrawLaserExt", "IS_BEAMER: %d / %d",
+ get_element_angle(element), laser.damage[damage_start].angle);
}
#endif
YS = 2 * Step[laser.current_angle].y;
#if 0
- printf("DrawLaser: Set (LX, LY) to (%d, %d) [%d]\n",
- LX, LY, element);
+ Debug("game:mm:DrawLaserExt", "Set (LX, LY) to (%d, %d) [%d]",
+ LX, LY, element);
#endif
if (start_edge > 0)
int step_size;
#if 0
- printf("element == %d\n", element);
+ Debug("game:mm:DrawLaserExt", "element == %d", element);
#endif
if (IS_22_5_ANGLE(laser.current_angle)) // neither 90° nor 45° angle
#if 0
if (IS_BEAMER(element))
- {
- printf("start_edge == %d, laser.beamer_edge == %d\n",
- start_edge, laser.beamer_edge);
- }
+ Debug("game:mm:DrawLaserExt",
+ "start_edge == %d, laser.beamer_edge == %d",
+ start_edge, laser.beamer_edge);
#endif
LX += step_size * XS;
}
#if 0
- printf("DrawLaser: Finally: (LX, LY) to (%d, %d) [%d]\n",
- LX, LY, element);
+ Debug("game:mm:DrawLaserExt", "Finally: (LX, LY) to (%d, %d) [%d]",
+ LX, LY, element);
#endif
}
continue;
#if 0
- printf("DrawLaser: DL_LASER_ENABLED: i==%d: %d, %d\n",
- i, laser.beamer_edge[i], tmp_start_edge);
+ Debug("game:mm:DrawLaser", "DL_LASER_ENABLED: i==%d: %d, %d",
+ i, laser.beamer_edge[i], tmp_start_edge);
#endif
DrawLaserExt(tmp_start_edge, tmp_num_edges, DL_LASER_ENABLED);
#if 0
if (last_num_edges - start_edge <= 0)
- printf("DrawLaser: DL_LASER_DISABLED: %d, %d\n",
- last_num_edges, start_edge);
+ Debug("game:mm:DrawLaser", "DL_LASER_DISABLED: %d, %d",
+ last_num_edges, start_edge);
#endif
// special case when rotating first beamer: delete laser edge on beamer
element = MovingOrBlocked2Element_MM(ELX, ELY);
#if 0
- printf("HitElement (1): element == %d\n", element);
+ Debug("game:mm:HitElement", "(1): element == %d", element);
#endif
#if 0
if ((ELX * TILEX + 14 - LX) * YS == (ELY * TILEY + 14 - LY) * XS)
- printf("HitElement (%d): EXACT MATCH @ (%d, %d)\n", element, ELX, ELY);
+ Debug("game:mm:HitElement", "(%d): EXACT MATCH @ (%d, %d)",
+ element, ELX, ELY);
else
- printf("HitElement (%d): FUZZY MATCH @ (%d, %d)\n", element, ELX, ELY);
+ Debug("game:mm:HitElement", "(%d): FUZZY MATCH @ (%d, %d)",
+ element, ELX, ELY);
#endif
AddDamagedField(ELX, ELY);
}
#if 0
- printf("HitElement (2): element == %d\n", element);
+ Debug("game:mm:HitElement", "(2): element == %d", element);
#endif
if (LX + 5 * XS < 0 ||
}
#if 0
- printf("HitElement (3): element == %d\n", element);
+ Debug("game:mm:HitElement", "(3): element == %d", element);
#endif
if (IS_POLAR(element) &&
{
#if 0
if ((ELX * TILEX + 14 - LX) * YS == (ELY * TILEY + 14 - LY) * XS)
- printf("EXACT MATCH @ (%d, %d)\n", ELX, ELY);
+ Debug("game:mm:HitElement", "EXACT MATCH @ (%d, %d)", ELX, ELY);
else
- printf("FUZZY MATCH @ (%d, %d)\n", ELX, ELY);
+ Debug("game:mm:HitElement", "FUZZY MATCH @ (%d, %d)", ELX, ELY);
#endif
LX = ELX * TILEX + 14;
}
#if 0
- printf("HitElement (4): element == %d\n", element);
+ Debug("game:mm:HitElement", "(4): element == %d", element);
#endif
if ((IS_BEAMER(element) || IS_FIBRE_OPTIC(element)) &&
int step_size;
#if 0
- printf("HitElement (BEAMER): element == %d\n", element);
+ Debug("game:mm:HitElement", "(BEAMER): element == %d", element);
#endif
laser.num_damages--;
// check if the laser hit only the edge of an element and, if so, go on
#if 0
- printf("LX, LY, hit_mask == %d, %d, %d\n", LX, LY, hit_mask);
+ Debug("game:mm:HitOnlyAnEdge", "LX, LY, hit_mask == %d, %d, %d",
+ LX, LY, hit_mask);
#endif
if ((hit_mask == HIT_MASK_TOPLEFT ||
LY += YS;
#if 0
- printf("[HitOnlyAnEdge() == TRUE]\n");
+ Debug("game:mm:HitOnlyAnEdge", "[HitOnlyAnEdge() == TRUE]");
#endif
return TRUE;
}
#if 0
- printf("[HitOnlyAnEdge() == FALSE]\n");
+ Debug("game:mm:HitOnlyAnEdge", "[HitOnlyAnEdge() == FALSE]");
#endif
return FALSE;
int grid_angle = get_element_angle(element);
#if 0
- printf("HitPolarizer: angle: grid == %d, laser == %d\n",
- grid_angle, laser.current_angle);
+ Debug("game:mm:HitPolarizer", "angle: grid == %d, laser == %d",
+ grid_angle, laser.current_angle);
#endif
AddLaserEdge(LX, LY);
LY += YS;
#if 0
- printf("HitPolarizer: LX, LY == %d, %d [%d, %d] [%d, %d]\n",
- LX, LY,
- LX / TILEX, LY / TILEY,
- LX % TILEX, LY % TILEY);
+ Debug("game:mm:HitPolarizer", "LX, LY == %d, %d [%d, %d] [%d, %d]",
+ LX, LY,
+ LX / TILEX, LY / TILEY,
+ LX % TILEX, LY % TILEY);
#endif
return FALSE;
if (IS_BEAMER(Tile[x][y]))
{
#if 0
- printf("TEST (%d, %d) [%d] [%d]\n",
- LX, LY,
- laser.beamer_edge, laser.beamer[1].num);
+ Debug("game:mm:RotateMirror", "TEST (%d, %d) [%d] [%d]",
+ LX, LY, laser.beamer_edge, laser.beamer[1].num);
#endif
laser.num_edges--;
#if 0
if (element != Tile[ELX][ELY])
{
- printf("element == %d, Tile[ELX][ELY] == %d\n",
- element, Tile[ELX][ELY]);
+ Debug("game:mm:GameActions_MM_Ext", "element == %d, Tile[ELX][ELY] == %d",
+ element, Tile[ELX][ELY]);
}
#endif
DrawField_MM(ELX, ELY);
#if 0
- printf("NEW ELEMENT: (%d, %d)\n", ELX, ELY);
+ Debug("game:mm:GameActions_MM_Ext", "NEW ELEMENT: (%d, %d)", ELX, ELY);
#endif
// above stuff: GRAY BALL -> PRISM !!!
#endif
ScanLaser();
-
- /*
- printf("TEST ELEMENT: %d\n", Tile[0][0]);
- */
#endif
return;
#if DEBUG
if (!IN_SCR_FIELD(x,y))
{
- printf("DrawGraphic_MM(): x = %d, y = %d, graphic = %d\n",x,y,graphic);
- printf("DrawGraphic_MM(): This should never happen!\n");
+ Debug("game:mm:DrawGraphic_MM", "x = %d, y = %d, graphic = %d",
+ x, y, graphic);
+ Debug("game:mm:DrawGraphic_MM", "This should never happen!");
+
return;
}
#endif
#if DEBUG
if (!IN_SCR_FIELD(x,y))
{
- printf("DrawGraphicThruMask_MM(): x = %d,y = %d, graphic = %d\n",x,y,graphic);
- printf("DrawGraphicThruMask_MM(): This should never happen!\n");
+ Debug("game:mm:DrawGraphicThruMask_MM", "x = %d,y = %d, graphic = %d",
+ x, y, graphic);
+ Debug("game:mm:DrawGraphicThruMask_MM", "This should never happen!");
+
return;
}
#endif
#if DEBUG
if (!IN_SCR_FIELD(x,y))
{
- printf("DrawGraphicShifted_MM(): x = %d, y = %d, graphic = %d\n",x,y,graphic);
- printf("DrawGraphicShifted_MM(): This should never happen!\n");
+ Debug("game:mm:DrawGraphicShifted_MM", "x = %d, y = %d, graphic = %d",
+ x, y, graphic);
+ Debug("game:mm:DrawGraphicShifted_MM", "This should never happen!");
+
return;
}
#endif
}
#if 0
- printf("::: InitGlobalAnimGraphicInfo\n");
-
for (i = 0; i < NUM_GLOBAL_ANIMS; i++)
for (j = 0; j < NUM_GLOBAL_ANIM_PARTS_ALL; j++)
for (k = 0; k < NUM_SPECIAL_GFX_ARGS; k++)
if (global_anim_info[i].graphic[j][k] != IMG_UNDEFINED &&
graphic_info[global_anim_info[i].graphic[j][k]].bitmap != NULL)
- printf("::: - anim %d, part %d, mode %d => %d\n",
- i, j, k, global_anim_info[i].graphic[j][k]);
+ Debug("init:InitGlobalAnimGraphicInfo",
+ "anim %d, part %d, mode %d => %d",
+ i, j, k, global_anim_info[i].graphic[j][k]);
#endif
}
}
#if 0
- printf("::: InitGlobalAnimSoundInfo\n");
-
for (i = 0; i < NUM_GLOBAL_ANIMS; i++)
for (j = 0; j < NUM_GLOBAL_ANIM_PARTS_ALL; j++)
for (k = 0; k < NUM_SPECIAL_GFX_ARGS; k++)
if (global_anim_info[i].sound[j][k] != SND_UNDEFINED)
- printf("::: - anim %d, part %d, mode %d => %d\n",
- i, j, k, global_anim_info[i].sound[j][k]);
+ Debug("init:InitGlobalAnimSoundInfo",
+ "anim %d, part %d, mode %d => %d",
+ i, j, k, global_anim_info[i].sound[j][k]);
#endif
}
}
#if 0
- printf("::: InitGlobalAnimMusicInfo\n");
-
for (i = 0; i < NUM_GLOBAL_ANIMS; i++)
for (j = 0; j < NUM_GLOBAL_ANIM_PARTS_ALL; j++)
for (k = 0; k < NUM_SPECIAL_GFX_ARGS; k++)
if (global_anim_info[i].music[j][k] != MUS_UNDEFINED)
- printf("::: - anim %d, part %d, mode %d => %d\n",
- i, j, k, global_anim_info[i].music[j][k]);
+ Debug("init:InitGlobalAnimMusicInfo",
+ "anim %d, part %d, mode %d => %d",
+ i, j, k, global_anim_info[i].music[j][k]);
#endif
}
print_timestamp_init("InitImages");
#if 0
- printf("::: leveldir_current->identifier == '%s'\n",
- leveldir_current == NULL ? "[NULL]" : leveldir_current->identifier);
- printf("::: leveldir_current->graphics_path == '%s'\n",
- leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_path);
- printf("::: leveldir_current->graphics_set == '%s'\n",
- leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_set);
- printf("::: getLevelArtworkSet(ARTWORK_TYPE_GRAPHICS) == '%s'\n",
- leveldir_current == NULL ? "[NULL]" : LEVELDIR_ARTWORK_SET(leveldir_current, ARTWORK_TYPE_GRAPHICS));
+ Debug("init:InitImages", "leveldir_current->identifier == '%s'",
+ leveldir_current == NULL ? "[NULL]" : leveldir_current->identifier);
+ Debug("init:InitImages", "leveldir_current->graphics_path == '%s'",
+ leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_path);
+ Debug("init:InitImages", "leveldir_current->graphics_set == '%s'",
+ leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_set);
+ Debug("init:InitImages", "getLevelArtworkSet(ARTWORK_TYPE_GRAPHICS) == '%s'",
+ leveldir_current == NULL ? "[NULL]" : LEVELDIR_ARTWORK_SET(leveldir_current, ARTWORK_TYPE_GRAPHICS));
#endif
setLevelArtworkDir(artwork.gfx_first);
#if 0
- printf("::: leveldir_current->identifier == '%s'\n",
- leveldir_current == NULL ? "[NULL]" : leveldir_current->identifier);
- printf("::: leveldir_current->graphics_path == '%s'\n",
- leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_path);
- printf("::: leveldir_current->graphics_set == '%s'\n",
+ Debug("init:InitImages", "leveldir_current->identifier == '%s'",
+ leveldir_current == NULL ? "[NULL]" : leveldir_current->identifier);
+ Debug("init:InitImages", "leveldir_current->graphics_path == '%s'",
+ leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_path);
+ Debug("init:InitImages", "leveldir_current->graphics_set == '%s'",
leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_set);
- printf("::: getLevelArtworkSet(ARTWORK_TYPE_GRAPHICS) == '%s'\n",
- leveldir_current == NULL ? "[NULL]" : LEVELDIR_ARTWORK_SET(leveldir_current, ARTWORK_TYPE_GRAPHICS));
+ Debug("init:InitImages", "getLevelArtworkSet(ARTWORK_TYPE_GRAPHICS) == '%s'",
+ leveldir_current == NULL ? "[NULL]" : LEVELDIR_ARTWORK_SET(leveldir_current, ARTWORK_TYPE_GRAPHICS));
#endif
#if 0
- printf("::: InitImages for '%s' ['%s', '%s'] ['%s', '%s']\n",
- leveldir_current->identifier,
- artwork.gfx_current_identifier,
- artwork.gfx_current->identifier,
- leveldir_current->graphics_set,
- leveldir_current->graphics_path);
+ Debug("init:InitImages", "InitImages for '%s' ['%s', '%s'] ['%s', '%s']",
+ leveldir_current->identifier,
+ artwork.gfx_current_identifier,
+ artwork.gfx_current->identifier,
+ leveldir_current->graphics_set,
+ leveldir_current->graphics_path);
#endif
UPDATE_BUSY_STATE();
setLevelArtworkDir(ARTWORK_FIRST_NODE(artwork, type));
#if 0
- printf("::: leveldir_current->identifier == '%s'\n",
- leveldir_current == NULL ? "[NULL]" : leveldir_current->identifier);
- printf("::: leveldir_current->graphics_path == '%s'\n",
- leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_path);
- printf("::: leveldir_current->graphics_set == '%s'\n",
- leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_set);
- printf("::: getLevelArtworkSet(ARTWORK_TYPE_GRAPHICS) == '%s'\n",
- leveldir_current == NULL ? "[NULL]" :
- LEVELDIR_ARTWORK_SET(leveldir_current, type));
+ Debug("init:CheckArtworkTypeForRedefinedCustomElements",
+ "leveldir_current->identifier == '%s'",
+ leveldir_current == NULL ? "[NULL]" : leveldir_current->identifier);
+ Debug("init:CheckArtworkTypeForRedefinedCustomElements",
+ "leveldir_current->graphics_path == '%s'",
+ leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_path);
+ Debug("init:CheckArtworkTypeForRedefinedCustomElements",
+ "leveldir_current->graphics_set == '%s'",
+ leveldir_current == NULL ? "[NULL]" : leveldir_current->graphics_set);
+ Debug("init:CheckArtworkTypeForRedefinedCustomElements",
+ "getLevelArtworkSet(ARTWORK_TYPE_GRAPHICS) == '%s'",
+ leveldir_current == NULL ? "[NULL]" :
+ LEVELDIR_ARTWORK_SET(leveldir_current, type));
#endif
// first look for special artwork configured in level series config
filename_base = getCustomArtworkLevelConfigFilename(type);
#if 0
- printf("::: filename_base == '%s'\n", filename_base);
+ Debug("init:CheckArtworkTypeForRedefinedCustomElements",
+ "filename_base == '%s'", filename_base);
#endif
if (fileExists(filename_base))
filename_local = getCustomArtworkConfigFilename(type);
#if 0
- printf("::: filename_local == '%s'\n", filename_local);
+ Debug("init:CheckArtworkTypeForRedefinedCustomElements",
+ "filename_local == '%s'", filename_local);
#endif
if (filename_local != NULL && !strEqual(filename_base, filename_local))
redefined_ce_found |= CheckArtworkConfigForCustomElements(filename_local);
#if 0
- printf("::: redefined_ce_found == %d\n", redefined_ce_found);
+ Debug("init:CheckArtworkTypeForRedefinedCustomElements",
+ "redefined_ce_found == %d", redefined_ce_found);
#endif
return redefined_ce_found;
CheckArtworkTypeForRedefinedCustomElements(ARTWORK_TYPE_MUSIC));
#if 0
- printf("::: redefined_ce_found == %d\n", redefined_ce_found);
+ Debug("init:InitOverrideArtwork", "redefined_ce_found == %d",
+ redefined_ce_found);
#endif
if (redefined_ce_found)
}
#if 0
- printf("::: => %d, %d, %d\n",
- gfx.override_level_graphics,
- gfx.override_level_sounds,
- gfx.override_level_music);
+ Debug("init:InitOverrideArtwork", "%d, %d, %d",
+ gfx.override_level_graphics,
+ gfx.override_level_sounds,
+ gfx.override_level_music);
#endif
}
#if 0
#if DEBUG
- printf("::: %d: %d ms", *loop_var, delay);
if (skip_frames)
- printf(" -> SKIP %d FRAME(S) [%d ms]", skip_frames, skip_frames * delay);
- printf("\n");
+ Debug("internal:SkipUntilDelayReached",
+ "%d: %d ms -> SKIP %d FRAME(S) [%d ms]",
+ *loop_var, delay,
+ skip_frames, skip_frames * delay);
+ else
+ Debug("internal:SkipUntilDelayReached",
+ "%d: %d ms",
+ *loop_var, delay);
#endif
#endif
if (!list)
return;
- printf("token: '%s'\n", list->token);
- printf("value: '%s'\n", list->value);
+ Debug("setup:printSetupFileList", "token: '%s'", list->token);
+ Debug("setup:printSetupFileList", "value: '%s'", list->value);
printSetupFileList(list->next);
}
{
BEGIN_HASH_ITERATION(hash, itr)
{
- printf("token: '%s'\n", HASH_ITERATION_TOKEN(itr));
- printf("value: '%s'\n", HASH_ITERATION_VALUE(itr));
+ Debug("setup:printSetupFileHash", "token: '%s'", HASH_ITERATION_TOKEN(itr));
+ Debug("setup:printSetupFileHash", "value: '%s'", HASH_ITERATION_VALUE(itr));
}
END_HASH_ITERATION(hash, itr)
}
artwork.mus_current_identifier = artwork.mus_current->identifier;
#if ENABLE_UNUSED_CODE
- printf("graphics set == %s\n\n", artwork.gfx_current_identifier);
- printf("sounds set == %s\n\n", artwork.snd_current_identifier);
- printf("music set == %s\n\n", artwork.mus_current_identifier);
+ Debug("setup:LoadArtworkInfo", "graphics set == %s",
+ artwork.gfx_current_identifier);
+ Debug("setup:LoadArtworkInfo", "sounds set == %s",
+ artwork.snd_current_identifier);
+ Debug("setup:LoadArtworkInfo", "music set == %s",
+ artwork.mus_current_identifier);
#endif
sortTreeInfo(&artwork.gfx_first);
while (snapshot_list != node)
{
#if DEBUG_SNAPSHOTS
- printf("::: FreeSnapshotList_*() [%s, %d, %d]\n",
- snapshot_list->key, num_snapshot_buffers, num_snapshot_bytes);
+ Debug("snapshot:FreeSnapshotList_UpToNode", "[%s, %d, %d]",
+ snapshot_list->key, num_snapshot_buffers, num_snapshot_bytes);
#endif
deleteNodeFromList(&snapshot_list, snapshot_list->key, FreeSnapshot);
void FreeSnapshotList(void)
{
#if DEBUG_SNAPSHOTS
- printf("::: FreeSnapshotList()\n");
+ Debug("snapshot:FreeSnapshotList", "");
#endif
FreeSnapshotList_UpToNode(NULL);
static void ReduceSnapshotList(void)
{
#if DEBUG_SNAPSHOTS
- printf("::: (Reducing number of snapshots from %d ",
- num_snapshots);
+ int num_snapshots_last = num_snapshots;
#endif
// maximum number of snapshots exceeded -- thin out list of snapshots
}
#if DEBUG_SNAPSHOTS
- printf("to %d.)\n", num_snapshots);
+ Debug("snapshot:ReduceSnapshotList",
+ "(Reducing number of snapshots from %d to %d.)",
+ num_snapshots_last, num_snapshots);
#if 0
node = snapshot_list;
while (node)
{
- printf("::: key: %s\n", node->key);
+ Debug("snapshot:ReduceSnapshotList", "key: %s", node->key);
+
node = node->next;
}
#endif
FreeSnapshotList_UpToNode(snapshot_current);
#if DEBUG_SNAPSHOTS
- printf("::: SaveSnapshotToList() [%d] [%d snapshots, %d buffers, %d bytes]\n",
- next_snapshot_key, num_snapshots,
- num_snapshot_buffers, num_snapshot_bytes);
+ Debug("snapshot:SaveSnapshotToList",
+ "[%d] [%d snapshots, %d buffers, %d bytes]",
+ next_snapshot_key, num_snapshots,
+ num_snapshot_buffers, num_snapshot_bytes);
#endif
addNodeToList(&snapshot_list, i_to_a(next_snapshot_key),
LoadSnapshotBuffers(snapshot_current->content);
#if DEBUG_SNAPSHOTS
- printf("::: LoadSnapshotFromList_Older() [%s]\n", snapshot_current->key);
+ Debug("snapshot:LoadSnapshotFromList_Older", "[%s]", snapshot_current->key);
#endif
return TRUE;
LoadSnapshotBuffers(snapshot_current->content);
#if DEBUG_SNAPSHOTS
- printf("::: LoadSnapshotFromList_Newer() [%s]\n", snapshot_current->key);
+ Debug("snapshot:LoadSnapshotFromList_Newer", "[%s]", snapshot_current->key);
#endif
return TRUE;
{
if (num_bytes > MAX_PACKET_SIZE)
{
- Error(ERR_NETWORK_SERVER, "protocol error: invalid packet size %d",
+ Debug("network:server", "protocol error: invalid packet size %d",
num_bytes);
return -1;
static void RemovePlayer(struct NetworkServerPlayerInfo *player)
{
- if (options.verbose)
- Error(ERR_NETWORK_SERVER, "dropping client %d (%s)",
- player->number, player->player_name);
+ Debug("network:server", "dropping client %d (%s)",
+ player->number, player->player_name);
SDLNet_TCP_DelSocket(fds, player->fd);
SDLNet_TCP_Close(player->fd);
#if 0 // do not terminate network server if last player disconnected
if (run_server_only_once && num_clients == 0)
{
- if (options.verbose)
- {
- Error(ERR_NETWORK_SERVER, "no clients left");
- Error(ERR_NETWORK_SERVER, "aborting");
- }
+ Debug("network:server", "no clients left");
+ Debug("network:server", "aborting");
exit(0);
}
if (protocol_version_major != PROTOCOL_VERSION_MAJOR ||
protocol_version_minor != PROTOCOL_VERSION_MINOR)
{
- if (options.verbose)
- Error(ERR_NETWORK_SERVER,
- "client %d (%s) has wrong protocol version %d.%d.%d",
- player->number, player->player_name,
- protocol_version_major,
- protocol_version_minor,
- protocol_version_patch);
+ Debug("network:server",
+ "client %d (%s) has wrong protocol version %d.%d.%d",
+ player->number, player->player_name,
+ protocol_version_major,
+ protocol_version_minor,
+ protocol_version_patch);
initNetworkBufferForWriting(write_buffer, OP_BAD_PROTOCOL_VERSION, 0);
}
else
{
- if (options.verbose)
- Error(ERR_NETWORK_SERVER,
- "client %d (%s) uses protocol version %d.%d.%d",
- player->number, player->player_name,
- protocol_version_major,
- protocol_version_minor,
- protocol_version_patch);
+ Debug("network:server",
+ "client %d (%s) uses protocol version %d.%d.%d",
+ player->number, player->player_name,
+ protocol_version_major,
+ protocol_version_minor,
+ protocol_version_patch);
}
}
boolean nr_is_free = TRUE;
struct NetworkServerPlayerInfo *p;
- if (options.verbose)
- Error(ERR_NETWORK_SERVER, "client %d (%s) wants to switch to # %d",
- player->number, player->player_name, nr_wanted);
+ Debug("network:server", "client %d (%s) wants to switch to # %d",
+ player->number, player->player_name, nr_wanted);
for (p = first_player; p != NULL; p = p->next)
{
}
}
- if (options.verbose)
- {
- if (nr_is_free)
- Error(ERR_NETWORK_SERVER, "client %d (%s) switches to # %d",
- player->number, player->player_name, nr_wanted);
- else if (player->number == nr_wanted)
- Error(ERR_NETWORK_SERVER, "client %d (%s) already has # %d",
- player->number, player->player_name, nr_wanted);
- else
- Error(ERR_NETWORK_SERVER,
- "client %d (%s) cannot switch (client %d already exists)",
- player->number, player->player_name, nr_wanted);
- }
+ if (nr_is_free)
+ Debug("network:server", "client %d (%s) switches to # %d",
+ player->number, player->player_name, nr_wanted);
+ else if (player->number == nr_wanted)
+ Debug("network:server", "client %d (%s) already has # %d",
+ player->number, player->player_name, nr_wanted);
+ else
+ Debug("network:server",
+ "client %d (%s) cannot switch (client %d already exists)",
+ player->number, player->player_name, nr_wanted);
if (nr_is_free)
player->number = nr_wanted;
SendNetworkBufferToAllButOne(write_buffer, player);
}
- if (options.verbose)
- Error(ERR_NETWORK_SERVER, "client %d calls itself \"%s\"",
- player->number, player->player_name);
+ Debug("network:server", "client %d calls itself \"%s\"",
+ player->number, player->player_name);
copyNetworkBufferForWriting(read_buffer, write_buffer, player->number);
char *new_leveldir_identifier = getNetworkBufferString(read_buffer);
int level_nr = getNetworkBuffer16BitInteger(read_buffer);
- if (options.verbose)
- Error(ERR_NETWORK_SERVER,
- "client %d (%s) starts game [level %d from level set '%s']",
- player->number, player->player_name, level_nr,
- new_leveldir_identifier);
+ Debug("network:server",
+ "client %d (%s) starts game [level %d from level set '%s']",
+ player->number, player->player_name, level_nr,
+ new_leveldir_identifier);
struct NetworkServerPlayerInfo *p;
// reset frame counter
ServerFrameCounter = 0;
- Error(ERR_NETWORK_SERVER, "resetting ServerFrameCounter to 0");
+ Debug("network:server", "resetting ServerFrameCounter to 0");
// reset player actions
for (p = first_player; p != NULL; p = p->next)
static void Handle_OP_PAUSE_PLAYING(struct NetworkServerPlayerInfo *player)
{
- if (options.verbose)
- Error(ERR_NETWORK_SERVER, "client %d (%s) pauses game",
- player->number, player->player_name);
+ Debug("network:server", "client %d (%s) pauses game",
+ player->number, player->player_name);
copyNetworkBufferForWriting(read_buffer, write_buffer, player->number);
static void Handle_OP_CONTINUE_PLAYING(struct NetworkServerPlayerInfo *player)
{
- if (options.verbose)
- Error(ERR_NETWORK_SERVER, "client %d (%s) continues game",
- player->number, player->player_name);
+ Debug("network:server", "client %d (%s) continues game",
+ player->number, player->player_name);
copyNetworkBufferForWriting(read_buffer, write_buffer, player->number);
{
int cause_for_stopping = getNetworkBuffer8BitInteger(read_buffer);
- if (options.verbose)
- Error(ERR_NETWORK_SERVER, "client %d (%s) stops game [%d]",
- player->number, player->player_name, cause_for_stopping);
+ Debug("network:server", "client %d (%s) stops game [%d]",
+ player->number, player->player_name, cause_for_stopping);
copyNetworkBufferForWriting(read_buffer, write_buffer, player->number);
{
char *message = getNetworkBufferString(read_buffer);
- if (options.verbose)
- Error(ERR_NETWORK_SERVER, "client %d (%s) sends message: %s",
- player->number, player->player_name, message);
+ Debug("network:server", "client %d (%s) sends message: %s",
+ player->number, player->player_name, message);
copyNetworkBufferForWriting(read_buffer, write_buffer, player->number);
static void ExitNetworkServer(int exit_value)
{
- Error(ERR_NETWORK_SERVER, "exiting network server");
+ Debug("network:server", "exiting network server");
exit(exit_value);
}
Error(ERR_EXIT_NETWORK_SERVER, "SDLNet_TCP_AddSocket() failed: %s"),
SDLNet_GetError();
- if (options.verbose)
- {
- Error(ERR_NETWORK_SERVER, "started up, listening on port %d", port);
- Error(ERR_NETWORK_SERVER, "using protocol version %d.%d.%d",
- PROTOCOL_VERSION_MAJOR,
- PROTOCOL_VERSION_MINOR,
- PROTOCOL_VERSION_PATCH);
- }
+ Debug("network:server", "started up, listening on port %d", port);
+ Debug("network:server", "using protocol version %d.%d.%d",
+ PROTOCOL_VERSION_MAJOR,
+ PROTOCOL_VERSION_MINOR,
+ PROTOCOL_VERSION_PATCH);
while (1)
{
if (num_bytes <= 0)
{
- if (options.verbose)
- Error(ERR_NETWORK_SERVER, "EOF from client %d (%s)",
- player->number, player->player_name);
+ Debug("network:server", "EOF from client %d (%s)",
+ player->number, player->player_name);
RemovePlayer(player);
message_type != OP_PLAYER_NAME &&
message_type != OP_PROTOCOL_VERSION)
{
- if (options.verbose)
- Error(ERR_NETWORK_SERVER, "got opcode %d for client %d which is not introduced yet (expected OP_PLAYER_NAME or OP_PROTOCOL_VERSION)", message_type, player->number);
+ Debug("network:server", "got opcode %d for client %d which is not introduced yet (expected OP_PLAYER_NAME or OP_PROTOCOL_VERSION)", message_type, player->number);
RemovePlayer(player);
break;
default:
- if (options.verbose)
- Error(ERR_NETWORK_SERVER,
- "unknown opcode %d from client %d (%s)",
- message_type, player->number, player->player_name);
+ Debug("network:server", "unknown opcode %d from client %d (%s)",
+ message_type, player->number, player->player_name);
}
}
}
else
DrawNetworkText_Failed("No local network server found!");
- printf("SDLNet_TCP_Open(): %s\n", SDLNet_GetError());
+ Debug("network:client", "SDLNet_TCP_Open(): %s", SDLNet_GetError());
}
if (hostname) // connect to specified server failed
SendNetworkBufferToServer(write_buffer);
- Error(ERR_NETWORK_CLIENT, "you set your player name to \"%s\"", player_name);
+ Debug("network:client", "you set your player name to \"%s\"", player_name);
}
void SendToServer_ProtocolVersion(void)
network_level.use_network_level_files = FALSE;
#if 0
- printf("::: '%s'\n", leveldir_current->identifier);
- printf("::: '%d'\n", level.file_info.nr);
- printf("::: '%d'\n", level.file_info.type);
- printf("::: '%d'\n", level.file_info.packed);
- printf("::: '%s'\n", level.file_info.basename);
- printf("::: '%s'\n", level.file_info.filename);
+ Debug("network:client", "'%s'", leveldir_current->identifier);
+ Debug("network:client", "'%d'", level.file_info.nr);
+ Debug("network:client", "'%d'", level.file_info.type);
+ Debug("network:client", "'%d'", level.file_info.packed);
+ Debug("network:client", "'%s'", level.file_info.basename);
+ Debug("network:client", "'%s'", level.file_info.filename);
if (level.use_custom_template)
- printf("::: '%s'\n", level_template.file_info.filename);
+ Debug("network:client", "'%s'", level_template.file_info.filename);
#endif
}
struct PlayerInfo *old_local_player = local_player;
struct PlayerInfo *new_local_player = &stored_player[new_index_nr];
- printf("OP_YOUR_NUMBER: %d\n", old_client_nr);
+ Debug("network:client", "OP_YOUR_NUMBER: %d", old_client_nr);
+
first_player.nr = new_client_nr;
if (old_local_player != new_local_player)
if (first_player.nr > MAX_PLAYERS)
Error(ERR_EXIT, "sorry, more than %d players not allowed", MAX_PLAYERS);
- Error(ERR_NETWORK_CLIENT, "you get client # %d", new_client_nr);
+ Debug("network:client", "you get client # %d", new_client_nr);
stored_player[new_index_nr].connected_network = TRUE;
}
struct PlayerInfo *old_player = &stored_player[old_index_nr];
struct PlayerInfo *new_player = &stored_player[new_index_nr];
- printf("OP_NUMBER_WANTED: %d\n", old_client_nr);
+ Debug("network:client", "OP_NUMBER_WANTED: %d", old_client_nr);
if (new_client_nr == client_nr_wanted) // switching succeeded
{
struct NetworkClientPlayerInfo *player;
if (old_client_nr != client_nr_wanted) // client's nr has changed
- Error(ERR_NETWORK_CLIENT, "client %d switches to # %d",
+ Debug("network:client", "client %d switches to # %d",
old_client_nr, new_client_nr);
else if (old_client_nr == first_player.nr) // local player keeps his nr
- Error(ERR_NETWORK_CLIENT, "keeping client # %d", new_client_nr);
+ Debug("network:client", "keeping client # %d", new_client_nr);
if (old_client_nr != new_client_nr)
{
Request(request, REQ_CONFIRM);
- Error(ERR_NETWORK_CLIENT, "cannot switch -- you keep client # %d",
+ Debug("network:client", "cannot switch -- you keep client # %d",
new_client_nr);
}
char *player_name = getNetworkBufferString(read_buffer);
struct NetworkClientPlayerInfo *player = getNetworkPlayer(player_nr);
- printf("OP_PLAYER_NAME: %d\n", player_nr);
+ Debug("network:client", "OP_PLAYER_NAME: %d", player_nr);
strncpy(player->name, player_name, MAX_PLAYER_NAME_LEN);
player->name[MAX_PLAYER_NAME_LEN] = '\0';
- Error(ERR_NETWORK_CLIENT, "client %d calls itself \"%s\"",
+ Debug("network:client", "client %d calls itself \"%s\"",
player_nr, player->name);
}
int new_client_nr = getNetworkBuffer8BitInteger(read_buffer);
int new_index_nr = new_client_nr - 1;
- printf("OP_PLAYER_CONNECTED: %d\n", new_client_nr);
- Error(ERR_NETWORK_CLIENT, "new client %d connected", new_client_nr);
+ Debug("network:client", "OP_PLAYER_CONNECTED: %d", new_client_nr);
+ Debug("network:client", "new client %d connected", new_client_nr);
for (player = &first_player; player; player = player->next)
{
int player_nr = getNetworkBuffer8BitInteger(read_buffer);
int index_nr = player_nr - 1;
- printf("OP_PLAYER_DISCONNECTED: %d\n", player_nr);
- player_disconnected = getNetworkPlayer(player_nr);
- Error(ERR_NETWORK_CLIENT, "client %d (%s) disconnected",
+ Debug("network:client", "OP_PLAYER_DISCONNECTED: %d", player_nr);
+ Debug("network:client", "client %d (%s) disconnected",
player_nr, getNetworkPlayerName(player_nr));
+ player_disconnected = getNetworkPlayer(player_nr);
+
for (player = &first_player; player; player = player->next)
if (player->next == player_disconnected)
player->next = player_disconnected->next;
return;
}
- printf("OP_START_PLAYING: %d\n", player_nr);
- Error(ERR_NETWORK_CLIENT,
- "client %d starts game [level %d from level identifier '%s']\n",
+ Debug("network:client", "OP_START_PLAYING: %d", player_nr);
+ Debug("network:client",
+ "client %d starts game [level %d from level identifier '%s']",
player_nr, new_level_nr, new_leveldir_identifier);
LevelDirTree *new_leveldir =
{
int player_nr = getNetworkBuffer8BitInteger(read_buffer);
- printf("OP_PAUSE_PLAYING: %d\n", player_nr);
- Error(ERR_NETWORK_CLIENT, "client %d pauses game", player_nr);
+ Debug("network:client", "OP_PAUSE_PLAYING: %d", player_nr);
+ Debug("network:client", "client %d pauses game", player_nr);
if (game_status == GAME_MODE_PLAYING)
{
{
int player_nr = getNetworkBuffer8BitInteger(read_buffer);
- printf("OP_CONTINUE_PLAYING: %d\n", player_nr);
- Error(ERR_NETWORK_CLIENT, "client %d continues game", player_nr);
+ Debug("network:client", "OP_CONTINUE_PLAYING: %d", player_nr);
+ Debug("network:client", "client %d continues game", player_nr);
if (game_status == GAME_MODE_PLAYING)
{
int client_nr = getNetworkBuffer8BitInteger(read_buffer);
int cause_for_stopping = getNetworkBuffer8BitInteger(read_buffer);
- printf("OP_STOP_PLAYING: %d [%d]\n", client_nr, cause_for_stopping);
- Error(ERR_NETWORK_CLIENT, "client %d stops game [%d]",
+ Debug("network:client", "OP_STOP_PLAYING: %d [%d]",
+ client_nr, cause_for_stopping);
+ Debug("network:client", "client %d stops game [%d]",
client_nr, cause_for_stopping);
if (game_status == GAME_MODE_PLAYING)
{
int player_nr = getNetworkBuffer8BitInteger(read_buffer);
- printf("OP_BROADCAST_MESSAGE: %d\n", player_nr);
- Error(ERR_NETWORK_CLIENT, "client %d sends message", player_nr);
+ Debug("network:client", "OP_BROADCAST_MESSAGE: %d", player_nr);
+ Debug("network:client", "client %d sends message", player_nr);
}
static void Handle_OP_LEVEL_FILE(void)
setString(&network_level.tmpl_info.basename, NULL);
setString(&network_level.tmpl_info.filename, NULL);
- printf("OP_LEVEL_FILE: %d\n", player_nr);
+ Debug("network:client", "OP_LEVEL_FILE: %d", player_nr);
leveldir_identifier = getStringCopy(getNetworkBufferString(read_buffer));
network_level.use_network_level_files = TRUE;
#if 0
- printf("::: '%s'\n", leveldir_identifier);
- printf("::: '%d'\n", file_info->nr);
- printf("::: '%d'\n", file_info->type);
- printf("::: '%d'\n", file_info->packed);
- printf("::: '%s'\n", file_info->basename);
- printf("::: '%s'\n", file_info->filename);
+ Debug("network:client", "'%s'", leveldir_identifier);
+ Debug("network:client", "'%d'", file_info->nr);
+ Debug("network:client", "'%d'", file_info->type);
+ Debug("network:client", "'%d'", file_info->packed);
+ Debug("network:client", "'%s'", file_info->basename);
+ Debug("network:client", "'%s'", file_info->filename);
if (use_custom_template)
- printf("::: '%s'\n", tmpl_info->filename);
+ Debug("network:client", "'%s'", tmpl_info->filename);
#endif
}
break;
default:
- if (options.verbose)
- Error(ERR_NETWORK_CLIENT,
- "unknown opcode %d from server", message_type);
+ Debug("network:client", "unknown opcode %d from server", message_type);
}
fflush(stdout);
#if DEBUG
if (!IN_SCR_FIELD(x, y))
{
- printf("DrawGraphic(): x = %d, y = %d, graphic = %d\n", x, y, graphic);
- printf("DrawGraphic(): This should never happen!\n");
+ Debug("draw:DrawGraphic", "x = %d, y = %d, graphic = %d", x, y, graphic);
+ Debug("draw:DrawGraphic", "This should never happen!");
+
return;
}
#endif
#if DEBUG
if (!IN_SCR_FIELD(x, y))
{
- printf("DrawGraphic(): x = %d, y = %d, graphic = %d\n", x, y, graphic);
- printf("DrawGraphic(): This should never happen!\n");
+ Debug("draw:DrawFixedGraphic", "x = %d, y = %d, graphic = %d",
+ x, y, graphic);
+ Debug("draw:DrawFixedGraphic", "This should never happen!");
+
return;
}
#endif
#if DEBUG
if (!IN_SCR_FIELD(x, y))
{
- printf("DrawGraphicThruMask(): x = %d,y = %d, graphic = %d\n",x,y,graphic);
- printf("DrawGraphicThruMask(): This should never happen!\n");
+ Debug("draw:DrawGraphicThruMask", "x = %d,y = %d, graphic = %d",
+ x, y, graphic);
+ Debug("draw:DrawGraphicThruMask", "This should never happen!");
+
return;
}
#endif
#if DEBUG
if (!IN_SCR_FIELD(x, y))
{
- printf("DrawGraphicThruMask(): x = %d,y = %d, graphic = %d\n",x,y,graphic);
- printf("DrawGraphicThruMask(): This should never happen!\n");
+ Debug("draw:DrawFixedGraphicThruMask", "x = %d,y = %d, graphic = %d",
+ x, y, graphic);
+ Debug("draw:DrawFixedGraphicThruMask", "This should never happen!");
+
return;
}
#endif
#if DEBUG
if (!IN_SCR_FIELD(x, y))
{
- printf("DrawGraphicShifted(): x = %d, y = %d, graphic = %d\n",x,y,graphic);
- printf("DrawGraphicShifted(): This should never happen!\n");
+ Debug("draw:DrawGraphicShiftedNormal", "x = %d, y = %d, graphic = %d",
+ x, y, graphic);
+ Debug("draw:DrawGraphicShiftedNormal", "This should never happen!");
+
return;
}
#endif
#if DEBUG
if (!IN_LEV_FIELD(player->jx, player->jy))
{
- printf("DrawPlayerField(): x = %d, y = %d\n", player->jx, player->jy);
- printf("DrawPlayerField(): This should never happen!\n");
+ Debug("draw:DrawPlayerExt", "x = %d, y = %d", player->jx, player->jy);
+ Debug("draw:DrawPlayerExt", "This should never happen!");
draw_player[pnr] = FALSE;