changed handling of chain explosions in EM engine
[rocksndiamonds.git] / src / game_em / logic.c
index a465bbe3354dc7e83a9be5f646affe3b4240258e..7774c1dba4490e04b987d51e91ac05307943a038 100644 (file)
@@ -9,6 +9,8 @@
 
 
 #define SPRING_ROLL    /* spring rolling off round things continues to roll */
+#define ACID_ROLL      /* rolling objects go into acid rather than remove it */
+
 #define USE_CHANGED_ACID_STUFF
 
 #define RANDOM_RAW     (seed = seed << 31 | seed >> 1)
@@ -71,7 +73,7 @@ static const byte is_fake_acid[TILE_MAX] =
 static const byte is_amoeba[TILE_MAX] =
 {
   [Xfake_amoeba]       = 1,
-  [Xfake_amoebaB]      = 1,
+  [Yfake_amoeba]       = 1,
   [Xamoeba_1]          = 1,
   [Xamoeba_2]          = 1,
   [Xamoeba_3]          = 1,
@@ -111,31 +113,34 @@ static void Lboom_generic(int x, int y, int element, int element_middle)
   boom[x+1][y+1] = element;
 }
 
-static void Lboom_bug(int x, int y, int by_element)
+static void Lboom_bug(int x, int y)
 {
-  next[x][y] = Znormal;
+  if (game_em.use_old_explosions)
+    next[x][y] = Zbug;
 
   Lboom_generic(x, y, Xemerald, Xdiamond);
 
 #if PLAY_ELEMENT_SOUND
-  play_element_sound(x, y, SOUND_boom, by_element);
+  play_element_sound(x, y, SOUND_boom, Xbug_1_n);
 #endif
 }
 
-static void Lboom_tank(int x, int y, int by_element)
+static void Lboom_tank(int x, int y)
 {
-  next[x][y] = Znormal;
+  if (game_em.use_old_explosions)
+    next[x][y] = Ztank;
 
   Lboom_generic(x, y, Xblank, Xblank);
 
 #if PLAY_ELEMENT_SOUND
-  play_element_sound(x, y, SOUND_boom, by_element);
+  play_element_sound(x, y, SOUND_boom, Xtank_1_n);
 #endif
 }
 
-static void Lboom_eater(int x, int y, int by_element)
+static void Lboom_eater(int x, int y)
 {
-  next[x][y] = Znormal;
+  if (game_em.use_old_explosions)
+    next[x][y] = Zeater;
 
   boom[x-1][y-1] = lev.eater_array[lev.eater_pos][0];
   boom[x][y-1]   = lev.eater_array[lev.eater_pos][1];
@@ -150,10 +155,67 @@ static void Lboom_eater(int x, int y, int by_element)
   lev.eater_pos = (lev.eater_pos + 1) & 7;
 
 #if PLAY_ELEMENT_SOUND
-  play_element_sound(x, y, SOUND_boom, by_element);
+  play_element_sound(x, y, SOUND_boom, Xeater_n);
 #endif
 }
 
+static void Lboom_bug_old(int x, int y)
+{
+  if (!game_em.use_old_explosions)
+    return;
+
+  Lboom_bug(x, y);
+}
+
+static void Lboom_tank_old(int x, int y)
+{
+  if (!game_em.use_old_explosions)
+    return;
+
+  Lboom_tank(x, y);
+}
+
+static void Lboom_eater_old(int x, int y)
+{
+  if (!game_em.use_old_explosions)
+    return;
+
+  Lboom_eater(x, y);
+}
+
+static void Lboom_bug_new(int x, int y, boolean chain_explosion)
+{
+  if (game_em.use_old_explosions)
+    return;
+
+  if (chain_explosion)
+    cave[x][y] = Xchain;
+
+  Lboom_bug(x, y);
+}
+
+static void Lboom_tank_new(int x, int y, boolean chain_explosion)
+{
+  if (game_em.use_old_explosions)
+    return;
+
+  if (chain_explosion)
+    cave[x][y] = Xchain;
+
+  Lboom_tank(x, y);
+}
+
+static void Lboom_eater_new(int x, int y, boolean chain_explosion)
+{
+  if (game_em.use_old_explosions)
+    return;
+
+  if (chain_explosion)
+    cave[x][y] = Xchain;
+
+  Lboom_eater(x, y);
+}
+
 static boolean player_killed(struct PLAYER *ply)
 {
   int x = ply->x;
@@ -251,6 +313,7 @@ static boolean player_killed(struct PLAYER *ply)
 
   switch (cave[x][y])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -262,7 +325,6 @@ static boolean player_killed(struct PLAYER *ply)
     case Xfake_acid_6:
     case Xfake_acid_7:
     case Xfake_acid_8:
-    case Zplayer:
     case Xdynamite_1:
     case Xdynamite_2:
     case Xdynamite_3:
@@ -291,6 +353,7 @@ static void kill_player(struct PLAYER *ply)
     case Xbug_2_s:
     case Xbug_2_w:
       cave[x][y-1] = Xboom_bug;
+      Lboom_bug_new(x, y-1, TRUE);
       break;
 
     case Xtank_1_n:
@@ -301,7 +364,8 @@ static void kill_player(struct PLAYER *ply)
     case Xtank_2_e:
     case Xtank_2_s:
     case Xtank_2_w:
-      cave[x][y-1] = Xboom_bomb;
+      cave[x][y-1] = Xboom_tank;
+      Lboom_tank_new(x, y-1, TRUE);
       break;
   }
 
@@ -316,6 +380,7 @@ static void kill_player(struct PLAYER *ply)
     case Xbug_2_s:
     case Xbug_2_w:
       cave[x+1][y] = Xboom_bug;
+      Lboom_bug_new(x+1, y, TRUE);
       break;
 
     case Xtank_1_n:
@@ -326,7 +391,8 @@ static void kill_player(struct PLAYER *ply)
     case Xtank_2_e:
     case Xtank_2_s:
     case Xtank_2_w:
-      cave[x+1][y] = Xboom_bomb;
+      cave[x+1][y] = Xboom_tank;
+      Lboom_tank_new(x+1, y, TRUE);
       break;
   }
 
@@ -341,6 +407,7 @@ static void kill_player(struct PLAYER *ply)
     case Xbug_2_s:
     case Xbug_2_w:
       cave[x][y+1] = Xboom_bug;
+      Lboom_bug_new(x, y+1, TRUE);
       break;
 
     case Xtank_1_n:
@@ -351,7 +418,8 @@ static void kill_player(struct PLAYER *ply)
     case Xtank_2_e:
     case Xtank_2_s:
     case Xtank_2_w:
-      cave[x][y+1] = Xboom_bomb;
+      cave[x][y+1] = Xboom_tank;
+      Lboom_tank_new(x, y+1, TRUE);
       break;
   }
 
@@ -366,6 +434,7 @@ static void kill_player(struct PLAYER *ply)
     case Xbug_2_s:
     case Xbug_2_w:
       cave[x-1][y] = Xboom_bug;
+      Lboom_bug_new(x-1, y, TRUE);
       break;
 
     case Xtank_1_n:
@@ -376,7 +445,8 @@ static void kill_player(struct PLAYER *ply)
     case Xtank_2_e:
     case Xtank_2_s:
     case Xtank_2_w:
-      cave[x-1][y] = Xboom_bomb;
+      cave[x-1][y] = Xboom_tank;
+      Lboom_tank_new(x-1, y, TRUE);
       break;
   }
 
@@ -533,7 +603,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        next[x][y] = Zplayer;
        play_element_sound(x, y, SOUND_collect, element);
        lev.score += lev.diamond_score;
-       lev.required = lev.required < 3 ? 0 : lev.required - 3;
+       lev.gems_needed = lev.gems_needed < 3 ? 0 : lev.gems_needed - 3;
        game.snapshot.collected_item = TRUE;
        ply->anim = PLY_walk_n + anim;
        ply->x = x;
@@ -546,7 +616,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        next[x][y] = Zplayer;
        play_element_sound(x, y, SOUND_collect, element);
        lev.score += lev.emerald_score;
-       lev.required = lev.required < 1 ? 0 : lev.required - 1;
+       lev.gems_needed = lev.gems_needed < 1 ? 0 : lev.gems_needed - 1;
        game.snapshot.collected_item = TRUE;
        ply->anim = PLY_walk_n + anim;
        ply->x = x;
@@ -1124,7 +1194,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        next[x][y] = Xblank;
        play_element_sound(x, y, SOUND_collect, element);
        lev.score += lev.diamond_score;
-       lev.required = lev.required < 3 ? 0 : lev.required - 3;
+       lev.gems_needed = lev.gems_needed < 3 ? 0 : lev.gems_needed - 3;
        game.snapshot.collected_item = TRUE;
        ply->anim = PLY_walk_n + anim;
        break;
@@ -1135,7 +1205,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
        next[x][y] = Xblank;
        play_element_sound(x, y, SOUND_collect, element);
        lev.score += lev.emerald_score;
-       lev.required = lev.required < 1 ? 0 : lev.required - 1;
+       lev.gems_needed = lev.gems_needed < 1 ? 0 : lev.gems_needed - 1;
        game.snapshot.collected_item = TRUE;
        ply->anim = PLY_walk_n + anim;
        break;
@@ -1311,7 +1381,8 @@ static void check_player(struct PLAYER *ply)
       ply->dynamite_cnt = 0;
     }
 
-    RandomEM += 7;     /* be a bit more random if the player doesn't move */
+    /* be a bit more random if the player doesn't move */
+    game_em.random += 7;
 
     return;
   }
@@ -2259,6 +2330,7 @@ static void Leater_n(int x, int y)
 
   switch (cave[x][y-1])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -2272,7 +2344,6 @@ static void Leater_n(int x, int y)
     case Xfake_acid_8:
     case Xplant:
     case Yplant:
