added separate initial and runtime level structure definitions for EM engine
[rocksndiamonds.git] / src / game_em / input.c
index 3883bbda97a3bf0fadaf3ecda9eb4f75dd1c6d9d..7eccf546178f894186ff1f0e9240cbcc70708e9e 100644 (file)
@@ -8,7 +8,8 @@
 
 unsigned int RandomEM;
 
-struct LEVEL lev;
+struct CAVE cav;
+struct LOGIC lev;
 struct PLAYER ply[MAX_PLAYERS];
 
 extern int screen_x;
@@ -16,32 +17,35 @@ extern int screen_y;
 
 struct EngineSnapshotInfo_EM engine_snapshot_em;
 
-void game_init_vars(void)
+void game_init_random(void)
 {
-  int x, y;
-
   RandomEM = 1684108901;
+}
+
+void game_init_cave_buffers(void)
+{
+  int x, y;
 
-  for (y = 0; y < CAVE_HEIGHT; y++)
-    for (x = 0; x < CAVE_WIDTH; x++)
+  for (y = 0; y < CAVE_BUFFER_HEIGHT; y++)
+    for (x = 0; x < CAVE_BUFFER_WIDTH; x++)
       lev.cavebuf[x][y] = Zborder;
-  for (y = 0; y < CAVE_HEIGHT; y++)
-    for (x = 0; x < CAVE_WIDTH; x++)
+  for (y = 0; y < CAVE_BUFFER_HEIGHT; y++)
+    for (x = 0; x < CAVE_BUFFER_WIDTH; x++)
       lev.nextbuf[x][y] = Zborder;
-  for (y = 0; y < CAVE_HEIGHT; y++)
-    for (x = 0; x < CAVE_WIDTH; x++)
+  for (y = 0; y < CAVE_BUFFER_HEIGHT; y++)
+    for (x = 0; x < CAVE_BUFFER_WIDTH; x++)
       lev.drawbuf[x][y] = Zborder;
-  for (y = 0; y < CAVE_HEIGHT; y++)
-    for (x = 0; x < CAVE_WIDTH; x++)
+  for (y = 0; y < CAVE_BUFFER_HEIGHT; y++)
+    for (x = 0; x < CAVE_BUFFER_WIDTH; x++)
       lev.boombuf[x][y] = Xblank;
 
-  for (x = 0; x < CAVE_WIDTH; x++)
+  for (x = 0; x < CAVE_BUFFER_WIDTH; x++)
     lev.cavecol[x] = lev.cavebuf[x];
-  for (x = 0; x < CAVE_WIDTH; x++)
+  for (x = 0; x < CAVE_BUFFER_WIDTH; x++)
     lev.nextcol[x] = lev.nextbuf[x];
-  for (x = 0; x < CAVE_WIDTH; x++)
+  for (x = 0; x < CAVE_BUFFER_WIDTH; x++)
     lev.drawcol[x] = lev.drawbuf[x];
-  for (x = 0; x < CAVE_WIDTH; x++)
+  for (x = 0; x < CAVE_BUFFER_WIDTH; x++)
     lev.boomcol[x] = lev.boombuf[x];
 
   lev.cave = lev.cavecol;
@@ -79,13 +83,13 @@ void GameActions_EM(byte action[MAX_PLAYERS], boolean warp_mode)
 
   if (frame == 7)
   {
-    logic_1();
-    logic_2();
+    logic_players();
+    logic_objects();
   }
 
   if (frame == 6)
   {
-    logic_3();
+    logic_globals();
 
     UpdateGameDoorValues_EM();
   }