added graphics animation mode "random_static" (unchanged for each tile)
[rocksndiamonds.git] / src / tools.c
index 0271abfc43d83eb615b99fe8663df7cd83e0a5d5..bf79b048d344368bf064bbc992bf98a18c4cf301 100644 (file)
@@ -1496,6 +1496,15 @@ int getGraphicAnimationFrameXY(int graphic, int lx, int ly)
 
     return sync_frame % g->anim_frames;
   }
 
     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]);
 }
 
   return getGraphicAnimationFrame(graphic, GfxFrame[lx][ly]);
 }
@@ -3951,7 +3960,7 @@ void DrawLevelGraphicAnimationIfNeeded(int x, int y, int graphic)
   if (!IS_NEW_FRAME(GfxFrame[x][y], graphic))
     return;
 
   if (!IS_NEW_FRAME(GfxFrame[x][y], graphic))
     return;
 
-  if (ANIM_MODE(graphic) & ANIM_TILED)
+  if (ANIM_MODE(graphic) & (ANIM_TILED | ANIM_RANDOM_STATIC))
     return;
 
   DrawGraphicAnimation(sx, sy, graphic);
     return;
 
   DrawGraphicAnimation(sx, sy, graphic);