removed warning when compiling for Windows platform
[rocksndiamonds.git] / src / tools.c
index 08f2cc1e56d4ceb22df90824ce61fcd9433b2423..ad4170e66870a4edcb676221742ee83b1051ab3d 100644 (file)
@@ -1496,6 +1496,15 @@ int getGraphicAnimationFrameXY(int graphic, int lx, int ly)
 
     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]);
 }
@@ -1987,6 +1996,9 @@ void DrawScreenElementExt(int x, int y, int dx, int dy, int element,
   int graphic;
   int frame;
 
+  if (element == EL_EMPTY)
+    element = GfxElementEmpty[lx][ly];
+
   if (IN_LEV_FIELD(lx, ly))
   {
     SetRandomAnimationValue(lx, ly);
@@ -3948,9 +3960,15 @@ void DrawLevelGraphicAnimationIfNeeded(int x, int y, int graphic)
   if (!IN_LEV_FIELD(x, y) || !IN_SCR_FIELD(sx, sy))
     return;
 
+  if (Tile[x][y] == EL_EMPTY)
+    graphic = el2img(GfxElementEmpty[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
@@ -9939,7 +9957,7 @@ static const unsigned __int64 epoch = ((unsigned __int64) 116444736000000000ULL)
  * Note: this function is not for Win32 high precision timing purpose. See
  * elapsed_time().
  */
-int gettimeofday_windows(struct timeval * tp, struct timezone * tzp)
+static int gettimeofday_windows(struct timeval * tp, struct timezone * tzp)
 {
   FILETIME    file_time;
   SYSTEMTIME  system_time;