- this bug was caused by getFixedGraphicSource() always using 32x32 tile
size even if element graphic was defined using smaller tile size like
16x16, resulting in correct definitions to be assumed as out of bounds
- fixed by using getGraphicSourceXY() instead, which only uses width and
height attributes (which are set to the correct tile size for elements)
for (i = 0; i < num_images; i++)
{
for (i = 0; i < num_images; i++)
{
+ Bitmap *src_bitmap = graphic_info[i].bitmap;
int src_x, src_y;
int width, height;
int src_x, src_y;
int width, height;
- int first_frame, last_frame;
int src_bitmap_width, src_bitmap_height;
/* now check if no animation frames are outside of the loaded image */
int src_bitmap_width, src_bitmap_height;
/* now check if no animation frames are outside of the loaded image */
/* check if first animation frame is inside specified bitmap */
/* check if first animation frame is inside specified bitmap */
- first_frame = 0;
- getFixedGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
-
+ /* do not use getGraphicSourceXY() here to get position of first frame; */
/* this avoids calculating wrong start position for out-of-bounds frame */
src_x = graphic_info[i].src_x;
src_y = graphic_info[i].src_y;
/* this avoids calculating wrong start position for out-of-bounds frame */
src_x = graphic_info[i].src_x;
src_y = graphic_info[i].src_y;
Error(ERR_INFO_LINE, "-");
graphic_info[i] = graphic_info[fallback_graphic];
Error(ERR_INFO_LINE, "-");
graphic_info[i] = graphic_info[fallback_graphic];
+
+ /* if first frame out of bounds, do not check last frame anymore */
+ continue;
}
/* check if last animation frame is inside specified bitmap */
last_frame = graphic_info[i].anim_frames - 1;
}
/* check if last animation frame is inside specified bitmap */
last_frame = graphic_info[i].anim_frames - 1;
- getFixedGraphicSource(i, last_frame, &src_bitmap, &src_x, &src_y);
+ getGraphicSourceXY(i, last_frame, &src_x, &src_y, FALSE);
if (src_x < 0 || src_y < 0 ||
src_x + width > src_bitmap_width ||
if (src_x < 0 || src_y < 0 ||
src_x + width > src_bitmap_width ||