- if (g->anim_frames == 1)
- g->anim_mode = ANIM_NONE;
-#endif
-
- /* automatically determine correct start frame, if not defined */
- if (parameter[GFX_ARG_START_FRAME] == ARG_UNDEFINED_VALUE)
- g->anim_start_frame = 0;
- else if (g->anim_mode & ANIM_REVERSE)
- g->anim_start_frame = g->anim_frames - parameter[GFX_ARG_START_FRAME] - 1;
- else
- g->anim_start_frame = parameter[GFX_ARG_START_FRAME];
-
- /* animation synchronized with global frame counter, not move position */
- g->anim_global_sync = parameter[GFX_ARG_GLOBAL_SYNC];
-
- /* optional element for cloning crumble graphics */
- if (parameter[GFX_ARG_CRUMBLED_LIKE] != ARG_UNDEFINED_VALUE)
- g->crumbled_like = parameter[GFX_ARG_CRUMBLED_LIKE];
-
- /* optional element for cloning digging graphics */
- if (parameter[GFX_ARG_DIGGABLE_LIKE] != ARG_UNDEFINED_VALUE)
- g->diggable_like = parameter[GFX_ARG_DIGGABLE_LIKE];
-
- /* optional border size for "crumbling" diggable graphics */
- if (parameter[GFX_ARG_BORDER_SIZE] != ARG_UNDEFINED_VALUE)
- g->border_size = parameter[GFX_ARG_BORDER_SIZE];
-
- /* this is only used for player "boring" and "sleeping" actions */
- if (parameter[GFX_ARG_ANIM_DELAY_FIXED] != ARG_UNDEFINED_VALUE)
- g->anim_delay_fixed = parameter[GFX_ARG_ANIM_DELAY_FIXED];
- if (parameter[GFX_ARG_ANIM_DELAY_RANDOM] != ARG_UNDEFINED_VALUE)
- g->anim_delay_random = parameter[GFX_ARG_ANIM_DELAY_RANDOM];
- if (parameter[GFX_ARG_POST_DELAY_FIXED] != ARG_UNDEFINED_VALUE)
- g->post_delay_fixed = parameter[GFX_ARG_POST_DELAY_FIXED];
- if (parameter[GFX_ARG_POST_DELAY_RANDOM] != ARG_UNDEFINED_VALUE)
- g->post_delay_random = parameter[GFX_ARG_POST_DELAY_RANDOM];
-
- /* this is only used for toon animations */
- g->step_offset = parameter[GFX_ARG_STEP_OFFSET];
- g->step_delay = parameter[GFX_ARG_STEP_DELAY];
-
- /* this is only used for drawing font characters */
- g->draw_xoffset = parameter[GFX_ARG_DRAW_XOFFSET];
- g->draw_yoffset = parameter[GFX_ARG_DRAW_YOFFSET];
-
- /* this is only used for drawing envelope graphics */
- g->draw_masked = parameter[GFX_ARG_DRAW_MASKED];
-
- /* optional graphic for cloning all graphics settings */
- if (parameter[GFX_ARG_CLONE_FROM] != ARG_UNDEFINED_VALUE)
- g->clone_from = parameter[GFX_ARG_CLONE_FROM];
-
- /* optional settings for drawing title screens and title messages */
- if (parameter[GFX_ARG_FADE_MODE] != ARG_UNDEFINED_VALUE)
- g->fade_mode = parameter[GFX_ARG_FADE_MODE];
- if (parameter[GFX_ARG_FADE_DELAY] != ARG_UNDEFINED_VALUE)
- g->fade_delay = parameter[GFX_ARG_FADE_DELAY];
- if (parameter[GFX_ARG_POST_DELAY] != ARG_UNDEFINED_VALUE)
- g->post_delay = parameter[GFX_ARG_POST_DELAY];
- if (parameter[GFX_ARG_AUTO_DELAY] != ARG_UNDEFINED_VALUE)
- g->auto_delay = parameter[GFX_ARG_AUTO_DELAY];
- if (parameter[GFX_ARG_ALIGN] != ARG_UNDEFINED_VALUE)
- g->align = parameter[GFX_ARG_ALIGN];
- if (parameter[GFX_ARG_VALIGN] != ARG_UNDEFINED_VALUE)
- g->valign = parameter[GFX_ARG_VALIGN];
- if (parameter[GFX_ARG_SORT_PRIORITY] != ARG_UNDEFINED_VALUE)
- g->sort_priority = parameter[GFX_ARG_SORT_PRIORITY];
-}
-
-static void set_graphic_parameters(int graphic)
-{
-#if 1
- struct FileInfo *image = getImageListEntryFromImageID(graphic);
- char **parameter_raw = image->parameter;
- Bitmap *src_bitmap = getBitmapFromImageID(graphic);
- int parameter[NUM_GFX_ARGS];
- int i;
-
- /* if fallback to default artwork is done, also use the default parameters */
- if (image->fallback_to_default)
- parameter_raw = image->default_parameter;
-
- /* get integer values from string parameters */
- for (i = 0; i < NUM_GFX_ARGS; i++)
- parameter[i] = get_graphic_parameter_value(parameter_raw[i],
- image_config_suffix[i].token,
- image_config_suffix[i].type);
-
- set_graphic_parameters_ext(graphic, parameter, src_bitmap);
-
-#else
-
- struct FileInfo *image = getImageListEntryFromImageID(graphic);
- char **parameter_raw = image->parameter;
- Bitmap *src_bitmap = getBitmapFromImageID(graphic);
- int parameter[NUM_GFX_ARGS];
- int anim_frames_per_row = 1, anim_frames_per_col = 1;
- int anim_frames_per_line = 1;
- int i;
-
- /* if fallback to default artwork is done, also use the default parameters */
- if (image->fallback_to_default)
- parameter_raw = image->default_parameter;
-
- /* get integer values from string parameters */
- for (i = 0; i < NUM_GFX_ARGS; i++)
- parameter[i] = get_graphic_parameter_value(parameter_raw[i],
- image_config_suffix[i].token,
- image_config_suffix[i].type);
-
- graphic_info[graphic].bitmap = src_bitmap;
-
- /* always start with reliable default values */
- graphic_info[graphic].src_image_width = 0;
- graphic_info[graphic].src_image_height = 0;
- graphic_info[graphic].src_x = 0;
- graphic_info[graphic].src_y = 0;
- graphic_info[graphic].width = TILEX; /* default for element graphics */
- graphic_info[graphic].height = TILEY; /* default for element graphics */
- graphic_info[graphic].offset_x = 0; /* one or both of these values ... */
- graphic_info[graphic].offset_y = 0; /* ... will be corrected later */
- graphic_info[graphic].offset2_x = 0; /* one or both of these values ... */
- graphic_info[graphic].offset2_y = 0; /* ... will be corrected later */
- graphic_info[graphic].swap_double_tiles = -1; /* auto-detect tile swapping */
- graphic_info[graphic].crumbled_like = -1; /* do not use clone element */
- graphic_info[graphic].diggable_like = -1; /* do not use clone element */
- graphic_info[graphic].border_size = TILEX / 8; /* "CRUMBLED" border size */
- graphic_info[graphic].scale_up_factor = 1; /* default: no scaling up */
- graphic_info[graphic].clone_from = -1; /* do not use clone graphic */
- graphic_info[graphic].anim_delay_fixed = 0;
- graphic_info[graphic].anim_delay_random = 0;
- graphic_info[graphic].post_delay_fixed = 0;
- graphic_info[graphic].post_delay_random = 0;
- graphic_info[graphic].fade_mode = FADE_MODE_DEFAULT;
- graphic_info[graphic].fade_delay = -1;
- graphic_info[graphic].post_delay = -1;
- graphic_info[graphic].auto_delay = -1;
- graphic_info[graphic].align = ALIGN_CENTER; /* default for title screens */
- graphic_info[graphic].valign = VALIGN_MIDDLE; /* default for title screens */
- graphic_info[graphic].sort_priority = 0; /* default for title screens */
-
-#if 1
- /* optional zoom factor for scaling up the image to a larger size */
- if (parameter[GFX_ARG_SCALE_UP_FACTOR] != ARG_UNDEFINED_VALUE)
- graphic_info[graphic].scale_up_factor = parameter[GFX_ARG_SCALE_UP_FACTOR];
- if (graphic_info[graphic].scale_up_factor < 1)
- graphic_info[graphic].scale_up_factor = 1; /* no scaling */