removed options to prevent initial rolling objects in native EM levels
authorHolger Schemel <info@artsoft.org>
Sun, 19 Jan 2020 13:02:51 +0000 (14:02 +0100)
committerHolger Schemel <info@artsoft.org>
Tue, 19 May 2020 16:12:55 +0000 (18:12 +0200)
When reading, converting and playing native Emerald Mine levels,
always allow initial rolling objects now. Compile-time switches
to deactivate this behaviour have been removed now. (A special
switch to handle rolling springs when playing has been kept.)

src/game_em/convert.c
src/game_em/emerald.h
src/game_em/synchro_2.c
src/game_em/tab_generate.c
src/tools.c

index d8157a695b748d521fb34d5969d7fa8a6a5a6fdc..d009b7403927b71c14b99724aad89b1e25f8ef45 100644 (file)
@@ -11,8 +11,6 @@
 #include "main_em.h"
 
 
 #include "main_em.h"
 
 
-#define ALLOW_ROLLING_SPRING
-
 static unsigned char remap_v6[256] =
 {
   /* filter crap for v6 */
 static unsigned char remap_v6[256] =
 {
   /* filter crap for v6 */
@@ -22,11 +20,7 @@ static unsigned char remap_v6[256] =
   0,16,2,18,       36,37,37,37,     40,41,42,43,     44,45,128,128,
   128,148,148,     148,45,45,45,    148,0,57,58,     59,60,61,62,63,
 
   0,16,2,18,       36,37,37,37,     40,41,42,43,     44,45,128,128,
   128,148,148,     148,45,45,45,    148,0,57,58,     59,60,61,62,63,
 
-#ifdef ALLOW_ROLLING_SPRING
   64,65,66,67,     68,69,69,71,     72,73,74,75,     118,75,75,75,
   64,65,66,67,     68,69,69,71,     72,73,74,75,     118,75,75,75,
-#else
-  64,65,66,67,     68,69,69,69,     69,73,74,75,     118,75,75,75,
-#endif
   75,75,75,75,     75,153,153,153,  153,153,153,153, 153,153,153,153,
   153,153,153,99,  100,68,68,68,    68,68,68,68,     68,118,118,118,
   118,118,114,115, 131,118,118,119, 120,121,122,118, 118,118,118,118,
   75,75,75,75,     75,153,153,153,  153,153,153,153, 153,153,153,153,
   153,153,153,99,  100,68,68,68,    68,68,68,68,     68,118,118,118,
   118,118,114,115, 131,118,118,119, 120,121,122,118, 118,118,118,118,
@@ -517,6 +511,10 @@ int cleanup_em_level(unsigned char *src, int length, char *filename)
  * - introduced ALLOW_ROLLING_SPRING; if defined, do NOT turn rolling spring
  *   into regular spring, because this breaks at least E.M.C. Mine 3, level 79
  *   (see comment directly above)
  * - introduced ALLOW_ROLLING_SPRING; if defined, do NOT turn rolling spring
  *   into regular spring, because this breaks at least E.M.C. Mine 3, level 79
  *   (see comment directly above)
+ *
+ * 2020-01-19
+ * - always use BAD_ROLL and ALLOW_ROLLING_SPRING code when converting caves
+ *   (that is, always allow initial rolling objects in caves now)
  */
 
 static unsigned short remap_emerald[256] =
  */
 
 static unsigned short remap_emerald[256] =
@@ -541,25 +539,16 @@ static unsigned short remap_emerald[256] =
   Xstone,              Xslidewall_ew,  Xslidewall_ns,  Xdynamite_1,
   Xdynamite_2,         Xdynamite_3,    Xdynamite_4,    Xacid_s,
 
   Xstone,              Xslidewall_ew,  Xslidewall_ns,  Xdynamite_1,
   Xdynamite_2,         Xdynamite_3,    Xdynamite_4,    Xacid_s,
 
-#ifdef ALLOW_ROLLING_SPRING
   Xexit_1,             Xexit_2,        Xexit_3,        Xballoon,
   Xplant,              Xspring,        Xspring_fall,   Xspring_w,
   Xspring_e,           Xball_1,        Xball_2,        Xandroid,
   Xblank,              Xandroid,       Xandroid,       Xandroid,
   Xexit_1,             Xexit_2,        Xexit_3,        Xballoon,
   Xplant,              Xspring,        Xspring_fall,   Xspring_w,
   Xspring_e,           Xball_1,        Xball_2,        Xandroid,
   Xblank,              Xandroid,       Xandroid,       Xandroid,
-#else
-  Xexit_1,             Xexit_2,        Xexit_3,        Xballoon,
-  Xplant,              Xspring,        Xspring,        Xspring,
-  Xspring,             Xball_1,        Xball_2,        Xandroid,
-  Xblank,              Xandroid,       Xandroid,       Xandroid,
-#endif
 
   Xandroid,            Xandroid,       Xandroid,       Xandroid,
   Xandroid,            Xblank,         Xblank,         Xblank,
   Xblank,              Xblank,         Xblank,         Xblank,
   Xblank,              Xblank,         Xblank,         Xblank,
 
 
   Xandroid,            Xandroid,       Xandroid,       Xandroid,
   Xandroid,            Xblank,         Xblank,         Xblank,
   Xblank,              Xblank,         Xblank,         Xblank,
   Xblank,              Xblank,         Xblank,         Xblank,
 
-#ifdef BAD_ROLL
-
   Xblank,              Xblank,         Xblank,         Xpush_spring_w,
   Xpush_spring_e,      Xacid_1,        Xacid_2,        Xacid_3,
   Xacid_4,             Xacid_5,        Xacid_6,        Xacid_7,
   Xblank,              Xblank,         Xblank,         Xpush_spring_w,
   Xpush_spring_e,      Xacid_1,        Xacid_2,        Xacid_3,
   Xacid_4,             Xacid_5,        Xacid_6,        Xacid_7,
@@ -570,20 +559,6 @@ static unsigned short remap_emerald[256] =
   Xpush_bomb_e,                Xpush_stone_w,  Xpush_stone_e,  Xblank,
   Xblank,              Xblank,         Xblank,         Xblank,
 
   Xpush_bomb_e,                Xpush_stone_w,  Xpush_stone_e,  Xblank,
   Xblank,              Xblank,         Xblank,         Xblank,
 
-#else
-
-  Xblank,              Xblank,         Xblank,         Xspring,
-  Xspring,             Xacid_1,        Xacid_2,        Xacid_3,
-  Xacid_4,             Xacid_5,        Xacid_6,        Xacid_7,
-  Xacid_8,             Xblank,         Xblank,         Xblank,
-
-  Xblank,              Xblank,         Xnut,           Xnut,
-  Xsteel_1,            Xblank,         Xblank,         Xbomb,
-  Xbomb,               Xstone,         Xstone,         Xblank,
-  Xblank,              Xblank,         Xblank,         Xblank,
-
-#endif
-
   Xblank,              Xroundwall_1,   Xgrass,         Xsteel_1,
   Xwall_1,             Xkey_1,         Xkey_2,         Xkey_3,
   Xkey_4,              Xdoor_1,        Xdoor_2,        Xdoor_3,
   Xblank,              Xroundwall_1,   Xgrass,         Xsteel_1,
   Xwall_1,             Xkey_1,         Xkey_2,         Xkey_3,
   Xkey_4,              Xdoor_1,        Xdoor_2,        Xdoor_3,
@@ -925,48 +900,6 @@ void convert_em_level(unsigned char *src, int file_version)
        lev.wheel_cnt_initial = lev.wheel_time;
        break;
 
        lev.wheel_cnt_initial = lev.wheel_time;
        break;
 
-#ifndef BAD_ROLL
-      case 0x63:                               /* spring roll left */
-       src[temp - 1] = 0x45;
-       src[temp] = 0x80;
-       break;
-
-      case 0x64:                               /* spring roll right */
-       src[temp + 1] = 0x45;
-       src[temp] = 0x80;
-       break;
-
-      case 0x72:                               /* nut roll left */
-       src[temp - 1] = 0x25;
-       src[temp] = 0x80;
-       break;
-
-      case 0x73:                               /* nut roll right */
-       src[temp + 1] = 0x25;
-       src[temp] = 0x80;
-       break;
-
-      case 0x77:                               /* bomb roll left */
-       src[temp - 1] = 0x10;
-       src[temp] = 0x80;
-       break;
-
-      case 0x78:                               /* bomb roll right */
-       src[temp + 1] = 0x10;
-       src[temp] = 0x80;
-       break;
-
-      case 0x79:                               /* stone roll left */
-       src[temp - 1] = 0x00;
-       src[temp] = 0x80;
-       break;
-
-      case 0x7A:                               /* stone roll right */
-       src[temp + 1] = 0x00;
-       src[temp] = 0x80;
-       break;
-#endif
-
       case 0xA3:                               /* fake blank */
        lev.lenses_cnt_initial = 9999;
        break;
       case 0xA3:                               /* fake blank */
        lev.lenses_cnt_initial = 9999;
        break;
index e16fcae480c3b6451abe77856b57056481098461..6faa9e61f0d2507137650ab5fcdcca64d866beed 100644 (file)
@@ -48,22 +48,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 // constant definitions
 // ----------------------------------------------------------------------------
 
 // constant definitions
 // ----------------------------------------------------------------------------
 
-/* define these for backwards compatibility */
-#define EM_ENGINE_BAD_ROLL
-#define EM_ENGINE_BAD_SPRING
-
 /* define these to use additional elements */
 #define EM_ENGINE_USE_ADDITIONAL_ELEMENTS
 
 /* define these to use additional elements */
 #define EM_ENGINE_USE_ADDITIONAL_ELEMENTS
 
-/* internal definitions for EM engine */
-#ifdef EM_ENGINE_BAD_ROLL
-#define BAD_ROLL
-#endif
-
-#ifdef EM_ENGINE_BAD_SPRING
-#define BAD_SPRING
-#endif
-
 /* one border for Zborder elements, one border for steelwall, if needed */
 #define EM_MAX_CAVE_WIDTH              (MAX_PLAYFIELD_WIDTH  + 2 + 2)
 #define EM_MAX_CAVE_HEIGHT             (MAX_PLAYFIELD_HEIGHT + 2 + 2)
 /* one border for Zborder elements, one border for steelwall, if needed */
 #define EM_MAX_CAVE_WIDTH              (MAX_PLAYFIELD_WIDTH  + 2 + 2)
 #define EM_MAX_CAVE_HEIGHT             (MAX_PLAYFIELD_HEIGHT + 2 + 2)
@@ -85,7 +72,6 @@ enum
   Xacid_splash_e,
   Xacid_splash_w,
 
   Xacid_splash_e,
   Xacid_splash_w,
 
-#ifdef EM_ENGINE_BAD_ROLL
   Xpush_stone_e,
   Xpush_stone_w,
   Xpush_nut_e,
   Xpush_stone_e,
   Xpush_stone_w,
   Xpush_nut_e,
@@ -98,7 +84,6 @@ enum
   Xpush_diamond_w,
   Xpush_bomb_e,
   Xpush_bomb_w,
   Xpush_diamond_w,
   Xpush_bomb_e,
   Xpush_bomb_w,
-#endif
 
   Xstone,
   Xstone_pause,
 
   Xstone,
   Xstone_pause,
index 60044374bcb78982a12bb649e984cff7ee2162b3..25805d16df8f077d934121c344bcb23e56930972 100644 (file)
@@ -11,6 +11,8 @@
 #include "main_em.h"
 
 
 #include "main_em.h"
 
 
+#define SPRING_ROLL    /* spring rolling off round things continues to roll */
+
 #define RANDOM (random = random << 31 | random >> 1)
 
 static void set_nearest_player_xy(int x, int y, int *dx, int *dy)
 #define RANDOM (random = random << 31 | random >> 1)
 
 static void set_nearest_player_xy(int x, int y, int *dx, int *dy)
@@ -63,7 +65,6 @@ void synchro_2(void)
 
     /* --------------------------------------------------------------------- */
 
 
     /* --------------------------------------------------------------------- */
 
-#ifdef BAD_ROLL
     case Xpush_stone_e:
       switch (Cave[y][x+1])
       {
     case Xpush_stone_e:
       switch (Cave[y][x+1])
       {
@@ -175,12 +176,7 @@ void synchro_2(void)
          Cave[y][x] = Yspring_eB;
          Cave[y][x+1] = Yspring_e;
          Next[y][x] = Xblank;
          Cave[y][x] = Yspring_eB;
          Cave[y][x+1] = Yspring_e;
          Next[y][x] = Xblank;
-
-#ifdef BAD_SPRING
          Next[y][x+1] = Xspring_e;
          Next[y][x+1] = Xspring_e;
-#else
-         Next[y][x+1] = Xspring_pause;
-#endif
 
          goto loop;
       }
 
          goto loop;
       }
@@ -204,12 +200,7 @@ void synchro_2(void)
          Cave[y][x] = Yspring_wB;
          Cave[y][x-1] = Yspring_w;
          Next[y][x] = Xblank;
          Cave[y][x] = Yspring_wB;
          Cave[y][x-1] = Yspring_w;
          Next[y][x] = Xblank;
-
-#ifdef BAD_SPRING
          Next[y][x-1] = Xspring_w;
          Next[y][x-1] = Xspring_w;
-#else  
-         Next[y][x-1] = Xspring_pause;
-#endif 
          goto loop;
        }
 
          goto loop;
        }
 
