+ {
+ Error(ERR_RETURN_LINE, "-");
+ Error(ERR_RETURN, "warning: error found in config file:");
+ Error(ERR_RETURN, "- config file: '%s'",
+ getImageConfigFilename());
+ Error(ERR_RETURN, "- config token: '%s'",
+ getTokenFromImageID(i));
+ Error(ERR_RETURN, "- image file: '%s'",
+ src_bitmap->source_filename);
+ Error(ERR_RETURN,
+ "error: last animation frame (%d) out of bounds (%d, %d)",
+ last_frame, src_x, src_y);
+ Error(ERR_RETURN, "custom graphic rejected for this element/action");
+
+ if (i == fallback_graphic)
+ Error(ERR_EXIT, "fatal error: no fallback graphic available");
+
+ Error(ERR_RETURN, "fallback done to 'char_exclam' for this graphic");
+ Error(ERR_RETURN_LINE, "-");
+
+ set_graphic_parameters(i, fallback_image->default_parameter);
+ graphic_info[i].bitmap = fallback_bitmap;
+ }
+
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
+ /* currently we need only a tile clip mask from the first frame */
+ getGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
+
+ if (copy_clipmask_gc == None)
+ {
+ clip_gc_values.graphics_exposures = False;
+ clip_gc_valuemask = GCGraphicsExposures;
+ copy_clipmask_gc = XCreateGC(display, src_bitmap->clip_mask,
+ clip_gc_valuemask, &clip_gc_values);
+ }
+
+ graphic_info[i].clip_mask =
+ XCreatePixmap(display, window->drawable, TILEX, TILEY, 1);
+
+ src_pixmap = src_bitmap->clip_mask;
+ XCopyArea(display, src_pixmap, graphic_info[i].clip_mask,
+ copy_clipmask_gc, src_x, src_y, TILEX, TILEY, 0, 0);
+
+ clip_gc_values.graphics_exposures = False;
+ clip_gc_values.clip_mask = graphic_info[i].clip_mask;
+ clip_gc_valuemask = GCGraphicsExposures | GCClipMask;
+
+ graphic_info[i].clip_gc =
+ XCreateGC(display, window->drawable, clip_gc_valuemask, &clip_gc_values);
+#endif
+ }
+
+#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
+ if (copy_clipmask_gc)
+ XFreeGC(display, copy_clipmask_gc);
+
+ clipmasks_initialized = TRUE;
+#endif
+}
+
+static void InitElementSoundInfo()
+{
+ struct PropertyMapping *property_mapping = getSoundListPropertyMapping();
+ int num_property_mappings = getSoundListPropertyMappingSize();
+ int i, j, act;
+
+ /* 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].sound[act] = -1;
+
+ /* initialize element/sound mapping from static configuration */
+ for (i=0; element_to_sound[i].element > -1; i++)
+ {
+ int element = element_to_sound[i].element;
+ int action = element_to_sound[i].action;
+ int sound = element_to_sound[i].sound;
+ boolean is_class = element_to_sound[i].is_class;
+
+ if (action < 0)
+ action = ACTION_DEFAULT;
+
+ if (!is_class)
+ 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)
+ element_info[j].sound[action] = sound;
+ }
+
+ /* initialize element/sound 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 sound = property_mapping[i].artwork_index;
+
+ if (element >= MAX_NUM_ELEMENTS)
+ continue;
+
+ if (action < 0)
+ action = ACTION_DEFAULT;
+
+ element_info[element].sound[action] = sound;
+ }
+
+ /* initialize element class/sound mapping from dynamic configuration */
+ for (i=0; i < num_property_mappings; i++)
+ {
+ int element_class = property_mapping[i].base_index - MAX_NUM_ELEMENTS;
+ int action = property_mapping[i].ext1_index;
+ int sound = property_mapping[i].artwork_index;
+
+ if (element_class < 0 || element_class >= MAX_NUM_ELEMENTS)
+ continue;
+
+ if (action < 0)
+ 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)
+ element_info[j].sound[action] = sound;
+ }
+
+ /* now set all '-1' values to element specific default values */
+ for (i=0; i<MAX_NUM_ELEMENTS; i++)
+ {
+ int default_action_sound = element_info[i].sound[ACTION_DEFAULT];
+
+ for (act=0; act < NUM_ACTIONS; act++)
+ {
+ /* no sound for this specific action -- use default action sound */
+ if (element_info[i].sound[act] == -1)
+ element_info[i].sound[act] = default_action_sound;
+ }