-    case Zplayer:
       cave[x][y] = Yeater_nB;
       next[x][y] = Xblank;
       cave[x][y-1] = Yeater_n;
@@ -2339,6 +2410,7 @@ static void Leater_e(int x, int y)
 
   switch (cave[x+1][y])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -2352,7 +2424,6 @@ static void Leater_e(int x, int y)
     case Xfake_acid_8:
     case Xplant:
     case Yplant:
-    case Zplayer:
       cave[x][y] = Yeater_eB;
       next[x][y] = Xblank;
       cave[x+1][y] = Yeater_e;
@@ -2419,6 +2490,7 @@ static void Leater_s(int x, int y)
 
   switch (cave[x][y+1])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -2432,7 +2504,6 @@ static void Leater_s(int x, int y)
     case Xfake_acid_8:
     case Xplant:
     case Yplant:
-    case Zplayer:
       cave[x][y] = Yeater_sB;
       next[x][y] = Xblank;
       cave[x][y+1] = Yeater_s;
@@ -2499,6 +2570,7 @@ static void Leater_w(int x, int y)
 
   switch (cave[x-1][y])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -2512,7 +2584,6 @@ static void Leater_w(int x, int y)
     case Xfake_acid_8:
     case Xplant:
     case Yplant:
-    case Zplayer:
       cave[x][y] = Yeater_wB;
       next[x][y] = Xblank;
       cave[x-1][y] = Yeater_w;
