fixed updating tiled graphics only when needed
[rocksndiamonds.git] / src / tools.c
index e16a35ff097e77403277c32a0332220d99f0c679..0271abfc43d83eb615b99fe8663df7cd83e0a5d5 100644 (file)
@@ -1490,8 +1490,8 @@ 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;
@@ -2007,7 +2007,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 +3951,9 @@ void DrawLevelGraphicAnimationIfNeeded(int x, int y, int graphic)
   if (!IS_NEW_FRAME(GfxFrame[x][y], graphic))
     return;
 
+  if (ANIM_MODE(graphic) & ANIM_TILED)
+    return;
+
   DrawGraphicAnimation(sx, sy, graphic);
 
 #if 1