X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=bf79b048d344368bf064bbc992bf98a18c4cf301;hb=d781e40cf5aade94d6f4e80b98b0bf04cc880766;hp=e16a35ff097e77403277c32a0332220d99f0c679;hpb=fb0df571e1a4207bc756e73f7954e1ba05fa1fad;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index e16a35ff..bf79b048 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1490,12 +1490,21 @@ int getGraphicAnimationFrameXY(int graphic, int lx, int ly) 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; - int y = (ly + yoffset) % 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]); } @@ -2007,7 +2016,7 @@ void DrawScreenElementExt(int x, int y, int dx, int dy, int element, else // border element { graphic = el2img(element); - frame = getGraphicAnimationFrame(graphic, -1); + frame = getGraphicAnimationFrameXY(graphic, lx, ly); } if (element == EL_EXPANDABLE_WALL) @@ -3951,6 +3960,9 @@ void DrawLevelGraphicAnimationIfNeeded(int x, int y, int graphic) 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