@@ -2563,6 +2634,7 @@ static void Lalien(int x, int y)
     {
       switch (cave[x][y-1])
       {
+       case Zplayer:
        case Xblank:
        case Xsplash_e:
        case Xsplash_w:
@@ -2576,7 +2648,6 @@ static void Lalien(int x, int y)
        case Xfake_acid_8:
        case Xplant:
        case Yplant:
-       case Zplayer:
          cave[x][y] = Yalien_nB;
          next[x][y] = Xblank;
          cave[x][y-1] = Yalien_n;
@@ -2606,6 +2677,7 @@ static void Lalien(int x, int y)
     {
       switch (cave[x][y+1])
       {
+       case Zplayer:
        case Xblank:
        case Xsplash_e:
        case Xsplash_w:
@@ -2619,7 +2691,6 @@ static void Lalien(int x, int y)
        case Xfake_acid_8:
        case Xplant:
        case Yplant:
-       case Zplayer:
          cave[x][y] = Yalien_sB;
          next[x][y] = Xblank;
          cave[x][y+1] = Yalien_s;
@@ -2652,6 +2723,7 @@ static void Lalien(int x, int y)
     {
       switch (cave[x+1][y])
       {
+       case Zplayer:
        case Xblank:
        case Xsplash_e:
        case Xsplash_w:
@@ -2665,7 +2737,6 @@ static void Lalien(int x, int y)
        case Xfake_acid_8:
        case Xplant:
        case Yplant:
-       case Zplayer:
          cave[x][y] = Yalien_eB;
          next[x][y] = Xblank;
          cave[x+1][y] = Yalien_e;
@@ -2695,6 +2766,7 @@ static void Lalien(int x, int y)
     {
       switch (cave[x-1][y])
       {
+       case Zplayer:
        case Xblank:
        case Xsplash_e:
        case Xsplash_w:
@@ -2708,7 +2780,6 @@ static void Lalien(int x, int y)
        case Xfake_acid_8:
        case Xplant:
        case Yplant:
-       case Zplayer:
          cave[x][y] = Yalien_wB;
          next[x][y] = Xblank;
          cave[x-1][y] = Yalien_w;
@@ -2746,6 +2817,7 @@ static void Lbug_n(int x, int y)
 {
   switch (cave[x][y-1])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -2759,7 +2831,6 @@ static void Lbug_n(int x, int y)
     case Xfake_acid_8:
     case Xplant:
     case Yplant:
-    case Zplayer:
       cave[x][y] = Ybug_nB;
       next[x][y] = Xblank;
       cave[x][y-1] = Ybug_n;
@@ -2799,13 +2870,15 @@ static void Lbug_1_n(int x, int y)
       is_amoeba[cave[x][y+1]] ||
       is_amoeba[cave[x-1][y]])
   {
-    Lboom_bug(x, y, Xbug_1_n);
+    next[x][y] = Zboom;
+    Lboom_bug(x, y);
 
     return;
   }
 
   switch (cave[x+1][y])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -2827,7 +2900,6 @@ static void Lbug_1_n(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
-    case Zplayer:
       cave[x][y] = Ybug_n_e;
       next[x][y] = Xbug_2_e;
       play_element_sound(x, y, SOUND_bug, Xbug_1_n);
@@ -2846,7 +2918,8 @@ static void Lbug_2_n(int x, int y)
       is_amoeba[cave[x][y+1]] ||
       is_amoeba[cave[x-1][y]])
   {
-    Lboom_bug(x, y, Xbug_2_n);
+    next[x][y] = Zboom;
+    Lboom_bug(x, y);
 
     return;
   }
@@ -2858,6 +2931,7 @@ static void Lbug_e(int x, int y)
 {
   switch (cave[x+1][y])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -2871,7 +2945,6 @@ static void Lbug_e(int x, int y)
     case Xfake_acid_8:
     case Xplant:
     case Yplant:
-    case Zplayer:
       cave[x][y] = Ybug_eB;
       next[x][y] = Xblank;
       cave[x+1][y] = Ybug_e;
@@ -2911,13 +2984,15 @@ static void Lbug_1_e(int x, int y)
       is_amoeba[cave[x][y+1]] ||
       is_amoeba[cave[x-1][y]])
   {
-    Lboom_bug(x, y, Xbug_1_e);
+    next[x][y] = Zboom;
+    Lboom_bug(x, y);
 
     return;
   }
 
   switch (cave[x][y+1])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -2939,7 +3014,6 @@ static void Lbug_1_e(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
-    case Zplayer:
       cave[x][y] = Ybug_e_s;
       next[x][y] = Xbug_2_s;
       play_element_sound(x, y, SOUND_bug, Xbug_1_e);
@@ -2958,7 +3032,8 @@ static void Lbug_2_e(int x, int y)
       is_amoeba[cave[x][y+1]] ||
       is_amoeba[cave[x-1][y]])
   {
-    Lboom_bug(x, y, Xbug_2_e);
+    next[x][y] = Zboom;
+    Lboom_bug(x, y);
 
     return;
   }
@@ -2970,6 +3045,7 @@ static void Lbug_s(int x, int y)
 {
   switch (cave[x][y+1])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -2983,7 +3059,6 @@ static void Lbug_s(int x, int y)
     case Xfake_acid_8:
     case Xplant:
     case Yplant:
-    case Zplayer:
       cave[x][y] = Ybug_sB;
       next[x][y] = Xblank;
       cave[x][y+1] = Ybug_s;
@@ -3023,13 +3098,15 @@ static void Lbug_1_s(int x, int y)
       is_amoeba[cave[x][y+1]] ||
       is_amoeba[cave[x-1][y]])
   {
-    Lboom_bug(x, y, Xbug_1_s);
+    next[x][y] = Zboom;
+    Lboom_bug(x, y);
 
     return;
   }
 
   switch (cave[x-1][y])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -3051,7 +3128,6 @@ static void Lbug_1_s(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
-    case Zplayer:
       cave[x][y] = Ybug_s_w;
       next[x][y] = Xbug_2_w;
       play_element_sound(x, y, SOUND_bug, Xbug_1_s);
@@ -3070,7 +3146,8 @@ static void Lbug_2_s(int x, int y)
       is_amoeba[cave[x][y+1]] ||
       is_amoeba[cave[x-1][y]])
   {
-    Lboom_bug(x, y, Xbug_2_s);
+    next[x][y] = Zboom;
+    Lboom_bug(x, y);
 
     return;
   }
@@ -3082,6 +3159,7 @@ static void Lbug_w(int x, int y)
 {
   switch (cave[x-1][y])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -3095,7 +3173,6 @@ static void Lbug_w(int x, int y)
     case Xfake_acid_8:
     case Xplant:
     case Yplant:
-    case Zplayer:
       cave[x][y] = Ybug_wB;
       next[x][y] = Xblank;
       cave[x-1][y] = Ybug_w;
@@ -3135,13 +3212,15 @@ static void Lbug_1_w(int x, int y)
       is_amoeba[cave[x][y+1]] ||
       is_amoeba[cave[x-1][y]])
   {
-    Lboom_bug(x, y, Xbug_1_w);
+    next[x][y] = Zboom;
+    Lboom_bug(x, y);
 
     return;
   }
 
   switch (cave[x][y-1])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -3163,7 +3242,6 @@ static void Lbug_1_w(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
-    case Zplayer:
       cave[x][y] = Ybug_w_n;
       next[x][y] = Xbug_2_n;
       play_element_sound(x, y, SOUND_bug, Xbug_1_w);
@@ -3182,7 +3260,8 @@ static void Lbug_2_w(int x, int y)
       is_amoeba[cave[x][y+1]] ||
       is_amoeba[cave[x-1][y]])
   {
-    Lboom_bug(x, y, Xbug_2_w);
+    next[x][y] = Zboom;
+    Lboom_bug(x, y);
 
     return;
   }
@@ -3194,6 +3273,7 @@ static void Ltank_n(int x, int y)
 {
   switch (cave[x][y-1])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -3207,7 +3287,6 @@ static void Ltank_n(int x, int y)
     case Xfake_acid_8:
     case Xplant:
     case Yplant:
-    case Zplayer:
       cave[x][y] = Ytank_nB;
       next[x][y] = Xblank;
       cave[x][y-1] = Ytank_n;
@@ -3247,13 +3326,15 @@ static void Ltank_1_n(int x, int y)
       is_amoeba[cave[x][y+1]] ||
       is_amoeba[cave[x-1][y]])
   {
-    Lboom_tank(x, y, Xtank_1_n);
+    next[x][y] = Zboom;
+    Lboom_tank(x, y);
 
     return;
   }
 
   switch (cave[x-1][y])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -3275,7 +3356,6 @@ static void Ltank_1_n(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
-    case Zplayer:
       cave[x][y] = Ytank_n_w;
       next[x][y] = Xtank_2_w;
       play_element_sound(x, y, SOUND_tank, Xtank_1_n);
@@ -3294,7 +3374,8 @@ static void Ltank_2_n(int x, int y)
       is_amoeba[cave[x][y+1]] ||
       is_amoeba[cave[x-1][y]])
   {
-    Lboom_tank(x, y, Xtank_2_n);
+    next[x][y] = Zboom;
+    Lboom_tank(x, y);
 
     return;
   }
@@ -3306,6 +3387,7 @@ static void Ltank_e(int x, int y)
 {
   switch (cave[x+1][y])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -3319,7 +3401,6 @@ static void Ltank_e(int x, int y)
     case Xfake_acid_8:
     case Xplant:
     case Yplant:
-    case Zplayer:
       cave[x][y] = Ytank_eB;
       next[x][y] = Xblank;
       cave[x+1][y] = Ytank_e;
@@ -3359,13 +3440,15 @@ static void Ltank_1_e(int x, int y)
       is_amoeba[cave[x][y+1]] ||
       is_amoeba[cave[x-1][y]])
   {
-    Lboom_tank(x, y, Xtank_1_e);
+    next[x][y] = Zboom;
+    Lboom_tank(x, y);
 
     return;
   }
 
   switch (cave[x][y-1])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -3387,7 +3470,6 @@ static void Ltank_1_e(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
-    case Zplayer:
       cave[x][y] = Ytank_e_n;
       next[x][y] = Xtank_2_n;
       play_element_sound(x, y, SOUND_tank, Xtank_1_e);
@@ -3406,7 +3488,8 @@ static void Ltank_2_e(int x, int y)
       is_amoeba[cave[x][y+1]] ||
       is_amoeba[cave[x-1][y]])
   {
-    Lboom_tank(x, y, Xtank_2_e);
+    next[x][y] = Zboom;
+    Lboom_tank(x, y);
 
     return;
   }
@@ -3418,6 +3501,7 @@ static void Ltank_s(int x, int y)
 {
   switch (cave[x][y+1])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -3431,7 +3515,6 @@ static void Ltank_s(int x, int y)
     case Xfake_acid_8:
     case Xplant:
     case Yplant:
-    case Zplayer:
       cave[x][y] = Ytank_sB;
       next[x][y] = Xblank;
       cave[x][y+1] = Ytank_s;
@@ -3471,13 +3554,15 @@ static void Ltank_1_s(int x, int y)
       is_amoeba[cave[x][y+1]] ||
       is_amoeba[cave[x-1][y]])
   {
-    Lboom_tank(x, y, Xtank_1_s);
+    next[x][y] = Zboom;
+    Lboom_tank(x, y);
 
     return;
   }
 
   switch (cave[x+1][y])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -3499,7 +3584,6 @@ static void Ltank_1_s(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
-    case Zplayer:
       cave[x][y] = Ytank_s_e;
       next[x][y] = Xtank_2_e;
       play_element_sound(x, y, SOUND_tank, Xtank_1_s);
@@ -3518,7 +3602,8 @@ static void Ltank_2_s(int x, int y)
       is_amoeba[cave[x][y+1]] ||
       is_amoeba[cave[x-1][y]])
   {
-    Lboom_tank(x, y, Xtank_2_s);
+    next[x][y] = Zboom;
+    Lboom_tank(x, y);
 
     return;
   }
@@ -3530,6 +3615,7 @@ static void Ltank_w(int x, int y)
 {
   switch (cave[x-1][y])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -3543,7 +3629,6 @@ static void Ltank_w(int x, int y)
     case Xfake_acid_8:
     case Xplant:
     case Yplant:
-    case Zplayer:
       cave[x][y] = Ytank_wB;
       next[x][y] = Xblank;
       cave[x-1][y] = Ytank_w;
@@ -3583,13 +3668,15 @@ static void Ltank_1_w(int x, int y)
       is_amoeba[cave[x][y+1]] ||
       is_amoeba[cave[x-1][y]])
   {
-    Lboom_tank(x, y, Xtank_1_w);
+    next[x][y] = Zboom;
+    Lboom_tank(x, y);
 
     return;
   }
 
   switch (cave[x][y+1])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -3611,7 +3698,6 @@ static void Ltank_1_w(int x, int y)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
-    case Zplayer:
       cave[x][y] = Ytank_w_s;
       next[x][y] = Xtank_2_s;
       play_element_sound(x, y, SOUND_tank, Xtank_1_w);
@@ -3630,7 +3716,8 @@ static void Ltank_2_w(int x, int y)
       is_amoeba[cave[x][y+1]] ||
       is_amoeba[cave[x-1][y]])
   {
-    Lboom_tank(x, y, Xtank_2_w);
+    next[x][y] = Zboom;
+    Lboom_tank(x, y);
 
     return;
   }
@@ -3676,10 +3763,6 @@ static void Lemerald(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 
-    case Xspring:
-    case Xspring_pause:
-    case Xspring_e:
-    case Xspring_w:
     case Xandroid:
     case Xandroid_1_n:
     case Xandroid_2_n:
@@ -3689,24 +3772,20 @@ static void Lemerald(int x, int y)
     case Xandroid_2_s:
     case Xandroid_1_w:
     case Xandroid_2_w:
-    case Xstone:
-    case Xstone_pause:
     case Xemerald:
     case Xemerald_pause:
     case Xdiamond:
     case Xdiamond_pause:
+    case Xstone:
+    case Xstone_pause:
     case Xbomb:
     case Xbomb_pause:
-    case Xballoon:
-    case Xacid_ne:
-    case Xacid_nw:
-    case Xball_1:
-    case Xball_2:
     case Xnut:
     case Xnut_pause:
-    case Xslide_ns:
-    case Xslide_ew:
-    case Xwonderwall:
+    case Xspring:
+    case Xspring_pause:
+    case Xspring_e:
+    case Xspring_w:
     case Xkey_1:
     case Xkey_2:
     case Xkey_3:
@@ -3715,12 +3794,17 @@ static void Lemerald(int x, int y)
     case Xkey_6:
     case Xkey_7:
     case Xkey_8:
-    case Xbumper:
+    case Xballoon:
+    case Xball_1:
+    case Xball_2:
+    case Xwonderwall:
     case Xswitch:
-    case Xsteel_1:
-    case Xsteel_2:
-    case Xsteel_3:
-    case Xsteel_4:
+    case Xbumper:
+    case Ybumper:
+    case Xacid_ne:
+    case Xacid_nw:
+    case Xslide_ns:
+    case Xslide_ew:
     case Xwall_1:
     case Xwall_2:
     case Xwall_3:
@@ -3729,6 +3813,10 @@ static void Lemerald(int x, int y)
     case Xroundwall_2:
     case Xroundwall_3:
     case Xroundwall_4:
+    case Xsteel_1:
+    case Xsteel_2:
+    case Xsteel_3:
+    case Xsteel_4:
       if (RANDOM(2))
       {
        if (is_blank[cave[x+1][y]] && is_blank_or_acid[cave[x+1][y+1]])
@@ -3737,6 +3825,8 @@ static void Lemerald(int x, int y)
          next[x][y] = Xblank;
          cave[x+1][y] = Yemerald_e;
          next[x+1][y] = Xemerald_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
 
@@ -3746,6 +3836,8 @@ static void Lemerald(int x, int y)
          next[x][y] = Xblank;
          cave[x-1][y] = Yemerald_w;
          next[x-1][y] = Xemerald_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
       }
@@ -3757,6 +3849,8 @@ static void Lemerald(int x, int y)
          next[x][y] = Xblank;
          cave[x-1][y] = Yemerald_w;
          next[x-1][y] = Xemerald_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
 
@@ -3766,6 +3860,8 @@ static void Lemerald(int x, int y)
          next[x][y] = Xblank;
          cave[x+1][y] = Yemerald_e;
          next[x+1][y] = Xemerald_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
       }
@@ -3830,6 +3926,7 @@ static void Lemerald_fall(int x, int y)
 {
   switch (cave[x][y+1])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -3841,7 +3938,6 @@ static void Lemerald_fall(int x, int y)
     case Xfake_acid_6:
     case Xfake_acid_7:
     case Xfake_acid_8:
-    case Zplayer:
       cave[x][y] = Yemerald_sB;
       next[x][y] = Xblank;
       cave[x][y+1] = Yemerald_s;
@@ -3870,13 +3966,12 @@ static void Lemerald_fall(int x, int y)
       {
        lev.wonderwall_state = 1;
        cave[x][y] = Yemerald_sB;
+       next[x][y] = Xblank;
        if (is_blank[cave[x][y+2]])
        {
          cave[x][y+2] = Ydiamond_s;
          next[x][y+2] = Xdiamond_fall;
        }
-
-       next[x][y] = Xblank;
        play_element_sound(x, y, SOUND_wonderfall, Xwonderwall);
        return;
       }
@@ -3927,10 +4022,6 @@ static void Ldiamond(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 
-    case Xspring:
-    case Xspring_pause:
-    case Xspring_e:
-    case Xspring_w:
     case Xandroid:
     case Xandroid_1_n:
     case Xandroid_2_n:
@@ -3940,24 +4031,20 @@ static void Ldiamond(int x, int y)
     case Xandroid_2_s:
     case Xandroid_1_w:
     case Xandroid_2_w:
-    case Xstone:
-    case Xstone_pause:
     case Xemerald:
     case Xemerald_pause:
     case Xdiamond:
     case Xdiamond_pause:
+    case Xstone:
+    case Xstone_pause:
     case Xbomb:
     case Xbomb_pause:
-    case Xballoon:
-    case Xacid_ne:
-    case Xacid_nw:
-    case Xball_1:
-    case Xball_2:
     case Xnut:
     case Xnut_pause:
-    case Xslide_ns:
-    case Xslide_ew:
-    case Xwonderwall:
+    case Xspring:
+    case Xspring_pause:
+    case Xspring_e:
+    case Xspring_w:
     case Xkey_1:
     case Xkey_2:
     case Xkey_3:
@@ -3966,12 +4053,17 @@ static void Ldiamond(int x, int y)
     case Xkey_6:
     case Xkey_7:
     case Xkey_8:
-    case Xbumper:
+    case Xballoon:
+    case Xball_1:
+    case Xball_2:
+    case Xwonderwall:
     case Xswitch:
-    case Xsteel_1:
-    case Xsteel_2:
-    case Xsteel_3:
-    case Xsteel_4:
+    case Xbumper:
+    case Ybumper:
+    case Xacid_ne:
+    case Xacid_nw:
+    case Xslide_ns:
+    case Xslide_ew:
     case Xwall_1:
     case Xwall_2:
     case Xwall_3:
@@ -3980,6 +4072,10 @@ static void Ldiamond(int x, int y)
     case Xroundwall_2:
     case Xroundwall_3:
     case Xroundwall_4:
+    case Xsteel_1:
+    case Xsteel_2:
+    case Xsteel_3:
+    case Xsteel_4:
       if (RANDOM(2))
       {
        if (is_blank[cave[x+1][y]] && is_blank_or_acid[cave[x+1][y+1]])
@@ -3988,6 +4084,8 @@ static void Ldiamond(int x, int y)
          next[x][y] = Xblank;
          cave[x+1][y] = Ydiamond_e;
          next[x+1][y] = Xdiamond_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
 
@@ -3997,6 +4095,8 @@ static void Ldiamond(int x, int y)
          next[x][y] = Xblank;
          cave[x-1][y] = Ydiamond_w;
          next[x-1][y] = Xdiamond_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
       }
@@ -4008,6 +4108,8 @@ static void Ldiamond(int x, int y)
          next[x][y] = Xblank;
          cave[x-1][y] = Ydiamond_w;
          next[x-1][y] = Xdiamond_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
 
@@ -4017,6 +4119,8 @@ static void Ldiamond(int x, int y)
          next[x][y] = Xblank;
          cave[x+1][y] = Ydiamond_e;
          next[x+1][y] = Xdiamond_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
       }
@@ -4081,6 +4185,7 @@ static void Ldiamond_fall(int x, int y)
 {
   switch (cave[x][y+1])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -4092,7 +4197,6 @@ static void Ldiamond_fall(int x, int y)
     case Xfake_acid_6:
     case Xfake_acid_7:
     case Xfake_acid_8:
-    case Zplayer:
       cave[x][y] = Ydiamond_sB;
       next[x][y] = Xblank;
       cave[x][y+1] = Ydiamond_s;
@@ -4121,13 +4225,12 @@ static void Ldiamond_fall(int x, int y)
       {
        lev.wonderwall_state = 1;
        cave[x][y] = Ydiamond_sB;
+       next[x][y] = Xblank;
        if (is_blank[cave[x][y+2]])
        {
          cave[x][y+2] = Ystone_s;
          next[x][y+2] = Xstone_fall;
        }
-
-       next[x][y] = Xblank;
        play_element_sound(x, y, SOUND_wonderfall, Xwonderwall);
        return;
       }
@@ -4187,10 +4290,6 @@ static void Lstone(int x, int y)
       next[x][y+1] = Xsand_sandstone_2;
       return;
 
-    case Xspring:
-    case Xspring_pause:
-    case Xspring_e:
-    case Xspring_w:
     case Xandroid:
     case Xandroid_1_n:
     case Xandroid_2_n:
@@ -4200,23 +4299,20 @@ static void Lstone(int x, int y)
     case Xandroid_2_s:
     case Xandroid_1_w:
     case Xandroid_2_w:
-    case Xstone:
-    case Xstone_pause:
     case Xemerald:
     case Xemerald_pause:
     case Xdiamond:
     case Xdiamond_pause:
+    case Xstone:
+    case Xstone_pause:
     case Xbomb:
     case Xbomb_pause:
-    case Xballoon:
-    case Xacid_ne:
-    case Xacid_nw:
-    case Xball_1:
-    case Xball_2:
     case Xnut:
     case Xnut_pause:
-    case Xslide_ns:
-    case Xslide_ew:
+    case Xspring:
+    case Xspring_pause:
+    case Xspring_e:
+    case Xspring_w:
     case Xkey_1:
     case Xkey_2:
     case Xkey_3:
@@ -4225,10 +4321,18 @@ static void Lstone(int x, int y)
     case Xkey_6:
     case Xkey_7:
     case Xkey_8:
-    case Xbumper:
+    case Xballoon:
+    case Xball_1:
+    case Xball_2:
     case Xswitch:
+    case Xbumper:
+    case Ybumper:
+    case Xacid_ne:
+    case Xacid_nw:
     case Xlenses:
     case Xmagnify:
+    case Xslide_ns:
+    case Xslide_ew:
     case Xroundwall_1:
     case Xroundwall_2:
     case Xroundwall_3:
@@ -4241,6 +4345,8 @@ static void Lstone(int x, int y)
          next[x][y] = Xblank;
          cave[x+1][y] = Ystone_e;
          next[x+1][y] = Xstone_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
 
@@ -4250,6 +4356,8 @@ static void Lstone(int x, int y)
          next[x][y] = Xblank;
          cave[x-1][y] = Ystone_w;
          next[x-1][y] = Xstone_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
       }
@@ -4261,6 +4369,8 @@ static void Lstone(int x, int y)
          next[x][y] = Xblank;
          cave[x-1][y] = Ystone_w;
          next[x-1][y] = Xstone_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
 
@@ -4270,6 +4380,8 @@ static void Lstone(int x, int y)
          next[x][y] = Xblank;
          cave[x+1][y] = Ystone_e;
          next[x+1][y] = Xstone_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
       }
@@ -4325,6 +4437,7 @@ static void Lstone_fall(int x, int y)
 {
   switch (cave[x][y+1])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -4336,7 +4449,6 @@ static void Lstone_fall(int x, int y)
     case Xfake_acid_6:
     case Xfake_acid_7:
     case Xfake_acid_8:
-    case Zplayer:
       cave[x][y] = Ystone_sB;
       next[x][y] = Xblank;
       cave[x][y+1] = Ystone_s;
@@ -4360,13 +4472,26 @@ static void Lstone_fall(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 
-    case Xnut:
-    case Xnut_pause:
-      next[x][y] = Xstone;
-      cave[x][y+1] = Ynut_stone;
-      next[x][y+1] = Xemerald;
-      play_element_sound(x, y, SOUND_crack, Xnut);
-      score += lev.nut_score;
+    case Xeater_n:
+    case Xeater_e:
+    case Xeater_s:
+    case Xeater_w:
+      cave[x][y] = Ystone_sB;
+      next[x][y] = Xblank;
+      cave[x][y+1] = Yeater_stone;
+      next[x][y+1] = Zeater;
+      Lboom_eater_old(x, y+1);
+      score += lev.eater_score;
+      return;
+
+    case Xalien:
+    case Xalien_pause:
+      cave[x][y] = Ystone_sB;
+      next[x][y] = Xblank;
+      cave[x][y+1] = Yalien_stone;
+      next[x][y+1] = Ztank;
+      Lboom_tank_old(x, y+1);
+      score += lev.alien_score;
       return;
 
     case Xbug_1_n:
@@ -4378,8 +4503,10 @@ static void Lstone_fall(int x, int y)
     case Xbug_2_s:
     case Xbug_2_w:
       cave[x][y] = Ystone_sB;
+      next[x][y] = Xblank;
       cave[x][y+1] = Ybug_stone;
-      Lboom_bug(x, y+1, Xstone_fall);
+      next[x][y+1] = Zbug;
+      Lboom_bug_old(x, y+1);
       score += lev.bug_score;
       return;
 
@@ -4392,87 +4519,18 @@ static void Lstone_fall(int x, int y)
     case Xtank_2_s:
     case Xtank_2_w:
       cave[x][y] = Ystone_sB;
+      next[x][y] = Xblank;
       cave[x][y+1] = Ytank_stone;
-      Lboom_tank(x, y+1, Xstone_fall);
+      next[x][y+1] = Ztank;
+      Lboom_tank_old(x, y+1);
       score += lev.tank_score;
       return;
 
-    case Xspring:
-      if (RANDOM(2))
-      {
-       switch (cave[x+1][y+1])
-       {
-         case Xblank:
-         case Xsplash_e:
-         case Xsplash_w:
-         case Xfake_acid_1:
-         case Xfake_acid_2:
-         case Xfake_acid_3:
-         case Xfake_acid_4:
-         case Xfake_acid_5:
-         case Xfake_acid_6:
-         case Xfake_acid_7:
-         case Xfake_acid_8:
-         case Xalien:
-         case Xalien_pause:
-           cave[x][y+1] = Xspring_e;
-           break;
-
-         default:
-           cave[x][y+1] = Xspring_w;
-           break;
-       }
-      }
-      else
-      {
-       switch (cave[x-1][y+1])
-       {
-         case Xblank:
-         case Xsplash_e:
-         case Xsplash_w:
-         case Xfake_acid_1:
-         case Xfake_acid_2:
-         case Xfake_acid_3:
-         case Xfake_acid_4:
-         case Xfake_acid_5:
-         case Xfake_acid_6:
-         case Xfake_acid_7:
-         case Xfake_acid_8:
-         case Xalien:
-         case Xalien_pause:
-           cave[x][y+1] = Xspring_w;
-           break;
-         default:
-           cave[x][y+1] = Xspring_e;
-           break;
-       }
-      }
-
-      next[x][y] = Xstone;
-      return;
-
-    case Xeater_n:
-    case Xeater_e:
-    case Xeater_s:
-    case Xeater_w:
-      cave[x][y] = Ystone_sB;
-      cave[x][y+1] = Yeater_stone;
-      Lboom_eater(x, y+1, Xstone_fall);
-      score += lev.eater_score;
-      return;
-
-    case Xalien:
-    case Xalien_pause:
-      cave[x][y] = Ystone_sB;
-      cave[x][y+1] = Yalien_stone;
-      Lboom_tank(x, y+1, Xstone_fall);
-      score += lev.alien_score;
-      return;
-
-    case Xdiamond:
-    case Xdiamond_pause:
-      switch (cave[x][y+2])
+    case Xdiamond:
+    case Xdiamond_pause:
+      switch (cave[x][y+2])
       {
+       case Zplayer:
        case Xblank:
        case Xsplash_e:
        case Xsplash_w:
@@ -4484,7 +4542,25 @@ static void Lstone_fall(int x, int y)
        case Xfake_acid_6:
        case Xfake_acid_7:
        case Xfake_acid_8:
-       case Zplayer:
+       case Xplant:
+       case Yplant:
+       case Xacid_1:
+       case Xacid_2:
+       case Xacid_3:
+       case Xacid_4:
+       case Xacid_5:
+       case Xacid_6:
+       case Xacid_7:
+       case Xacid_8:
+       case Xandroid:
+       case Xandroid_1_n:
+       case Xandroid_2_n:
+       case Xandroid_1_e:
+       case Xandroid_2_e:
+       case Xandroid_1_s:
+       case Xandroid_2_s:
+       case Xandroid_1_w:
+       case Xandroid_2_w:
        case Xbug_1_n:
        case Xbug_1_e:
        case Xbug_1_s:
@@ -4501,32 +4577,13 @@ static void Lstone_fall(int x, int y)
        case Xtank_2_e:
        case Xtank_2_s:
        case Xtank_2_w:
-       case Xspring_fall:
-       case Xandroid:
-       case Xandroid_1_n:
-       case Xandroid_2_n:
-       case Xandroid_1_e:
-       case Xandroid_2_e:
-       case Xandroid_1_s:
-       case Xandroid_2_s:
-       case Xandroid_1_w:
-       case Xandroid_2_w:
-       case Xstone_fall:
        case Xemerald_fall:
        case Xdiamond_fall:
+       case Xstone_fall:
        case Xbomb_fall:
-       case Xacid_s:
-       case Xacid_1:
-       case Xacid_2:
-       case Xacid_3:
-       case Xacid_4:
-       case Xacid_5:
-       case Xacid_6:
-       case Xacid_7:
-       case Xacid_8:
        case Xnut_fall:
-       case Xplant:
-       case Yplant:
+       case Xspring_fall:
+       case Xacid_s:
          next[x][y] = Xstone;
          play_element_sound(x, y, SOUND_stone, Xstone);
          return;
@@ -4541,8 +4598,74 @@ static void Lstone_fall(int x, int y)
 
     case Xbomb:
     case Xbomb_pause:
+      cave[x][y] = Xstone;
+      next[x][y] = Xstone;
       cave[x][y+1] = Ybomb_blank;
-      Lboom_tank(x, y+1, Xstone_fall);
+      next[x][y+1] = Ztank;
+      Lboom_tank_old(x, y+1);
+      return;
+
+    case Xnut:
+    case Xnut_pause:
+      next[x][y] = Xstone;
+      cave[x][y+1] = Ynut_stone;
+      next[x][y+1] = Xemerald;
+      play_element_sound(x, y, SOUND_crack, Xnut);
+      score += lev.nut_score;
+      return;
+
+    case Xspring:
+      if (RANDOM(2))
+      {
+       switch (cave[x+1][y+1])
+       {
+         case Xblank:
+         case Xsplash_e:
+         case Xsplash_w:
+         case Xfake_acid_1:
+         case Xfake_acid_2:
+         case Xfake_acid_3:
+         case Xfake_acid_4:
+         case Xfake_acid_5:
+         case Xfake_acid_6:
+         case Xfake_acid_7:
+         case Xfake_acid_8:
+         case Xalien:
+         case Xalien_pause:
+           cave[x][y+1] = Xspring_e;
+           break;
+
+         default:
+           cave[x][y+1] = Xspring_w;
+           break;
+       }
+      }
+      else
+      {
+       switch (cave[x-1][y+1])
+       {
+         case Xblank:
+         case Xsplash_e:
+         case Xsplash_w:
+         case Xfake_acid_1:
+         case Xfake_acid_2:
+         case Xfake_acid_3:
+         case Xfake_acid_4:
+         case Xfake_acid_5:
+         case Xfake_acid_6:
+         case Xfake_acid_7:
+         case Xfake_acid_8:
+         case Xalien:
+         case Xalien_pause:
+           cave[x][y+1] = Xspring_w;
+           break;
+         default:
+           cave[x][y+1] = Xspring_e;
+           break;
+       }
+      }
+
+      next[x][y] = Xstone;
       return;
 
     case Xwonderwall:
@@ -4550,14 +4673,12 @@ static void Lstone_fall(int x, int y)
       {
        lev.wonderwall_state = 1;
        cave[x][y] = Ystone_sB;
-
+       next[x][y] = Xblank;
        if (is_blank[cave[x][y+2]])
        {
          cave[x][y+2] = Yemerald_s;
          next[x][y+2] = Xemerald_fall;
        }
-
-       next[x][y] = Xblank;
        play_element_sound(x, y, SOUND_wonderfall, Xwonderwall);
        return;
       }
@@ -4608,10 +4729,6 @@ static void Lbomb(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 
-    case Xspring:
-    case Xspring_pause:
-    case Xspring_e:
-    case Xspring_w:
     case Xandroid:
     case Xandroid_1_n:
     case Xandroid_2_n:
@@ -4621,23 +4738,20 @@ static void Lbomb(int x, int y)
     case Xandroid_2_s:
     case Xandroid_1_w:
     case Xandroid_2_w:
-    case Xstone:
-    case Xstone_pause:
     case Xemerald:
     case Xemerald_pause:
     case Xdiamond:
     case Xdiamond_pause:
+    case Xstone:
+    case Xstone_pause:
     case Xbomb:
     case Xbomb_pause:
-    case Xballoon:
-    case Xacid_ne:
-    case Xacid_nw:
-    case Xball_1:
-    case Xball_2:
     case Xnut:
     case Xnut_pause:
-    case Xslide_ns:
-    case Xslide_ew:
+    case Xspring:
+    case Xspring_pause:
+    case Xspring_e:
+    case Xspring_w:
     case Xkey_1:
     case Xkey_2:
     case Xkey_3:
@@ -4646,8 +4760,16 @@ static void Lbomb(int x, int y)
     case Xkey_6:
     case Xkey_7:
     case Xkey_8:
-    case Xbumper:
+    case Xballoon:
+    case Xball_1:
+    case Xball_2:
     case Xswitch:
+    case Xbumper:
+    case Ybumper:
+    case Xacid_ne:
+    case Xacid_nw:
+    case Xslide_ns:
+    case Xslide_ew:
     case Xroundwall_1:
     case Xroundwall_2:
     case Xroundwall_3:
@@ -4660,6 +4782,8 @@ static void Lbomb(int x, int y)
          next[x][y] = Xblank;
          cave[x+1][y] = Ybomb_e;
          next[x+1][y] = Xbomb_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
 
@@ -4669,6 +4793,8 @@ static void Lbomb(int x, int y)
          next[x][y] = Xblank;
          cave[x-1][y] = Ybomb_w;
          next[x-1][y] = Xbomb_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
       }
@@ -4680,6 +4806,8 @@ static void Lbomb(int x, int y)
          next[x][y] = Xblank;
          cave[x-1][y] = Ybomb_w;
          next[x-1][y] = Xbomb_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
 
@@ -4689,6 +4817,8 @@ static void Lbomb(int x, int y)
          next[x][y] = Xblank;
          cave[x+1][y] = Ybomb_e;
          next[x+1][y] = Xbomb_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
       }
@@ -4780,7 +4910,8 @@ static void Lbomb_fall(int x, int y)
 
     default:
       cave[x][y] = Ybomb_blank;
-      Lboom_tank(x, y, Xbomb_fall);
+      next[x][y] = Ztank;
+      Lboom_tank_old(x, y);
       return;
   }
 }
@@ -4823,10 +4954,6 @@ static void Lnut(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 
-    case Xspring:
-    case Xspring_pause:
-    case Xspring_e:
-    case Xspring_w:
     case Xandroid:
     case Xandroid_1_n:
     case Xandroid_2_n:
@@ -4836,23 +4963,20 @@ static void Lnut(int x, int y)
     case Xandroid_2_s:
     case Xandroid_1_w:
     case Xandroid_2_w:
-    case Xstone:
-    case Xstone_pause:
     case Xemerald:
     case Xemerald_pause:
     case Xdiamond:
     case Xdiamond_pause:
+    case Xstone:
+    case Xstone_pause:
     case Xbomb:
     case Xbomb_pause:
-    case Xballoon:
-    case Xacid_ne:
-    case Xacid_nw:
-    case Xball_1:
-    case Xball_2:
     case Xnut:
     case Xnut_pause:
-    case Xslide_ns:
-    case Xslide_ew:
+    case Xspring:
+    case Xspring_pause:
+    case Xspring_e:
+    case Xspring_w:
     case Xkey_1:
     case Xkey_2:
     case Xkey_3:
@@ -4861,8 +4985,16 @@ static void Lnut(int x, int y)
     case Xkey_6:
     case Xkey_7:
     case Xkey_8:
-    case Xbumper:
+    case Xballoon:
+    case Xball_1:
+    case Xball_2:
     case Xswitch:
+    case Xbumper:
+    case Ybumper:
+    case Xacid_ne:
+    case Xacid_nw:
+    case Xslide_ns:
+    case Xslide_ew:
     case Xroundwall_1:
     case Xroundwall_2:
     case Xroundwall_3:
@@ -4875,6 +5007,8 @@ static void Lnut(int x, int y)
          next[x][y] = Xblank;
          cave[x+1][y] = Ynut_e;
          next[x+1][y] = Xnut_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
 
@@ -4884,6 +5018,8 @@ static void Lnut(int x, int y)
          next[x][y] = Xblank;
          cave[x-1][y] = Ynut_w;
          next[x-1][y] = Xnut_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
       }
@@ -4895,6 +5031,8 @@ static void Lnut(int x, int y)
          next[x][y] = Xblank;
          cave[x-1][y] = Ynut_w;
          next[x-1][y] = Xnut_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
 
@@ -4904,6 +5042,8 @@ static void Lnut(int x, int y)
          next[x][y] = Xblank;
          cave[x+1][y] = Ynut_e;
          next[x+1][y] = Xnut_pause;
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
       }
@@ -4959,6 +5099,7 @@ static void Lnut_fall(int x, int y)
 {
   switch (cave[x][y+1])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -4970,7 +5111,6 @@ static void Lnut_fall(int x, int y)
     case Xfake_acid_6:
     case Xfake_acid_7:
     case Xfake_acid_8:
-    case Zplayer:
       cave[x][y] = Ynut_sB;
       next[x][y] = Xblank;
       cave[x][y+1] = Ynut_s;
@@ -5042,10 +5182,6 @@ static void Lspring(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 
-    case Xspring:
-    case Xspring_pause:
-    case Xspring_e:
-    case Xspring_w:
     case Xandroid:
     case Xandroid_1_n:
     case Xandroid_2_n:
@@ -5055,23 +5191,20 @@ static void Lspring(int x, int y)
     case Xandroid_2_s:
     case Xandroid_1_w:
     case Xandroid_2_w:
-    case Xstone:
-    case Xstone_pause:
     case Xemerald:
     case Xemerald_pause:
     case Xdiamond:
     case Xdiamond_pause:
+    case Xstone:
+    case Xstone_pause:
     case Xbomb:
     case Xbomb_pause:
-    case Xballoon:
-    case Xacid_ne:
-    case Xacid_nw:
-    case Xball_1:
-    case Xball_2:
     case Xnut:
     case Xnut_pause:
-    case Xslide_ns:
-    case Xslide_ew:
+    case Xspring:
+    case Xspring_pause:
+    case Xspring_e:
+    case Xspring_w:
     case Xkey_1:
     case Xkey_2:
     case Xkey_3:
@@ -5080,8 +5213,16 @@ static void Lspring(int x, int y)
     case Xkey_6:
     case Xkey_7:
     case Xkey_8:
-    case Xbumper:
+    case Xballoon:
+    case Xball_1:
+    case Xball_2:
     case Xswitch:
+    case Xbumper:
+    case Ybumper:
+    case Xacid_ne:
+    case Xacid_nw:
+    case Xslide_ns:
+    case Xslide_ew:
     case Xroundwall_1:
     case Xroundwall_2:
     case Xroundwall_3:
@@ -5093,14 +5234,13 @@ static void Lspring(int x, int y)
          cave[x][y] = Yspring_eB;
          next[x][y] = Xblank;
          cave[x+1][y] = Yspring_e;
-         if (cave[x][y+1] == Xbumper)
-           cave[x][y+1] = XbumperB;
-
 #ifdef SPRING_ROLL
          next[x+1][y] = Xspring_e;
 #else
          next[x+1][y] = Xspring_pause;
 #endif
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
 
@@ -5109,14 +5249,13 @@ static void Lspring(int x, int y)
          cave[x][y] = Yspring_wB;
          next[x][y] = Xblank;
          cave[x-1][y] = Yspring_w;
-         if (cave[x][y+1] == Xbumper)
-           cave[x][y+1] = XbumperB;
-
 #ifdef SPRING_ROLL
          next[x-1][y] = Xspring_w;
 #else
          next[x-1][y] = Xspring_pause;
 #endif
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
       }
@@ -5127,14 +5266,13 @@ static void Lspring(int x, int y)
          cave[x][y] = Yspring_wB;
          next[x][y] = Xblank;
          cave[x-1][y] = Yspring_w;
-         if (cave[x][y+1] == Xbumper)
-           cave[x][y+1] = XbumperB;
-
 #ifdef SPRING_ROLL
          next[x-1][y] = Xspring_w;
 #else
          next[x-1][y] = Xspring_pause;
 #endif
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
 
@@ -5143,14 +5281,13 @@ static void Lspring(int x, int y)
          cave[x][y] = Yspring_eB;
          next[x][y] = Xblank;
          cave[x+1][y] = Yspring_e;
-         if (cave[x][y+1] == Xbumper)
-           cave[x][y+1] = XbumperB;
-
 #ifdef SPRING_ROLL
          next[x+1][y] = Xspring_e;
 #else
          next[x+1][y] = Xspring_pause;
 #endif
+         if (cave[x][y+1] == Xbumper)
+           cave[x][y+1] = Ybumper;
          return;
        }
       }
@@ -5241,7 +5378,7 @@ static void Lspring_e(int x, int y)
       return;
 
     case Xbumper:
-      cave[x][y+1] = XbumperB;
+      cave[x][y+1] = Ybumper;
   }
 
   switch (cave[x+1][y])
@@ -5299,8 +5436,8 @@ static void Lspring_e(int x, int y)
       return;
 
     case Xbumper:
-    case XbumperB:
-      cave[x+1][y] = XbumperB;
+    case Ybumper:
+      cave[x+1][y] = Ybumper;
       next[x][y] = Xspring_w;
       play_element_sound(x, y, SOUND_spring, Xspring);
       return;
@@ -5352,7 +5489,7 @@ static void Lspring_w(int x, int y)
       return;
 
     case Xbumper:
-      cave[x][y+1] = XbumperB;
+      cave[x][y+1] = Ybumper;
   }
 
   switch (cave[x-1][y])
@@ -5410,8 +5547,8 @@ static void Lspring_w(int x, int y)
       return;
 
     case Xbumper:
-    case XbumperB:
-      cave[x-1][y] = XbumperB;
+    case Ybumper:
+      cave[x-1][y] = Ybumper;
       next[x][y] = Xspring_e;
       play_element_sound(x, y, SOUND_spring, Xspring);
       return;
@@ -5428,6 +5565,7 @@ static void Lspring_fall(int x, int y)
 {
   switch (cave[x][y+1])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -5439,7 +5577,6 @@ static void Lspring_fall(int x, int y)
     case Xfake_acid_6:
     case Xfake_acid_7:
     case Xfake_acid_8:
-    case Zplayer:
       cave[x][y] = Yspring_sB;
       next[x][y] = Xblank;
       cave[x][y+1] = Yspring_s;
@@ -5463,10 +5600,26 @@ static void Lspring_fall(int x, int y)
       play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
 
-    case Xbomb:
-    case Xbomb_pause:
-      cave[x][y+1] = Ybomb_blank;
-      Lboom_tank(x, y+1, Xspring_fall);
+    case Xeater_n:
+    case Xeater_e:
+    case Xeater_s:
+    case Xeater_w:
+      cave[x][y] = Yspring_sB;
+      next[x][y] = Xblank;
+      cave[x][y+1] = Yeater_spring;
+      next[x][y+1] = Zeater;
+      Lboom_eater_old(x, y+1);
+      score += lev.eater_score;
+      return;
+
+    case Xalien:
+    case Xalien_pause:
+      cave[x][y] = Yspring_sB;
+      next[x][y] = Xblank;
+      cave[x][y+1] = Yalien_spring;
+      next[x][y+1] = Ztank;
+      Lboom_tank_old(x, y+1);
+      score += lev.alien_score;
       return;
 
     case Xbug_1_n:
@@ -5478,8 +5631,10 @@ static void Lspring_fall(int x, int y)
     case Xbug_2_s:
     case Xbug_2_w:
       cave[x][y] = Yspring_sB;
+      next[x][y] = Xblank;
       cave[x][y+1] = Ybug_spring;
-      Lboom_bug(x, y+1, Xspring_fall);
+      next[x][y+1] = Zbug;
+      Lboom_bug_old(x, y+1);
       score += lev.bug_score;
       return;
 
@@ -5492,27 +5647,20 @@ static void Lspring_fall(int x, int y)
     case Xtank_2_s:
     case Xtank_2_w:
       cave[x][y] = Yspring_sB;
+      next[x][y] = Xblank;
       cave[x][y+1] = Ytank_spring;
-      Lboom_tank(x, y+1, Xspring_fall);
+      next[x][y+1] = Ztank;
+      Lboom_tank_old(x, y+1);
       score += lev.tank_score;
       return;
 
-    case Xeater_n:
-    case Xeater_e:
-    case Xeater_s:
-    case Xeater_w:
-      cave[x][y] = Yspring_sB;
-      cave[x][y+1] = Yeater_spring;
-      Lboom_eater(x, y+1, Xspring_fall);
-      score += lev.eater_score;
-      return;
-
-    case Xalien:
-    case Xalien_pause:
-      cave[x][y] = Yspring_sB;
-      cave[x][y+1] = Yalien_spring;
-      Lboom_tank(x, y+1, Xspring_fall);
-      score += lev.alien_score;
+    case Xbomb:
+    case Xbomb_pause:
+      cave[x][y] = Xspring;
+      next[x][y] = Xspring;
+      cave[x][y+1] = Ybomb_blank;
+      next[x][y+1] = Ztank;
+      Lboom_tank_old(x, y+1);
       return;
 
     default:
@@ -5525,302 +5673,506 @@ static void Lspring_fall(int x, int y)
 
 static void Lpush_emerald_e(int x, int y)
 {
+  cave[x][y] = Yemerald_eB;
+  next[x][y] = Xblank;
+
   switch (cave[x+1][y])
   {
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
+    case Zboom:
+    case Xchain:
     case Xboom_bug:
-    case Xboom_bomb:
+    case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
-    case Zplayer:
-      cave[x][y] = Xemerald;
-      next[x][y] = Xemerald;
       return;
 
-    default:
-      cave[x][y] = Yemerald_eB;
-      next[x][y] = Xblank;
-      cave[x+1][y] = Yemerald_e;
-      next[x+1][y] = Xemerald_pause;
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      if (cave[x+2][y-1] == Xblank)
+       cave[x+2][y-1] = Xsplash_e;
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
+#endif
   }
+
+  cave[x+1][y] = Yemerald_e;
+  next[x+1][y] = Xemerald_pause;
 }
 
 static void Lpush_emerald_w(int x, int y)
 {
+  cave[x][y] = Yemerald_wB;
+  next[x][y] = Xblank;
+
   switch (cave[x-1][y])
   {
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
+    case Zboom:
+    case Xchain:
     case Xboom_bug:
-    case Xboom_bomb:
+    case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
-    case Zplayer:
-      cave[x][y] = Xemerald;
-      next[x][y] = Xemerald;
       return;
 
-    default:
-      cave[x][y] = Yemerald_wB;
-      next[x][y] = Xblank;
-      cave[x-1][y] = Yemerald_w;
-      next[x-1][y] = Xemerald_pause;
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_e;
+      if (cave[x-2][y-1] == Xblank)
+       cave[x-2][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
+#endif
   }
+
+  cave[x-1][y] = Yemerald_w;
+  next[x-1][y] = Xemerald_pause;
 }
 
 static void Lpush_diamond_e(int x, int y)
 {
+  cave[x][y] = Ydiamond_eB;
+  next[x][y] = Xblank;
+
   switch (cave[x+1][y])
   {
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
+    case Zboom:
+    case Xchain:
     case Xboom_bug:
-    case Xboom_bomb:
+    case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
-    case Zplayer:
-      cave[x][y] = Xdiamond;
-      next[x][y] = Xdiamond;
       return;
 
-    default:
-      cave[x][y] = Ydiamond_eB;
-      next[x][y] = Xblank;
-      cave[x+1][y] = Ydiamond_e;
-      next[x+1][y] = Xdiamond_pause;
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      if (cave[x+2][y-1] == Xblank)
+       cave[x+2][y-1] = Xsplash_e;
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
+#endif
   }
+
+  cave[x+1][y] = Ydiamond_e;
+  next[x+1][y] = Xdiamond_pause;
 }
 
 static void Lpush_diamond_w(int x, int y)
 {
+  cave[x][y] = Ydiamond_wB;
+  next[x][y] = Xblank;
+
   switch (cave[x-1][y])
   {
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
+    case Zboom:
+    case Xchain:
     case Xboom_bug:
-    case Xboom_bomb:
+    case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
-    case Zplayer:
-      cave[x][y] = Xdiamond;
-      next[x][y] = Xdiamond;
       return;
 
-    default:
-      cave[x][y] = Ydiamond_wB;
-      next[x][y] = Xblank;
-      cave[x-1][y] = Ydiamond_w;
-      next[x-1][y] = Xdiamond_pause;
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_e;
+      if (cave[x-2][y-1] == Xblank)
+       cave[x-2][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
+#endif
   }
+
+  cave[x-1][y] = Ydiamond_w;
+  next[x-1][y] = Xdiamond_pause;
 }
 
 static void Lpush_stone_e(int x, int y)
 {
+  cave[x][y] = Ystone_eB;
+  next[x][y] = Xblank;
+
   switch (cave[x+1][y])
   {
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
+    case Zboom:
+    case Xchain:
     case Xboom_bug:
-    case Xboom_bomb:
+    case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
-    case Zplayer:
-      cave[x][y] = Xstone;
-      next[x][y] = Xstone;
       return;
 
-    default:
-      cave[x][y] = Ystone_eB;
-      next[x][y] = Xblank;
-      cave[x+1][y] = Ystone_e;
-      next[x+1][y] = Xstone_pause;
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      if (cave[x+2][y-1] == Xblank)
+       cave[x+2][y-1] = Xsplash_e;
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
+#endif
   }
+
+  cave[x+1][y] = Ystone_e;
+  next[x+1][y] = Xstone_pause;
 }
 
 static void Lpush_stone_w(int x, int y)
 {
+  cave[x][y] = Ystone_wB;
+  next[x][y] = Xblank;
+
   switch (cave[x-1][y])
   {
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
+    case Zboom:
+    case Xchain:
     case Xboom_bug:
-    case Xboom_bomb:
+    case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
-    case Zplayer:
-      cave[x][y] = Xstone;
-      next[x][y] = Xstone;
       return;
 
-    default:
-      cave[x][y] = Ystone_wB;
-      next[x][y] = Xblank;
-      cave[x-1][y] = Ystone_w;
-      next[x-1][y] = Xstone_pause;
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_e;
+      if (cave[x-2][y-1] == Xblank)
+       cave[x-2][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
+#endif
   }
+
+  cave[x-1][y] = Ystone_w;
+  next[x-1][y] = Xstone_pause;
 }
 
 static void Lpush_bomb_e(int x, int y)
 {
+  cave[x][y] = Ybomb_eB;
+  next[x][y] = Xblank;
+
   switch (cave[x+1][y])
   {
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
+    case Zboom:
+    case Xchain:
     case Xboom_bug:
-    case Xboom_bomb:
+    case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
-    case Zplayer:
-      cave[x][y] = Xbomb;
-      next[x][y] = Xbomb;
       return;
 
-    default:
-      cave[x][y] = Ybomb_eB;
-      next[x][y] = Xblank;
-      cave[x+1][y] = Ybomb_e;
-      next[x+1][y] = Xbomb_pause;
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      if (cave[x+2][y-1] == Xblank)
+       cave[x+2][y-1] = Xsplash_e;
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
+#endif
   }
+
+  cave[x+1][y] = Ybomb_e;
+  next[x+1][y] = Xbomb_pause;
 }
 
 static void Lpush_bomb_w(int x, int y)
 {
+  cave[x][y] = Ybomb_wB;
+  next[x][y] = Xblank;
+
   switch (cave[x-1][y])
   {
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
+    case Zboom:
+    case Xchain:
     case Xboom_bug:
-    case Xboom_bomb:
+    case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
-    case Zplayer:
-      cave[x][y] = Xbomb;
-      next[x][y] = Xbomb;
       return;
 
-    default:
-      cave[x][y] = Ybomb_wB;
-      next[x][y] = Xblank;
-      cave[x-1][y] = Ybomb_w;
-      next[x-1][y] = Xbomb_pause;
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_e;
+      if (cave[x-2][y-1] == Xblank)
+       cave[x-2][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
+#endif
   }
+
+  cave[x-1][y] = Ybomb_w;
+  next[x-1][y] = Xbomb_pause;
 }
 
 static void Lpush_nut_e(int x, int y)
 {
+  cave[x][y] = Ynut_eB;
+  next[x][y] = Xblank;
+
   switch (cave[x+1][y])
   {
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
+    case Zboom:
+    case Xchain:
     case Xboom_bug:
-    case Xboom_bomb:
+    case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
-    case Zplayer:
-      cave[x][y] = Xnut;
-      next[x][y] = Xnut;
       return;
 
-    default:
-      cave[x][y] = Ynut_eB;
-      next[x][y] = Xblank;
-      cave[x+1][y] = Ynut_e;
-      next[x+1][y] = Xnut_pause;
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      if (cave[x+2][y-1] == Xblank)
+       cave[x+2][y-1] = Xsplash_e;
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
+#endif
   }
+
+  cave[x+1][y] = Ynut_e;
+  next[x+1][y] = Xnut_pause;
 }
 
 static void Lpush_nut_w(int x, int y)
 {
+  cave[x][y] = Ynut_wB;
+  next[x][y] = Xblank;
+
   switch (cave[x-1][y])
   {
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
+    case Zboom:
+    case Xchain:
     case Xboom_bug:
-    case Xboom_bomb:
+    case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
-    case Zplayer:
-      cave[x][y] = Xnut;
-      next[x][y] = Xnut;
       return;
 
-    default:
-      cave[x][y] = Ynut_wB;
-      next[x][y] = Xblank;
-      cave[x-1][y] = Ynut_w;
-      next[x-1][y] = Xnut_pause;
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_e;
+      if (cave[x-2][y-1] == Xblank)
+       cave[x-2][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
+#endif
   }
+
+  cave[x-1][y] = Ynut_w;
+  next[x-1][y] = Xnut_pause;
 }
 
 static void Lpush_spring_e(int x, int y)
 {
+  cave[x][y] = Yspring_eB;
+  next[x][y] = Xblank;
+
   switch (cave[x+1][y])
   {
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
+    case Zboom:
+    case Xchain:
     case Xboom_bug:
-    case Xboom_bomb:
+    case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
-    case Zplayer:
-      cave[x][y] = Xspring;
-      next[x][y] = Xspring;
       return;
 
-    default:
-      cave[x][y] = Yspring_eB;
-      next[x][y] = Xblank;
-      cave[x+1][y] = Yspring_e;
-      next[x+1][y] = Xspring_e;
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      if (cave[x+2][y-1] == Xblank)
+       cave[x+2][y-1] = Xsplash_e;
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
+#endif
   }
+
+  cave[x+1][y] = Yspring_e;
+  next[x+1][y] = Xspring_e;
 }
 
 static void Lpush_spring_w(int x, int y)
 {
+  cave[x][y] = Yspring_wB;
+  next[x][y] = Xblank;
+
   switch (cave[x-1][y])
   {
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
+    case Zboom:
+    case Xchain:
     case Xboom_bug:
-    case Xboom_bomb:
+    case Xboom_tank:
     case Xboom_android:
     case Xboom_1:
-    case Zplayer:
-      cave[x][y] = Xspring;
-      next[x][y] = Xspring;
       return;
 
-    default:
-      cave[x][y] = Yspring_wB;
-      next[x][y] = Xblank;
-      cave[x-1][y] = Yspring_w;
-      next[x-1][y] = Xspring_w;
+#ifdef ACID_ROLL
+    case Xacid_1:
+    case Xacid_2:
+    case Xacid_3:
+    case Xacid_4:
+    case Xacid_5:
+    case Xacid_6:
+    case Xacid_7:
+    case Xacid_8:
+      if (cave[x][y-1] == Xblank)
+       cave[x][y-1] = Xsplash_e;
+      if (cave[x-2][y-1] == Xblank)
+       cave[x-2][y-1] = Xsplash_w;
+      play_element_sound(x, y, SOUND_acid, Xacid_1);
       return;
+#endif
   }
+
+  cave[x-1][y] = Yspring_w;
+  next[x-1][y] = Xspring_w;
 }
 
 static void Ldynamite_1(int x, int y)
@@ -6242,6 +6594,7 @@ static void Ldrip_fall(int x, int y)
 
   switch (cave[x][y+1])
   {
+    case Zplayer:
     case Xblank:
     case Xsplash_e:
     case Xsplash_w:
@@ -6255,7 +6608,6 @@ static void Ldrip_fall(int x, int y)
     case Xfake_acid_8:
     case Xplant:
     case Yplant:
-    case Zplayer:
       cave[x][y] = Ydrip_1_sB;
       next[x][y] = Xdrip_stretchB;
       cave[x][y+1] = Ydrip_1_s;
@@ -6315,7 +6667,7 @@ static void Lwonderwall(int x, int y)
 {
   if (lev.wonderwall_time && lev.wonderwall_state)
   {
-    cave[x][y] = XwonderwallB;
+    cave[x][y] = Ywonderwall;
     play_element_sound(x, y, SOUND_wonder, Xwonderwall);
   }
 }
@@ -6323,31 +6675,31 @@ static void Lwonderwall(int x, int y)
 static void Lwheel(int x, int y)
 {
   if (lev.wheel_cnt && x == lev.wheel_x && y == lev.wheel_y)
-    cave[x][y] = XwheelB;
+    cave[x][y] = Ywheel;
 }
 
 static void Lswitch(int x, int y)
 {
   if (lev.ball_state)
-    cave[x][y] = XswitchB;
+    cave[x][y] = Yswitch;
 }
 
 static void Lfake_blank(int x, int y)
 {
   if (lev.lenses_cnt)
-    cave[x][y] = Xfake_blankB;
+    cave[x][y] = Yfake_blank;
 }
 
 static void Lfake_grass(int x, int y)
 {
   if (lev.magnify_cnt)
-    cave[x][y] = Xfake_grassB;
+    cave[x][y] = Yfake_grass;
 }
 
 static void Lfake_amoeba(int x, int y)
 {
   if (lev.lenses_cnt)
-    cave[x][y] = Xfake_amoebaB;
+    cave[x][y] = Yfake_amoeba;
 }
 
 static void Lsand_stone(int x, int y)
@@ -6513,7 +6865,7 @@ static void Lslide_ew(int x, int y)
 
 static void Lexit(int x, int y)
 {
-  if (lev.required > 0)
+  if (lev.gems_needed > 0)
     return;
 
   switch (RANDOM(64) / 21)
@@ -6572,11 +6924,11 @@ static void Lamoeba(int x, int y)
     case Xfake_acid_6:
     case Xfake_acid_7:
     case Xfake_acid_8:
+    case Xplant:
+    case Yplant:
     case Xgrass:
     case Xdirt:
     case Xsand:
-    case Xplant:
-    case Yplant:
       if (is_amoeba[cave[x][y-1]] ||
          is_amoeba[cave[x+1][y]] ||
          is_amoeba[cave[x][y+1]] ||
@@ -6590,10 +6942,14 @@ static void Lboom_one(int x, int y, boolean by_dynamite)
   switch (cave[x][y])
   {
     case Zborder:
-    case Znormal:
+    case Zbug:
+    case Ztank:
+    case Zeater:
     case Zdynamite:
+    case Zboom:
+    case Xchain:
     case Xboom_bug:
-    case Xboom_bomb:
+    case Xboom_tank:
     case Xboom_android:
     case Xacid_1:
     case Xacid_2:
@@ -6603,11 +6959,6 @@ static void Lboom_one(int x, int y, boolean by_dynamite)
     case Xacid_6:
     case Xacid_7:
     case Xacid_8:
-    case Xacid_ne:
-    case Xacid_nw:
-    case Xacid_s:
-    case Xacid_se:
-    case Xacid_sw:
     case Xplant:
     case Yplant:
     case Xdoor_1:
@@ -6626,6 +6977,11 @@ static void Lboom_one(int x, int y, boolean by_dynamite)
     case Xfake_door_6:
     case Xfake_door_7:
     case Xfake_door_8:
+    case Xacid_ne:
+    case Xacid_nw:
+    case Xacid_s:
+    case Xacid_se:
+    case Xacid_sw:
     case Xsteel_1:
     case Xsteel_2:
     case Xsteel_3:
@@ -6654,12 +7010,14 @@ static void Lboom_one(int x, int y, boolean by_dynamite)
     case Xbug_2_s:
     case Xbug_2_w:
       cave[x][y] = Xboom_bug;
+      Lboom_bug_new(x, y, TRUE);
       return;
 
     case Xbomb:
     case Xbomb_pause:
     case Xbomb_fall:
-      cave[x][y] = Xboom_bomb;
+      cave[x][y] = Xboom_tank;
+      Lboom_tank_new(x, y, TRUE);
       return;
 
     default:
@@ -6686,13 +7044,28 @@ static void Lexplode(int x, int y)
 {
   switch (cave[x][y])
   {
-    case Znormal:
+    case Zbug:
+      Lboom_bug_new(x, y, FALSE);
+      Lboom_nine(x, y, FALSE);
+      break;
+
+    case Ztank:
+      Lboom_tank_new(x, y, FALSE);
+      Lboom_nine(x, y, FALSE);
+      break;
+
+    case Zeater:
+      Lboom_eater_new(x, y, FALSE);
       Lboom_nine(x, y, FALSE);
       break;
 
     case Zdynamite:
       Lboom_nine(x, y, TRUE);
       break;
+
+    case Zboom:
+      Lboom_nine(x, y, FALSE);
+      break;
   }
 }
 
@@ -6721,6 +7094,11 @@ static void Lboom_android(int x, int y)
   Lboom_1(x, y);
 }
 
+static void Lchain(int x, int y)
+{
+  next[x][y] = Zboom;
+}
+
 static void handle_tile(int x, int y)
 {
   switch (cave[x][y])
@@ -6880,8 +7258,9 @@ static void handle_tile(int x, int y)
 
     case Xpause:               Lpause(x, y);                   break;
 
-    case Xboom_bug:            Lboom_bug(x, y, Xboom_bug);     break;
-    case Xboom_bomb:           Lboom_tank(x, y, Xboom_bomb);   break;
+    case Xchain:               Lchain(x, y);                   break;
+    case Xboom_bug:            Lboom_bug(x, y);                break;
+    case Xboom_tank:           Lboom_tank(x, y);               break;
     case Xboom_android:                Lboom_android(x, y);            break;
     case Xboom_1:              Lboom_1(x, y);                  break;
     case Xboom_2:              Lboom_2(x, y);                  break;
@@ -6927,7 +7306,8 @@ void logic_players(void)
     ply[i].anim = PLY_still;
   }
 
-  start_check_nr = (RandomEM & 128 ? 0 : 1) * 2 + (RandomEM & 256 ? 0 : 1);
+  start_check_nr = ((game_em.random & 128 ? 0 : 1) * 2 +
+                   (game_em.random & 256 ? 0 : 1));
 
   for (i = 0; i < MAX_PLAYERS; i++)
   {
@@ -6964,7 +7344,7 @@ void logic_objects(void)
   next = lev.next;
   boom = lev.boom;
 
-  seed = RandomEM;
+  seed = game_em.random;
   score = 0;
 
   for (y = lev.top; y < lev.bottom; y++)
@@ -6976,7 +7356,7 @@ void logic_objects(void)
   else
     game_em.game_over = TRUE;
 
-  RandomEM = seed;
+  game_em.random = seed;
 
   /* triple buffering */
   void *temp = lev.cave;
@@ -7024,7 +7404,7 @@ void logic_globals(void)
 
   /* grow amoeba */
 
-  random = RandomEM;
+  random = game_em.random;
 
   for (count = lev.amoeba_time; count--;)
   {
@@ -7038,7 +7418,7 @@ void logic_globals(void)
     random = random * 129 + 1;
   }
 
-  RandomEM = random;
+  game_em.random = random;
 
   /* handle explosions */