completed game engine snapshot values to save/load for MM game engine
authorHolger Schemel <info@artsoft.org>
Mon, 20 Nov 2017 20:05:28 +0000 (21:05 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 23 Mar 2018 22:21:16 +0000 (23:21 +0100)
src/game_mm/export.h
src/game_mm/mm_game.c
src/game_mm/mm_init.c

index f48cd4738eb8d28d20c51455eccb2c14d7088da0..65d2e3a5fe9bf8651cf5973219e7d49f123d83da 100644 (file)
@@ -185,6 +185,26 @@ struct GraphicInfo_MM
 struct EngineSnapshotInfo_MM
 {
   struct GameInfo_MM game_mm;
+
+  struct LaserInfo laser;
+
+  short Ur[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
+  short Hit[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
+  short Box[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
+  short Angle[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
+  short Frame[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
+
+  short LX,LY, XS,YS, ELX,ELY;
+  short CT,Ct;
+
+  int last_LX, last_LY, last_hit_mask;
+  int hold_x, hold_y;
+  int pacman_nr;
+
+  unsigned int rotate_delay;
+  unsigned int pacman_delay;
+  unsigned int energy_delay;
+  unsigned int overload_delay;
 };
 
 
index 0e9496e6c1fb8696ee6b92a23c40eaf176fa8486..19439a8427458bed53b19d0bb1660c514f0b9f38 100644 (file)
@@ -4192,3 +4192,94 @@ void RaiseScoreElement_MM(int element)
       break;
   }
 }
+
+
+/* ------------------------------------------------------------------------- */
+/* Mirror Magic game engine snapshot handling functions                      */
+/* ------------------------------------------------------------------------- */
+
+void SaveEngineSnapshotValues_MM(ListNode **buffers)
+{
+  int x, y;
+
+  engine_snapshot_mm.game_mm = game_mm;
+  engine_snapshot_mm.laser = laser;
+
+  for (x = 0; x < MAX_PLAYFIELD_WIDTH; x++)
+  {
+    for (y = 0; y < MAX_PLAYFIELD_HEIGHT; y++)
+    {
+      engine_snapshot_mm.Ur[x][y]    = Ur[x][y];
+      engine_snapshot_mm.Hit[x][y]   = Hit[x][y];
+      engine_snapshot_mm.Box[x][y]   = Box[x][y];
+      engine_snapshot_mm.Angle[x][y] = Angle[x][y];
+      engine_snapshot_mm.Frame[x][y] = Frame[x][y];
+    }
+  }
+
+  engine_snapshot_mm.LX = LX;
+  engine_snapshot_mm.LY = LY;
+  engine_snapshot_mm.XS = XS;
+  engine_snapshot_mm.YS = YS;
+  engine_snapshot_mm.ELX = ELX;
+  engine_snapshot_mm.ELY = ELY;
+  engine_snapshot_mm.CT = CT;
+  engine_snapshot_mm.Ct = Ct;
+
+  engine_snapshot_mm.last_LX = last_LX;
+  engine_snapshot_mm.last_LY = last_LY;
+  engine_snapshot_mm.last_hit_mask = last_hit_mask;
+  engine_snapshot_mm.hold_x = hold_x;
+  engine_snapshot_mm.hold_y = hold_y;
+  engine_snapshot_mm.pacman_nr = pacman_nr;
+
+  engine_snapshot_mm.rotate_delay = rotate_delay;
+  engine_snapshot_mm.pacman_delay = pacman_delay;
+  engine_snapshot_mm.energy_delay = energy_delay;
+  engine_snapshot_mm.overload_delay = overload_delay;
+}
+
+void LoadEngineSnapshotValues_MM()
+{
+  int x, y;
+
+  /* stored engine snapshot buffers already restored at this point */
+
+  game_mm = engine_snapshot_mm.game_mm;
+  laser   = engine_snapshot_mm.laser;
+
+  for (x = 0; x < MAX_PLAYFIELD_WIDTH; x++)
+  {
+    for (y = 0; y < MAX_PLAYFIELD_HEIGHT; y++)
+    {
+      Ur[x][y]    = engine_snapshot_mm.Ur[x][y];
+      Hit[x][y]   = engine_snapshot_mm.Hit[x][y];
+      Box[x][y]   = engine_snapshot_mm.Box[x][y];
+      Angle[x][y] = engine_snapshot_mm.Angle[x][y];
+      Frame[x][y] = engine_snapshot_mm.Frame[x][y];
+    }
+  }
+
+  LX  = engine_snapshot_mm.LX;
+  LY  = engine_snapshot_mm.LY;
+  XS  = engine_snapshot_mm.XS;
+  YS  = engine_snapshot_mm.YS;
+  ELX = engine_snapshot_mm.ELX;
+  ELY = engine_snapshot_mm.ELY;
+  CT  = engine_snapshot_mm.CT;
+  Ct  = engine_snapshot_mm.Ct;
+
+  last_LX       = engine_snapshot_mm.last_LX;
+  last_LY       = engine_snapshot_mm.last_LY;
+  last_hit_mask = engine_snapshot_mm.last_hit_mask;
+  hold_x        = engine_snapshot_mm.hold_x;
+  hold_y        = engine_snapshot_mm.hold_y;
+  pacman_nr     = engine_snapshot_mm.pacman_nr;
+
+  rotate_delay   = engine_snapshot_mm.rotate_delay;
+  pacman_delay   = engine_snapshot_mm.pacman_delay;
+  energy_delay   = engine_snapshot_mm.energy_delay;
+  overload_delay = engine_snapshot_mm.overload_delay;
+
+  RedrawPlayfield_MM(TRUE);
+}
index 85bf271ad120372ad2f7fd4bc9baef8bac178385..73ab232dc4a2fc9072f568eda0619f408f2e86c4 100644 (file)
@@ -243,22 +243,3 @@ void mm_open_all()
 void mm_close_all()
 {
 }
-
-
-/* ------------------------------------------------------------------------- */
-/* Mirror Magic game engine snapshot handling functions                      */
-/* ------------------------------------------------------------------------- */
-
-void SaveEngineSnapshotValues_MM(ListNode **buffers)
-{
-  engine_snapshot_mm.game_mm = game_mm;
-}
-
-void LoadEngineSnapshotValues_MM()
-{
-  /* stored engine snapshot buffers already restored at this point */
-
-  game_mm = engine_snapshot_mm.game_mm;
-
-  RedrawPlayfield_MM(TRUE);
-}