int element = EL_CUSTOM_START + i;
/* order of checking and copying events to be mapped is important */
- for (j = CE_BY_OTHER_ACTION; j >= CE_BY_PLAYER; j--)
+ for (j = CE_BY_OTHER_ACTION; j >= CE_BY_PLAYER_OBSOLETE; j--)
{
if (HAS_CHANGE_EVENT(element, j - 2))
{
}
/* order of checking and copying events to be mapped is important */
- for (j = CE_OTHER_GETS_COLLECTED; j >= CE_COLLISION; j--)
+ for (j = CE_OTHER_GETS_COLLECTED; j >= CE_COLLISION_ACTIVE; j--)
{
if (HAS_CHANGE_EVENT(element, j - 1))
{
{
int element = EL_CUSTOM_START + i;
- if (HAS_CHANGE_EVENT(element, CE_BY_PLAYER) ||
- HAS_CHANGE_EVENT(element, CE_BY_COLLISION))
+ if (HAS_CHANGE_EVENT(element, CE_BY_PLAYER_OBSOLETE) ||
+ HAS_CHANGE_EVENT(element, CE_BY_COLLISION_OBSOLETE))
{
- SET_CHANGE_EVENT(element, CE_BY_PLAYER, FALSE);
- SET_CHANGE_EVENT(element, CE_BY_COLLISION, FALSE);
+ SET_CHANGE_EVENT(element, CE_BY_PLAYER_OBSOLETE, FALSE);
+ SET_CHANGE_EVENT(element, CE_BY_COLLISION_OBSOLETE, FALSE);
SET_CHANGE_EVENT(element, CE_BY_DIRECT_ACTION, TRUE);
}
freeSetupFileHash(setup_file_hash);
}
-static char *itoa(unsigned int i)
-{
- static char *a = NULL;
-
- if (a != NULL)
- free(a);
-
- if (i > 2147483647) /* yes, this is a kludge */
- i = 2147483647;
-
- a = checked_malloc(10 + 1);
-
- sprintf(a, "%d", i);
-
- return a;
-}
-
void LoadUserDefinedEditorElementList(int **elements, int *num_elements)
{
char *filename = getEditorSetupFilename();
element_hash = newSetupFileHash();
for (i = 0; i < NUM_FILE_ELEMENTS; i++)
- setHashEntry(element_hash, element_info[i].token_name, itoa(i));
+ setHashEntry(element_hash, element_info[i].token_name, i_to_a(i));
/* determined size may be larger than needed (due to unknown elements) */
*num_elements = 0;
new = &music_file_info;
+ printf("::: num_music == %d\n", num_music);
+
for (i = 0; i < num_music; i++)
{
music = getMusicListEntry(i);
+#if 0
+ printf("::: %d [%08x]\n", i, music->filename);
+#endif
+
+ if (music->filename == NULL)
+ continue;
+
if (strcmp(music->filename, UNDEFINED_FILENAME) == 0)
continue;
{
music = getMusicListEntry(i);
+ if (music->filename == NULL)
+ continue;
+
if (strcmp(basename, music->filename) == 0)
{
music_already_used = TRUE;
Error(ERR_RETURN_LINE, "-");
}
-#if 1
-
void LoadHelpAnimInfo()
{
char *filename = getHelpAnimFilename();
direction_hash = newSetupFileHash();
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
- setHashEntry(element_hash, element_info[i].token_name, itoa(i));
+ setHashEntry(element_hash, element_info[i].token_name, i_to_a(i));
for (i = 0; i < NUM_ACTIONS; i++)
setHashEntry(action_hash, element_action_info[i].suffix,
- itoa(element_action_info[i].value));
+ i_to_a(element_action_info[i].value));
/* do not store direction index (bit) here, but direction value! */
for (i = 0; i < NUM_DIRECTIONS; i++)
setHashEntry(direction_hash, element_direction_info[i].suffix,
- itoa(1 << element_direction_info[i].value));
+ i_to_a(1 << element_direction_info[i].value));
for (list = setup_file_list; list != NULL; list = list->next)
{
print_unknown_token_end(num_unknown_tokens);
- add_helpanim_entry(HELPANIM_LIST_END, -1, -1, -1, &num_list_entries);
-
- freeSetupFileList(setup_file_list);
- freeSetupFileHash(element_hash);
- freeSetupFileHash(action_hash);
- freeSetupFileHash(direction_hash);
-
-#if 0
- /* TEST ONLY */
- for (i = 0; i < num_list_entries; i++)
- printf("::: %d, %d, %d => %d\n",
- helpanim_info[i].element,
- helpanim_info[i].action,
- helpanim_info[i].direction,
- helpanim_info[i].delay);
-#endif
-}
-
-#else
-
-void LoadHelpAnimInfo()
-{
- char *filename = getHelpAnimFilename();
- SetupFileList *setup_file_list = NULL, *list;
- SetupFileHash *element_hash, *action_hash, *direction_hash;
- int num_list_entries = 0;
- int num_unknown_tokens = 0;
- int i;
-
- if (fileExists(filename))
- setup_file_list = loadSetupFileList(filename);
-
- if (setup_file_list == NULL)
- {
- /* use reliable default values from static configuration */
- SetupFileList *insert_ptr;
-
- insert_ptr = setup_file_list =
- newSetupFileList(helpanim_config[0].token,
- helpanim_config[0].value);
-
- for (i = 1; helpanim_config[i].token; i++)
- insert_ptr = addListEntry(insert_ptr,
- helpanim_config[i].token,
- helpanim_config[i].value);
- }
-
- element_hash = newSetupFileHash();
- action_hash = newSetupFileHash();
- direction_hash = newSetupFileHash();
-
- for (i = 0; i < MAX_NUM_ELEMENTS; i++)
- setHashEntry(element_hash, element_info[i].token_name, itoa(i));
-
- for (i = 0; i < NUM_ACTIONS; i++)
- setHashEntry(action_hash, element_action_info[i].suffix,
- itoa(element_action_info[i].value));
-
- /* do not store direction index (bit) here, but direction value! */
- for (i = 0; i < NUM_DIRECTIONS; i++)
- setHashEntry(direction_hash, element_direction_info[i].suffix,
- itoa(1 << element_direction_info[i].value));
-
- for (list = setup_file_list; list != NULL; list = list->next)
- {
- char *element_token, *action_token, *direction_token;
- char *element_value, *action_value, *direction_value;
- int delay = atoi(list->value);
-
- if (strcmp(list->token, "end") == 0)
- {
- add_helpanim_entry(HELPANIM_LIST_NEXT, -1, -1, -1, &num_list_entries);
-
- continue;
- }
-
- element_token = list->token;
- element_value = getHashEntry(element_hash, element_token);
-
- if (element_value != NULL)
- {
- /* element found */
- add_helpanim_entry(atoi(element_value), -1, -1, delay,&num_list_entries);
-
- continue;
- }
-
- if (strchr(element_token, '.') == NULL)
- {
- /* no further suffixes found -- this is not an element */
- print_unknown_token(filename, list->token, num_unknown_tokens++);
-
- continue;
- }
-
- action_token = strchr(element_token, '.');
- element_token = getStringCopy(element_token);
- *strchr(element_token, '.') = '\0';
-
- element_value = getHashEntry(element_hash, element_token);
-
- if (element_value == NULL)
- {
- /* this is not an element */
- print_unknown_token(filename, list->token, num_unknown_tokens++);
- free(element_token);
-
- continue;
- }
-
- action_value = getHashEntry(action_hash, action_token);
-
- if (action_value != NULL)
- {
- /* action found */
- add_helpanim_entry(atoi(element_value), atoi(action_value), -1, delay,
- &num_list_entries);
- free(element_token);
-
- continue;
- }
-
- direction_token = action_token;
- direction_value = getHashEntry(direction_hash, direction_token);
-
- if (direction_value != NULL)
- {
- /* direction found */
- add_helpanim_entry(atoi(element_value), -1, atoi(direction_value), delay,
- &num_list_entries);
- free(element_token);
-
- continue;
- }
-
- if (strchr(action_token + 1, '.') == NULL)
- {
- /* no further suffixes found -- this is not an action or direction */
- print_unknown_token(filename, list->token, num_unknown_tokens++);
- free(element_token);
-
- continue;
- }
-
- direction_token = strchr(action_token + 1, '.');
- action_token = getStringCopy(action_token);
- *strchr(action_token + 1, '.') = '\0';
-
- action_value = getHashEntry(action_hash, action_token);
-
- if (action_value == NULL)
- {
- /* this is not an action */
- print_unknown_token(filename, list->token, num_unknown_tokens++);
- free(element_token);
- free(action_token);
-
- continue;
- }
-
- direction_value = getHashEntry(direction_hash, direction_token);
-
- if (direction_value != NULL)
- {
- /* direction found */
- add_helpanim_entry(atoi(element_value), atoi(action_value),
- atoi(direction_value), delay, &num_list_entries);
- free(element_token);
- free(action_token);
-
- continue;
- }
-
- print_unknown_token(filename, list->token, num_unknown_tokens++);
-
- free(element_token);
- free(action_token);
- }
-
- print_unknown_token_end(num_unknown_tokens);
-
- add_helpanim_entry(HELPANIM_LIST_END, -1, -1, -1, &num_list_entries);
+ add_helpanim_entry(HELPANIM_LIST_NEXT, -1, -1, -1, &num_list_entries);
+ add_helpanim_entry(HELPANIM_LIST_END, -1, -1, -1, &num_list_entries);
freeSetupFileList(setup_file_list);
freeSetupFileHash(element_hash);
helpanim_info[i].delay);
#endif
}
-#endif
void LoadHelpTextInfo()
{