@@ -350,7 +341,6 @@ void synchro_2(void)
          Next[y][x-1] = Xbomb_pause;
          goto loop;
        }
          Next[y][x-1] = Xbomb_pause;
          goto loop;
        }
-#endif /* BAD_ROLL */
 
     /* --------------------------------------------------------------------- */
 
 
     /* --------------------------------------------------------------------- */
 
@@ -2461,7 +2451,7 @@ void synchro_2(void)
                Cave[y+1][x] = XbumperB;
              Next[y][x] = Xblank;
 
                Cave[y+1][x] = XbumperB;
              Next[y][x] = Xblank;
 
-#ifdef BAD_SPRING
+#ifdef SPRING_ROLL
              Next[y][x+1] = Xspring_e;
 #else  
              Next[y][x+1] = Xspring_pause;
              Next[y][x+1] = Xspring_e;
 #else  
              Next[y][x+1] = Xspring_pause;
@@ -2478,7 +2468,7 @@ void synchro_2(void)
                Cave[y+1][x] = XbumperB;
              Next[y][x] = Xblank;
 
                Cave[y+1][x] = XbumperB;
              Next[y][x] = Xblank;
 
-#ifdef BAD_SPRING
+#ifdef SPRING_ROLL
              Next[y][x-1] = Xspring_w;
 #else
              Next[y][x-1] = Xspring_pause;
              Next[y][x-1] = Xspring_w;
 #else
              Next[y][x-1] = Xspring_pause;
