added separate playfield and buffer sizes for EM engine caves
[rocksndiamonds.git] / src / game_em / graphics.c
index 1ba8c511eed1263cfbfad8da728d3c2b898a985b..548b24db1c7e29680e687fa64fa1b9673665e04d 100644 (file)
@@ -109,7 +109,7 @@ void BackToFront_EM(void)
 
 static struct GraphicInfo_EM *getObjectGraphic(int x, int y)
 {
-  int tile = Draw[x][y];
+  int tile = lev.draw[x][y];
   struct GraphicInfo_EM *g = &graphic_info_em_object[tile][frame];
 
   if (!game.use_native_emc_graphics_engine)
@@ -300,10 +300,10 @@ static void animscreen(void)
   };
 
   if (!game.use_native_emc_graphics_engine)
-    for (y = 2; y < EM_MAX_CAVE_HEIGHT - 2; y++)
-      for (x = 2; x < EM_MAX_CAVE_WIDTH - 2; x++)
-       SetGfxAnimation_EM(&graphic_info_em_object[Draw[x][y]][frame],
-                          Draw[x][y], 7 - frame, x - 2, y - 2);
+    for (y = 2; y < CAVE_BUFFER_HEIGHT - 2; y++)
+      for (x = 2; x < CAVE_BUFFER_WIDTH - 2; x++)
+       SetGfxAnimation_EM(&graphic_info_em_object[lev.draw[x][y]][frame],
+                          lev.draw[x][y], 7 - frame, x - 2, y - 2);
 
   for (y = top; y < top + MAX_BUF_YSIZE; y++)
   {
@@ -311,7 +311,7 @@ static void animscreen(void)
     {
       int sx = x % MAX_BUF_XSIZE;
       int sy = y % MAX_BUF_YSIZE;    
-      int tile = Draw[x][y];
+      int tile = lev.draw[x][y];
       struct GraphicInfo_EM *g = &graphic_info_em_object[tile][frame];
       int obj = g->unique_identifier;
       int crm = 0;
@@ -326,11 +326,11 @@ static void animscreen(void)
          int yy = y + xy[i][1];
          int tile_next;
 
-         if (xx < 0 || xx >= EM_MAX_CAVE_WIDTH ||
-             yy < 0 || yy >= EM_MAX_CAVE_HEIGHT)
+         if (xx < 0 || xx >= CAVE_BUFFER_WIDTH ||
+             yy < 0 || yy >= CAVE_BUFFER_HEIGHT)
            continue;
 
-         tile_next = Draw[xx][yy];
+         tile_next = lev.draw[xx][yy];
 
          if (!graphic_info_em_object[tile_next][frame].has_crumbled_graphics)
            crm |= (1 << i);