added handling 64-bit random value bug with old tapes in EM engine
[rocksndiamonds.git] / src / game.c
index 8c243a4954c3bbec07e28c79afa20bfbbc1cec21..ea44ebd1b295e0fbd134a548d6f12fd0d56b0cc9 100644 (file)
@@ -4,7 +4,7 @@
 // (c) 1995-2014 by Artsoft Entertainment
 //                         Holger Schemel
 //                 info@artsoft.org
-//                 http://www.artsoft.org/
+//                 https://www.artsoft.org/
 // ----------------------------------------------------------------------------
 // game.c
 // ============================================================================
@@ -1877,6 +1877,8 @@ static void InitField(int x, int y, boolean init_game)
     case EL_MOLE_RIGHT:
     case EL_MOLE_UP:
     case EL_MOLE_DOWN:
+    case EL_SPRING_LEFT:
+    case EL_SPRING_RIGHT:
       InitMovDir(x, y);
       break;
 
@@ -2865,12 +2867,12 @@ static void InitGameEngine(void)
     2.0.1
 
     Bug was fixed in version:
-    4.1.4.2
+    4.2.0.0
 
     Description:
     In version 2.0.1, a new run-time element "EL_AMOEBA_DROPPING" was added,
     but the property "can fall" was missing, which caused some levels to be
-    unsolvable. This was fixed in version 4.1.4.2.
+    unsolvable. This was fixed in version 4.2.0.0.
 
     Affected levels/tapes:
     An example for a tape that was fixed by this bugfix is tape 029 from the
@@ -2882,10 +2884,10 @@ static void InitGameEngine(void)
 
   boolean use_amoeba_dropping_cannot_fall_bug =
     ((game.engine_version >= VERSION_IDENT(2,0,1,0) &&
-      game.engine_version <= VERSION_IDENT(4,1,4,1)) ||
+      game.engine_version <  VERSION_IDENT(4,2,0,0)) ||
      (tape.playing &&
       tape.game_version >= VERSION_IDENT(2,0,1,0) &&
-      tape.game_version <= VERSION_IDENT(4,1,4,1)));
+      tape.game_version <  VERSION_IDENT(4,2,0,0)));
 
   /*
     Summary of bugfix/change:
@@ -2906,7 +2908,7 @@ static void InitGameEngine(void)
     The second condition is an exception from the above case and is needed for
     the special case of tapes recorded with game (not engine!) version 2.0.1 or
     above, but before it was known that this change would break tapes like the
-    above and was fixed in 4.1.4.2, so that the changed behaviour was active
+    above and was fixed in 4.2.0.0, so that the changed behaviour was active
     although the engine version while recording maybe was before 2.0.1. There
     are a lot of tapes that are affected by this exception, like tape 006 from
     the level set "rnd_conor_mancone".
@@ -2916,7 +2918,7 @@ static void InitGameEngine(void)
     (game.engine_version < VERSION_IDENT(2,0,1,0) &&
      !(tape.playing &&
        tape.game_version >= VERSION_IDENT(2,0,1,0) &&
-       tape.game_version <  VERSION_IDENT(4,1,4,2)));
+       tape.game_version <  VERSION_IDENT(4,2,0,0)));
 
   /*
     Summary of bugfix/change:
@@ -2988,11 +2990,17 @@ static void InitGameEngine(void)
   game_em.use_snap_key_bug =
     (game.engine_version < VERSION_IDENT(4,0,1,0));
 
-  game_em.use_old_explosions =
-    (game.engine_version < VERSION_IDENT(4,1,4,2));
+  game_em.use_random_bug =
+    (tape.property_bits & TAPE_PROPERTY_EM_RANDOM_BUG);
 
-  game_em.use_wrap_around =
-    (game.engine_version > VERSION_IDENT(4,1,4,1));
+  boolean use_old_em_engine = (game.engine_version < VERSION_IDENT(4,2,0,0));
+
+  game_em.use_old_explosions           = use_old_em_engine;
+  game_em.use_old_android              = use_old_em_engine;
+  game_em.use_old_push_elements                = use_old_em_engine;
+  game_em.use_old_push_into_acid       = use_old_em_engine;
+
+  game_em.use_wrap_around              = !use_old_em_engine;
 
   // --------------------------------------------------------------------------
 
@@ -3007,7 +3015,7 @@ static void InitGameEngine(void)
 
   // ---------- initialize special element properties -------------------------
 
-  // "EL_AMOEBA_DROPPING" missed property "can fall" between 2.0.1 and 4.1.4.1
+  // "EL_AMOEBA_DROPPING" missed property "can fall" in older game versions
   if (use_amoeba_dropping_cannot_fall_bug)
     SET_PROPERTY(EL_AMOEBA_DROPPING, EP_CAN_FALL, FALSE);
 
@@ -4489,6 +4497,12 @@ void InitMovDir(int x, int y)
       MovDir[x][y] = direction[2][element - EL_MOLE_LEFT];
       break;
 
+    case EL_SPRING_LEFT:
+    case EL_SPRING_RIGHT:
+      Feld[x][y] = EL_SPRING;
+      MovDir[x][y] = direction[2][element - EL_SPRING_LEFT];
+      break;
+
     default:
       if (IS_CUSTOM_ELEMENT(element))
       {