fixed compiler warnings (after adding "-Wstrict-prototypes")
[rocksndiamonds.git] / src / game_em / tab_generate.c
index ff8ea4a7e1347603bd845991db7b40a104766365..c9b950e19fc74538295e884458f30fab643ebe91 100644 (file)
  * modify.
  */
 
-#include "tile.h"
-#include "display.h"
+#include "main_em.h"
 
 
-/* ---------------------------------------------------------------------- */
+/* ------------------------------------------------------------------------- */
 
 /* 0=stop 1=blank */
 int tile_blank[] =
@@ -69,7 +68,8 @@ int tile_android_move[] =
   TILE_MAX
 };
 
-/* ---------------------------------------------------------------------- */
+
+/* ------------------------------------------------------------------------- */
 
 /* explosions: special format */
 /* everything is initially filled with Xboom_1 */
@@ -152,7 +152,8 @@ int tile_explode[] =
   TILE_MAX                     /* up until here are dynamite explosions */
 };
 
-/* ---------------------------------------------------------------------- */
+
+/* ------------------------------------------------------------------------- */
 
 /* map the graphics file to internal tiles and animations
  *
@@ -306,7 +307,12 @@ int obj_map[] =
   Xsand_stoneout_1, 1,
   Xsand_stoneout_1, 0,
   -1,
+
+#if 0
+  /* use normal "Xblank" instead of explicit x==0, y==2 empty space graphic */
   Ynut_sB, 7,
+#endif
+
   -1,
   -1,
   Ynut_sB, 6,
@@ -4430,7 +4436,7 @@ unsigned short map_ttl[128];
 struct GraphicInfo_EM graphic_info_em_object[TILE_MAX][8];
 
 /* map player number, frames and action to graphic info */
-struct GraphicInfo_EM graphic_info_em_player[2][SPR_MAX][8];
+struct GraphicInfo_EM graphic_info_em_player[MAX_PLAYERS][SPR_MAX][8];
 
 void create_tab(int *invert, unsigned char *array)
 {
@@ -4447,7 +4453,7 @@ void create_tab(int *invert, unsigned char *array)
     array[i] = buffer[i];
 }
 
-void create_explode()
+void create_explode(void)
 {
   int i;
   int *tile = tile_explode;
@@ -4470,85 +4476,12 @@ void create_explode()
     tab_explode_dynamite[i] = buffer[i];
 }
 
-void create_obj()
+void create_obj(void)
 {
   int i, j;
   int *map = obj_map;
   int buffer[8][TILE_MAX];
 
-#if 0
-
-  int debug = 0;
-
-  for (i = 0; i < 8; i++)
-    for (j = 0; j < TILE_MAX; j++)
-      buffer[i][j] = 0;
-
-  for (i = 0; i < 64; i++)
-  {
-    for (;*map != -1; map += 2)
-    {
-      if (map[0] < 0 || map[0] >= TILE_MAX || map[1] < 0 || map[1] >= 8)
-      {
-       fprintf(stderr, "obj_map: bad tile (%d, %d) @ %d+%d\n",
-               map[0], map[1], i / 16, i % 16);
-       debug = 1;
-       continue;
-      }
-      buffer[map[1]][map[0]]++;
-    }
-    map++;
-  }
-
-  for (i = 0; i < 896; i++)
-  {
-    for (;*map != -1; map += 2)
-    {
-      if (map[0] < 0 || map[0] >= TILE_MAX || map[1] < 0 || map[1] >= 8)
-      {
-       fprintf(stderr, "obj_map: bad tile (%d, %d) @ %d\n", map[0], map[1], i);
-       debug = 1;
-       continue;
-      }
-      buffer[map[1]][map[0]]++;
-    }
-    map++;
-  }
-
-  for (i = 0; i < TILE_MAX; i++)
-  {
-    for (j = 0; j < 8; j++)
-    {
-      switch(buffer[j][i])
-      {
-        case 0:
-         fprintf(stderr, "obj_map: uninitialized (%d, %d)\n", i, j);
-         debug = 1;
-         break;
-        case 1:
-         break; /* good */
-        default:
-         fprintf(stderr, "obj_map: duplicate (%d, %d)\n", i, j);
-         debug = 1;
-         break;
-      }
-    }
-  }
-
-  if (sizeof(obj_map) / sizeof(*obj_map) != map - obj_map)
-  {
-    fprintf(stderr, "obj_map: bad end (%d != %d)\n",
-           sizeof(obj_map) / sizeof(*obj_map), map - obj_map);
-    debug = 1;
-  }
-
-  if (debug == 0)
-    fprintf(stderr, "obj_map: looks good, now disable debug code\n");
-
-  abort();
-
-#else
-
   for (i = 0; i < 8; i++)
     for (j = 0; j < TILE_MAX; j++)
       buffer[i][j] = Xblank;
@@ -4572,11 +4505,9 @@ void create_obj()
   for (i = 0; i < 8; i++)
     for (j = 0; j < TILE_MAX; j++)
       map_obj[i][j] = buffer[7 - i][j];
-
-#endif
 }
 
-void create_obj_graphics_info_em()
+void create_obj_graphics_info_em(void)
 {
   int i, j;
 
@@ -4597,13 +4528,22 @@ void create_obj_graphics_info_em()
       g->width = TILEX;
       g->height = TILEY;
 
+      g->crumbled_bitmap = NULL;
+      g->crumbled_src_x = 0;
+      g->crumbled_src_y = 0;
+      g->crumbled_border_size = 0;
+      g->crumbled_tile_size = 0;
+
+      g->has_crumbled_graphics = FALSE;
+      g->preserve_background = FALSE;
+
       /* create unique graphic identifier to decide if tile must be redrawn */
       g->unique_identifier = obj;
     }
   }
 }
 
-void create_spr()
+void create_spr(void)
 {
   int i, j, k;
   int *map = spr_map;
@@ -4624,18 +4564,18 @@ void create_spr()
        map_spr[i][j][k] = buffer[i][7 - j][k];
 }
 
-void create_spr_graphics_info_em()
+void create_spr_graphics_info_em(void)
 {
   int i, j, k;
 
-  for (i = 0; i < 2; i++)
+  for (i = 0; i < MAX_PLAYERS; i++)
   {
     for (j = 0; j < SPR_MAX; j++)
     {
       for (k = 0; k < 8; k++)
       {
        struct GraphicInfo_EM *g = &graphic_info_em_player[i][j][k];
-       int spr = map_spr[i][k][j];
+       int spr = map_spr[i % 2][k][j];
 
        g->bitmap = sprBitmap;
        g->src_x = (spr / 8) * TILEX;
@@ -4646,12 +4586,20 @@ void create_spr_graphics_info_em()
        g->dst_offset_y = 0;
        g->width = TILEX;
        g->height = TILEY;
+
+       g->has_crumbled_graphics = FALSE;
+       g->crumbled_bitmap = NULL;
+       g->crumbled_src_x = 0;
+       g->crumbled_src_y = 0;
+       g->crumbled_border_size = 0;
+
+       g->unique_identifier = 0;
       }
     }
   }
 }
 
-void tab_generate()
+void tab_generate(void)
 {
   create_tab(tile_blank, tab_blank);
   create_tab(tile_acid, tab_acid);
@@ -4662,7 +4610,7 @@ void tab_generate()
   create_spr();
 }
 
-void tab_generate_graphics_info_em()
+void tab_generate_graphics_info_em(void)
 {
   create_obj_graphics_info_em();
   create_spr_graphics_info_em();