+ // always start with reliable default values (no global animation sounds)
+ for (i = 0; i < NUM_GLOBAL_ANIM_TOKENS; i++)
+ for (j = 0; j < NUM_GLOBAL_ANIM_PARTS_ALL; j++)
+ for (k = 0; k < NUM_SPECIAL_GFX_ARGS; k++)
+ global_anim_info[i].sound[j][k] = SND_UNDEFINED;
+
+ // initialize global animation sound definitions from dynamic configuration
+ for (i = 0; i < num_property_mappings; i++)
+ {
+ int anim_nr = property_mapping[i].base_index - 2 * MAX_NUM_ELEMENTS;
+ int part_nr = property_mapping[i].ext1_index - ACTION_PART_1;
+ int special = property_mapping[i].ext3_index;
+ int sound = property_mapping[i].artwork_index;
+
+ // sound uses control definition; map it to position of graphic (artwork)
+ anim_nr -= GLOBAL_ANIM_ID_CONTROL_FIRST;
+
+ if (anim_nr < 0 || anim_nr >= NUM_GLOBAL_ANIM_TOKENS)
+ continue;
+
+ // set animation part to base part, if not specified
+ if (!IS_GLOBAL_ANIM_PART(part_nr))
+ part_nr = GLOBAL_ANIM_ID_PART_BASE;
+
+ // set animation screen to default, if not specified
+ if (!IS_SPECIAL_GFX_ARG(special))
+ special = GFX_SPECIAL_ARG_DEFAULT;
+
+ global_anim_info[anim_nr].sound[part_nr][special] = sound;
+ }
+
+#if 0
+ for (i = 0; i < NUM_GLOBAL_ANIMS; i++)
+ for (j = 0; j < NUM_GLOBAL_ANIM_PARTS_ALL; j++)
+ for (k = 0; k < NUM_SPECIAL_GFX_ARGS; k++)
+ if (global_anim_info[i].sound[j][k] != SND_UNDEFINED)
+ Debug("init:InitGlobalAnimSoundInfo",
+ "anim %d, part %d, mode %d => %d",
+ i, j, k, global_anim_info[i].sound[j][k]);
+#endif
+}
+
+static void InitGlobalAnimMusicInfo(void)
+{
+ struct PropertyMapping *property_mapping = getMusicListPropertyMapping();
+ int num_property_mappings = getMusicListPropertyMappingSize();
+ int i, j, k;
+
+ // always start with reliable default values (no global animation music)
+ for (i = 0; i < NUM_GLOBAL_ANIM_TOKENS; i++)
+ for (j = 0; j < NUM_GLOBAL_ANIM_PARTS_ALL; j++)
+ for (k = 0; k < NUM_SPECIAL_GFX_ARGS; k++)
+ global_anim_info[i].music[j][k] = MUS_UNDEFINED;
+
+ // initialize global animation music definitions from dynamic configuration
+ for (i = 0; i < num_property_mappings; i++)
+ {
+ int anim_nr = property_mapping[i].base_index - NUM_MUSIC_PREFIXES;
+ int part_nr = property_mapping[i].ext1_index - ACTION_PART_1;
+ int special = property_mapping[i].ext2_index;
+ int music = property_mapping[i].artwork_index;
+
+ // music uses control definition; map it to position of graphic (artwork)
+ anim_nr -= GLOBAL_ANIM_ID_CONTROL_FIRST;
+
+ if (anim_nr < 0 || anim_nr >= NUM_GLOBAL_ANIM_TOKENS)
+ continue;
+
+ // set animation part to base part, if not specified
+ if (!IS_GLOBAL_ANIM_PART(part_nr))
+ part_nr = GLOBAL_ANIM_ID_PART_BASE;
+
+ // set animation screen to default, if not specified
+ if (!IS_SPECIAL_GFX_ARG(special))
+ special = GFX_SPECIAL_ARG_DEFAULT;
+
+ global_anim_info[anim_nr].music[part_nr][special] = music;
+ }
+
+#if 0
+ for (i = 0; i < NUM_GLOBAL_ANIMS; i++)
+ for (j = 0; j < NUM_GLOBAL_ANIM_PARTS_ALL; j++)
+ for (k = 0; k < NUM_SPECIAL_GFX_ARGS; k++)
+ if (global_anim_info[i].music[j][k] != MUS_UNDEFINED)
+ Debug("init:InitGlobalAnimMusicInfo",
+ "anim %d, part %d, mode %d => %d",
+ i, j, k, global_anim_info[i].music[j][k]);
+#endif
+}
+
+static void InitElementGraphicInfo(void)
+{
+ struct PropertyMapping *property_mapping = getImageListPropertyMapping();
+ int num_property_mappings = getImageListPropertyMappingSize();
+ int i, act, dir;
+
+ if (graphic_info == NULL) // still at startup phase
+ return;
+
+ // set values to -1 to identify later as "uninitialized" values
+ for (i = 0; i < MAX_NUM_ELEMENTS; i++)
+ {
+ for (act = 0; act < NUM_ACTIONS; act++)
+ {
+ element_info[i].graphic[act] = -1;
+ element_info[i].crumbled[act] = -1;
+
+ for (dir = 0; dir < NUM_DIRECTIONS_FULL; dir++)
+ {
+ element_info[i].direction_graphic[act][dir] = -1;
+ element_info[i].direction_crumbled[act][dir] = -1;
+ }
+ }
+ }
+
+ UPDATE_BUSY_STATE();
+
+ // initialize normal element/graphic mapping from static configuration
+ for (i = 0; element_to_graphic[i].element > -1; i++)
+ {
+ int element = element_to_graphic[i].element;
+ int action = element_to_graphic[i].action;
+ int direction = element_to_graphic[i].direction;
+ boolean crumbled = element_to_graphic[i].crumbled;
+ int graphic = element_to_graphic[i].graphic;
+ int base_graphic = el2baseimg(element);
+
+ if (graphic_info[graphic].bitmap == NULL)
+ continue;
+
+ if ((action > -1 || direction > -1 || crumbled == TRUE) &&
+ base_graphic != -1)
+ {
+ boolean base_redefined =
+ getImageListEntryFromImageID(base_graphic)->redefined;
+ boolean act_dir_redefined =
+ getImageListEntryFromImageID(graphic)->redefined;
+
+ /* if the base graphic ("emerald", for example) has been redefined,
+ but not the action graphic ("emerald.falling", for example), do not
+ use an existing (in this case considered obsolete) action graphic
+ anymore, but use the automatically determined default graphic */
+ if (base_redefined && !act_dir_redefined)
+ continue;
+ }
+
+ if (action < 0)
+ action = ACTION_DEFAULT;
+
+ if (crumbled)
+ {
+ if (direction > -1)
+ element_info[element].direction_crumbled[action][direction] = graphic;
+ else
+ element_info[element].crumbled[action] = graphic;
+ }
+ else
+ {
+ if (direction > -1)
+ element_info[element].direction_graphic[action][direction] = graphic;
+ else
+ element_info[element].graphic[action] = graphic;
+ }
+ }
+
+ // initialize normal element/graphic mapping from dynamic configuration
+ for (i = 0; i < num_property_mappings; i++)
+ {
+ int element = property_mapping[i].base_index;
+ int action = property_mapping[i].ext1_index;
+ int direction = property_mapping[i].ext2_index;
+ int special = property_mapping[i].ext3_index;
+ int graphic = property_mapping[i].artwork_index;
+ boolean crumbled = FALSE;
+
+ if (special == GFX_SPECIAL_ARG_CRUMBLED)
+ {
+ special = -1;
+ crumbled = TRUE;
+ }
+
+ if (graphic_info[graphic].bitmap == NULL)
+ continue;