@@ -2497,7 +2487,7 @@ void synchro_2(void)
                Cave[y+1][x] = XbumperB;
              Next[y][x] = Xblank;
 
                Cave[y+1][x] = XbumperB;
              Next[y][x] = Xblank;
 
-#ifdef BAD_SPRING
+#ifdef SPRING_ROLL
              Next[y][x-1] = Xspring_w;
 #else
              Next[y][x-1] = Xspring_pause;
              Next[y][x-1] = Xspring_w;
 #else
              Next[y][x-1] = Xspring_pause;
@@ -2514,7 +2504,7 @@ void synchro_2(void)
                Cave[y+1][x] = XbumperB;
              Next[y][x] = Xblank;
 
                Cave[y+1][x] = XbumperB;
              Next[y][x] = Xblank;
 
-#ifdef BAD_SPRING
+#ifdef SPRING_ROLL
              Next[y][x+1] = Xspring_e;
 #else
              Next[y][x+1] = Xspring_pause;
              Next[y][x+1] = Xspring_e;
 #else
              Next[y][x+1] = Xspring_pause;
index bcdecfe5c27cb664125e9ebd37601b9872bfea52..69e9036be34b5f17fefa1d215bebc6065e0db17c 100644 (file)
@@ -243,8 +243,6 @@ int obj_map[] =
   Xstone_fall, 5,
   Xstone_fall, 6,
   Xstone_fall, 7,
   Xstone_fall, 5,
   Xstone_fall, 6,
   Xstone_fall, 7,
