+2006-04-06
+ * added selection between ECS and AGA graphics for EMC levels to setup
+
+2006-04-04
+ * adjusted font handling for various narrow EMC style fonts
+
2006-04-03
* changed EM engine behaviour back to re-allow initial rolling springs
-#define COMPILE_DATE_STRING "[2006-04-06 19:38]"
+#define COMPILE_DATE_STRING "[2006-04-07 01:18]"
if (element >= NUM_FILE_ELEMENTS)
Error(ERR_WARN, "editor element %d is runtime element", element);
- if (strcmp(getElementInfoText(element), INFOTEXT_UNKNOWN_ELEMENT) == 0)
+ if (strEqual(getElementInfoText(element), INFOTEXT_UNKNOWN_ELEMENT))
Error(ERR_WARN, "no element description for element %d", element);
}
}
if (suffix_len > string_len)
return FALSE;
- return (strcmp(&string[string_len - suffix_len], suffix) == 0);
+ return (strEqual(&string[string_len - suffix_len], suffix));
}
#define MAX_CHEAT_INPUT_LEN 32
return;
/* try to determine better author name than 'anonymous' */
- if (strcmp(leveldir_current->author, ANONYMOUS_NAME) != 0)
+ if (!strEqual(leveldir_current->author, ANONYMOUS_NAME))
{
strncpy(level->author, leveldir_current->author, MAX_LEVEL_AUTHOR_LEN);
level->author[MAX_LEVEL_AUTHOR_LEN] = '\0';
{
char *id_lower = getStringToLower(filetype_id_list[i].id);
- if (strcmp(filetype_id_lower, id_lower) == 0)
+ if (strEqual(filetype_id_lower, id_lower))
filetype = filetype_id_list[i].filetype;
free(id_lower);
}
getFileChunkBE(file, chunk_name, NULL);
- if (strcmp(chunk_name, "RND1") == 0)
+ if (strEqual(chunk_name, "RND1"))
{
getFile32BitBE(file); /* not used */
getFileChunkBE(file, chunk_name, NULL);
- if (strcmp(chunk_name, "CAVE") != 0)
+ if (!strEqual(chunk_name, "CAVE"))
{
level->no_valid_file = TRUE;
int i = 0;
while (chunk_info[i].name != NULL &&
- strcmp(chunk_name, chunk_info[i].name) != 0)
+ !strEqual(chunk_name, chunk_info[i].name))
i++;
if (chunk_info[i].name == NULL)
if (reading_multipart_level &&
(!is_multipart_level ||
- strcmp(level->name, multipart_level.name) != 0))
+ !strEqual(level->name, multipart_level.name)))
{
/* we are already reading parts of a multi-part level, but this level is
either not a multi-part level, or a part of a different multi-part
}
getFileChunkBE(file, chunk_name, NULL);
- if (strcmp(chunk_name, "RND1") == 0)
+ if (strEqual(chunk_name, "RND1"))
{
getFile32BitBE(file); /* not used */
getFileChunkBE(file, chunk_name, NULL);
- if (strcmp(chunk_name, "TAPE") != 0)
+ if (!strEqual(chunk_name, "TAPE"))
{
tape.no_valid_file = TRUE;
int i = 0;
while (chunk_info[i].name != NULL &&
- strcmp(chunk_name, chunk_info[i].name) != 0)
+ !strEqual(chunk_name, chunk_info[i].name))
i++;
if (chunk_info[i].name == NULL)
/* always start with reliable default values from default config */
for (i = 0; image_config_vars[i].token != NULL; i++)
for (j = 0; image_config[j].token != NULL; j++)
- if (strcmp(image_config_vars[i].token, image_config[j].token) == 0)
+ if (strEqual(image_config_vars[i].token, image_config[j].token))
*image_config_vars[i].value =
get_auto_parameter_value(image_config_vars[i].token,
image_config[j].value);
char *basename, boolean is_sound)
{
for (; list != NULL; list = list->next)
- if (list->is_sound == is_sound && strcmp(list->basename, basename) == 0)
+ if (list->is_sound == is_sound && strEqual(list->basename, basename))
return TRUE;
return FALSE;
if (music->filename == NULL)
continue;
- if (strcmp(music->filename, UNDEFINED_FILENAME) == 0)
+ if (strEqual(music->filename, UNDEFINED_FILENAME))
continue;
/* a configured file may be not recognized as music */
if (music->filename == NULL)
continue;
- if (strcmp(basename, music->filename) == 0)
+ if (strEqual(basename, music->filename))
{
music_already_used = TRUE;
break;
if (sound->filename == NULL)
continue;
- if (strcmp(sound->filename, UNDEFINED_FILENAME) == 0)
+ if (strEqual(sound->filename, UNDEFINED_FILENAME))
continue;
/* a configured file may be not recognized as sound */
char *element_value, *action_value, *direction_value;
int delay = atoi(list->value);
- if (strcmp(list->token, "end") == 0)
+ if (strEqual(list->token, "end"))
{
add_helpanim_entry(HELPANIM_LIST_NEXT, -1, -1, -1, &num_list_entries);
LoadScore(level_nr);
- if (strcmp(setup.player_name, EMPTY_PLAYER_NAME) == 0 ||
+ if (strEqual(setup.player_name, EMPTY_PLAYER_NAME) ||
local_player->score < highscore[MAX_SCORE_ENTRIES - 1].Score)
return -1;
#ifdef ONE_PER_NAME
for (l = k; l < MAX_SCORE_ENTRIES; l++)
- if (!strcmp(setup.player_name, highscore[l].Name))
+ if (strEqual(setup.player_name, highscore[l].Name))
m = l;
if (m == k) /* player's new highscore overwrites his old one */
goto put_into_list;
if (type != TYPE_TOKEN)
return get_parameter_value(value_raw, suffix, type);
- if (strcmp(value_raw, ARG_UNDEFINED) == 0)
+ if (strEqual(value_raw, ARG_UNDEFINED))
return ARG_UNDEFINED_VALUE;
/* !!! OPTIMIZE THIS BY USING HASH !!! */
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
- if (strcmp(element_info[i].token_name, value_raw) == 0)
+ if (strEqual(element_info[i].token_name, value_raw))
return i;
/* !!! OPTIMIZE THIS BY USING HASH !!! */
{
int len_config_value = strlen(image_config[i].value);
- if (strcmp(&image_config[i].value[len_config_value - 4], ".pcx") != 0 &&
- strcmp(&image_config[i].value[len_config_value - 4], ".wav") != 0 &&
- strcmp(image_config[i].value, UNDEFINED_FILENAME) != 0)
+ if (!strEqual(&image_config[i].value[len_config_value - 4], ".pcx") &&
+ !strEqual(&image_config[i].value[len_config_value - 4], ".wav") &&
+ !strEqual(image_config[i].value, UNDEFINED_FILENAME))
continue;
- if (strcmp(image_config[i].token, value_raw) == 0)
+ if (strEqual(image_config[i].token, value_raw))
return x;
x++;
element_info[element].sound[action] = sound;
else
for (j = 0; j < MAX_NUM_ELEMENTS; j++)
- if (strcmp(element_info[j].class_name,
- element_info[element].class_name) == 0)
+ if (strEqual(element_info[j].class_name,
+ element_info[element].class_name))
element_info[j].sound[action] = sound;
}
action = ACTION_DEFAULT;
for (j = 0; j < MAX_NUM_ELEMENTS; j++)
- if (strcmp(element_info[j].class_name,
- element_info[element_class].class_name) == 0)
+ if (strEqual(element_info[j].class_name,
+ element_info[element_class].class_name))
element_info[j].sound[action] = sound;
}
int len_action_text = strlen(element_action_info[j].suffix);
if (len_action_text < len_effect_text &&
- strcmp(&sound->token[len_effect_text - len_action_text],
- element_action_info[j].suffix) == 0)
+ strEqual(&sound->token[len_effect_text - len_action_text],
+ element_action_info[j].suffix))
{
sound_effect_properties[i] = element_action_info[j].value;
sound_info[i].loop = element_action_info[j].is_loop_sound;
{
int i;
- if (strcmp(command, "print graphicsinfo.conf") == 0)
+ if (strEqual(command, "print graphicsinfo.conf"))
{
printf("# You can configure additional/alternative image files here.\n");
printf("# (The entries below are default and therefore commented out.)\n");
exit(0);
}
- else if (strcmp(command, "print soundsinfo.conf") == 0)
+ else if (strEqual(command, "print soundsinfo.conf"))
{
printf("# You can configure additional/alternative sound files here.\n");
printf("# (The entries below are default and therefore commented out.)\n");
exit(0);
}
- else if (strcmp(command, "print musicinfo.conf") == 0)
+ else if (strEqual(command, "print musicinfo.conf"))
{
printf("# You can configure additional/alternative music files here.\n");
printf("# (The entries below are default and therefore commented out.)\n");
exit(0);
}
- else if (strcmp(command, "print editorsetup.conf") == 0)
+ else if (strEqual(command, "print editorsetup.conf"))
{
printf("# You can configure your personal editor element list here.\n");
printf("# (The entries below are default and therefore commented out.)\n");
exit(0);
}
- else if (strcmp(command, "print helpanim.conf") == 0)
+ else if (strEqual(command, "print helpanim.conf"))
{
printf("# You can configure different element help animations here.\n");
printf("# (The entries below are default and therefore commented out.)\n");
printf("# %s\n", getFormattedSetupEntry(helpanim_config[i].token,
helpanim_config[i].value));
- if (strcmp(helpanim_config[i].token, "end") == 0)
+ if (strEqual(helpanim_config[i].token, "end"))
printf("#\n");
}
exit(0);
}
- else if (strcmp(command, "print helptext.conf") == 0)
+ else if (strEqual(command, "print helptext.conf"))
{
printf("# You can configure different element help text here.\n");
printf("# (The entries below are default and therefore commented out.)\n");
sprintf(font_token, "%s_%d", CONFIG_TOKEN_FONT_INITIAL, j + 1);
len_font_token = strlen(font_token);
- if (strcmp(image_config[i].token, font_token) == 0)
+ if (strEqual(image_config[i].token, font_token))
filename_font_initial = image_config[i].value;
else if (strlen(image_config[i].token) > len_font_token &&
strncmp(image_config[i].token, font_token, len_font_token) == 0)
{
- if (strcmp(&image_config[i].token[len_font_token], ".x") == 0)
+ if (strEqual(&image_config[i].token[len_font_token], ".x"))
font_initial[j].src_x = atoi(image_config[i].value);
- else if (strcmp(&image_config[i].token[len_font_token], ".y") == 0)
+ else if (strEqual(&image_config[i].token[len_font_token], ".y"))
font_initial[j].src_y = atoi(image_config[i].value);
- else if (strcmp(&image_config[i].token[len_font_token], ".width") == 0)
+ else if (strEqual(&image_config[i].token[len_font_token], ".width"))
font_initial[j].width = atoi(image_config[i].value);
- else if (strcmp(&image_config[i].token[len_font_token],".height") == 0)
+ else if (strEqual(&image_config[i].token[len_font_token],".height"))
font_initial[j].height = atoi(image_config[i].value);
}
}
#endif
/* ---------- reload if current artwork identifier has changed ----------- */
- if (strcmp(ARTWORK_CURRENT_IDENTIFIER(artwork, type),
- artwork_current_identifier) != 0)
+ if (!strEqual(ARTWORK_CURRENT_IDENTIFIER(artwork, type),
+ artwork_current_identifier))
artwork_new_identifier = artwork_current_identifier;
*(ARTWORK_CURRENT_IDENTIFIER_PTR(artwork, type))= artwork_current_identifier;
{
CheckRangeOfNumericInputGadget(gi);
- if (strcmp(gi->textinput.value, gi->textinput.last_value) != 0)
+ if (!strEqual(gi->textinput.last_value, gi->textinput.value))
strcpy(gi->textinput.last_value, gi->textinput.value);
else
gadget_changed = FALSE;
{
CheckRangeOfNumericInputGadget(gi);
- if (strcmp(gi->textinput.value, gi->textinput.last_value) != 0)
+ if (!strEqual(gi->textinput.last_value, gi->textinput.value))
strcpy(gi->textinput.last_value, gi->textinput.value);
else
gadget_changed = FALSE;
int i;
for (i = 0; i < num_list_entries; i++)
- if (strcmp(file_list[i].token, token) == 0)
+ if (strEqual(file_list[i].token, token))
return i;
return -1;
for (i = 0; i < 6; i++)
{
- if (strcmp(*name, translate_joy[i].name) == 0)
+ if (strEqual(*name, translate_joy[i].name))
{
*joysymbol = translate_joy[i].joysymbol;
break;
*old_value = getStringCopy(new_value);
}
+boolean strEqual(char *s1, char *s2)
+{
+ return (s1 == NULL && s2 == NULL ? TRUE :
+ s1 == NULL && s2 != NULL ? FALSE :
+ s1 != NULL && s2 == NULL ? FALSE :
+ strcmp(s1, s2) == 0);
+}
+
/* ------------------------------------------------------------------------- */
/* command line option handling functions */
in an application package directory -- do not try to use this directory
as the program data directory (Mac OS X handles this correctly anyway) */
- if (strcmp(ro_base_path, ".") == 0)
+ if (strEqual(ro_base_path, "."))
ro_base_path = program.command_basepath;
- if (strcmp(rw_base_path, ".") == 0)
+ if (strEqual(rw_base_path, "."))
rw_base_path = program.command_basepath;
#endif
strcpy(option_str, option); /* copy argument into buffer */
option = option_str;
- if (strcmp(option, "--") == 0) /* stop scanning arguments */
+ if (strEqual(option, "--")) /* stop scanning arguments */
break;
if (strncmp(option, "--", 2) == 0) /* treat '--' like '-' */
option_len = strlen(option);
- if (strcmp(option, "-") == 0)
+ if (strEqual(option, "-"))
Error(ERR_EXIT_HELP, "unrecognized option '%s'", option);
else if (strncmp(option, "-help", option_len) == 0)
{
i = 0;
do
{
- if (strcmp(translate_key[i].name, *name) == 0)
+ if (strEqual(translate_key[i].name, *name))
{
key = translate_key[i].key;
break;
do
{
- if (strcmp(name_ptr, translate_key[i].x11name) == 0)
+ if (strEqual(name_ptr, translate_key[i].x11name))
{
key = translate_key[i].key;
break;
if (strlen(keyname) == 1)
letter = keyname[0];
- else if (strcmp(keyname, "space") == 0)
+ else if (strEqual(keyname, "space"))
letter = ' ';
- else if (strcmp(keyname, "circumflex") == 0)
+ else if (strEqual(keyname, "circumflex"))
letter = '^';
return letter;
for (i = 0; number_text[i][0] != NULL; i++)
for (j = 0; j < 3; j++)
- if (strcmp(s_lower, number_text[i][j]) == 0)
+ if (strEqual(s_lower, number_text[i][j]))
result = i;
if (result == -1)
{
- if (strcmp(s_lower, "false") == 0)
+ if (strEqual(s_lower, "false"))
result = 0;
- else if (strcmp(s_lower, "true") == 0)
+ else if (strEqual(s_lower, "true"))
result = 1;
else
result = atoi(s);
char *s_lower = getStringToLower(s);
boolean result = FALSE;
- if (strcmp(s_lower, "true") == 0 ||
- strcmp(s_lower, "yes") == 0 ||
- strcmp(s_lower, "on") == 0 ||
+ if (strEqual(s_lower, "true") ||
+ strEqual(s_lower, "yes") ||
+ strEqual(s_lower, "on") ||
get_integer_from_string(s) == 1)
result = TRUE;
if (node_first == NULL || *node_first == NULL)
return;
- if (strcmp((*node_first)->key, key) == 0)
+ if (strEqual((*node_first)->key, key))
{
free((*node_first)->key);
if (destructor_function)
if (node_first == NULL)
return NULL;
- if (strcmp(node_first->key, key) == 0)
+ if (strEqual(node_first->key, key))
return node_first;
else
return getNodeFromKey(node_first->next, key);
if (basename_length > suffix_length + 1 &&
basename_lower[basename_length - suffix_length - 1] == '.' &&
- strcmp(&basename_lower[basename_length - suffix_length], suffix) == 0)
+ strEqual(&basename_lower[basename_length - suffix_length], suffix))
return TRUE;
return FALSE;
char *value = getStringToLower(value_raw);
int result = 0; /* probably a save default value */
- if (strcmp(suffix, ".direction") == 0)
+ if (strEqual(suffix, ".direction"))
{
- result = (strcmp(value, "left") == 0 ? MV_LEFT :
- strcmp(value, "right") == 0 ? MV_RIGHT :
- strcmp(value, "up") == 0 ? MV_UP :
- strcmp(value, "down") == 0 ? MV_DOWN : MV_NONE);
+ result = (strEqual(value, "left") ? MV_LEFT :
+ strEqual(value, "right") ? MV_RIGHT :
+ strEqual(value, "up") ? MV_UP :
+ strEqual(value, "down") ? MV_DOWN : MV_NONE);
}
- else if (strcmp(suffix, ".anim_mode") == 0)
+ else if (strEqual(suffix, ".anim_mode"))
{
result = (string_has_parameter(value, "none") ? ANIM_NONE :
string_has_parameter(value, "loop") ? ANIM_LOOP :
}
else /* generic parameter of type integer or boolean */
{
- result = (strcmp(value, ARG_UNDEFINED) == 0 ? ARG_UNDEFINED_VALUE :
+ result = (strEqual(value, ARG_UNDEFINED) ? ARG_UNDEFINED_VALUE :
type == TYPE_INTEGER ? get_integer_from_string(value) :
type == TYPE_BOOLEAN ? get_boolean_from_string(value) :
ARG_UNDEFINED_VALUE);
int len_suffix = strlen(suffix_list[j].token);
if (len_suffix < len_config_token &&
- strcmp(&config_list[i].token[len_config_token - len_suffix],
- suffix_list[j].token) == 0)
+ strEqual(&config_list[i].token[len_config_token - len_suffix],
+ suffix_list[j].token))
{
setString(&file_list[list_pos].default_parameter[j],
config_list[i].value);
/* the following tokens are no file definitions, but other config tokens */
for (j = 0; ignore_tokens[j] != NULL; j++)
- if (strcmp(config_list[i].token, ignore_tokens[j]) == 0)
+ if (strEqual(config_list[i].token, ignore_tokens[j]))
is_file_entry = FALSE;
if (is_file_entry)
break;
/* simple sanity check if this is really a file definition */
- if (strcmp(&config_list[i].value[len_config_value - 4], ".pcx") != 0 &&
- strcmp(&config_list[i].value[len_config_value - 4], ".wav") != 0 &&
- strcmp(config_list[i].value, UNDEFINED_FILENAME) != 0)
+ if (!strEqual(&config_list[i].value[len_config_value - 4], ".pcx") &&
+ !strEqual(&config_list[i].value[len_config_value - 4], ".wav") &&
+ !strEqual(config_list[i].value, UNDEFINED_FILENAME))
{
Error(ERR_RETURN, "Configuration directive '%s' -> '%s':",
config_list[i].token, config_list[i].value);
{
char *value = HASH_ITERATION_VALUE(itr);
- if (strcmp(value, known_token_value) != 0)
+ if (!strEqual(value, known_token_value))
setHashEntry(extra_file_hash, HASH_ITERATION_TOKEN(itr), value);
}
END_HASH_ITERATION(valid_file_hash, itr)
BEGIN_HASH_ITERATION(extra_file_hash, itr)
{
- if (strcmp(HASH_ITERATION_VALUE(itr), known_token_value) == 0)
+ if (strEqual(HASH_ITERATION_VALUE(itr), known_token_value))
dynamic_tokens_found = TRUE;
else
unknown_tokens_found = TRUE;
{
char *value = getHashEntry(extra_file_hash, list->token);
- if (value != NULL && strcmp(value, known_token_value) == 0)
+ if (value != NULL && strEqual(value, known_token_value))
Error(ERR_RETURN, "- dynamic token: '%s'", list->token);
}
{
char *value = getHashEntry(extra_file_hash, list->token);
- if (value != NULL && strcmp(value, known_token_value) != 0)
+ if (value != NULL && !strEqual(value, known_token_value))
Error(ERR_RETURN, "- dynamic token: '%s'", list->token);
}
filename_local = getCustomArtworkConfigFilename(artwork_info->type);
- if (filename_local != NULL && strcmp(filename_base, filename_local) != 0)
+ if (filename_local != NULL && !strEqual(filename_base, filename_local))
LoadArtworkConfigFromFilename(artwork_info, filename_local);
}
basename = file_list_entry->default_filename;
/* dynamic artwork has no default filename / skip empty default artwork */
- if (basename == NULL || strcmp(basename, UNDEFINED_FILENAME) == 0)
+ if (basename == NULL || strEqual(basename, UNDEFINED_FILENAME))
return;
file_list_entry->fallback_to_default = TRUE;
}
/* check if the old and the new artwork file are the same */
- if (*listnode && strcmp((*listnode)->source_filename, filename) == 0)
+ if (*listnode && strEqual((*listnode)->source_filename, filename))
{
/* The old and new artwork are the same (have the same filename and path).
This usually means that this artwork does not exist in this artwork set
printf("GOT CUSTOM ARTWORK FILE '%s'\n", filename);
#endif
- if (strcmp(file_list_entry->filename, UNDEFINED_FILENAME) == 0)
+ if (strEqual(file_list_entry->filename, UNDEFINED_FILENAME))
{
deleteArtworkListEntry(artwork_info, listnode);
return;
char *getStringCopy(char *);
char *getStringToLower(char *);
void setString(char **, char *);
+boolean strEqual(char *, char *);
void GetOptions(char **, void (*print_usage_function)(void));
inline void SDLOpenAudio(void)
{
- if (strcmp(setup.system.sdl_audiodriver, ARG_DEFAULT) != 0)
+ if (!strEqual(setup.system.sdl_audiodriver, ARG_DEFAULT))
putenv(getStringCat2("SDL_AUDIODRIVER=", setup.system.sdl_audiodriver));
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
if (!setup.override_level_graphics)
{
-#if 1
- /* try special ECS graphics */
- filename = getPath3(getCurrentLevelDir(), GRAPHICS_ECS_DIRECTORY, basename);
- if (fileExists(filename) && !setup.prefer_aga_graphics)
- return filename;
-
- free(filename);
-
- /* try special AGA graphics */
- filename = getPath3(getCurrentLevelDir(), GRAPHICS_AGA_DIRECTORY, basename);
- if (fileExists(filename) && setup.prefer_aga_graphics)
- return filename;
-
- free(filename);
-#endif
-
/* 1st try: look for special artwork in current level series directory */
filename = getPath3(getCurrentLevelDir(), GRAPHICS_DIRECTORY, basename);
if (fileExists(filename))
free(filename);
-#if 1
- if (leveldir_current)
- printf("::: A -> '%s' [%s]\n", leveldir_current->graphics_set,
- leveldir_current->subdir);
-#endif
-
/* check if there is special artwork configured in level series config */
if (getLevelArtworkSet(ARTWORK_TYPE_GRAPHICS) != NULL)
{
-#if 1
- printf("::: B -> '%s' ---------> '%s'\n",
- getLevelArtworkSet(ARTWORK_TYPE_GRAPHICS),
- leveldir_current->graphics_path);
- /* -> getLevelArtworkDir(ARTWORK_TYPE_GRAPHICS)); */
-#endif
-
/* 2nd try: look for special artwork configured in level series config */
filename = getPath2(getLevelArtworkDir(ARTWORK_TYPE_GRAPHICS), basename);
if (fileExists(filename))
}
else if (!node->parent_link)
{
- if (strcmp(identifier, node->identifier) == 0)
+ if (strEqual(identifier, node->identifier))
return node;
}
*ti_new = ti_cloned;
}
-static boolean adjustTreeGraphics(TreeInfo *node)
+static boolean adjustTreeGraphicsForEMC(TreeInfo *node)
{
boolean settings_changed = FALSE;
while (node)
{
-#if 1
- if (node->graphics_ecs_set && !setup.prefer_aga_graphics)
+ if (node->graphics_set_ecs && !setup.prefer_aga_graphics &&
+ !strEqual(node->graphics_set, node->graphics_set_ecs))
{
- setString(&node->graphics_set, node->graphics_ecs_set);
-#if 0
- printf("::: setting graphics for set '%s' to '%s' [ECS]\n",
- node->subdir, node->graphics_set);
-#endif
-
+ setString(&node->graphics_set, node->graphics_set_ecs);
settings_changed = TRUE;
}
- else if (node->graphics_aga_set && setup.prefer_aga_graphics)
+ else if (node->graphics_set_aga && setup.prefer_aga_graphics &&
+ !strEqual(node->graphics_set, node->graphics_set_aga))
{
- setString(&node->graphics_set, node->graphics_aga_set);
-#if 0
- printf("::: setting graphics for set '%s' to '%s' [AGA]\n",
- node->subdir, node->graphics_set);
-#endif
-
+ setString(&node->graphics_set, node->graphics_set_aga);
settings_changed = TRUE;
}
- else if (node->graphics_set == NULL)
- {
-#if 0
- printf("::: cannot set graphics_set for set '%s'\n", node->subdir);
-#endif
- }
-#else
- if (node->graphics_ecs_set)
- printf("::: SET '%s': found ECS set '%s'\n",
- node->subdir, node->graphics_ecs_set);
-
- if (node->graphics_aga_set)
- printf("::: SET '%s': found AGA set '%s'\n",
- node->subdir, node->graphics_aga_set);
-#endif
if (node->node_group != NULL)
- settings_changed |= adjustTreeGraphics(node->node_group);
+ settings_changed |= adjustTreeGraphicsForEMC(node->node_group);
node = node->next;
}
char *dir = checked_malloc(MAX_PATH + 1);
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_COMMON_DOCUMENTS, NULL, 0, dir))
- && strcmp(dir, "") != 0) /* empty for Windows 95/98 */
+ && !strEqual(dir, "")) /* empty for Windows 95/98 */
common_data_dir = getPath2(dir, program.userdata_directory);
else
common_data_dir = options.rw_base_directory;
if (list == NULL)
return NULL;
- if (strcmp(list->token, token) == 0)
+ if (strEqual(list->token, token))
return list->value;
else
return getListEntry(list->next, token);
if (list == NULL)
return NULL;
- if (strcmp(list->token, token) == 0)
+ if (strEqual(list->token, token))
{
checked_free(list->value);
static int keys_are_equal(void *key1, void *key2)
{
- return (strcmp((char *)key1, (char *)key2) == 0);
+ return (strEqual((char *)key1, (char *)key2));
}
SetupFileHash *newSetupFileHash()
#define LEVELINFO_TOKEN_LATEST_ENGINE 9
#define LEVELINFO_TOKEN_LEVEL_GROUP 10
#define LEVELINFO_TOKEN_READONLY 11
-#define LEVELINFO_TOKEN_GRAPHICS_ECS_SET 12
-#define LEVELINFO_TOKEN_GRAPHICS_AGA_SET 13
+#define LEVELINFO_TOKEN_GRAPHICS_SET_ECS 12
+#define LEVELINFO_TOKEN_GRAPHICS_SET_AGA 13
#define LEVELINFO_TOKEN_GRAPHICS_SET 14
#define LEVELINFO_TOKEN_SOUNDS_SET 15
#define LEVELINFO_TOKEN_MUSIC_SET 16
{ TYPE_BOOLEAN, &ldi.latest_engine, "latest_engine" },
{ TYPE_BOOLEAN, &ldi.level_group, "level_group" },
{ TYPE_BOOLEAN, &ldi.readonly, "readonly" },
- { TYPE_STRING, &ldi.graphics_ecs_set, "graphics_ecs_set" },
- { TYPE_STRING, &ldi.graphics_aga_set, "graphics_aga_set" },
+ { TYPE_STRING, &ldi.graphics_set_ecs, "graphics_set.ecs" },
+ { TYPE_STRING, &ldi.graphics_set_aga, "graphics_set.aga" },
{ TYPE_STRING, &ldi.graphics_set, "graphics_set" },
{ TYPE_STRING, &ldi.sounds_set, "sounds_set" },
{ TYPE_STRING, &ldi.music_set, "music_set" },
ldi->imported_from = NULL;
ldi->imported_by = NULL;
- ldi->graphics_ecs_set = NULL;
- ldi->graphics_aga_set = NULL;
+ ldi->graphics_set_ecs = NULL;
+ ldi->graphics_set_aga = NULL;
ldi->graphics_set = NULL;
ldi->sounds_set = NULL;
ldi->music_set = NULL;
ldi->imported_from = getStringCopy(parent->imported_from);
ldi->imported_by = getStringCopy(parent->imported_by);
- ldi->graphics_ecs_set = NULL;
- ldi->graphics_aga_set = NULL;
+ ldi->graphics_set_ecs = NULL;
+ ldi->graphics_set_aga = NULL;
ldi->graphics_set = NULL;
ldi->sounds_set = NULL;
ldi->music_set = NULL;
checked_free(ldi->imported_from);
checked_free(ldi->imported_by);
- checked_free(ldi->graphics_ecs_set);
- checked_free(ldi->graphics_aga_set);
+ checked_free(ldi->graphics_set_ecs);
+ checked_free(ldi->graphics_set_aga);
checked_free(ldi->graphics_set);
checked_free(ldi->sounds_set);
checked_free(ldi->music_set);
getHashEntry(setup_file_hash, levelinfo_tokens[i].text));
*leveldir_new = ldi;
- if (strcmp(leveldir_new->name, ANONYMOUS_NAME) == 0)
+ if (strEqual(leveldir_new->name, ANONYMOUS_NAME))
setString(&leveldir_new->name, leveldir_new->subdir);
DrawInitText(leveldir_new->name, 150, FC_YELLOW);
leveldir_new->first_level + leveldir_new->levels - 1;
leveldir_new->in_user_dir =
- (strcmp(leveldir_new->basepath, options.level_directory) != 0);
+ (!strEqual(leveldir_new->basepath, options.level_directory));
/* adjust some settings if user's private level directory was detected */
if (leveldir_new->sort_priority == LEVELCLASS_UNDEFINED &&
leveldir_new->in_user_dir &&
- (strcmp(leveldir_new->subdir, getLoginName()) == 0 ||
- strcmp(leveldir_new->name, getLoginName()) == 0 ||
- strcmp(leveldir_new->author, getRealName()) == 0))
+ (strEqual(leveldir_new->subdir, getLoginName()) ||
+ strEqual(leveldir_new->name, getLoginName()) ||
+ strEqual(leveldir_new->author, getRealName())))
{
leveldir_new->sort_priority = LEVELCLASS_PRIVATE_START;
leveldir_new->readonly = FALSE;
char *directory_path = getPath2(level_directory, directory_name);
/* skip entries for current and parent directory */
- if (strcmp(directory_name, ".") == 0 ||
- strcmp(directory_name, "..") == 0)
+ if (strEqual(directory_name, ".") ||
+ strEqual(directory_name, ".."))
{
free(directory_path);
continue;
free(directory_path);
- if (strcmp(directory_name, GRAPHICS_DIRECTORY) == 0 ||
- strcmp(directory_name, SOUNDS_DIRECTORY) == 0 ||
- strcmp(directory_name, MUSIC_DIRECTORY) == 0)
+ if (strEqual(directory_name, GRAPHICS_DIRECTORY) ||
+ strEqual(directory_name, SOUNDS_DIRECTORY) ||
+ strEqual(directory_name, MUSIC_DIRECTORY))
continue;
valid_entry_found |= LoadLevelInfoFromLevelConf(node_first, node_parent,
{
boolean settings_changed = FALSE;
-#if 1
- printf("::: AdjustGraphicsForEMC()\n");
-
- settings_changed |= adjustTreeGraphics(leveldir_first_all);
- settings_changed |= adjustTreeGraphics(leveldir_first);
-
- if (leveldir_current)
- printf("::: X -> '%s'\n", leveldir_current->graphics_set);
- else
- printf("::: X (leveldir_current == NULL)\n");
-#endif
+ settings_changed |= adjustTreeGraphicsForEMC(leveldir_first_all);
+ settings_changed |= adjustTreeGraphicsForEMC(leveldir_first);
return settings_changed;
}
TreeInfo *artwork_new = NULL;
int i;
-#if 0
- printf("::: CHECKING FOR CONFIG FILE '%s'\n", filename);
-#endif
-
if (fileExists(filename))
setup_file_hash = loadSetupFileHash(filename);
if (!valid_file_found)
{
- if (strcmp(directory_name, ".") != 0)
+ if (!strEqual(directory_name, "."))
Error(ERR_WARN, "ignoring artwork directory '%s'", directory_path);
free(directory_path);
getHashEntry(setup_file_hash, levelinfo_tokens[i].text));
*artwork_new = ldi;
- if (strcmp(artwork_new->name, ANONYMOUS_NAME) == 0)
+ if (strEqual(artwork_new->name, ANONYMOUS_NAME))
setString(&artwork_new->name, artwork_new->subdir);
#if 0
}
artwork_new->in_user_dir =
- (strcmp(artwork_new->basepath, OPTIONS_ARTWORK_DIRECTORY(type)) != 0);
+ (!strEqual(artwork_new->basepath, OPTIONS_ARTWORK_DIRECTORY(type)));
/* (may use ".sort_priority" from "setup_file_hash" above) */
artwork_new->color = ARTWORKCOLOR(artwork_new);
if (setup_file_hash == NULL) /* (after determining ".user_defined") */
{
- if (strcmp(artwork_new->subdir, ".") == 0)
+ if (strEqual(artwork_new->subdir, "."))
{
if (artwork_new->user_defined)
{
struct dirent *dir_entry;
boolean valid_entry_found = FALSE;
-#if 0
- printf("::: CHECKING BASE DIR '%s'\n", base_directory);
-#endif
-
if ((dir = opendir(base_directory)) == NULL)
{
/* display error if directory is main "options.graphics_directory" etc. */
char *directory_path = getPath2(base_directory, directory_name);
/* skip directory entries for current and parent directory */
- if (strcmp(directory_name, ".") == 0 ||
- strcmp(directory_name, "..") == 0)
+ if (strEqual(directory_name, ".") ||
+ strEqual(directory_name, ".."))
{
free(directory_path);
continue;
#endif
}
-void LoadArtworkInfoFromLevelNode(ArtworkDirTree **artwork_node,
- LevelDirTree *level_node,
- char *artwork_directory)
-{
- TreeInfo *topnode_last = *artwork_node;
- char *path = getPath2(getLevelDirFromTreeInfo(level_node), artwork_directory);
-
-#if 1
- printf("::: CHECKING '%s' ...\n", path);
-#endif
-
- LoadArtworkInfoFromArtworkDir(artwork_node, NULL, path,(*artwork_node)->type);
-
- if (topnode_last != *artwork_node)
- {
- free((*artwork_node)->identifier);
- free((*artwork_node)->name);
- free((*artwork_node)->name_sorting);
-
- (*artwork_node)->identifier = getStringCopy(level_node->subdir);
- (*artwork_node)->name = getStringCopy(level_node->name);
- (*artwork_node)->name_sorting = getStringCopy(level_node->name);
-
- (*artwork_node)->sort_priority = level_node->sort_priority;
- (*artwork_node)->color = LEVELCOLOR((*artwork_node));
- }
-
- free(path);
-}
-
void LoadArtworkInfoFromLevelInfo(ArtworkDirTree **artwork_node,
LevelDirTree *level_node)
{
/* check all tree entries for artwork, but skip parent link entries */
if (!level_node->parent_link)
{
-#if 1
- struct
- {
- int type;
- char *dir;
- }
- artwork_type_dirs[] =
- {
- { ARTWORK_TYPE_GRAPHICS, GRAPHICS_DIRECTORY },
- { ARTWORK_TYPE_GRAPHICS, GRAPHICS_ECS_DIRECTORY },
- { ARTWORK_TYPE_GRAPHICS, GRAPHICS_AGA_DIRECTORY },
- { ARTWORK_TYPE_SOUNDS, SOUNDS_DIRECTORY },
- { ARTWORK_TYPE_MUSIC, MUSIC_DIRECTORY },
- { -1, NULL }
- };
- int i;
-
- for (i = 0; artwork_type_dirs[i].type != -1; i++)
- if ((*artwork_node)->type == artwork_type_dirs[i].type)
- LoadArtworkInfoFromLevelNode(artwork_node, level_node,
- artwork_type_dirs[i].dir);
-#else
TreeInfo *topnode_last = *artwork_node;
char *path = getPath2(getLevelDirFromTreeInfo(level_node),
ARTWORK_DIRECTORY((*artwork_node)->type));
}
free(path);
-#endif
}
if (level_node->node_group != NULL)
/* needed for reloading level artwork not known at ealier stage */
- if (strcmp(artwork.gfx_current_identifier, setup.graphics_set) != 0)
+ if (!strEqual(artwork.gfx_current_identifier, setup.graphics_set))
{
artwork.gfx_current =
getTreeInfoFromIdentifier(artwork.gfx_first, setup.graphics_set);
artwork.gfx_current = getFirstValidTreeInfoEntry(artwork.gfx_first);
}
- if (strcmp(artwork.snd_current_identifier, setup.sounds_set) != 0)
+ if (!strEqual(artwork.snd_current_identifier, setup.sounds_set))
{
artwork.snd_current =
getTreeInfoFromIdentifier(artwork.snd_first, setup.sounds_set);
artwork.snd_current = getFirstValidTreeInfoEntry(artwork.snd_first);
}
- if (strcmp(artwork.mus_current_identifier, setup.music_set) != 0)
+ if (!strEqual(artwork.mus_current_identifier, setup.music_set))
{
artwork.mus_current =
getTreeInfoFromIdentifier(artwork.mus_first, setup.music_set);
char *keyname = getKeyNameFromKey(key);
/* add comment, if useful */
- if (strcmp(keyname, "(undefined)") != 0 &&
- strcmp(keyname, "(unknown)") != 0)
+ if (!strEqual(keyname, "(undefined)") &&
+ !strEqual(keyname, "(unknown)"))
{
/* add at least one whitespace */
strcat(line, " ");
{
if (strlen(dir_entry->d_name) > 4 &&
dir_entry->d_name[3] == '.' &&
- strcmp(&dir_entry->d_name[4], LEVELFILE_EXTENSION) == 0)
+ strEqual(&dir_entry->d_name[4], LEVELFILE_EXTENSION))
{
char levelnum_str[4];
int levelnum_value;
/* read chunk id "RIFF" */
getFileChunkLE(file, chunk_name, &chunk_size);
- if (strcmp(chunk_name, "RIFF") != 0)
+ if (!strEqual(chunk_name, "RIFF"))
{
Error(ERR_WARN, "missing 'RIFF' chunk of sound file '%s'", filename);
fclose(file);
/* read "RIFF" type id "WAVE" */
getFileChunkLE(file, chunk_name, NULL);
- if (strcmp(chunk_name, "WAVE") != 0)
+ if (!strEqual(chunk_name, "WAVE"))
{
Error(ERR_WARN, "missing 'WAVE' type ID of sound file '%s'", filename);
fclose(file);
while (getFileChunkLE(file, chunk_name, &chunk_size))
{
- if (strcmp(chunk_name, "fmt ") == 0)
+ if (strEqual(chunk_name, "fmt "))
{
if (chunk_size < WAV_HEADER_SIZE)
{
printf(" Significant bits per sample: %d'\n", header.bits_per_sample);
#endif
}
- else if (strcmp(chunk_name, "data") == 0)
+ else if (strEqual(chunk_name, "data"))
{
data_byte_len = chunk_size;
return;
if (last_music_directory != NULL &&
- strcmp(last_music_directory, music_directory) == 0)
+ strEqual(last_music_directory, music_directory))
return; /* old and new music directory are the same */
if (last_music_directory != NULL)
{
struct FileInfo *music = getMusicListEntry(i);
- if (strcmp(basename, music->filename) == 0)
+ if (strEqual(basename, music->filename))
{
music_already_used = TRUE;
break;
return;
}
- if (strcmp(filename, bitmap->source_filename) == 0)
+ if (strEqual(filename, bitmap->source_filename))
{
/* The old and new image are the same (have the same filename and path).
This usually means that this image does not exist in this graphic set
#define RW_BASE_PATH RW_GAME_DIR
/* directory names */
-#define GRAPHICS_ECS_DIRECTORY "graphics.ecs"
-#define GRAPHICS_AGA_DIRECTORY "graphics.aga"
#define GRAPHICS_DIRECTORY "graphics"
#define SOUNDS_DIRECTORY "sounds"
#define MUSIC_DIRECTORY "music"
char *imported_from; /* optional comment for imported levels or artwork */
char *imported_by; /* optional comment for imported levels or artwork */
- char *graphics_ecs_set; /* special EMC custom graphics set (ECS graphics) */
- char *graphics_aga_set; /* special EMC custom graphics set (AGA graphics) */
+ char *graphics_set_ecs; /* special EMC custom graphics set (ECS graphics) */
+ char *graphics_set_aga; /* special EMC custom graphics set (AGA graphics) */
char *graphics_set; /* optional custom graphics set (level tree only) */
char *sounds_set; /* optional custom sounds set (level tree only) */
char *music_set; /* optional custom music set (level tree only) */
static int get_toon_direction(char *direction_string_raw)
{
char *direction_string = getStringToLower(direction_string_raw);
- int direction = (strcmp(direction_string, "left") == 0 ? MV_LEFT :
- strcmp(direction_string, "right") == 0 ? MV_RIGHT :
- strcmp(direction_string, "up") == 0 ? MV_UP :
- strcmp(direction_string, "down") == 0 ? MV_DOWN :
+ int direction = (strEqual(direction_string, "left") ? MV_LEFT :
+ strEqual(direction_string, "right") ? MV_RIGHT :
+ strEqual(direction_string, "up") ? MV_UP :
+ strEqual(direction_string, "down") ? MV_DOWN :
MV_NONE);
free(direction_string);
{
int pos_bottom = screen_info.height - anim->height;
- if (strcmp(anim->position, "top") == 0)
+ if (strEqual(anim->position, "top"))
pos_y = 0;
- else if (strcmp(anim->position, "bottom") == 0)
+ else if (strEqual(anim->position, "bottom"))
pos_y = pos_bottom;
- else if (strcmp(anim->position, "upper") == 0)
+ else if (strEqual(anim->position, "upper"))
pos_y = SimpleRND(pos_bottom / 2);
- else if (strcmp(anim->position, "lower") == 0)
+ else if (strEqual(anim->position, "lower"))
pos_y = pos_bottom / 2 + SimpleRND(pos_bottom / 2);
else
pos_y = SimpleRND(pos_bottom);
{
int pos_right = screen_info.width - anim->width;
- if (strcmp(anim->position, "left") == 0)
+ if (strEqual(anim->position, "left"))
pos_x = 0;
- else if (strcmp(anim->position, "right") == 0)
+ else if (strEqual(anim->position, "right"))
pos_x = pos_right;
else
pos_x = SimpleRND(pos_right);
else if (y == 3)
{
if (leveldir_current->readonly &&
- strcmp(setup.player_name, "Artsoft") != 0)
+ !strEqual(setup.player_name, "Artsoft"))
Request("This level is read only !", REQ_CONFIRM);
game_status = GAME_MODE_EDITOR;
DrawLevelEd();
DrawTextSCentered(100, FONT_TEXT_1, "The Game Background Music:");
}
- if (strcmp(list->title, UNKNOWN_NAME) != 0)
+ if (!strEqual(list->title, UNKNOWN_NAME))
{
- if (strcmp(list->title_header, UNKNOWN_NAME) != 0)
+ if (!strEqual(list->title_header, UNKNOWN_NAME))
DrawTextSCentered(ystart + y++ * dy, FONT_TEXT_2, list->title_header);
DrawTextFCentered(ystart + y++ * dy, FONT_TEXT_3, "\"%s\"", list->title);
}
- if (strcmp(list->artist, UNKNOWN_NAME) != 0)
+ if (!strEqual(list->artist, UNKNOWN_NAME))
{
- if (strcmp(list->artist_header, UNKNOWN_NAME) != 0)
+ if (!strEqual(list->artist_header, UNKNOWN_NAME))
DrawTextSCentered(ystart + y++ * dy, FONT_TEXT_2, list->artist_header);
else
DrawTextSCentered(ystart + y++ * dy, FONT_TEXT_2, "by");
DrawTextFCentered(ystart + y++ * dy, FONT_TEXT_3, "%s", list->artist);
}
- if (strcmp(list->album, UNKNOWN_NAME) != 0)
+ if (!strEqual(list->album, UNKNOWN_NAME))
{
- if (strcmp(list->album_header, UNKNOWN_NAME) != 0)
+ if (!strEqual(list->album_header, UNKNOWN_NAME))
DrawTextSCentered(ystart + y++ * dy, FONT_TEXT_2, list->album_header);
else
DrawTextSCentered(ystart + y++ * dy, FONT_TEXT_2, "from the album");
DrawTextFCentered(ystart + y++ * dy, FONT_TEXT_3, "\"%s\"", list->album);
}
- if (strcmp(list->year, UNKNOWN_NAME) != 0)
+ if (!strEqual(list->year, UNKNOWN_NAME))
{
- if (strcmp(list->year_header, UNKNOWN_NAME) != 0)
+ if (!strEqual(list->year_header, UNKNOWN_NAME))
DrawTextSCentered(ystart + y++ * dy, FONT_TEXT_2, list->year_header);
else
DrawTextSCentered(ystart + y++ * dy, FONT_TEXT_2, "from the year");
DrawText(mSX, sy, int2str(entry + 1, 3), font_nr1);
DrawText(mSX + dx1, sy, ".", font_nr1);
DrawText(mSX + dx2, sy, ".........................", font_nr3);
- if (strcmp(highscore[entry].Name, EMPTY_PLAYER_NAME) != 0)
+
+ if (!strEqual(highscore[entry].Name, EMPTY_PLAYER_NAME))
DrawText(mSX + dx2, sy, highscore[entry].Name, font_nr2);
+
DrawText(mSX + dx3, sy, int2str(highscore[entry].Score, 5), font_nr4);
}
/* !!! THIS ALL SUCKS -- SHOULD BE CLEANLY REWRITTEN !!! */
/* redraw micro level label, if needed */
- if (strcmp(level.name, NAMELESS_LEVEL_NAME) != 0 &&
- strcmp(level.author, ANONYMOUS_NAME) != 0 &&
- strcmp(level.author, leveldir_current->name) != 0 &&
+ if (!strEqual(level.name, NAMELESS_LEVEL_NAME) &&
+ !strEqual(level.author, ANONYMOUS_NAME) &&
+ !strEqual(level.author, leveldir_current->name) &&
DelayReached(&label_delay, MICROLEVEL_LABEL_DELAY))
{
int max_label_counter = 23;