sync_frame);
}
+int getGraphicAnimationFrameXY(int graphic, int lx, int ly)
+{
+ if (graphic_info[graphic].anim_mode & ANIM_TILED)
+ {
+ struct GraphicInfo *g = &graphic_info[graphic];
+ int xsize = MAX(1, g->anim_frames_per_line);
+ int ysize = MAX(1, g->anim_frames / xsize);
+ int xoffset = g->anim_start_frame % xsize;
+ int yoffset = g->anim_start_frame % ysize;
+ int x = (lx + xoffset + xsize) % xsize;
+ int y = (ly + yoffset + ysize) % ysize;
+ int sync_frame = y * xsize + x;
+
+ return sync_frame % g->anim_frames;
+ }
+ else if (graphic_info[graphic].anim_mode & ANIM_RANDOM_STATIC)
+ {
+ struct GraphicInfo *g = &graphic_info[graphic];
+ int x = (lx + lev_fieldx) % lev_fieldx;
+ int y = (ly + lev_fieldy) % lev_fieldy;
+ int sync_frame = GfxRandomStatic[x][y];
+
+ return sync_frame % g->anim_frames;
+ }
+
+ return getGraphicAnimationFrame(graphic, GfxFrame[lx][ly]);
+}
+
void getGraphicSourceBitmap(int graphic, int tilesize, Bitmap **bitmap)
{
struct GraphicInfo *g = &graphic_info[graphic];
int graphic;
int frame;
+ if (element == EL_EMPTY)
+ element = GfxElementEmpty[lx][ly];
+
if (IN_LEV_FIELD(lx, ly))
{
SetRandomAnimationValue(lx, ly);
graphic = el_act_dir2img(element, GfxAction[lx][ly], GfxDir[lx][ly]);
- frame = getGraphicAnimationFrame(graphic, GfxFrame[lx][ly]);
+ frame = getGraphicAnimationFrameXY(graphic, lx, ly);
// do not use double (EM style) movement graphic when not moving
if (graphic_info[graphic].double_movement && !dx && !dy)
{
graphic = el_act_dir2img(element, ACTION_DEFAULT, GfxDir[lx][ly]);
- frame = getGraphicAnimationFrame(graphic, GfxFrame[lx][ly]);
+ frame = getGraphicAnimationFrameXY(graphic, lx, ly);
}
if (game.use_masked_elements && (dx || dy))
else // border element
{
graphic = el2img(element);
- frame = getGraphicAnimationFrame(graphic, -1);
+ frame = getGraphicAnimationFrameXY(graphic, lx, ly);
}
if (element == EL_EXPANDABLE_WALL)
if (game.use_masked_elements)
{
int graphic0 = el2img(EL_EMPTY);
- int frame0 = getGraphicAnimationFrame(graphic0, GfxFrame[x][y]);
+ int frame0 = getGraphicAnimationFrameXY(graphic0, x, y);
Bitmap *src_bitmap0;
int src_x0, src_y0;
// only needed when using masked elements
int graphic0 = el2img(EL_EMPTY);
- int frame0 = getGraphicAnimationFrame(graphic0, GfxFrame[x][y]);
+ int frame0 = getGraphicAnimationFrameXY(graphic0, x, y);
Bitmap *src_bitmap0;
int src_x0, src_y0;
}
static void DrawGraphicAnimationExt(DrawBuffer *dst_bitmap, int x, int y,
- int graphic, int sync_frame,
+ int graphic, int lx, int ly,
int mask_mode)
{
- int frame = getGraphicAnimationFrame(graphic, sync_frame);
+ int frame = getGraphicAnimationFrameXY(graphic, lx, ly);
if (mask_mode == USE_MASKING)
DrawGraphicThruMaskExt(dst_bitmap, x, y, graphic, frame);
}
DrawGraphicAnimationExt(drawto_field, FX + x * TILEX_VAR, FY + y * TILEY_VAR,
- graphic, GfxFrame[lx][ly], mask_mode);
+ graphic, lx, ly, mask_mode);
MarkTileDirty(x, y);
}
}
DrawGraphicAnimationExt(drawto_field, FX + x * TILEX, FY + y * TILEY,
- graphic, GfxFrame[lx][ly], mask_mode);
+ graphic, lx, ly, mask_mode);
MarkTileDirty(x, y);
}
if (!IS_NEW_FRAME(GfxFrame[x][y], graphic))
return;
+ if (ANIM_MODE(graphic) & (ANIM_TILED | ANIM_RANDOM_STATIC))
+ return;
+
DrawGraphicAnimation(sx, sy, graphic);
#if 1
if (IS_ACTIVE_BOMB(element))
{
int graphic = el2img(element);
- int frame = getGraphicAnimationFrame(graphic, GfxFrame[jx][jy]);
+ int frame = getGraphicAnimationFrameXY(graphic, jx, jy);
if (game.emulation == EMU_SUPAPLEX)
DrawGraphic(sx, sy, IMG_SP_DISK_RED, frame);