-
-#ifdef BAD_ROLL
   Xpush_stone_e, 0,
   Xpush_stone_e, 1,
   Xpush_stone_e, 2,
   Xpush_stone_e, 0,
   Xpush_stone_e, 1,
   Xpush_stone_e, 2,
@@ -261,8 +259,6 @@ int obj_map[] =
   Xpush_stone_w, 5,
   Xpush_stone_w, 6,
   Xpush_stone_w, 7,
   Xpush_stone_w, 5,
   Xpush_stone_w, 6,
   Xpush_stone_w, 7,
-#endif
-
   Ystone_s, 7,
   Xsand_stoneout_2, 7,
   Xsand_stonein_1, 0,
   Ystone_s, 7,
   Xsand_stoneout_2, 7,
   Xsand_stonein_1, 0,
@@ -363,8 +359,6 @@ int obj_map[] =
   Xnut_fall, 5,
   Xnut_fall, 6,
   Xnut_fall, 7,
   Xnut_fall, 5,
   Xnut_fall, 6,
   Xnut_fall, 7,
-
-#ifdef BAD_ROLL
   Xpush_nut_e, 0,
   Xpush_nut_e, 1,
   Xpush_nut_e, 2,
   Xpush_nut_e, 0,
   Xpush_nut_e, 1,
   Xpush_nut_e, 2,
