added optional button to restart game (door, panel and touch variants)
[rocksndiamonds.git] / src / game_mm / mm_init.c
index b3376a12a2fec3faabb34fd6d3883db58c66191b..b7dcbe35ebcfb424bacc353ca5164cbb728cbb8f 100644 (file)
@@ -4,7 +4,7 @@
 // (c) 1994-2017 by Artsoft Entertainment
 //                         Holger Schemel
 //                 info@artsoft.org
-//                 http://www.artsoft.org/
+//                 https://www.artsoft.org/
 // ----------------------------------------------------------------------------
 // mm_init.c
 // ============================================================================
 #include "mm_main.h"
 
 
+Bitmap *drawto_mm;
+
 struct EngineSnapshotInfo_MM engine_snapshot_mm;
 
 
+void InitGfxBuffers_MM(void)
+{
+  ReCreateBitmap(&drawto_mm, video.width, video.height);
+}
+
 unsigned int InitEngineRandom_MM(int seed)
 {
   return InitEngineRandom(seed);
 }
 
-void InitElementProperties_MM()
+void InitElementProperties_MM(void)
 {
-  int i,j;
+  int i, j;
 
   static int ep_grid[] =
   {
@@ -37,7 +44,7 @@ void InitElementProperties_MM()
     EL_GRID_WOOD_02,
     EL_GRID_WOOD_03,
   };
-  static int ep_grid_num = sizeof(ep_grid)/sizeof(int);
+  static int ep_grid_num = sizeof(ep_grid) / sizeof(int);
 
   static int ep_mcduffin[] =
   {
@@ -46,7 +53,7 @@ void InitElementProperties_MM()
     EL_MCDUFFIN_LEFT,
     EL_MCDUFFIN_DOWN,
   };
-  static int ep_mcduffin_num = sizeof(ep_mcduffin)/sizeof(int);
+  static int ep_mcduffin_num = sizeof(ep_mcduffin) / sizeof(int);
 
   static int ep_rectangle[] =
   {
@@ -59,7 +66,7 @@ void InitElementProperties_MM()
     EL_GATE_STONE,
     EL_GATE_WOOD
   };
-  static int ep_rectangle_num = sizeof(ep_rectangle)/sizeof(int);
+  static int ep_rectangle_num = sizeof(ep_rectangle) / sizeof(int);
 
   static int ep_mirror[] =
   {
@@ -80,7 +87,7 @@ void InitElementProperties_MM()
     EL_MIRROR_14,
     EL_MIRROR_15,
   };
-  static int ep_mirror_num = sizeof(ep_mirror)/sizeof(int);
+  static int ep_mirror_num = sizeof(ep_mirror) / sizeof(int);
 
   static int ep_mirror_fixed[] =
   {
@@ -89,7 +96,7 @@ void InitElementProperties_MM()
     EL_MIRROR_FIXED_02,
     EL_MIRROR_FIXED_03,
   };
-  static int ep_mirror_fixed_num = sizeof(ep_mirror_fixed)/sizeof(int);
+  static int ep_mirror_fixed_num = sizeof(ep_mirror_fixed) / sizeof(int);
 
   static int ep_polar[] =
   {
@@ -110,7 +117,7 @@ void InitElementProperties_MM()
     EL_POLAR_14,
     EL_POLAR_15,
   };
-  static int ep_polar_num = sizeof(ep_polar)/sizeof(int);
+  static int ep_polar_num = sizeof(ep_polar) / sizeof(int);
 
   static int ep_polar_cross[] =
   {
@@ -119,7 +126,7 @@ void InitElementProperties_MM()
     EL_POLAR_CROSS_02,
     EL_POLAR_CROSS_03,
   };
-  static int ep_polar_cross_num = sizeof(ep_polar_cross)/sizeof(int);
+  static int ep_polar_cross_num = sizeof(ep_polar_cross) / sizeof(int);
 
   static int ep_beamer[] =
   {
@@ -140,27 +147,27 @@ void InitElementProperties_MM()
     EL_BEAMER_14,
     EL_BEAMER_15,
   };
-  static int ep_beamer_num = sizeof(ep_beamer)/sizeof(int);
+  static int ep_beamer_num = sizeof(ep_beamer) / sizeof(int);
 
   static int ep_reflecting[] =
   {
   };
-  static int ep_reflecting_num = sizeof(ep_reflecting)/sizeof(int);
+  static int ep_reflecting_num = sizeof(ep_reflecting) / sizeof(int);
 
   static int ep_absorbing[] =
   {
   };
-  static int ep_absorbing_num = sizeof(ep_absorbing)/sizeof(int);
+  static int ep_absorbing_num = sizeof(ep_absorbing) / sizeof(int);
 
   static int ep_inactive[] =
   {
   };
-  static int ep_inactive_num = sizeof(ep_inactive)/sizeof(int);
+  static int ep_inactive_num = sizeof(ep_inactive) / sizeof(int);
 
   static int ep_wall[] =
   {
   };
-  static int ep_wall_num = sizeof(ep_wall)/sizeof(int);
+  static int ep_wall_num = sizeof(ep_wall) / sizeof(int);
 
   static int ep_pacman[] =
   {
@@ -169,7 +176,16 @@ void InitElementProperties_MM()
     EL_PACMAN_LEFT,
     EL_PACMAN_DOWN,
   };
-  static int ep_pacman_num = sizeof(ep_pacman)/sizeof(int);
+  static int ep_pacman_num = sizeof(ep_pacman) / sizeof(int);
+
+  static int ep_envelope[] =
+  {
+    EL_ENVELOPE_1,
+    EL_ENVELOPE_2,
+    EL_ENVELOPE_3,
+    EL_ENVELOPE_4,
+  };
+  static int ep_envelope_num = sizeof(ep_envelope) / sizeof(int);
 
   static long ep_bit[] =
   {
@@ -186,6 +202,7 @@ void InitElementProperties_MM()
     EP_BIT_INACTIVE,
     EP_BIT_WALL,
     EP_BIT_PACMAN,
+    EP_BIT_ENVELOPE,
   };
   static int *ep_array[] =
   {
@@ -202,6 +219,7 @@ void InitElementProperties_MM()
     ep_inactive,
     ep_wall,
     ep_pacman,
+    ep_envelope,
   };
   static int *ep_num[] =
   {
@@ -218,47 +236,25 @@ void InitElementProperties_MM()
     &ep_inactive_num,
     &ep_wall_num,
     &ep_pacman_num,
+    &ep_envelope_num,
   };
-  static int num_properties = sizeof(ep_num)/sizeof(int *);
+  static int num_properties = sizeof(ep_num) / sizeof(int *);
 
-  for(i=0; i<MAX_ELEMENTS; i++)
+  for (i = 0; i < MAX_ELEMENTS; i++)
     Elementeigenschaften[i] = 0;
 
-  for(i=0; i<num_properties; i++)
-    for(j=0; j<*(ep_num[i]); j++)
+  for (i = 0; i < num_properties; i++)
+    for (j = 0; j < *(ep_num[i]); j++)
       Elementeigenschaften[(ep_array[i])[j]] |= ep_bit[i];
 
-  for(i=EL_CHAR_START; i<=EL_CHAR_END; i++)
+  for (i = EL_CHAR_START; i <= EL_CHAR_END; i++)
     Elementeigenschaften[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
 
-  for(i=EL_WALL_START; i<=EL_WALL_END; i++)
+  for (i = EL_WALL_START; i <= EL_WALL_END; i++)
     Elementeigenschaften[i] |= EP_BIT_WALL;
 }
 
-void mm_open_all()
+void mm_open_all(void)
 {
   InitElementProperties_MM();
 }
-
-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);
-}