int element = (*editor_elements_info[i].element_list)[j];
if (element >= NUM_FILE_ELEMENTS)
- Error(ERR_WARN, "editor element %d is runtime element", element);
+ Warn("editor element %d is runtime element", element);
if (strEqual(getElementInfoText(element), INFOTEXT_UNKNOWN_ELEMENT))
- Error(ERR_WARN, "no element description text for element %d", element);
+ Warn("no element description text for element %d", element);
}
}
for (i = 0; i < NUM_FILE_ELEMENTS; i++)
if (getElementDescriptionFilename(i) == NULL && !IS_OBSOLETE(i))
- Error(ERR_WARN, "no element description file for element '%s'",
- EL_NAME(i));
+ Warn("no element description file for element '%s'", EL_NAME(i));
}
#endif
void HandleButtonEvent(ButtonEvent *event)
{
#if DEBUG_EVENTS_BUTTON
- Error(ERR_DEBUG, "BUTTON EVENT: button %d %s, x/y %d/%d\n",
+ Debug("event:button", "button %d %s, x/y %d/%d\n",
event->button,
event->type == EVENT_BUTTONPRESS ? "pressed" : "released",
event->x, event->y);
motion_status = TRUE;
#if DEBUG_EVENTS_MOTION
- Error(ERR_DEBUG, "MOTION EVENT: button %d moved, x/y %d/%d\n",
+ Debug("event:motion", "button %d moved, x/y %d/%d\n",
button_status, event->x, event->y);
#endif
#if DEBUG_EVENTS_WHEEL
#if 1
- Error(ERR_DEBUG, "WHEEL EVENT: mouse == %d, x/y == %d/%d\n",
+ Debug("event:wheel", "mouse == %d, x/y == %d/%d\n",
event->which, event->x, event->y);
#else
// (SDL_MOUSEWHEEL_NORMAL/SDL_MOUSEWHEEL_FLIPPED needs SDL 2.0.4 or newer)
- Error(ERR_DEBUG, "WHEEL EVENT: mouse == %d, x/y == %d/%d, direction == %s\n",
+ Debug("event:wheel", "mouse == %d, x/y == %d/%d, direction == %s\n",
event->which, event->x, event->y,
(event->direction == SDL_MOUSEWHEEL_NORMAL ? "SDL_MOUSEWHEEL_NORMAL" :
"SDL_MOUSEWHEEL_FLIPPED"));
subtype == SDL_WINDOWEVENT_CLOSE ? "SDL_WINDOWEVENT_CLOSE" :
"(UNKNOWN)");
- Error(ERR_DEBUG, "WINDOW EVENT: '%s', %ld, %ld",
+ Debug("event:window", "name: '%s', data1: %ld, data2: %ld",
event_name, event->data1, event->data2);
#endif
// for any touch input event, enable overlay buttons (if activated)
SetOverlayEnabled(TRUE);
- Error(ERR_DEBUG, "::: key '%s' was '%s' [fingerId: %lld]",
+ Debug("event:finger", "key '%s' was '%s' [fingerId: %lld]",
getKeyNameFromKey(key), key_status_name, event->fingerId);
if (key_status == KEY_PRESSED)
if (touch_info[i].touched &&
touch_info[i].finger_id == event->fingerId)
{
- // Error(ERR_DEBUG, "MARK 1: %d", i);
+ // Debug("event:finger", "MARK 1: %d", i);
break;
}
oldest_pos = i;
oldest_counter = touch_info[i].counter;
- // Error(ERR_DEBUG, "MARK 2: %d", i);
+ // Debug("event:finger", "MARK 2: %d", i);
}
if (!touch_info[i].touched)
{
- // Error(ERR_DEBUG, "MARK 3: %d", i);
+ // Debug("event:finger", "MARK 3: %d", i);
break;
}
// all slots allocated -- use oldest slot
i = oldest_pos;
- // Error(ERR_DEBUG, "MARK 4: %d", i);
+ // Debug("event:finger", "MARK 4: %d", i);
}
}
else
{
HandleKey(key, KEY_RELEASED);
- Error(ERR_DEBUG, "=> key == '%s', key_status == '%s' [slot %d] [1]",
+ Debug("event:finger", "key == '%s', key_status == '%s' [slot %d] [1]",
getKeyNameFromKey(key), "KEY_RELEASED", i);
}
}
// undraw previous grid button when moving finger away
overlay.grid_button_action &= ~touch_info[i].action;
- Error(ERR_DEBUG, "=> key == '%s', key_status == '%s' [slot %d] [2]",
+ Debug("event:finger", "key == '%s', key_status == '%s' [slot %d] [2]",
getKeyNameFromKey(touch_info[i].key), "KEY_RELEASED", i);
}
{
HandleKey(key, KEY_PRESSED);
- Error(ERR_DEBUG, "=> key == '%s', key_status == '%s' [slot %d] [3]",
+ Debug("event:finger", "key == '%s', key_status == '%s' [slot %d] [3]",
getKeyNameFromKey(key), "KEY_PRESSED", i);
}
}
{
HandleKey(touch_info[i].key, KEY_RELEASED);
- Error(ERR_DEBUG, "=> key == '%s', key_status == '%s' [slot %d] [4]",
+ Debug("event:finger", "key == '%s', key_status == '%s' [slot %d] [4]",
getKeyNameFromKey(touch_info[i].key), "KEY_RELEASED", i);
}
motion_key_x = KSYM_UNDEFINED;
motion_key_y = KSYM_UNDEFINED;
- Error(ERR_DEBUG, "---------- MOVE STARTED (WAIT) ----------");
+ Debug("event:finger", "---------- MOVE STARTED (WAIT) ----------");
}
else
{
HandleKey(button_key, KEY_PRESSED);
- Error(ERR_DEBUG, "---------- SNAP STARTED ----------");
+ Debug("event:finger", "---------- SNAP STARTED ----------");
}
}
else if (event->type == EVENT_FINGERRELEASE)
motion_key_x = KSYM_UNDEFINED;
motion_key_y = KSYM_UNDEFINED;
- Error(ERR_DEBUG, "---------- MOVE STOPPED ----------");
+ Debug("event:finger", "---------- MOVE STOPPED ----------");
}
else if (event->fingerId == button_id)
{
button_key = KSYM_UNDEFINED;
- Error(ERR_DEBUG, "---------- SNAP STOPPED ----------");
+ Debug("event:finger", "---------- SNAP STOPPED ----------");
}
}
else if (event->type == EVENT_FINGERMOTION)
motion_key_x = new_motion_key_x;
motion_key_y = new_motion_key_y;
- Error(ERR_DEBUG, "---------- MOVE STARTED (MOVE) ----------");
+ Debug("event:finger", "---------- MOVE STARTED (MOVE) ----------");
}
}
else if (event->fingerId == button_id)
HandleKey(button_key, KEY_PRESSED);
- Error(ERR_DEBUG, "---------- DROP STARTED ----------");
+ Debug("event:finger", "---------- DROP STARTED ----------");
}
}
}
void HandleFingerEvent(FingerEvent *event)
{
#if DEBUG_EVENTS_FINGER
- Error(ERR_DEBUG, "FINGER EVENT: finger was %s, touch ID %lld, finger ID %lld, x/y %f/%f, dx/dy %f/%f, pressure %f",
+ Debug("event:finger", "finger was %s, touch ID %lld, finger ID %lld, x/y %f/%f, dx/dy %f/%f, pressure %f",
event->type == EVENT_FINGERPRESS ? "pressed" :
event->type == EVENT_FINGERRELEASE ? "released" : "moved",
event->touchId,
ClearPlayerMouseAction();
- Error(ERR_DEBUG, "---------- TOUCH ACTION STARTED ----------");
+ Debug("event:finger", "---------- TOUCH ACTION STARTED ----------");
}
}
else if (button == MB_RELEASED && touched)
else
SetPlayerMouseAction(old_mx, old_my, MB_RELEASED);
- Error(ERR_DEBUG, "---------- TOUCH ACTION STOPPED ----------");
+ Debug("event:finger", "---------- TOUCH ACTION STOPPED ----------");
}
if (touched)
last_button = button_nr;
- Error(ERR_DEBUG, "---------- TOUCH ACTION: ROTATING ----------");
+ Debug("event:finger", "---------- TOUCH ACTION: ROTATING ----------");
}
else
{
SetPlayerMouseAction(old_mx, old_my, MB_RELEASED);
- Error(ERR_DEBUG, "---------- TOUCH ACTION PAUSED ----------");
+ Debug("event:finger", "---------- TOUCH ACTION PAUSED ----------");
}
}
}
ClearPlayerMouseAction();
- Error(ERR_DEBUG, "---------- TOUCH ACTION STARTED ----------");
+ Debug("event:finger", "---------- TOUCH ACTION STARTED ----------");
}
}
else if (button == MB_RELEASED && touched)
else
SetPlayerMouseAction(old_mx, old_my, MB_RELEASED);
- Error(ERR_DEBUG, "---------- TOUCH ACTION STOPPED ----------");
+ Debug("event:finger", "---------- TOUCH ACTION STOPPED ----------");
}
if (touched)
tapped = FALSE;
- Error(ERR_DEBUG, "---------- TOUCH ACTION: ROTATING ----------");
+ Debug("event:finger", "---------- TOUCH ACTION: ROTATING ----------");
}
else
{
SetPlayerMouseAction(old_mx, old_my, MB_RELEASED);
- Error(ERR_DEBUG, "---------- TOUCH ACTION PAUSED ----------");
+ Debug("event:finger", "---------- TOUCH ACTION PAUSED ----------");
}
}
}
motion_key_x = KSYM_UNDEFINED;
motion_key_y = KSYM_UNDEFINED;
- Error(ERR_DEBUG, "---------- TOUCH ACTION STARTED ----------");
+ Debug("event:finger", "---------- TOUCH ACTION STARTED ----------");
}
}
else if (button == MB_RELEASED && touched)
{
if (player_is_dropping)
{
- Error(ERR_DEBUG, "---------- DROP STOPPED ----------");
+ Debug("event:finger", "---------- DROP STOPPED ----------");
HandleKey(setup.input[0].key.drop, KEY_RELEASED);
}
else
{
- Error(ERR_DEBUG, "---------- SNAP STOPPED ----------");
+ Debug("event:finger", "---------- SNAP STOPPED ----------");
HandleKey(setup.input[0].key.snap, KEY_RELEASED);
}
motion_key_x = KSYM_UNDEFINED;
motion_key_y = KSYM_UNDEFINED;
- Error(ERR_DEBUG, "---------- TOUCH ACTION STOPPED ----------");
+ Debug("event:finger", "---------- TOUCH ACTION STOPPED ----------");
}
if (touched)
if (player_is_dropping)
{
- Error(ERR_DEBUG, "---------- DROP STARTED ----------");
+ Debug("event:finger", "---------- DROP STARTED ----------");
HandleKey(setup.input[0].key.drop, KEY_PRESSED);
}
else
{
- Error(ERR_DEBUG, "---------- SNAP STARTED ----------");
+ Debug("event:finger", "---------- SNAP STARTED ----------");
HandleKey(setup.input[0].key.snap, KEY_PRESSED);
}
if (player_is_dropping &&
player_drop_count == getPlayerInventorySize(0))
{
- Error(ERR_DEBUG, "---------- DROP -> SNAP ----------");
+ Debug("event:finger", "---------- DROP -> SNAP ----------");
HandleKey(setup.input[0].key.drop, KEY_RELEASED);
HandleKey(setup.input[0].key.snap, KEY_PRESSED);
if (new_motion_key_x != motion_key_x)
{
- Error(ERR_DEBUG, "---------- %s %s ----------",
+ Debug("event:finger", "---------- %s %s ----------",
started_on_player && !player_is_dropping ? "SNAPPING" : "MOVING",
dx < 0 ? "LEFT" : dx > 0 ? "RIGHT" : "PAUSED");
if (new_motion_key_y != motion_key_y)
{
- Error(ERR_DEBUG, "---------- %s %s ----------",
+ Debug("event:finger", "---------- %s %s ----------",
started_on_player && !player_is_dropping ? "SNAPPING" : "MOVING",
dy < 0 ? "UP" : dy > 0 ? "DOWN" : "PAUSED");
Key key = getKeyFromKeyName(text);
#if DEBUG_EVENTS_TEXT
- Error(ERR_DEBUG, "TEXT EVENT: text == '%s' [%d byte(s), '%c'/%d], resulting key == %d (%s) [%04x]",
+ Debug("event:text", "text == '%s' [%d byte(s), '%c'/%d], resulting key == %d (%s) [%04x]",
text,
strlen(text),
text[0], (int)(text[0]),
Key keymod = (with_modifiers ? GetEventKey(event, FALSE) : key);
#if DEBUG_EVENTS_KEY
- Error(ERR_DEBUG, "KEY EVENT: key was %s, keysym.scancode == %d, keysym.sym == %d, keymod = %d, GetKeyModState() = 0x%04x, resulting key == %d (%s)",
+ Debug("event:key", "key was %s, keysym.scancode == %d, keysym.sym == %d, keymod = %d, GetKeyModState() = 0x%04x, resulting key == %d (%s)",
event->type == EVENT_KEYPRESS ? "pressed" : "released",
event->keysym.scancode,
event->keysym.sym,
static int HandleDropFileEvent(char *filename)
{
- Error(ERR_DEBUG, "DROP FILE EVENT: '%s'", filename);
+ Debug("event:dropfile", "filename == '%s'", filename);
// check and extract dropped zip files into correct user data directory
if (!strSuffixLower(filename, ".zip"))
{
- Error(ERR_WARN, "file '%s' not supported", filename);
+ Warn("file '%s' not supported", filename);
return TREE_TYPE_UNDEFINED;
}
if (directory == NULL)
{
- Error(ERR_WARN, "zip file '%s' has invalid content!", filename);
+ Warn("zip file '%s' has invalid content!", filename);
return TREE_TYPE_UNDEFINED;
}
static void HandleDropTextEvent(char *text)
{
- Error(ERR_DEBUG, "DROP TEXT EVENT: '%s'", text);
+ Debug("event:droptext", "text == '%s'", text);
}
static void HandleDropCompleteEvent(int num_level_sets_succeeded,
cheat_input[cheat_input_len] = '\0';
#if DEBUG_EVENTS_KEY
- Error(ERR_DEBUG, "SPECIAL KEY '%s' [%d]\n", cheat_input, cheat_input_len);
+ Debug("event:key:special", "'%s' [%d]\n", cheat_input, cheat_input_len);
#endif
if (game_status == GAME_MODE_MAIN)
SetVideoFrameDelay(GameFrameDelay);
if (GameFrameDelay > ONE_SECOND_DELAY)
- Error(ERR_INFO, "frame delay == %d ms", GameFrameDelay);
+ Debug("event:key:debug", "frame delay == %d ms", GameFrameDelay);
else if (GameFrameDelay != 0)
- Error(ERR_INFO, "frame delay == %d ms (max. %d fps / %d %%)",
+ Debug("event:key:debug", "frame delay == %d ms (max. %d fps / %d %%)",
GameFrameDelay, ONE_SECOND_DELAY / GameFrameDelay,
GAME_FRAME_DELAY * 100 / GameFrameDelay);
else
- Error(ERR_INFO, "frame delay == 0 ms (maximum speed)");
+ Debug("event:key:debug", "frame delay == 0 ms (maximum speed)");
return TRUE;
}
{
options.debug = !options.debug;
- Error(ERR_INFO, "debug mode %s",
+ Debug("event:key:debug", "debug mode %s",
(options.debug ? "enabled" : "disabled"));
return TRUE;
}
else if (key == KSYM_v)
{
- Error(ERR_INFO, "currently using game engine version %d",
+ Debug("event:key:debug", "currently using game engine version %d",
game.engine_version);
return TRUE;
if ((dir = openDirectory(directory)) == NULL)
{
- Error(ERR_WARN, "cannot read current level directory '%s'", directory);
+ Warn("cannot read current level directory '%s'", directory);
return basename;
}
default:
if (element >= NUM_FILE_ELEMENTS)
{
- Error(ERR_WARN, "invalid level element %d", element);
+ Warn("invalid level element %d", element);
element = EL_UNKNOWN;
}
}
else
{
- Error(ERR_WARN, "cannot load content for element '%d'", element);
+ Warn("cannot load content for element '%d'", element);
}
return chunk_size;
if (IS_CUSTOM_ELEMENT(element))
element_info[element].properties[EP_BITFIELD_BASE_NR] = properties;
else
- Error(ERR_WARN, "invalid custom element number %d", element);
+ Warn("invalid custom element number %d", element);
// older game versions that wrote level files with CUS1 chunks used
// different default push delay values (not yet stored in level file)
if (IS_CUSTOM_ELEMENT(element))
element_info[element].change->target_element = custom_target_element;
else
- Error(ERR_WARN, "invalid custom element number %d", element);
+ Warn("invalid custom element number %d", element);
}
level->file_has_custom_elements = TRUE;
if (!IS_CUSTOM_ELEMENT(element))
{
- Error(ERR_WARN, "invalid custom element number %d", element);
+ Warn("invalid custom element number %d", element);
element = EL_INTERNAL_DUMMY;
}
if (!IS_CUSTOM_ELEMENT(element))
{
- Error(ERR_WARN, "invalid custom element number %d", element);
+ Warn("invalid custom element number %d", element);
ReadUnusedBytesFromFile(file, chunk_size - 2);
+
return chunk_size;
}
if (!IS_GROUP_ELEMENT(element))
{
- Error(ERR_WARN, "invalid group element number %d", element);
+ Warn("invalid group element number %d", element);
ReadUnusedBytesFromFile(file, chunk_size - 2);
+
return chunk_size;
}
if (num_entities > max_num_entities)
{
- Error(ERR_WARN,
- "truncating number of entities for element %d from %d to %d",
- element, num_entities, max_num_entities);
+ Warn("truncating number of entities for element %d from %d to %d",
+ element, num_entities, max_num_entities);
num_entities = max_num_entities;
}
data_type == TYPE_CONTENT_LIST))
{
// for element and content lists, zero entities are not allowed
- Error(ERR_WARN, "found empty list of entities for element %d",
- element);
+ Warn("found empty list of entities for element %d", element);
// do not set "num_entities" here to prevent reading behind buffer
int error_conf_chunk_token = conf_type & CONF_MASK_TOKEN;
int error_element = real_element;
- Error(ERR_WARN, "cannot load micro chunk '%s(%d)' value for element %d ['%s']",
- error_conf_chunk_bytes, error_conf_chunk_token,
- error_element, EL_NAME(error_element));
+ Warn("cannot load micro chunk '%s(%d)' value for element %d ['%s']",
+ error_conf_chunk_bytes, error_conf_chunk_token,
+ error_element, EL_NAME(error_element));
}
return micro_chunk_size;
if (ei->num_change_pages == -1)
{
- Error(ERR_WARN, "LoadLevel_CUSX(): missing 'num_change_pages' for '%s'",
- EL_NAME(element));
+ Warn("LoadLevel_CUSX(): missing 'num_change_pages' for '%s'",
+ EL_NAME(element));
ei->num_change_pages = 1;
if (level_info_only)
return;
- Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
+ Warn("cannot read level '%s' -- using empty level", filename);
if (!setup.editor.use_template_for_new_levels)
return;
{
level->no_valid_file = TRUE;
- Error(ERR_WARN, "unknown format of level file '%s'", filename);
+ Warn("unknown format of level file '%s'", filename);
closeFile(file);
{
level->no_valid_file = TRUE;
- Error(ERR_WARN, "unknown format of level file '%s'", filename);
+ Warn("unknown format of level file '%s'", filename);
closeFile(file);
{
level->no_valid_file = TRUE;
- Error(ERR_WARN, "unsupported version of level file '%s'", filename);
+ Warn("unsupported version of level file '%s'", filename);
closeFile(file);
if (chunk_info[i].name == NULL)
{
- Error(ERR_WARN, "unknown chunk '%s' in level file '%s'",
- chunk_name, filename);
+ Warn("unknown chunk '%s' in level file '%s'",
+ chunk_name, filename);
+
ReadUnusedBytesFromFile(file, chunk_size);
}
else if (chunk_info[i].size != -1 &&
chunk_info[i].size != chunk_size)
{
- Error(ERR_WARN, "wrong size (%d) of chunk '%s' in level file '%s'",
- chunk_size, chunk_name, filename);
+ Warn("wrong size (%d) of chunk '%s' in level file '%s'",
+ chunk_size, chunk_name, filename);
+
ReadUnusedBytesFromFile(file, chunk_size);
}
else
// information, so check them here
if (chunk_size_expected != chunk_size)
{
- Error(ERR_WARN, "wrong size (%d) of chunk '%s' in level file '%s'",
- chunk_size, chunk_name, filename);
+ Warn("wrong size (%d) of chunk '%s' in level file '%s'",
+ chunk_size, chunk_name, filename);
}
}
}
{
num_invalid_elements++;
- Error(ERR_DEBUG, "invalid element %d at position %d, %d",
+ Debug("level:native:SP", "invalid element %d at position %d, %d",
element_old, x, y);
}
}
if (num_invalid_elements > 0)
- Error(ERR_WARN, "found %d invalid elements%s", num_invalid_elements,
- (!options.debug ? " (use '--debug' for more details)" : ""));
+ Warn("found %d invalid elements%s", num_invalid_elements,
+ (!options.debug ? " (use '--debug' for more details)" : ""));
for (i = 0; i < MAX_PLAYERS; i++)
level->initial_player_gravity[i] =
if (port_x < 0 || port_x >= level->fieldx ||
port_y < 0 || port_y >= level->fieldy)
{
- Error(ERR_WARN, "special port position (%d, %d) out of bounds",
- port_x, port_y);
+ Warn("special port position (%d, %d) out of bounds", port_x, port_y);
continue;
}
if (port_element < EL_SP_GRAVITY_PORT_RIGHT ||
port_element > EL_SP_GRAVITY_PORT_UP)
{
- Error(ERR_WARN, "no special port at position (%d, %d)", port_x, port_y);
+ Warn("no special port at position (%d, %d)", port_x, port_y);
continue;
}
if (demo->length + demo_entries >= SP_MAX_TAPE_LEN)
{
- Error(ERR_WARN, "tape truncated: size exceeds maximum SP demo size %d",
- SP_MAX_TAPE_LEN);
+ Warn("tape truncated: size exceeds maximum SP demo size %d",
+ SP_MAX_TAPE_LEN);
break;
}
if (!success)
{
- Error(ERR_WARN, "SP demo truncated: size exceeds maximum tape size %d",
- MAX_TAPE_LEN);
+ Warn("SP demo truncated: size exceeds maximum tape size %d",
+ MAX_TAPE_LEN);
break;
}
element = EL_INVISIBLE_SAND;
else
{
- Error(ERR_WARN, "unknown Diamond Caves element 0x%04x", element);
+ Warn("unknown Diamond Caves element 0x%04x", element);
+
element = EL_UNKNOWN;
}
break;
{
level->no_valid_file = TRUE;
- Error(ERR_WARN, "cannot decode level from stream -- using empty level");
+ Warn("cannot decode level from stream -- using empty level");
return;
}
level->no_valid_file = TRUE;
if (!level_info_only)
- Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
+ Warn("cannot read level '%s' -- using empty level", filename);
return;
}
{
level->no_valid_file = TRUE;
- Error(ERR_WARN, "unknown DC level file '%s' -- using empty level",
- filename);
+ Warn("unknown DC level file '%s' -- using empty level", filename);
return;
}
{
level->no_valid_file = TRUE;
- Error(ERR_WARN, "cannot fseek in file '%s' -- using empty level",
- filename);
+ Warn("cannot fseek in file '%s' -- using empty level", filename);
return;
}
{
level->no_valid_file = TRUE;
- Error(ERR_WARN, "unknown DC2 level file '%s' -- using empty level",
- filename);
+ Warn("unknown DC2 level file '%s' -- using empty level", filename);
return;
}
level->no_valid_file = TRUE;
if (!level_info_only)
- Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
+ Warn("cannot read level '%s' -- using empty level", filename);
return;
}
{
level->no_valid_file = TRUE;
- Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
+ Warn("cannot read level '%s' -- using empty level", filename);
return;
}
{
if (!fileExists(getGlobalLevelTemplateFilename()))
{
- Error(ERR_WARN, "no level template found for this level");
+ Warn("no level template found for this level");
return;
}
// chunk header already written -- write empty chunk data
WriteUnusedBytesToFile(file, LEVEL_CHUNK_CNT2_SIZE);
- Error(ERR_WARN, "cannot save content for element '%d'", element);
+ Warn("cannot save content for element '%d'", element);
+
return;
}
}
if (check != num_changed_custom_elements) // should not happen
- Error(ERR_WARN, "inconsistent number of custom element properties");
+ Warn("inconsistent number of custom element properties");
}
#endif
}
if (check != num_changed_custom_elements) // should not happen
- Error(ERR_WARN, "inconsistent number of custom target elements");
+ Warn("inconsistent number of custom target elements");
}
#endif
}
if (check != num_changed_custom_elements) // should not happen
- Error(ERR_WARN, "inconsistent number of custom element properties");
+ Warn("inconsistent number of custom element properties");
}
#endif
if (!(file = fopen(filename, MODE_WRITE)))
{
- Error(ERR_WARN, "cannot save level file '%s'", filename);
+ Warn("cannot save level file '%s'", filename);
+
return;
}
{
if (level->no_level_file || level->no_valid_file)
{
- Error(ERR_WARN, "cannot dump -- no valid level file found");
+ Warn("cannot dump -- no valid level file found");
return;
}
{
if (i >= MAX_TAPE_LEN)
{
- Error(ERR_WARN, "tape truncated -- size exceeds maximum tape size %d",
+ Warn("tape truncated -- size exceeds maximum tape size %d",
MAX_TAPE_LEN);
// tape too large; read and ignore remaining tape data from this chunk
default:
tape.no_valid_file = TRUE;
- Error(ERR_WARN, "unsupported Sokoban solution file '%s' ['%d']", filename, c);
+ Warn("unsupported Sokoban solution file '%s' ['%d']", filename, c);
break;
}
{
tape.no_valid_file = TRUE;
- Error(ERR_WARN, "unknown format of tape file '%s'", filename);
+ Warn("unknown format of tape file '%s'", filename);
closeFile(file);
{
tape.no_valid_file = TRUE;
- Error(ERR_WARN, "unknown format of tape file '%s'", filename);
+ Warn("unknown format of tape file '%s'", filename);
closeFile(file);
{
tape.no_valid_file = TRUE;
- Error(ERR_WARN, "unsupported version of tape file '%s'", filename);
+ Warn("unsupported version of tape file '%s'", filename);
closeFile(file);
if (chunk_info[i].name == NULL)
{
- Error(ERR_WARN, "unknown chunk '%s' in tape file '%s'",
+ Warn("unknown chunk '%s' in tape file '%s'",
chunk_name, filename);
+
ReadUnusedBytesFromFile(file, chunk_size);
}
else if (chunk_info[i].size != -1 &&
chunk_info[i].size != chunk_size)
{
- Error(ERR_WARN, "wrong size (%d) of chunk '%s' in tape file '%s'",
+ Warn("wrong size (%d) of chunk '%s' in tape file '%s'",
chunk_size, chunk_name, filename);
+
ReadUnusedBytesFromFile(file, chunk_size);
}
else
// information, so check them here
if (chunk_size_expected != chunk_size)
{
- Error(ERR_WARN, "wrong size (%d) of chunk '%s' in tape file '%s'",
+ Warn("wrong size (%d) of chunk '%s' in tape file '%s'",
chunk_size, chunk_name, filename);
}
}
if (!(file = fopen(filename, MODE_WRITE)))
{
- Error(ERR_WARN, "cannot save level recording file '%s'", filename);
+ Warn("cannot save level recording file '%s'", filename);
+
return;
}
if (tape->no_valid_file)
{
- Error(ERR_WARN, "cannot dump -- no valid tape file found");
+ Warn("cannot dump -- no valid tape file found");
return;
}
if (!checkCookieString(cookie, SCORE_COOKIE))
{
- Error(ERR_WARN, "unknown format of score file '%s'", filename);
+ Warn("unknown format of score file '%s'", filename);
+
fclose(file);
+
return;
}
for (i = 0; i < MAX_SCORE_ENTRIES; i++)
{
if (fscanf(file, "%d", &highscore[i].Score) == EOF)
- Error(ERR_WARN, "fscanf() failed; %s", strerror(errno));
+ Warn("fscanf() failed; %s", strerror(errno));
+
if (fgets(line, MAX_LINE_LEN, file) == NULL)
line[0] = '\0';
if (!(file = fopen(filename, MODE_WRITE)))
{
- Error(ERR_WARN, "cannot save score for level %d", nr);
+ Warn("cannot save score for level %d", nr);
+
return;
}
}
else
{
- Error(ERR_DEBUG, "using default setup values");
+ Debug("setup", "using default setup values");
}
}
if (!(file = fopen(filename, MODE_READ)))
{
- Error(ERR_WARN, "cannot read game controller mappings file '%s'", filename);
+ Warn("cannot read game controller mappings file '%s'", filename);
return;
}
if (!(file = fopen(filename, MODE_WRITE)))
{
- Error(ERR_WARN, "cannot write setup file '%s'", filename);
+ Warn("cannot write setup file '%s'", filename);
+
return;
}
if (!(file = fopen(filename, MODE_WRITE)))
{
- Error(ERR_WARN, "cannot write auto setup file '%s'", filename);
+ Warn("cannot write auto setup file '%s'", filename);
+
free(filename);
+
return;
}
if (!(file = fopen(filename, MODE_WRITE)))
{
- Error(ERR_WARN, "cannot write editor cascade state file '%s'", filename);
+ Warn("cannot write editor cascade state file '%s'", filename);
+
free(filename);
+
return;
}
if (!(file = fopen(filename, MODE_WRITE)))
{
- Error(ERR_WARN, "cannot write game controller mappings file '%s'",filename);
+ Warn("cannot write game controller mappings file '%s'", filename);
return;
}
if (value != NULL)
return atoi(value);
- Error(ERR_WARN, "unknown element token '%s'", token);
+ Warn("unknown element token '%s'", token);
return EL_UNDEFINED;
}
{
if (num_unknown_tokens == 0)
{
- Error(ERR_INFO_LINE, "-");
- Error(ERR_INFO, "warning: unknown token(s) found in config file:");
- Error(ERR_INFO, "- config file: '%s'", filename);
+ Warn("---");
+ Warn("unknown token(s) found in config file:");
+ Warn("- config file: '%s'", filename);
num_unknown_tokens++;
}
- Error(ERR_INFO, "- token: '%s'", list->token);
+ Warn("- token: '%s'", list->token);
}
}
if (num_unknown_tokens > 0)
- Error(ERR_INFO_LINE, "-");
+ Warn("---");
while (*num_elements % 4) // pad with empty elements, if needed
(*elements)[(*num_elements)++] = EL_EMPTY;
#if 0
for (i = 0; i < *num_elements; i++)
- printf("editor: element '%s' [%d]\n",
- element_info[(*elements)[i]].token_name, (*elements)[i]);
+ Debug("editor", "element '%s' [%d]\n",
+ element_info[(*elements)[i]].token_name, (*elements)[i]);
#endif
}
if ((dir = openDirectory(music_directory)) == NULL)
{
- Error(ERR_WARN, "cannot read music directory '%s'", music_directory);
+ Warn("cannot read music directory '%s'", music_directory);
+
return;
}
{
if (token_nr == 0)
{
- Error(ERR_INFO_LINE, "-");
- Error(ERR_INFO, "warning: unknown token(s) found in config file:");
- Error(ERR_INFO, "- config file: '%s'", filename);
+ Warn("---");
+ Warn("unknown token(s) found in config file:");
+ Warn("- config file: '%s'", filename);
}
- Error(ERR_INFO, "- token: '%s'", token);
+ Warn("- token: '%s'", token);
}
static void print_unknown_token_end(int token_nr)
{
if (token_nr > 0)
- Error(ERR_INFO_LINE, "-");
+ Warn("---");
}
void LoadHelpAnimInfo(void)
if (options.debug)
fprintf(stderr, "\n");
- Error(ERR_INFO, "%d normal and small images created", NUM_FILE_ELEMENTS);
+ Info("%d normal and small images created", NUM_FILE_ELEMENTS);
CloseAllAndExit(0);
}
EL_NAME(recursion_loop_element),
" caused endless loop! Quit the game?");
- Error(ERR_WARN, "element '%s' caused endless loop in game engine",
- EL_NAME(recursion_loop_element));
+ Warn("element '%s' caused endless loop in game engine",
+ EL_NAME(recursion_loop_element));
RequestQuitGameExt(FALSE, level_editor_test_game, message);
if (!(file = openFile(filename, MODE_READ)))
{
if (!level_info_only)
- Error(ERR_WARN, "cannot open level '%s' -- using empty level", filename);
+ Warn("cannot open level '%s' -- using empty level", filename);
return FALSE;
}
if (raw_leveldata_length <= 0)
{
- Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
+ Warn("cannot read level '%s' -- using empty level", filename);
return FALSE;
}
if (file_version == FILE_VERSION_EM_UNKNOWN)
{
- Error(ERR_WARN, "unknown EM level '%s' -- using empty level", filename);
+ Warn("unknown EM level '%s' -- using empty level", filename);
return FALSE;
}
{
if (element_em_cave < 0 || element_em_cave >= CAVE_TILE_MAX)
{
- Error(ERR_WARN, "invalid EM cave element %d", element_em_cave);
+ Warn("invalid EM cave element %d", element_em_cave);
return Xblank;
}
if (element_em_game < 0 || element_em_game >= GAME_TILE_MAX)
{
- Error(ERR_WARN, "invalid EM game element %d", element_em_game);
+ Warn("invalid EM game element %d", element_em_game);
return Cblank;
}
int element_em_cave = map_reverse[element_em_game];
if (element_em_cave == Cblank && element_em_game != Xblank)
- Error(ERR_WARN, "unknown EM game element %d", element_em_game);
+ Warn("unknown EM game element %d", element_em_game);
return element_em_cave;
}
/* if file has length of old-style level file, print (wrong) magic byte */
if (length < 2110)
- Error(ERR_WARN, "unknown magic byte 0x%02x at position 0x%04x",
- src[1983], 1983);
+ Warn("unknown magic byte 0x%02x at position 0x%04x", src[1983], 1983);
return FILE_VERSION_EM_UNKNOWN;
}
length = 2172;
if (options.debug)
- Error(ERR_DEBUG, "EM level file version: %d", file_version);
+ Debug("level:native:EM", "EM level file version: %d", file_version);
return file_version;
}
{
if (element >= EL_FIRST_RUNTIME_EL)
{
- Error(ERR_WARN, "invalid level element %d", element);
+ Warn("invalid level element %d", element);
+
element = EL_CHAR_FRAGE;
}
if (!(file = openFile(filename, MODE_READ)))
{
if (!level_info_only)
- Error(ERR_WARN, "cannot read level '%s' - creating new level", filename);
+ Warn("cannot read level '%s' - creating new level", filename);
return FALSE;
}
getFileChunk(file, chunk_name, NULL, BYTE_ORDER_BIG_ENDIAN);
if (strcmp(chunk_name, "CAVE") != 0)
{
- Error(ERR_WARN, "unknown format of level file '%s'", filename);
+ Warn("unknown format of level file '%s'", filename);
closeFile(file);
if (!checkCookieString(cookie, LEVEL_COOKIE_TMPL))
{
- Error(ERR_WARN, "unknown format of level file '%s'", filename);
+ Warn("unknown format of level file '%s'", filename);
closeFile(file);
if ((native_mm_level.file_version = getFileVersionFromCookieString(cookie))
== -1)
{
- Error(ERR_WARN, "unsupported version of level file '%s'", filename);
+ Warn("unsupported version of level file '%s'", filename);
closeFile(file);
if (chunk_info[i].name == NULL)
{
- Error(ERR_WARN, "unknown chunk '%s' in level file '%s'",
+ Warn("unknown chunk '%s' in level file '%s'",
chunk_name, filename);
ReadUnusedBytesFromFile(file, chunk_size);
else if (chunk_info[i].size != -1 &&
chunk_info[i].size != chunk_size)
{
- Error(ERR_WARN, "wrong size (%d) of chunk '%s' in level file '%s'",
+ Warn("wrong size (%d) of chunk '%s' in level file '%s'",
chunk_size, chunk_name, filename);
ReadUnusedBytesFromFile(file, chunk_size);
// chunks first (like "HEAD" and "BODY") that contain some header
// information, so check them here
if (chunk_size_expected != chunk_size)
- Error(ERR_WARN, "wrong size (%d) of chunk '%s' in level file '%s'",
+ Warn("wrong size (%d) of chunk '%s' in level file '%s'",
chunk_size, chunk_name, filename);
}
}
if (!(file = fopen(filename, MODE_WRITE)))
{
- Error(ERR_WARN, "cannot save level file '%s'", filename);
+ Warn("cannot save level file '%s'", filename);
return;
}
if (clx < -2 || cly < -2 || clx >= SXSIZE + 2 || cly >= SYSIZE + 2)
{
- Error(ERR_WARN, "AddLaserEdge: out of bounds: %d, %d", lx, ly);
+ Warn("AddLaserEdge: out of bounds: %d, %d", lx, ly);
return;
}
if (start_edge < 0)
{
- Error(ERR_WARN, "DrawLaserExt: start_edge < 0");
+ Warn("DrawLaserExt: start_edge < 0");
return;
}
if (num_edges < 0)
{
- Error(ERR_WARN, "DrawLaserExt: num_edges < 0");
+ Warn("DrawLaserExt: num_edges < 0");
return;
}
{
if (laser.num_edges - start_edge < 0)
{
- Error(ERR_WARN, "DrawLaser: laser.num_edges - start_edge < 0");
+ Warn("DrawLaser: laser.num_edges - start_edge < 0");
return;
}
if (edge == 0)
{
- Error(ERR_WARN, "RotateMirror: inconsistent field Hit[][]!\n");
+ Warn("RotateMirror: inconsistent field Hit[][]!\n");
+
edge = 1;
}
}
if (i >= SP_MAX_TAPE_LEN)
- Error(ERR_WARN, "SP demo truncated: size exceeds maximum SP demo size %d",
+ Warn("SP demo truncated: size exceeds maximum SP demo size %d",
SP_MAX_TAPE_LEN);
native_sp_level.demo.length = i;
if (!(file = openFile(filename, MODE_READ)))
{
if (!level_info_only)
- Error(ERR_WARN, "cannot open file '%s' -- using empty level", filename);
+ Warn("cannot open file '%s' -- using empty level", filename);
return FALSE;
}
if (!strEqual(mpx_chunk_name, "MPX "))
{
- Error(ERR_WARN, "cannot find MPX ID in file '%s' -- using empty level",
- filename);
+ Warn("cannot find MPX ID in file '%s' -- using empty level", filename);
return FALSE;
}
if (mpx_version != 1)
{
- Error(ERR_WARN, "unknown MPX version in file '%s' -- using empty level",
- filename);
+ Warn("unknown MPX version in file '%s' -- using empty level", filename);
return FALSE;
}
if (mpx_level_count < 1)
{
- Error(ERR_WARN, "no MPX levels found in file '%s' -- using empty level",
- filename);
+ Warn("no MPX levels found in file '%s' -- using empty level", filename);
return FALSE;
}
if (level_pos >= mpx_level_count)
{
- Error(ERR_WARN, "MPX level not found in file '%s' -- using empty level",
- filename);
+ Warn("MPX level not found in file '%s' -- using empty level", filename);
return FALSE;
}
// position file stream to the requested level (in case of level package)
if (seekFile(file, file_seek_pos, SEEK_SET) != 0)
{
- Error(ERR_WARN, "cannot fseek in file '%s' -- using empty level", filename);
+ Warn("cannot fseek in file '%s' -- using empty level", filename);
return FALSE;
}
if (multipart_xpos * SP_STD_PLAYFIELD_WIDTH > SP_MAX_PLAYFIELD_WIDTH ||
multipart_ypos * SP_STD_PLAYFIELD_HEIGHT > SP_MAX_PLAYFIELD_HEIGHT)
{
- Error(ERR_WARN, "multi-part level is too big -- ignoring part of it");
+ Warn("multi-part level is too big -- ignoring part of it");
break;
}
{
setLevelInfoToDefaults_SP();
- Error(ERR_WARN, "single part of multi-part level -- using empty level");
+ Warn("single part of multi-part level -- using empty level");
}
if (reading_multipart_level)
if (!(file = fopen(filename, MODE_WRITE)))
{
- Error(ERR_WARN, "cannot save native level file '%s'", filename);
+ Warn("cannot save native level file '%s'", filename);
return;
}
if (value == NULL)
{
- Error(ERR_INFO_LINE, "-");
- Error(ERR_INFO, "warning: error found in config file:");
- Error(ERR_INFO, "- config file: '%s'", getImageConfigFilename());
- Error(ERR_INFO, "error: invalid element token '%s'", value_raw);
- Error(ERR_INFO, "custom graphic rejected for this element/action");
- Error(ERR_INFO, "fallback done to undefined element for this graphic");
- Error(ERR_INFO_LINE, "-");
+ Warn("---");
+ Warn("error found in config file:");
+ Warn("- config file: '%s'", getImageConfigFilename());
+ Warn("error: invalid element token '%s'", value_raw);
+ Warn("custom graphic rejected for this element/action");
+ Warn("fallback done to undefined element for this graphic");
+ Warn("---");
}
return (value != NULL ? atoi(value) : EL_UNDEFINED);
if (value == NULL)
{
- Error(ERR_INFO_LINE, "-");
- Error(ERR_INFO, "warning: error found in config file:");
- Error(ERR_INFO, "- config file: '%s'", getImageConfigFilename());
- Error(ERR_INFO, "error: invalid graphic token '%s'", value_raw);
- Error(ERR_INFO, "custom graphic rejected for this element/action");
- Error(ERR_INFO, "fallback done to 'char_exclam' for this graphic");
- Error(ERR_INFO_LINE, "-");
+ Warn("---");
+ Warn("error found in config file:");
+ Warn("- config file: '%s'", getImageConfigFilename());
+ Warn("error: invalid graphic token '%s'", value_raw);
+ Warn("custom graphic rejected for this element/action");
+ Warn("fallback done to 'char_exclam' for this graphic");
+ Warn("---");
}
return (value != NULL ? atoi(value) : fallback_graphic);
{
if (g->width <= 0)
{
- Error(ERR_INFO_LINE, "-");
- Error(ERR_WARN, "invalid value %d for '%s.width' (fallback done to %d)",
- g->width, getTokenFromImageID(graphic), TILEX);
- Error(ERR_INFO_LINE, "-");
+ Warn("---");
+ Warn("invalid value %d for '%s.width' (fallback done to %d)",
+ g->width, getTokenFromImageID(graphic), TILEX);
+ Warn("---");
g->width = TILEX; // will be checked to be inside bitmap later
}
if (g->height <= 0)
{
- Error(ERR_INFO_LINE, "-");
- Error(ERR_WARN, "invalid value %d for '%s.height' (fallback done to %d)",
- g->height, getTokenFromImageID(graphic), TILEY);
- Error(ERR_INFO_LINE, "-");
+ Warn("---");
+ Warn("invalid value %d for '%s.height' (fallback done to %d)",
+ g->height, getTokenFromImageID(graphic), TILEY);
+ Warn("---");
g->height = TILEY; // will be checked to be inside bitmap later
}
if (num_references_followed >= max_num_images)
{
- Error(ERR_INFO_LINE, "-");
- Error(ERR_INFO, "warning: error found in config file:");
- Error(ERR_INFO, "- config file: '%s'", getImageConfigFilename());
- Error(ERR_INFO, "- config token: '%s'", getTokenFromImageID(graphic));
- Error(ERR_INFO, "error: loop discovered when resolving cloned graphics");
- Error(ERR_INFO, "custom graphic rejected for this element/action");
+ Warn("---");
+ Warn("error found in config file:");
+ Warn("- config file: '%s'", getImageConfigFilename());
+ Warn("- config token: '%s'", getTokenFromImageID(graphic));
+ Warn("error: loop discovered when resolving cloned graphics");
+ Warn("custom graphic rejected for this element/action");
if (graphic == fallback_graphic)
Error(ERR_EXIT, "no fallback graphic available");
- Error(ERR_INFO, "fallback done to 'char_exclam' for this graphic");
- Error(ERR_INFO_LINE, "-");
+ Warn("fallback done to 'char_exclam' for this graphic");
+ Warn("---");
graphic_info[graphic] = graphic_info[fallback_graphic];
}
src_x + width > src_bitmap_width ||
src_y + height > src_bitmap_height)
{
- Error(ERR_INFO_LINE, "-");
- Error(ERR_INFO, "warning: error found in config file:");
- Error(ERR_INFO, "- config file: '%s'", getImageConfigFilename());
- Error(ERR_INFO, "- config token: '%s'", getTokenFromImageID(i));
- Error(ERR_INFO, "- image file: '%s'", src_bitmap->source_filename);
- Error(ERR_INFO, "- frame size: %d, %d", width, height);
- Error(ERR_INFO,
- "error: first animation frame out of bounds (%d, %d) [%d, %d]",
- src_x, src_y, src_bitmap_width, src_bitmap_height);
- Error(ERR_INFO, "custom graphic rejected for this element/action");
+ Warn("---");
+ Warn("error found in config file:");
+ Warn("- config file: '%s'", getImageConfigFilename());
+ Warn("- config token: '%s'", getTokenFromImageID(i));
+ Warn("- image file: '%s'", src_bitmap->source_filename);
+ Warn("- frame size: %d, %d", width, height);
+ Warn("error: first animation frame out of bounds (%d, %d) [%d, %d]",
+ src_x, src_y, src_bitmap_width, src_bitmap_height);
+ Warn("custom graphic rejected for this element/action");
if (i == fallback_graphic)
Error(ERR_EXIT, "no fallback graphic available");
- Error(ERR_INFO, "fallback done to 'char_exclam' for this graphic");
- Error(ERR_INFO_LINE, "-");
+ Warn("fallback done to 'char_exclam' for this graphic");
+ Warn("---");
graphic_info[i] = graphic_info[fallback_graphic];
src_x + width > src_bitmap_width ||
src_y + height > src_bitmap_height)
{
- Error(ERR_INFO_LINE, "-");
- Error(ERR_INFO, "warning: error found in config file:");
- Error(ERR_INFO, "- config file: '%s'", getImageConfigFilename());
- Error(ERR_INFO, "- config token: '%s'", getTokenFromImageID(i));
- Error(ERR_INFO, "- image file: '%s'", src_bitmap->source_filename);
- Error(ERR_INFO, "- frame size: %d, %d", width, height);
- Error(ERR_INFO,
- "error: last animation frame (%d) out of bounds (%d, %d) [%d, %d]",
- last_frame, src_x, src_y, src_bitmap_width, src_bitmap_height);
- Error(ERR_INFO, "custom graphic rejected for this element/action");
+ Warn("---");
+ Warn("error found in config file:");
+ Warn("- config file: '%s'", getImageConfigFilename());
+ Warn("- config token: '%s'", getTokenFromImageID(i));
+ Warn("- image file: '%s'", src_bitmap->source_filename);
+ Warn("- frame size: %d, %d", width, height);
+ Warn("error: last animation frame (%d) out of bounds (%d, %d) [%d, %d]",
+ last_frame, src_x, src_y, src_bitmap_width, src_bitmap_height);
+ Warn("custom graphic rejected for this element/action");
if (i == fallback_graphic)
Error(ERR_EXIT, "no fallback graphic available");
- Error(ERR_INFO, "fallback done to 'char_exclam' for this graphic");
- Error(ERR_INFO_LINE, "-");
+ Warn("fallback done to 'char_exclam' for this graphic");
+ Warn("---");
graphic_info[i] = graphic_info[fallback_graphic];
}
if (recursion_depth > NUM_GROUP_ELEMENTS) // recursion too deep
{
- Error(ERR_WARN, "recursion too deep when resolving group element %d",
+ Warn("recursion too deep when resolving group element %d",
group_element - EL_GROUP_START + 1);
// replace element which caused too deep recursion by question mark
#if defined(PLATFORM_UNIX)
NetworkServer(network.server_port, TRUE);
#else
- Error(ERR_WARN, "networking only supported in Unix version");
+ Warn("networking only supported in Unix version");
#endif
exit(0); // never reached, server loops forever
DrawMainMenu();
#if 0
- Error(ERR_DEBUG, "::: SDL_GetBasePath() == '%s'",
+ Debug("internal:path", "SDL_GetBasePath() == '%s'",
SDL_GetBasePath());
- Error(ERR_DEBUG, "::: SDL_GetPrefPath() == '%s'",
+ Debug("internal:path", "SDL_GetPrefPath() == '%s'",
SDL_GetPrefPath("artsoft", "rocksndiamonds"));
#if defined(PLATFORM_ANDROID)
- Error(ERR_DEBUG, "::: SDL_AndroidGetInternalStoragePath() == '%s'",
+ Debug("internal:path", "SDL_AndroidGetInternalStoragePath() == '%s'",
SDL_AndroidGetInternalStoragePath());
- Error(ERR_DEBUG, "::: SDL_AndroidGetExternalStoragePath() == '%s'",
+ Debug("internal:path", "SDL_AndroidGetExternalStoragePath() == '%s'",
SDL_AndroidGetExternalStoragePath());
- Error(ERR_DEBUG, "::: SDL_AndroidGetExternalStorageState() == '%s'",
+ Debug("internal:path", "SDL_AndroidGetExternalStorageState() == '%s'",
(SDL_AndroidGetExternalStorageState() &
SDL_ANDROID_EXTERNAL_STORAGE_WRITE ? "writable" :
SDL_AndroidGetExternalStorageState() &
if ((img_info->bitmaps[IMG_BITMAP_STANDARD] = LoadImage(filename)) == NULL)
{
- Error(ERR_WARN, "cannot load image file '%s': LoadImage() failed: %s",
- filename, GetError());
+ Warn("cannot load image file '%s': LoadImage() failed: %s",
+ filename, GetError());
free(img_info);
if (!ReadJoystick(joystick_nr, &js_x, &js_y, &js_b1, &js_b2))
{
- Error(ERR_WARN, "cannot read joystick device '%s'",
- setup.input[player_nr].joy.device_name);
+ Warn("cannot read joystick device '%s'",
+ setup.input[player_nr].joy.device_name);
joystick.status = JOYSTICK_NOT_AVAILABLE;
+
return JOY_NO_ACTION;
}
}
if (key == KSYM_UNDEFINED)
- Error(ERR_WARN, "getKeyFromKeyName(): not completely implemented");
+ Warn("getKeyFromKeyName(): not completely implemented");
*keysym = key;
}
if (options.debug && dynamic_tokens_found)
{
- Error(ERR_INFO_LINE, "-");
- Error(ERR_INFO, "dynamic token(s) found in config file:");
- Error(ERR_INFO, "- config file: '%s'", filename);
+ Debug("config", "---");
+ Debug("config", "dynamic token(s) found in config file:");
+ Debug("config", "- config file: '%s'", filename);
for (list = setup_file_list; list != NULL; list = list->next)
{
char *value = getHashEntry(extra_file_hash, list->token);
if (value != NULL && strEqual(value, known_token_value))
- Error(ERR_INFO, "- dynamic token: '%s'", list->token);
+ Debug("config", "- dynamic token: '%s'", list->token);
}
- Error(ERR_INFO_LINE, "-");
+ Debug("config", "---");
}
if (unknown_tokens_found)
{
- Error(ERR_INFO_LINE, "-");
- Error(ERR_INFO, "warning: unknown token(s) found in config file:");
- Error(ERR_INFO, "- config file: '%s'", filename);
+ Warn("---");
+ Warn("unknown token(s) found in config file:");
+ Warn("- config file: '%s'", filename);
for (list = setup_file_list; list != NULL; list = list->next)
{
char *value = getHashEntry(extra_file_hash, list->token);
if (value != NULL && !strEqual(value, known_token_value))
- Error(ERR_INFO, "- dynamic token: '%s'", list->token);
+ Warn("- dynamic token: '%s'", list->token);
}
- Error(ERR_INFO_LINE, "-");
+ Warn("---");
}
if (undefined_values_found)
{
- Error(ERR_INFO_LINE, "-");
- Error(ERR_INFO, "warning: undefined values found in config file:");
- Error(ERR_INFO, "- config file: '%s'", filename);
+ Warn("---");
+ Warn("undefined values found in config file:");
+ Warn("- config file: '%s'", filename);
for (list = setup_file_list; list != NULL; list = list->next)
{
char *value = getHashEntry(empty_file_hash, list->token);
if (value != NULL)
- Error(ERR_INFO, "- undefined value for token: '%s'", list->token);
+ Warn("- undefined value for token: '%s'", list->token);
}
- Error(ERR_INFO_LINE, "-");
+ Warn("---");
}
freeSetupFileList(setup_file_list);
if (filename == NULL)
{
- Error(ERR_WARN, "cannot find artwork file '%s'", basename);
+ Warn("cannot find artwork file '%s'", basename);
basename = file_list_entry->default_filename;
file_list_entry->fallback_to_default = TRUE;
- Error(ERR_WARN, "trying default artwork file '%s'", basename);
+ Warn("trying default artwork file '%s'", basename);
filename = getCustomArtworkFilename(basename, artwork_info->type);
{
program.log_file[i] = program.log_file_default[i]; // reset to default
- Error(ERR_WARN, "cannot open file '%s' for writing: %s",
- program.log_filename[i], strerror(errno));
+ Warn("cannot open file '%s' for writing: %s",
+ program.log_filename[i], strerror(errno));
}
// output should be unbuffered so it is not truncated in a crash
if (filename == NULL)
{
- Error(ERR_WARN, "SDLSetWindowIcon(): cannot find file '%s'", basename);
+ Warn("SDLSetWindowIcon(): cannot find file '%s'", basename);
return;
}
if ((surface = IMG_Load(filename)) == NULL)
{
- Error(ERR_WARN, "IMG_Load('%s') failed: %s", basename, SDL_GetError());
+ Warn("IMG_Load('%s') failed: %s", basename, SDL_GetError());
return;
}
new_surface = SDL_CreateRGBSurface(0, width, height, 32, 0,0,0, 0);
if (new_surface == NULL)
- Error(ERR_WARN, "SDL_CreateRGBSurface() failed: %s", SDL_GetError());
+ Warn("SDL_CreateRGBSurface() failed: %s", SDL_GetError());
}
else
{
- Error(ERR_WARN, "SDL_CreateTexture() failed: %s", SDL_GetError());
+ Warn("SDL_CreateTexture() failed: %s", SDL_GetError());
}
}
else
{
- Error(ERR_WARN, "SDL_CreateRenderer() failed: %s", SDL_GetError());
+ Warn("SDL_CreateRenderer() failed: %s", SDL_GetError());
}
}
else
{
- Error(ERR_WARN, "SDL_CreateWindow() failed: %s", SDL_GetError());
+ Warn("SDL_CreateWindow() failed: %s", SDL_GetError());
}
SDLSetScreenProperties();
video.display_height = h;
#if 0
- Error(ERR_DEBUG, "SDL renderer size: %d x %d",
+ Debug("video", "SDL renderer size: %d x %d",
video.display_width, video.display_height);
#endif
}
video.display_height = display_bounds.h;
#if 0
- Error(ERR_DEBUG, "SDL display size: %d x %d",
+ Debug("video", "SDL display size: %d x %d",
video.display_width, video.display_height);
#endif
}
video.screen_yoffset = (video.screen_height - height) / 2;
#if 0
- Error(ERR_DEBUG, "Changing screen from %dx%d to %dx%d (%.2f to %.2f)",
+ Debug("video", "Changing screen from %dx%d to %dx%d (%.2f to %.2f)",
width, height,
video.screen_width, video.screen_height,
ratio_video, ratio_display);
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
{
- Error(ERR_WARN, "SDL_InitSubSystem() failed: %s", SDL_GetError());
+ Warn("SDL_InitSubSystem() failed: %s", SDL_GetError());
+
return;
}
AUDIO_NUM_CHANNELS_STEREO,
setup.system.audio_fragment_size) < 0)
{
- Error(ERR_WARN, "Mix_OpenAudio() failed: %s", SDL_GetError());
+ Warn("Mix_OpenAudio() failed: %s", SDL_GetError());
+
return;
}
sdl_is_controller[nr] = SDL_IsGameController(nr);
#if DEBUG_JOYSTICKS
- Error(ERR_DEBUG, "opening joystick %d (%s)",
+ Debug("joystick", "opening joystick %d (%s)",
nr, (sdl_is_controller[nr] ? "game controller" : "joystick"));
#endif
return;
#if DEBUG_JOYSTICKS
- Error(ERR_DEBUG, "closing joystick %d", nr);
+ Debug("joystick", "closing joystick %d", nr);
#endif
if (sdl_is_controller[nr])
{
case SDL_CONTROLLERDEVICEADDED:
#if DEBUG_JOYSTICKS
- Error(ERR_DEBUG, "SDL_CONTROLLERDEVICEADDED: device %d added",
+ Debug("joystick", "SDL_CONTROLLERDEVICEADDED: device %d added",
event->cdevice.which);
#endif
InitJoysticks();
case SDL_CONTROLLERDEVICEREMOVED:
#if DEBUG_JOYSTICKS
- Error(ERR_DEBUG, "SDL_CONTROLLERDEVICEREMOVED: device %d removed",
+ Debug("joystick", "SDL_CONTROLLERDEVICEREMOVED: device %d removed",
event->cdevice.which);
#endif
InitJoysticks();
case SDL_CONTROLLERAXISMOTION:
#if DEBUG_JOYSTICKS
- Error(ERR_DEBUG, "SDL_CONTROLLERAXISMOTION: device %d, axis %d: %d",
+ Debug("joystick", "SDL_CONTROLLERAXISMOTION: device %d, axis %d: %d",
event->caxis.which, event->caxis.axis, event->caxis.value);
#endif
setJoystickAxis(event->caxis.which,
case SDL_CONTROLLERBUTTONDOWN:
#if DEBUG_JOYSTICKS
- Error(ERR_DEBUG, "SDL_CONTROLLERBUTTONDOWN: device %d, button %d",
+ Debug("joystick", "SDL_CONTROLLERBUTTONDOWN: device %d, button %d",
event->cbutton.which, event->cbutton.button);
#endif
setJoystickButton(event->cbutton.which,
case SDL_CONTROLLERBUTTONUP:
#if DEBUG_JOYSTICKS
- Error(ERR_DEBUG, "SDL_CONTROLLERBUTTONUP: device %d, button %d",
+ Debug("joystick", "SDL_CONTROLLERBUTTONUP: device %d, button %d",
event->cbutton.which, event->cbutton.button);
#endif
setJoystickButton(event->cbutton.which,
break;
#if DEBUG_JOYSTICKS
- Error(ERR_DEBUG, "SDL_JOYAXISMOTION: device %d, axis %d: %d",
+ Debug("joystick", "SDL_JOYAXISMOTION: device %d, axis %d: %d",
event->jaxis.which, event->jaxis.axis, event->jaxis.value);
#endif
if (event->jaxis.axis < 4)
break;
#if DEBUG_JOYSTICKS
- Error(ERR_DEBUG, "SDL_JOYBUTTONDOWN: device %d, button %d",
+ Debug("joystick", "SDL_JOYBUTTONDOWN: device %d, button %d",
event->jbutton.which, event->jbutton.button);
#endif
if (event->jbutton.button < 4)
break;
#if DEBUG_JOYSTICKS
- Error(ERR_DEBUG, "SDL_JOYBUTTONUP: device %d, button %d",
+ Debug("joystick", "SDL_JOYBUTTONUP: device %d, button %d",
event->jbutton.which, event->jbutton.button);
#endif
if (event->jbutton.button < 4)
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) < 0)
{
Error(ERR_EXIT, "SDL_Init() failed: %s", SDL_GetError());
+
return;
}
// the included game controller base mappings should always be found
if (num_mappings == -1)
- Error(ERR_WARN, "no game controller base mappings found");
+ Warn("no game controller base mappings found");
#if DEBUG_JOYSTICKS
else
- Error(ERR_INFO, "%d game controller base mapping(s) added", num_mappings);
+ Debug("joystick", "%d game controller base mapping(s) added",
+ num_mappings);
#endif
num_mappings = SDL_GameControllerAddMappingsFromFile(mappings_file_user);
#if DEBUG_JOYSTICKS
// the personal game controller user mappings may or may not be found
if (num_mappings == -1)
- Error(ERR_WARN, "no game controller user mappings found");
+ Warn("no game controller user mappings found");
else
- Error(ERR_INFO, "%d game controller user mapping(s) added", num_mappings);
+ Debug("joystick", , "%d game controller user mapping(s) added",
+ num_mappings);
- Error(ERR_INFO, "%d joystick(s) found:", SDL_NumJoysticks());
+ Debug("joystick", "%d joystick(s) found:", SDL_NumJoysticks());
#endif
checked_free(mappings_file_base);
type = "joystick";
}
- Error(ERR_INFO, "- joystick %d (%s): '%s'",
+ Debug("joystick", "- joystick %d (%s): '%s'",
i, type, (name ? name : "(Unknown)"));
}
#endif
if (joystick_nr >= SDL_NumJoysticks())
{
if (setup.input[i].use_joystick && print_warning)
- Error(ERR_WARN, "cannot find joystick %d", joystick_nr);
+ Warn("cannot find joystick %d", joystick_nr);
joystick_nr = -1;
}
if (SDLOpenJoystick(i))
joystick.status = JOYSTICK_ACTIVATED;
else if (print_warning)
- Error(ERR_WARN, "cannot open joystick %d", i);
+ Warn("cannot open joystick %d", i);
}
SDLClearJoystickState();
{
free(filename);
- if (options.debug)
- Error(ERR_WARN, "cannot find artwork file '%s' (using fallback)",
- basename);
+ Warn("cannot find artwork file '%s' (using fallback)", basename);
// 6th try: look for fallback artwork in old default artwork directory
// (needed to prevent errors when trying to access unused artwork files)
{
free(filename);
- if (options.debug)
- Error(ERR_WARN, "cannot find artwork file '%s' (using fallback)",
- basename);
+ Warn("cannot find artwork file '%s' (using fallback)", basename);
// 6th try: look for fallback artwork in old default artwork directory
// (needed to prevent errors when trying to access unused artwork files)
{
free(filename);
- if (options.debug)
- Error(ERR_WARN, "cannot find artwork file '%s' (using fallback)",
- basename);
+ Warn("cannot find artwork file '%s' (using fallback)", basename);
// 6th try: look for fallback artwork in old default artwork directory
// (needed to prevent errors when trying to access unused artwork files)
}
if (posix_mkdir(dir, dir_mode) != 0)
- Error(ERR_WARN, "cannot create %s directory '%s': %s",
- text, dir, strerror(errno));
+ Warn("cannot create %s directory '%s': %s", text, dir, strerror(errno));
if (permission_class == PERMS_PUBLIC && !running_setgid)
chmod(dir, dir_mode);
{
if (!token_value_separator_warning)
{
- Error(ERR_INFO_LINE, "-");
+ Debug("setup", "---");
if (filename != NULL)
{
- Error(ERR_WARN, "missing token/value separator(s) in config file:");
- Error(ERR_INFO, "- config file: '%s'", filename);
+ Debug("setup", "missing token/value separator(s) in config file:");
+ Debug("setup", "- config file: '%s'", filename);
}
else
{
- Error(ERR_WARN, "missing token/value separator(s):");
+ Debug("setup", "missing token/value separator(s):");
}
token_value_separator_warning = TRUE;
}
if (filename != NULL)
- Error(ERR_INFO, "- line %d: '%s'", line_nr, line_raw);
+ Debug("setup", "- line %d: '%s'", line_nr, line_raw);
else
- Error(ERR_INFO, "- line: '%s'", line_raw);
+ Debug("setup", "- line: '%s'", line_raw);
}
#endif
}
if (!(file = openFile(filename, MODE_READ)))
{
#if DEBUG_NO_CONFIG_FILE
- Error(ERR_DEBUG, "cannot open configuration file '%s'", filename);
+ Debug("setup", "cannot open configuration file '%s'", filename);
#endif
return FALSE;
}
else
{
- Error(ERR_WARN, "ignoring already processed file '%s'", value);
+ Warn("ignoring already processed file '%s'", value);
}
}
else
{
if (!token_already_exists_warning)
{
- Error(ERR_INFO_LINE, "-");
- Error(ERR_WARN, "duplicate token(s) found in config file:");
- Error(ERR_INFO, "- config file: '%s'", filename);
+ Debug("setup", "---");
+ Debug("setup", "duplicate token(s) found in config file:");
+ Debug("setup", "- config file: '%s'", filename);
token_already_exists_warning = TRUE;
}
- Error(ERR_INFO, "- token: '%s' (in line %d)", token, line_nr);
- Error(ERR_INFO, " old value: '%s'", old_value);
- Error(ERR_INFO, " new value: '%s'", value);
+ Debug("setup", "- token: '%s' (in line %d)", token, line_nr);
+ Debug("setup", " old value: '%s'", old_value);
+ Debug("setup", " new value: '%s'", value);
}
#endif
#if CHECK_TOKEN_VALUE_SEPARATOR__WARN_IF_MISSING
if (token_value_separator_warning)
- Error(ERR_INFO_LINE, "-");
+ Debug("setup", "---");
#endif
#if CHECK_TOKEN__WARN_IF_ALREADY_EXISTS_IN_HASH
if (token_already_exists_warning)
- Error(ERR_INFO_LINE, "-");
+ Debug("setup", "---");
#endif
if (token_count == 0 && include_count == 0)
- Error(ERR_WARN, "configuration file '%s' is empty", filename);
+ Warn("configuration file '%s' is empty", filename);
if (top_recursion_level)
freeSetupFileHash(include_filename_hash);
if (!(file = fopen(filename, MODE_WRITE)))
{
- Error(ERR_WARN, "cannot write configuration file '%s'", filename);
+ Warn("cannot write configuration file '%s'", filename);
return;
}
{
if (parent == NULL)
{
- Error(ERR_WARN, "setTreeInfoToDefaultsFromParent(): parent == NULL");
+ Warn("setTreeInfoToDefaultsFromParent(): parent == NULL");
setTreeInfoToDefaults(ti, TREE_TYPE_UNDEFINED);
// check if cache entry for this item is mandatory, but missing
if (value == NULL && !optional)
{
- Error(ERR_WARN, "missing cache entry '%s'", token);
+ Warn("missing cache entry '%s'", token);
cached = FALSE;
}
if (!zip_file_valid)
{
- Error(ERR_WARN, "zip file '%s' rejected!", zip_filename);
+ Warn("zip file '%s' rejected!", zip_filename);
return NULL;
}
if (zip_entries == NULL)
{
- Error(ERR_WARN, "zip file '%s' could not be extracted!", zip_filename);
+ Warn("zip file '%s' could not be extracted!", zip_filename);
return NULL;
}
- Error(ERR_INFO, "zip file '%s' successfully extracted!", zip_filename);
+ Info("zip file '%s' successfully extracted!", zip_filename);
// first zip file entry contains top level directory
char *top_dir = zip_entries[0];
// display error if directory is main "options.graphics_directory" etc.
if (tree_type == TREE_TYPE_LEVEL_DIR ||
directory == OPTIONS_ARTWORK_DIRECTORY(tree_type))
- Error(ERR_WARN, "cannot read directory '%s'", directory);
+ Warn("cannot read directory '%s'", directory);
return;
}
if (setup_file_hash == NULL)
{
#if DEBUG_NO_CONFIG_FILE
- Error(ERR_WARN, "ignoring level directory '%s'", directory_path);
+ Debug("setup", "ignoring level directory '%s'", directory_path);
#endif
free(directory_path);
if ((dir = openDirectory(level_directory)) == NULL)
{
- Error(ERR_WARN, "cannot read level directory '%s'", level_directory);
+ Warn("cannot read level directory '%s'", level_directory);
return;
}
}
if (!valid_entry_found)
- Error(ERR_WARN, "cannot find any valid level series in directory '%s'",
+ Warn("cannot find any valid level series in directory '%s'",
level_directory);
}
{
#if DEBUG_NO_CONFIG_FILE
if (!strEqual(directory_name, "."))
- Error(ERR_WARN, "ignoring artwork directory '%s'", directory_path);
+ Debug("setup", "ignoring artwork directory '%s'", directory_path);
#endif
free(directory_path);
{
// display error if directory is main "options.graphics_directory" etc.
if (base_directory == OPTIONS_ARTWORK_DIRECTORY(type))
- Error(ERR_WARN, "cannot read directory '%s'", base_directory);
+ Warn("cannot read directory '%s'", base_directory);
return;
}
base_directory, ".",
type);
if (!valid_entry_found)
- Error(ERR_WARN, "cannot find any valid artwork in directory '%s'",
- base_directory);
+ Warn("cannot find any valid artwork in directory '%s'", base_directory);
}
static TreeInfo *getDummyArtworkInfo(int type)
if (!(file = fopen(filename, MODE_WRITE)))
{
- Error(ERR_WARN, "cannot write level info file '%s'", filename);
+ Warn("cannot write level info file '%s'", filename);
+
free(filename);
return FALSE;
}
else
{
- Error(ERR_DEBUG, "using default setup values");
+ Debug("setup", "using default setup values");
}
free(filename);
if (!(file = fopen(filename, MODE_WRITE)))
{
- Error(ERR_WARN, "cannot write setup file '%s'", filename);
+ Warn("cannot write setup file '%s'", filename);
free(filename);
if ((dir = openDirectory(level_directory)) == NULL)
{
- Error(ERR_WARN, "cannot read level directory '%s'", level_directory);
+ Warn("cannot read level directory '%s'", level_directory);
return;
}
if (levelnum_value < leveldir_current->first_level)
{
- Error(ERR_WARN, "additional level %d found", levelnum_value);
+ Warn("additional level %d found", levelnum_value);
+
leveldir_current->first_level = levelnum_value;
}
else if (levelnum_value > leveldir_current->last_level)
{
- Error(ERR_WARN, "additional level %d found", levelnum_value);
+ Warn("additional level %d found", levelnum_value);
+
leveldir_current->last_level = levelnum_value;
}
}
}
else
{
- Error(ERR_DEBUG, "using default setup values");
+ Debug("setup", "using default setup values");
}
free(filename);
if (!(file = fopen(filename, MODE_WRITE)))
{
- Error(ERR_WARN, "cannot write setup file '%s'", filename);
+ Warn("cannot write setup file '%s'", filename);
+
free(filename);
+
return;
}
{
if (!mixer[i].active)
{
- Error(ERR_INFO, "Mixer_InsertSound: Channel %d inactive", i);
- Error(ERR_INFO, "Mixer_InsertSound: This should never happen!");
+ Debug("audio", "Mixer_InsertSound: Channel %d inactive", i);
+ Debug("audio", "Mixer_InsertSound: This should never happen!");
mixer_active_channels--;
}
if ((snd_info->data_ptr = Mix_LoadWAV(filename)) == NULL)
{
- Error(ERR_WARN, "cannot read sound file '%s': %s", filename, Mix_GetError());
+ Warn("cannot read sound file '%s': %s", filename, Mix_GetError());
+
free(snd_info);
+
return NULL;
}
if ((mod_info->data_ptr = Mix_LoadMUS(filename)) == NULL)
{
- Error(ERR_WARN, "cannot read music file '%s': %s", filename, Mix_GetError());
+ Warn("cannot read music file '%s': %s", filename, Mix_GetError());
+
free(mod_info);
+
return NULL;
}
if ((dir = openDirectory(music_directory)) == NULL)
{
- Error(ERR_WARN, "cannot read music directory '%s'", music_directory);
+ Warn("cannot read music directory '%s'", music_directory);
audio.music_available = FALSE;
{
if (program.global_scores)
{
- Error(ERR_DEBUG, "Using global, multi-user scores directory '%s'.",
+ Debug("internal:path", "Using global, multi-user scores directory '%s'.",
global_scores_dir);
- Error(ERR_DEBUG, "Remove to enable single-user scores directory.");
- Error(ERR_DEBUG, "(This enables multipe score entries per user.)");
+ Debug("internal:path", "Remove to enable single-user scores directory.");
+ Debug("internal:path", "(This enables multipe score entries per user.)");
}
else
{
- Error(ERR_DEBUG, "Using private, single-user scores directory.");
+ Debug("internal:path", "Using private, single-user scores directory.");
}
}
#endif
if (filename == NULL) // (should never happen)
{
- Error(ERR_WARN, "ReloadCustomImage(): cannot find file '%s'", basename);
+ Warn("ReloadCustomImage(): cannot find file '%s'", basename);
+
return;
}
if ((new_bitmap = LoadImage(filename)) == NULL)
{
- Error(ERR_WARN, "LoadImage('%s') failed: %s", basename, GetError());
+ Warn("LoadImage('%s') failed: %s", basename, GetError());
+
return;
}
if (bitmap->width != new_bitmap->width ||
bitmap->height != new_bitmap->height)
{
- Error(ERR_WARN, "ReloadCustomImage: new image '%s' has wrong dimensions",
+ Warn("ReloadCustomImage: new image '%s' has wrong dimensions",
filename);
+
FreeBitmap(new_bitmap);
+
return;
}
int text_length = vsnprintf(text_buffer, MAX_OUTPUT_LINESIZE, format, ap);
if (text_length >= MAX_OUTPUT_LINESIZE)
- Error(ERR_WARN, "string too long in DrawTextBufferVA() -- truncated");
+ Warn("string too long in DrawTextBufferVA() -- truncated");
int num_lines_printed = DrawTextBuffer(x, y, text_buffer, font_nr,
line_length, cut_length, max_lines,
if (!(file = fopen(filename, MODE_WRITE)))
{
- Error(ERR_WARN, "cannot write file '%s' from network buffer", filename);
+ Warn("cannot write file '%s' from network buffer", filename);
return 0;
}
if (!(file = openFile(filename, MODE_READ)))
{
- Error(ERR_WARN, "cannot read file '%s' to network buffer", filename);
+ Warn("cannot read file '%s' to network buffer", filename);
return 0;
}
// accept incoming TCP connections
if (SDLNet_SocketReady(lfd))
{
- Error(ERR_DEBUG, "got TCP packet");
+ Debug("network:server", "got TCP packet");
TCPsocket newsock;
// accept incoming UDP packets
if (SDLNet_SocketReady(udp))
{
- Error(ERR_DEBUG, "got UDP packet");
+ Debug("network:server", "got UDP packet");
static UDPpacket packet;
ypos = SY + ypos_2;
}
- Error(ERR_DEBUG, "========== %s ==========", message);
+ Debug("network:client", "========== %s ==========", message);
}
else
{
ypos += (num_lines_printed + num_lines_spacing) * font_height;
- Error(ERR_DEBUG, "%s", message);
+ Debug("network:client", "%s", message);
}
BackToFront();
SDLNet_Write16(port, &ip.port);
}
- Error(ERR_DEBUG, "trying to connect to network server at %d.%d.%d.%d ...",
+ Debug("network:client", "trying to connect to network server at %d.%d.%d.%d ...",
(server_host >> 24) & 0xff,
(server_host >> 16) & 0xff,
(server_host >> 8) & 0xff,
int protocol_version_major = getNetworkBuffer8BitInteger(read_buffer);
int protocol_version_minor = getNetworkBuffer8BitInteger(read_buffer);
- Error(ERR_WARN, "protocol version mismatch");
- Error(ERR_WARN, "server expects %d.%d.x instead of %d.%d.%d",
+ Warn("protocol version mismatch");
+ Warn("server expects %d.%d.x instead of %d.%d.%d",
protocol_version_major,
protocol_version_minor,
PROTOCOL_VERSION_MAJOR,
if (!strEqual(new_leveldir_identifier, network_level.leveldir_identifier))
{
- Error(ERR_WARN, "no such level identifier: '%s'", new_leveldir_identifier);
+ Warn("no such level identifier: '%s'", new_leveldir_identifier);
stop_network_game = TRUE;
if (server_frame_counter != FrameCounter)
{
- Error(ERR_INFO, "frame counters of client %d and server out of sync",
- player_nr);
- Error(ERR_INFO, "frame counter of client is %d", FrameCounter);
- Error(ERR_INFO, "frame counter of server is %d", server_frame_counter);
- Error(ERR_INFO, "this should not happen -- please debug");
+ Warn("frame counters of client %d and server out of sync", player_nr);
+ Warn("frame counter of client is %d", FrameCounter);
+ Warn("frame counter of server is %d", server_frame_counter);
+ Warn("this should not happen -- please debug");
stop_network_game = TRUE;
#if DEBUG_JOYSTICKS
// print info about the joystick we are watching
- Error(ERR_DEBUG, "watching joystick %d: (%s)\n",
+ Debug("joystick", "watching joystick %d: (%s)",
SDL_JoystickInstanceID(joystick), name);
- Error(ERR_DEBUG, "joystick has %d axes, %d hats, %d balls, and %d buttons\n",
+ Debug("joystick", "joystick has %d axes, %d hats, %d balls, and %d buttons",
SDL_JoystickNumAxes(joystick), SDL_JoystickNumHats(joystick),
SDL_JoystickNumBalls(joystick), SDL_JoystickNumButtons(joystick));
#endif
if (success)
{
#if DEBUG_JOYSTICKS
- Error(ERR_DEBUG, "New game controller mapping:\n\n%s\n\n", mapping);
+ Debug("joystick", "New game controller mapping:\n\n%s\n\n", mapping);
#endif
// activate mapping for this game
diff_bar[pos++] = '\0';
- Error(ERR_INFO, "%06d [%02d] [%c%02d] %s",
+ Debug("time:frame", "%06d [%02d] [%c%02d] %s",
counter,
diff_1,
(diff_2 < 0 ? '-' : diff_2 > 0 ? '+' : ' '), ABS(diff_2),
if (element_rnd < 0 || element_rnd >= NUM_FILE_ELEMENTS)
{
- Error(ERR_WARN, "invalid RND level element %d", element_rnd);
+ Warn("invalid RND level element %d", element_rnd);
return EL_UNKNOWN;
}
if (element_em_cave < 0 || element_em_cave >= CAVE_TILE_MAX)
{
- Error(ERR_WARN, "invalid EM cave element %d", element_em_cave);
+ Warn("invalid EM cave element %d", element_em_cave);
return EL_UNKNOWN;
}
if (element_em_game < 0 || element_em_game >= GAME_TILE_MAX)
{
- Error(ERR_WARN, "invalid EM game element %d", element_em_game);
+ Warn("invalid EM game element %d", element_em_game);
return EL_UNKNOWN;
}