@@ -381,8 +375,6 @@ int obj_map[] =
   Xpush_nut_w, 5,
   Xpush_nut_w, 6,
   Xpush_nut_w, 7,
   Xpush_nut_w, 5,
   Xpush_nut_w, 6,
   Xpush_nut_w, 7,
-#endif
-
   -1,
   -1,
   Ynut_s, 6,
   -1,
   -1,
   Ynut_s, 6,
@@ -1457,8 +1449,6 @@ int obj_map[] =
   Xspring_fall, 5,
   Xspring_fall, 6,
   Xspring_fall, 7,
   Xspring_fall, 5,
   Xspring_fall, 6,
   Xspring_fall, 7,
-
-#ifdef BAD_ROLL
   Xpush_spring_e, 0,
   Xpush_spring_e, 1,
   Xpush_spring_e, 2,
   Xpush_spring_e, 0,
   Xpush_spring_e, 1,
   Xpush_spring_e, 2,
@@ -1475,8 +1465,6 @@ int obj_map[] =
   Xpush_spring_w, 5,
   Xpush_spring_w, 6,
   Xpush_spring_w, 7,
   Xpush_spring_w, 5,
   Xpush_spring_w, 6,
   Xpush_spring_w, 7,
-#endif
-
   -1,
   Yspring_sB, 6,
   -1,
   -1,
   Yspring_sB, 6,
   -1,
@@ -1919,8 +1907,6 @@ int obj_map[] =
   Xemerald_fall, 5,
   Xemerald_fall, 6,
   Xemerald_fall, 7,
   Xemerald_fall, 5,
   Xemerald_fall, 6,
   Xemerald_fall, 7,
-
-#ifdef BAD_ROLL
   Xpush_emerald_e, 0,
   Xpush_emerald_e, 1,
   Xpush_emerald_e, 2,
   Xpush_emerald_e, 0,
   Xpush_emerald_e, 1,
   Xpush_emerald_e, 2,
@@ -1937,8 +1923,6 @@ int obj_map[] =
   Xpush_emerald_w, 5,
   Xpush_emerald_w, 6,
   Xpush_emerald_w, 7,
   Xpush_emerald_w, 5,
   Xpush_emerald_w, 6,
   Xpush_emerald_w, 7,
