- Bitmap *src_bitmap = getBitmapFromImageID(i);
- int num_xtiles = (src_bitmap ? src_bitmap->width : TILEX) / TILEX;
- int num_ytiles = (src_bitmap ? src_bitmap->height * 2 / 3 : TILEY) / TILEY;
- int *parameter = image_files[i].parameter;
-
- graphic_info[i].bitmap = src_bitmap;
-
- graphic_info[i].src_x = parameter[GFX_ARG_XPOS] * TILEX;
- graphic_info[i].src_y = parameter[GFX_ARG_YPOS] * TILEY;
- graphic_info[i].offset_x = parameter[GFX_ARG_OFFSET];
- graphic_info[i].offset_y = 0;
-
- /* animation frames are ordered vertically instead of horizontally */
- if (parameter[GFX_ARG_VERTICAL])
- {
- graphic_info[i].offset_x = 0;
- graphic_info[i].offset_y = parameter[GFX_ARG_OFFSET];
- }
-
- /* optionally, the x and y offset of frames can be specified directly */
- if (parameter[GFX_ARG_XOFFSET] != GFX_ARG_UNDEFINED_VALUE)
- graphic_info[i].offset_x = parameter[GFX_ARG_XOFFSET];
- if (parameter[GFX_ARG_YOFFSET] != GFX_ARG_UNDEFINED_VALUE)
- graphic_info[i].offset_y = parameter[GFX_ARG_YOFFSET];
-
- /* automatically determine correct number of frames, if not defined */
- if (parameter[GFX_ARG_FRAMES] != GFX_ARG_UNDEFINED_VALUE)
- graphic_info[i].anim_frames = parameter[GFX_ARG_FRAMES];
- else if (parameter[GFX_ARG_XPOS] == 0 && !parameter[GFX_ARG_VERTICAL])
- graphic_info[i].anim_frames = num_xtiles;
- else if (parameter[GFX_ARG_YPOS] == 0 && parameter[GFX_ARG_VERTICAL])
- graphic_info[i].anim_frames = num_ytiles;
- else
- graphic_info[i].anim_frames = 1;
-
- graphic_info[i].anim_delay = parameter[GFX_ARG_DELAY];
- if (graphic_info[i].anim_delay == 0) /* delay must be at least 1 */
- graphic_info[i].anim_delay = 1;
-
- /* set mode for animation frame order */
- if (parameter[GFX_ARG_MODE_LOOP])
- graphic_info[i].anim_mode = ANIM_LOOP;
- else if (parameter[GFX_ARG_MODE_LINEAR])
- graphic_info[i].anim_mode = ANIM_LINEAR;
- else if (parameter[GFX_ARG_MODE_PINGPONG])
- graphic_info[i].anim_mode = ANIM_PINGPONG;
- else if (parameter[GFX_ARG_MODE_PINGPONG2])
- graphic_info[i].anim_mode = ANIM_PINGPONG2;
- else if (parameter[GFX_ARG_MODE_RANDOM])
- graphic_info[i].anim_mode = ANIM_RANDOM;
- else if (graphic_info[i].anim_frames > 1)
- graphic_info[i].anim_mode = ANIM_LOOP;
- else
- graphic_info[i].anim_mode = ANIM_NONE;
-
- /* set additional flag to play animation frames in reverse order */
- if (parameter[GFX_ARG_MODE_REVERSE])
- graphic_info[i].anim_mode |= ANIM_REVERSE;
-
- /* set first frame of animation after determining animation mode */
- graphic_info[i].anim_start_frame = parameter[GFX_ARG_START_FRAME];
-
- /* automatically determine correct start frame, if not defined */
- if (parameter[GFX_ARG_START_FRAME] == GFX_ARG_UNDEFINED_VALUE)
- graphic_info[i].anim_start_frame = 0;
- else if (graphic_info[i].anim_mode & ANIM_REVERSE)
- graphic_info[i].anim_start_frame =
- graphic_info[i].anim_frames - parameter[GFX_ARG_START_FRAME] - 1;
-
- /* animation synchronized with global frame counter, not move position */
- graphic_info[i].anim_global_sync = parameter[GFX_ARG_GLOBAL_SYNC];
-
- /* set global_sync for all animations with undefined "animation action" */
- if (parameter[GFX_ARG_GLOBAL_SYNC] == GFX_ARG_UNDEFINED_VALUE)
- graphic_info[i].anim_global_sync =
- (gfx_action[i] == GFX_ACTION_DEFAULT ? TRUE : FALSE);