-#endif
-
   Xemerald_shine, 0,
   Xemerald_shine, 7,
   Ynut_stone, 7,
   Xemerald_shine, 0,
   Xemerald_shine, 7,
   Ynut_stone, 7,
@@ -2078,8 +2062,6 @@ int obj_map[] =
   Xdiamond_fall, 5,
   Xdiamond_fall, 6,
   Xdiamond_fall, 7,
   Xdiamond_fall, 5,
   Xdiamond_fall, 6,
   Xdiamond_fall, 7,
-
-#ifdef BAD_ROLL
   Xpush_diamond_e, 0,
   Xpush_diamond_e, 1,
   Xpush_diamond_e, 2,
   Xpush_diamond_e, 0,
   Xpush_diamond_e, 1,
   Xpush_diamond_e, 2,
@@ -2096,8 +2078,6 @@ int obj_map[] =
   Xpush_diamond_w, 5,
   Xpush_diamond_w, 6,
   Xpush_diamond_w, 7,
   Xpush_diamond_w, 5,
   Xpush_diamond_w, 6,
   Xpush_diamond_w, 7,
-#endif
-
   Xdiamond_shine, 0,
   Xdiamond_shine, 7,
   Ydiamond_s, 7,
   Xdiamond_shine, 0,
   Xdiamond_shine, 7,
   Ydiamond_s, 7,
@@ -2338,8 +2318,6 @@ int obj_map[] =
   Xbomb_fall, 5,
   Xbomb_fall, 6,
   Xbomb_fall, 7,
   Xbomb_fall, 5,
   Xbomb_fall, 6,
   Xbomb_fall, 7,
-
-#ifdef BAD_ROLL
   Xpush_bomb_e, 0,
   Xpush_bomb_e, 1,
   Xpush_bomb_e, 2,
   Xpush_bomb_e, 0,
   Xpush_bomb_e, 1,
   Xpush_bomb_e, 2,
@@ -2356,8 +2334,6 @@ int obj_map[] =
   Xpush_bomb_w, 5,
   Xpush_bomb_w, 6,
   Xpush_bomb_w, 7,
   Xpush_bomb_w, 5,
   Xpush_bomb_w, 6,
   Xpush_bomb_w, 7,
-#endif
-
   Ybomb_s, 7,
   Ybomb_e, 7,
   Ybomb_w, 7,
   Ybomb_s, 7,
   Ybomb_e, 7,
   Ybomb_w, 7,
index c3668807a3f9601fd34ed7a7b6dac3dd960392b7..ffcc1f661e1b73678225f5b5b26f69a2bc1e8a61 100644 (file)
@@ -5752,8 +5752,6 @@ em_object_mapping_list[] =
     Xacid_splash_w,                    FALSE,  FALSE,
     EL_ACID_SPLASH_LEFT,               -1, -1
   },
     Xacid_splash_w,                    FALSE,  FALSE,
     EL_ACID_SPLASH_LEFT,               -1, -1
   },
-
-#ifdef EM_ENGINE_BAD_ROLL
   {
     Xpush_stone_e,                     FALSE,  FALSE,
     EL_ROCK,                           -1, MV_BIT_RIGHT
   {
     Xpush_stone_e,                     FALSE,  FALSE,
     EL_ROCK,                           -1, MV_BIT_RIGHT
@@ -5802,8 +5800,6 @@ em_object_mapping_list[] =
     Xpush_bomb_w,                      FALSE,  FALSE,
     EL_BOMB,                           -1, MV_BIT_LEFT
   },
     Xpush_bomb_w,                      FALSE,  FALSE,
     EL_BOMB,                           -1, MV_BIT_LEFT
   },
-#endif // EM_ENGINE_BAD_ROLL
-
   {
     Xstone,                            TRUE,   FALSE,
     EL_ROCK,                           -1, -1
   {
     Xstone,                            TRUE,   FALSE,
     EL_ROCK,                           -1, -1