+ Cave[y][x] = Ystone_sB;
+ Cave[y+1][x] = Ydiamond_stone;
+ Next[y][x] = Xblank;
+ Next[y+1][x] = Xstone_pause;
+ play_element_sound(x, y, SOUND_squash, Xdiamond);
+ return;
+
+ case Xbomb:
+ case Xbomb_pause:
+ Cave[y+1][x] = Ybomb_blank;
+ Next[y+1][x] = Znormal;
+ Boom[y][x-1] = Xblank;
+ Boom[y][x] = Xblank;
+ Boom[y][x+1] = Xblank;
+ Boom[y+1][x-1] = Xblank;
+ Boom[y+1][x] = Xblank;
+ Boom[y+1][x+1] = Xblank;
+ Boom[y+2][x-1] = Xblank;
+ Boom[y+2][x] = Xblank;
+ Boom[y+2][x+1] = Xblank;
+#if PLAY_ELEMENT_SOUND
+ play_element_sound(x, y, SOUND_boom, Xstone_fall);
+#endif
+ return;
+
+ case Xwonderwall:
+ if (lev.wonderwall_time)
+ {
+ lev.wonderwall_state = 1;
+ Cave[y][x] = Ystone_sB;
+
+ if (tab_blank[Cave[y+2][x]])
+ {
+ Cave[y+2][x] = Yemerald_s;
+ Next[y+2][x] = Xemerald_fall;
+ }
+
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_wonderfall, Xwonderwall);
+ return;
+ }
+
+ default:
+ Cave[y][x] = Xstone;
+ Next[y][x] = Xstone;
+ play_element_sound(x, y, SOUND_stone, Xstone);
+ return;
+ }
+}
+
+static void Lnut(int x, int y)
+{
+ switch (Cave[y+1][x])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Ynut_sB;
+ if (Cave[y][x+1] == Xblank)
+ Cave[y][x+1] = Xacid_splash_e;
+ if (Cave[y][x-1] == Xblank)
+ Cave[y][x-1] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ Cave[y][x] = Ynut_sB;
+ Cave[y+1][x] = Ynut_s;
+ Next[y][x] = Xblank;
+ Next[y+1][x] = Xnut_fall;
+ return;
+
+ case Xspring:
+ case Xspring_pause:
+ case Xspring_e:
+ case Xspring_w:
+ 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:
+ case Xstone_pause:
+ case Xemerald:
+ case Xemerald_pause:
+ case Xdiamond:
+ case Xdiamond_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 Xslidewall_ns:
+ case Xslidewall_ew:
+ case Xkey_1:
+ case Xkey_2:
+ case Xkey_3:
+ case Xkey_4:
+ case Xkey_5:
+ case Xkey_6:
+ case Xkey_7:
+ case Xkey_8:
+ case Xbumper:
+ case Xswitch:
+ case Xroundwall_1:
+ case Xroundwall_2:
+ case Xroundwall_3:
+ case Xroundwall_4:
+ if (RANDOM & 1)
+ {
+ if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
+ {
+ Cave[y][x] = Ynut_eB;
+ Cave[y][x+1] = Ynut_e;
+ Next[y][x] = Xblank;
+ Next[y][x+1] = Xnut_pause;
+ return;
+ }
+
+ if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
+ {
+ Cave[y][x] = Ynut_wB;
+ Cave[y][x-1] = Ynut_w;
+ Next[y][x] = Xblank;
+ Next[y][x-1] = Xnut_pause;
+ return;
+ }
+ }
+ else
+ {
+ if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
+ {
+ Cave[y][x] = Ynut_wB;
+ Cave[y][x-1] = Ynut_w;
+ Next[y][x] = Xblank;
+ Next[y][x-1] = Xnut_pause;
+ return;
+ }
+
+ if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
+ {
+ Cave[y][x] = Ynut_eB;
+ Cave[y][x+1] = Ynut_e;
+ Next[y][x] = Xblank;
+ Next[y][x+1] = Xnut_pause;
+ return;
+ }
+ }
+ }
+}
+
+static void Lnut_pause(int x, int y)
+{
+ switch (Cave[y+1][x])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Ynut_sB;
+ if (Cave[y][x+1] == Xblank)
+ Cave[y][x+1] = Xacid_splash_e;
+ if (Cave[y][x-1] == Xblank)
+ Cave[y][x-1] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ Cave[y][x] = Ynut_sB;
+ Cave[y+1][x] = Ynut_s;
+ Next[y][x] = Xblank;
+ Next[y+1][x] = Xnut_fall;
+ return;
+
+ default:
+ Cave[y][x] = Xnut;
+ Next[y][x] = Xnut;
+ return;
+ }
+}
+
+static void Lnut_fall(int x, int y)
+{
+ switch (Cave[y+1][x])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Ynut_sB;
+ if (Cave[y][x+1] == Xblank)
+ Cave[y][x+1] = Xacid_splash_e;
+ if (Cave[y][x-1] == Xblank)
+ Cave[y][x-1] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ case Zplayer:
+ Cave[y][x] = Ynut_sB;
+ Cave[y+1][x] = Ynut_s;
+ Next[y][x] = Xblank;
+ Next[y+1][x] = Xnut_fall;
+ return;
+
+ default:
+ Cave[y][x] = Xnut;
+ Next[y][x] = Xnut;
+ play_element_sound(x, y, SOUND_nut, Xnut);
+ return;
+ }
+}
+
+static void Lboom_bug(int x, int y)
+{
+ Next[y][x] = Znormal;
+ Boom[y-1][x-1] = Xemerald;
+ Boom[y-1][x] = Xemerald;
+ Boom[y-1][x+1] = Xemerald;
+ Boom[y][x-1] = Xemerald;
+ Boom[y][x] = Xdiamond;
+ Boom[y][x+1] = Xemerald;
+ Boom[y+1][x-1] = Xemerald;
+ Boom[y+1][x] = Xemerald;
+ Boom[y+1][x+1] = Xemerald;
+
+#if PLAY_ELEMENT_SOUND
+ play_element_sound(x, y, SOUND_boom, element);
+#endif
+}
+
+static void Lboom_tank(int x, int y)
+{
+ Next[y][x] = Znormal;
+ Boom[y-1][x-1] = Xblank;
+ Boom[y-1][x] = Xblank;
+ Boom[y-1][x+1] = Xblank;
+ Boom[y][x-1] = Xblank;
+ Boom[y][x] = Xblank;
+ Boom[y][x+1] = Xblank;
+ Boom[y+1][x-1] = Xblank;
+ Boom[y+1][x] = Xblank;
+ Boom[y+1][x+1] = Xblank;
+#if PLAY_ELEMENT_SOUND
+ play_element_sound(x, y, SOUND_boom, element);
+#endif
+}
+
+static void Lbug_n(int x, int y)
+{
+ switch (Cave[y-1][x])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Ybug_nB;
+ if (Cave[y-2][x+1] == Xblank)
+ Cave[y-2][x+1] = Xacid_splash_e;
+ if (Cave[y-2][x-1] == Xblank)
+ Cave[y-2][x-1] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ case Xplant:
+ case Yplant:
+ case Zplayer:
+ Cave[y][x] = Ybug_nB;
+ Cave[y-1][x] = Ybug_n;
+ Next[y][x] = Xblank;
+ Next[y-1][x] = Xbug_1_n;
+ play_element_sound(x, y, SOUND_bug, Xbug_1_n);
+ return;
+
+ default:
+ Cave[y][x] = Ybug_n_w;
+ Next[y][x] = Xbug_2_w;
+ play_element_sound(x, y, SOUND_bug, Xbug_1_n);
+ return;
+ }
+}
+
+static void Lbug_1_n(int x, int y)
+{
+ if (tab_amoeba[Cave[y-1][x]] ||
+ tab_amoeba[Cave[y][x+1]] ||
+ tab_amoeba[Cave[y+1][x]] ||
+ tab_amoeba[Cave[y][x-1]])
+ {
+ Lboom_bug(x, y);
+
+ return;
+ }
+
+ switch (Cave[y][x+1])
+ {
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ 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 Zplayer:
+ Cave[y][x] = Ybug_n_e;
+ Next[y][x] = Xbug_2_e;
+ play_element_sound(x, y, SOUND_bug, Xbug_1_n);
+ return;
+
+ default:
+ Lbug_n(x, y);
+ return;
+ }
+}
+
+static void Lbug_2_n(int x, int y)
+{
+ if (tab_amoeba[Cave[y-1][x]] ||
+ tab_amoeba[Cave[y][x+1]] ||
+ tab_amoeba[Cave[y+1][x]] ||
+ tab_amoeba[Cave[y][x-1]])
+ {
+ Lboom_bug(x, y);
+
+ return;
+ }
+
+ Lbug_n(x, y);
+}
+
+static void Lbug_e(int x, int y)
+{
+ switch (Cave[y][x+1])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Ybug_eB;
+ if (Cave[y-1][x+2] == Xblank)
+ Cave[y-1][x+2] = Xacid_splash_e;
+ if (Cave[y-1][x] == Xblank)
+ Cave[y-1][x] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ case Xplant:
+ case Yplant:
+ case Zplayer:
+ Cave[y][x] = Ybug_eB;
+ Cave[y][x+1] = Ybug_e;
+ Next[y][x] = Xblank;
+ Next[y][x+1] = Xbug_1_e;
+ play_element_sound(x, y, SOUND_bug, Xbug_1_e);
+ return;
+
+ default:
+ Cave[y][x] = Ybug_e_n;
+ Next[y][x] = Xbug_2_n;
+ play_element_sound(x, y, SOUND_bug, Xbug_1_e);
+ return;
+ }
+}
+
+static void Lbug_1_e(int x, int y)
+{
+ if (tab_amoeba[Cave[y-1][x]] ||
+ tab_amoeba[Cave[y][x+1]] ||
+ tab_amoeba[Cave[y+1][x]] ||
+ tab_amoeba[Cave[y][x-1]])
+ {
+ Lboom_bug(x, y);
+
+ return;
+ }
+
+ switch (Cave[y+1][x])
+ {
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ 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 Zplayer:
+ Cave[y][x] = Ybug_e_s;
+ Next[y][x] = Xbug_2_s;
+ play_element_sound(x, y, SOUND_bug, Xbug_1_e);
+ return;
+
+ default:
+ Lbug_e(x, y);
+ return;
+ }
+}
+
+static void Lbug_2_e(int x, int y)
+{
+ if (tab_amoeba[Cave[y-1][x]] ||
+ tab_amoeba[Cave[y][x+1]] ||
+ tab_amoeba[Cave[y+1][x]] ||
+ tab_amoeba[Cave[y][x-1]])
+ {
+ Lboom_bug(x, y);
+
+ return;
+ }
+
+ Lbug_e(x, y);
+}
+
+static void Lbug_s(int x, int y)
+{
+ switch (Cave[y+1][x])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Ybug_sB;
+ if (Cave[y][x+1] == Xblank)
+ Cave[y][x+1] = Xacid_splash_e;
+ if (Cave[y][x-1] == Xblank)
+ Cave[y][x-1] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ case Xplant:
+ case Yplant:
+ case Zplayer:
+ Cave[y][x] = Ybug_sB;
+ Cave[y+1][x] = Ybug_s;
+ Next[y][x] = Xblank;
+ Next[y+1][x] = Xbug_1_s;
+ play_element_sound(x, y, SOUND_bug, Xbug_1_s);
+ return;
+
+ default:
+ Cave[y][x] = Ybug_s_e;
+ Next[y][x] = Xbug_2_e;
+ play_element_sound(x, y, SOUND_bug, Xbug_1_s);
+ return;
+ }
+}
+
+static void Lbug_1_s(int x, int y)
+{
+ if (tab_amoeba[Cave[y-1][x]] ||
+ tab_amoeba[Cave[y][x+1]] ||
+ tab_amoeba[Cave[y+1][x]] ||
+ tab_amoeba[Cave[y][x-1]])
+ {
+ Lboom_bug(x, y);
+
+ return;
+ }
+
+ switch (Cave[y][x-1])
+ {
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ 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 Zplayer:
+ Cave[y][x] = Ybug_s_w;
+ Next[y][x] = Xbug_2_w;
+ play_element_sound(x, y, SOUND_bug, Xbug_1_s);
+ return;
+
+ default:
+ Lbug_s(x, y);
+ return;
+ }
+}
+
+static void Lbug_2_s(int x, int y)
+{
+ if (tab_amoeba[Cave[y-1][x]] ||
+ tab_amoeba[Cave[y][x+1]] ||
+ tab_amoeba[Cave[y+1][x]] ||
+ tab_amoeba[Cave[y][x-1]])
+ {
+ Lboom_bug(x, y);
+
+ return;
+ }
+
+ Lbug_s(x, y);
+}
+
+static void Lbug_w(int x, int y)
+{
+ switch (Cave[y][x-1])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Ybug_wB;
+ if (Cave[y-1][x] == Xblank)
+ Cave[y-1][x] = Xacid_splash_e;
+ if (Cave[y-1][x-2] == Xblank)
+ Cave[y-1][x-2] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ case Xplant:
+ case Yplant:
+ case Zplayer:
+ Cave[y][x] = Ybug_wB;
+ Cave[y][x-1] = Ybug_w;
+ Next[y][x] = Xblank;
+ Next[y][x-1] = Xbug_1_w;
+ play_element_sound(x, y, SOUND_bug, Xbug_1_w);
+ return;
+
+ default:
+ Cave[y][x] = Ybug_w_s;
+ Next[y][x] = Xbug_2_s;
+ play_element_sound(x, y, SOUND_bug, Xbug_1_w);
+ return;
+ }
+}
+
+static void Lbug_1_w(int x, int y)
+{
+ if (tab_amoeba[Cave[y-1][x]] ||
+ tab_amoeba[Cave[y][x+1]] ||
+ tab_amoeba[Cave[y+1][x]] ||
+ tab_amoeba[Cave[y][x-1]])
+ {
+ Lboom_bug(x, y);
+
+ return;
+ }
+
+ switch (Cave[y-1][x])
+ {
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ 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 Zplayer:
+ Cave[y][x] = Ybug_w_n;
+ Next[y][x] = Xbug_2_n;
+ play_element_sound(x, y, SOUND_bug, Xbug_1_w);
+ return;
+
+ default:
+ Lbug_w(x, y);
+ return;
+ }
+}
+
+static void Lbug_2_w(int x, int y)
+{
+ if (tab_amoeba[Cave[y-1][x]] ||
+ tab_amoeba[Cave[y][x+1]] ||
+ tab_amoeba[Cave[y+1][x]] ||
+ tab_amoeba[Cave[y][x-1]])
+ {
+ Lboom_bug(x, y);
+
+ return;
+ }
+
+ Lbug_w(x, y);
+}
+
+static void Ltank_n(int x, int y)
+{
+ switch (Cave[y-1][x])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Ytank_nB;
+ if (Cave[y-2][x+1] == Xblank)
+ Cave[y-2][x+1] = Xacid_splash_e;
+ if (Cave[y-2][x-1] == Xblank)
+ Cave[y-2][x-1] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ case Xplant:
+ case Yplant:
+ case Zplayer:
+ Cave[y][x] = Ytank_nB;
+ Cave[y-1][x] = Ytank_n;
+ Next[y][x] = Xblank;
+ Next[y-1][x] = Xtank_1_n;
+ play_element_sound(x, y, SOUND_tank, Xtank_1_n);
+ return;
+
+ default:
+ Cave[y][x] = Ytank_n_e;
+ Next[y][x] = Xtank_2_e;
+ play_element_sound(x, y, SOUND_tank, Xtank_1_n);
+ return;
+ }
+}
+
+static void Ltank_1_n(int x, int y)
+{
+ if (tab_amoeba[Cave[y-1][x]] ||
+ tab_amoeba[Cave[y][x+1]] ||
+ tab_amoeba[Cave[y+1][x]] ||
+ tab_amoeba[Cave[y][x-1]])
+ {
+ Lboom_tank(x, y);
+
+ return;
+ }
+
+ switch (Cave[y][x-1])
+ {
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ 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 Zplayer:
+ Cave[y][x] = Ytank_n_w;
+ Next[y][x] = Xtank_2_w;
+ play_element_sound(x, y, SOUND_tank, Xtank_1_n);
+ return;
+
+ default:
+ Ltank_n(x, y);
+ return;
+ }
+}
+
+static void Ltank_2_n(int x, int y)
+{
+ if (tab_amoeba[Cave[y-1][x]] ||
+ tab_amoeba[Cave[y][x+1]] ||
+ tab_amoeba[Cave[y+1][x]] ||
+ tab_amoeba[Cave[y][x-1]])
+ {
+ Lboom_tank(x, y);
+
+ return;
+ }
+
+ Ltank_n(x, y);
+}
+
+static void Ltank_e(int x, int y)
+{
+ switch (Cave[y][x+1])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Ytank_eB;
+ if (Cave[y-1][x+2] == Xblank)
+ Cave[y-1][x+2] = Xacid_splash_e;
+ if (Cave[y-1][x] == Xblank)
+ Cave[y-1][x] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ case Xplant:
+ case Yplant:
+ case Zplayer:
+ Cave[y][x] = Ytank_eB;
+ Cave[y][x+1] = Ytank_e;
+ Next[y][x] = Xblank;
+ Next[y][x+1] = Xtank_1_e;
+ play_element_sound(x, y, SOUND_tank, Xtank_1_e);
+ return;
+
+ default:
+ Cave[y][x] = Ytank_e_s;
+ Next[y][x] = Xtank_2_s;
+ play_element_sound(x, y, SOUND_tank, Xtank_1_e);
+ return;
+ }
+}
+
+static void Ltank_1_e(int x, int y)
+{
+ if (tab_amoeba[Cave[y-1][x]] ||
+ tab_amoeba[Cave[y][x+1]] ||
+ tab_amoeba[Cave[y+1][x]] ||
+ tab_amoeba[Cave[y][x-1]])
+ {
+ Lboom_tank(x, y);
+
+ return;
+ }
+
+ switch (Cave[y-1][x])
+ {
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ 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 Zplayer:
+ Cave[y][x] = Ytank_e_n;
+ Next[y][x] = Xtank_2_n;
+ play_element_sound(x, y, SOUND_tank, Xtank_1_e);
+ return;
+
+ default:
+ Ltank_e(x, y);
+ return;
+ }
+}
+
+static void Ltank_2_e(int x, int y)
+{
+ if (tab_amoeba[Cave[y-1][x]] ||
+ tab_amoeba[Cave[y][x+1]] ||
+ tab_amoeba[Cave[y+1][x]] ||
+ tab_amoeba[Cave[y][x-1]])
+ {
+ Lboom_tank(x, y);
+
+ return;
+ }
+
+ Ltank_e(x, y);
+}
+
+static void Ltank_s(int x, int y)
+{
+ switch (Cave[y+1][x])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Ytank_sB;
+ if (Cave[y][x+1] == Xblank)
+ Cave[y][x+1] = Xacid_splash_e;
+ if (Cave[y][x-1] == Xblank)
+ Cave[y][x-1] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ case Xplant:
+ case Yplant:
+ case Zplayer:
+ Cave[y][x] = Ytank_sB;
+ Cave[y+1][x] = Ytank_s;
+ Next[y][x] = Xblank;
+ Next[y+1][x] = Xtank_1_s;
+ play_element_sound(x, y, SOUND_tank, Xtank_1_s);
+ return;
+
+ default:
+ Cave[y][x] = Ytank_s_w;
+ Next[y][x] = Xtank_2_w;
+ play_element_sound(x, y, SOUND_tank, Xtank_1_s);
+ return;
+ }
+}
+
+static void Ltank_1_s(int x, int y)
+{
+ if (tab_amoeba[Cave[y-1][x]] ||
+ tab_amoeba[Cave[y][x+1]] ||
+ tab_amoeba[Cave[y+1][x]] ||
+ tab_amoeba[Cave[y][x-1]])
+ {
+ Lboom_tank(x, y);
+
+ return;
+ }
+
+ switch (Cave[y][x+1])
+ {
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ 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 Zplayer:
+ Cave[y][x] = Ytank_s_e;
+ Next[y][x] = Xtank_2_e;
+ play_element_sound(x, y, SOUND_tank, Xtank_1_s);
+ return;
+
+ default:
+ Ltank_s(x, y);
+ return;
+ }
+}
+
+static void Ltank_2_s(int x, int y)
+{
+ if (tab_amoeba[Cave[y-1][x]] ||
+ tab_amoeba[Cave[y][x+1]] ||
+ tab_amoeba[Cave[y+1][x]] ||
+ tab_amoeba[Cave[y][x-1]])
+ {
+ Lboom_tank(x, y);
+
+ return;
+ }
+
+ Ltank_s(x, y);
+}
+
+static void Ltank_w(int x, int y)
+{
+ switch (Cave[y][x-1])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Ytank_wB;
+ if (Cave[y-1][x] == Xblank)
+ Cave[y-1][x] = Xacid_splash_e;
+ if (Cave[y-1][x-2] == Xblank)
+ Cave[y-1][x-2] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ case Xplant:
+ case Yplant:
+ case Zplayer:
+ Cave[y][x] = Ytank_wB;
+ Cave[y][x-1] = Ytank_w;
+ Next[y][x] = Xblank;
+ Next[y][x-1] = Xtank_1_w;
+ play_element_sound(x, y, SOUND_tank, Xtank_1_w);
+ return;
+
+ default:
+ Cave[y][x] = Ytank_w_n;
+ Next[y][x] = Xtank_2_n;
+ play_element_sound(x, y, SOUND_tank, Xtank_1_w);
+ return;
+ }
+}
+
+static void Ltank_1_w(int x, int y)
+{
+ if (tab_amoeba[Cave[y-1][x]] ||
+ tab_amoeba[Cave[y][x+1]] ||
+ tab_amoeba[Cave[y+1][x]] ||
+ tab_amoeba[Cave[y][x-1]])
+ {
+ Lboom_tank(x, y);
+
+ return;
+ }
+
+ switch (Cave[y+1][x])
+ {
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ 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 Zplayer:
+ Cave[y][x] = Ytank_w_s;
+ Next[y][x] = Xtank_2_s;
+ play_element_sound(x, y, SOUND_tank, Xtank_1_w);
+ return;
+
+ default:
+ Ltank_w(x, y);
+ return;
+ }
+}
+
+static void Ltank_2_w(int x, int y)
+{
+ if (tab_amoeba[Cave[y-1][x]] ||
+ tab_amoeba[Cave[y][x+1]] ||
+ tab_amoeba[Cave[y+1][x]] ||
+ tab_amoeba[Cave[y][x-1]])
+ {
+ Lboom_tank(x, y);
+
+ return;
+ }
+
+ Ltank_w(x, y);
+}
+
+static void Landroid(int x, int y)
+{
+ int dx, dy, temp;
+
+ if (lev.android_clone_cnt == 0)
+ {
+ if (Cave[y-1][x-1] != Xblank &&
+ Cave[y-1][x] != Xblank &&
+ Cave[y-1][x+1] != Xblank &&
+ Cave[y][x-1] != Xblank &&
+ Cave[y][x+1] != Xblank &&
+ Cave[y+1][x-1] != Xblank &&
+ Cave[y+1][x] != Xblank &&
+ Cave[y+1][x+1] != Xblank)
+ goto android_move;
+
+ switch (RANDOM & 7)
+ {
+ /* randomly find an object to clone */
+
+ case 0: /* S,NE,W,NW,SE,E,SW,N */
+ temp = lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
+ goto android_move;
+
+ case 1: /* NW,SE,N,S,NE,SW,E,W */
+ temp = lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
+ goto android_move;
+
+ case 2: /* SW,E,S,W,N,NW,SE,NE */
+ temp = lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
+ goto android_move;
+
+ case 3: /* N,SE,NE,E,W,S,NW,SW */
+ temp = lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
+ goto android_move;
+
+ case 4: /* SE,NW,E,NE,SW,W,N,S */
+ temp = lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
+ goto android_move;
+
+ case 5: /* NE,W,SE,SW,S,N,E,NW */
+ temp = lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
+ goto android_move;
+
+ case 6: /* E,N,SW,S,NW,NE,SE,W */
+ temp = lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
+ goto android_move;
+
+ case 7: /* W,SW,NW,N,E,SE,NE,S */
+ temp = lev.android_array[Cave[y][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x-1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y-1][x+1]]; if (temp != Xblank) break;
+ temp = lev.android_array[Cave[y+1][x]]; if (temp != Xblank) break;
+ goto android_move;
+ }
+
+ Next[y][x] = temp; /* the item we chose to clone */
+ play_element_sound(x, y, SOUND_android_clone, temp);
+
+ switch (RANDOM & 7)
+ {
+ /* randomly find a direction to move */
+
+ case 0: /* S,NE,W,NW,SE,E,SW,N */
+ if (Cave[y+1][x] == Xblank) goto android_s;
+ if (Cave[y-1][x+1] == Xblank) goto android_ne;
+ if (Cave[y][x-1] == Xblank) goto android_w;
+ if (Cave[y-1][x-1] == Xblank) goto android_nw;
+ if (Cave[y+1][x+1] == Xblank) goto android_se;
+ if (Cave[y][x+1] == Xblank) goto android_e;
+ if (Cave[y+1][x-1] == Xblank) goto android_sw;
+ if (Cave[y-1][x] == Xblank) goto android_n;
+ goto android_move;
+
+ case 1: /* NW,SE,N,S,NE,SW,E,W */
+ if (Cave[y-1][x-1] == Xblank) goto android_nw;
+ if (Cave[y+1][x+1] == Xblank) goto android_se;
+ if (Cave[y-1][x] == Xblank) goto android_n;
+ if (Cave[y+1][x] == Xblank) goto android_s;
+ if (Cave[y-1][x+1] == Xblank) goto android_ne;
+ if (Cave[y+1][x-1] == Xblank) goto android_sw;
+ if (Cave[y][x+1] == Xblank) goto android_e;
+ if (Cave[y][x-1] == Xblank) goto android_w;
+ goto android_move;
+
+ case 2: /* SW,E,S,W,N,NW,SE,NE */
+ if (Cave[y+1][x-1] == Xblank) goto android_sw;
+ if (Cave[y][x+1] == Xblank) goto android_e;
+ if (Cave[y+1][x] == Xblank) goto android_s;
+ if (Cave[y][x-1] == Xblank) goto android_w;
+ if (Cave[y-1][x] == Xblank) goto android_n;
+ if (Cave[y-1][x-1] == Xblank) goto android_nw;
+ if (Cave[y+1][x+1] == Xblank) goto android_se;
+ if (Cave[y-1][x+1] == Xblank) goto android_ne;
+ goto android_move;
+
+ case 3: /* N,SE,NE,E,W,S,NW,SW */
+ if (Cave[y-1][x] == Xblank) goto android_n;
+ if (Cave[y+1][x+1] == Xblank) goto android_se;
+ if (Cave[y-1][x+1] == Xblank) goto android_ne;
+ if (Cave[y][x+1] == Xblank) goto android_e;
+ if (Cave[y][x-1] == Xblank) goto android_w;
+ if (Cave[y+1][x] == Xblank) goto android_s;
+ if (Cave[y-1][x-1] == Xblank) goto android_nw;
+ if (Cave[y+1][x-1] == Xblank) goto android_sw;
+ goto android_move;
+
+ case 4: /* SE,NW,E,NE,SW,W,N,S */
+ if (Cave[y+1][x+1] == Xblank) goto android_se;
+ if (Cave[y-1][x-1] == Xblank) goto android_nw;
+ if (Cave[y][x+1] == Xblank) goto android_e;
+ if (Cave[y-1][x+1] == Xblank) goto android_ne;
+ if (Cave[y+1][x-1] == Xblank) goto android_sw;
+ if (Cave[y][x-1] == Xblank) goto android_w;
+ if (Cave[y-1][x] == Xblank) goto android_n;
+ if (Cave[y+1][x] == Xblank) goto android_s;
+ goto android_move;
+
+ case 5: /* NE,W,SE,SW,S,N,E,NW */
+ if (Cave[y-1][x+1] == Xblank) goto android_ne;
+ if (Cave[y][x-1] == Xblank) goto android_w;
+ if (Cave[y+1][x+1] == Xblank) goto android_se;
+ if (Cave[y+1][x-1] == Xblank) goto android_sw;
+ if (Cave[y+1][x] == Xblank) goto android_s;
+ if (Cave[y-1][x] == Xblank) goto android_n;
+ if (Cave[y][x+1] == Xblank) goto android_e;
+ if (Cave[y-1][x-1] == Xblank) goto android_nw;
+ goto android_move;
+
+ case 6: /* E,N,SW,S,NW,NE,SE,W */
+ if (Cave[y][x+1] == Xblank) goto android_e;
+ if (Cave[y-1][x] == Xblank) goto android_n;
+ if (Cave[y+1][x-1] == Xblank) goto android_sw;
+ if (Cave[y+1][x] == Xblank) goto android_s;
+ if (Cave[y-1][x-1] == Xblank) goto android_nw;
+ if (Cave[y-1][x+1] == Xblank) goto android_ne;
+ if (Cave[y+1][x+1] == Xblank) goto android_se;
+ if (Cave[y][x-1] == Xblank) goto android_w;
+ goto android_move;
+
+ case 7: /* W,SW,NW,N,E,SE,NE,S */
+ if (Cave[y][x-1] == Xblank) goto android_w;
+ if (Cave[y+1][x-1] == Xblank) goto android_sw;
+ if (Cave[y-1][x-1] == Xblank) goto android_nw;
+ if (Cave[y-1][x] == Xblank) goto android_n;
+ if (Cave[y][x+1] == Xblank) goto android_e;
+ if (Cave[y+1][x+1] == Xblank) goto android_se;
+ if (Cave[y-1][x+1] == Xblank) goto android_ne;
+ if (Cave[y+1][x] == Xblank) goto android_s;
+ goto android_move;
+ }
+ }
+
+ android_move:
+ if (lev.android_move_cnt == 0)
+ {
+ if (Cave[y-1][x-1] == Zplayer ||
+ Cave[y-1][x] == Zplayer ||
+ Cave[y-1][x+1] == Zplayer ||
+ Cave[y][x-1] == Zplayer ||
+ Cave[y][x+1] == Zplayer ||
+ Cave[y+1][x-1] == Zplayer ||
+ Cave[y+1][x] == Zplayer ||
+ Cave[y+1][x+1] == Zplayer)
+ goto android_still;
+
+ set_nearest_player_xy(x, y, &dx, &dy);
+
+ Next[y][x] = Xblank; /* assume we will move */
+ temp = ((x < dx) + 1 - (x > dx)) + ((y < dy) + 1 - (y > dy)) * 3;
+
+ if (RANDOM & 1)
+ {
+ switch (temp)
+ {
+ /* attempt clockwise move first if direct path is blocked */
+
+ case 0: /* north west */
+ if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
+ if (tab_android_move[Cave[y-1][x]]) goto android_n;
+ if (tab_android_move[Cave[y][x-1]]) goto android_w;
+ break;
+
+ case 1: /* north */
+ if (tab_android_move[Cave[y-1][x]]) goto android_n;
+ if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
+ if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
+ break;
+
+ case 2: /* north east */
+ if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
+ if (tab_android_move[Cave[y][x+1]]) goto android_e;
+ if (tab_android_move[Cave[y-1][x]]) goto android_n;
+ break;
+
+ case 3: /* west */
+ if (tab_android_move[Cave[y][x-1]]) goto android_w;
+ if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
+ if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
+ break;
+
+ case 4: /* nowhere */
+ break;
+
+ case 5: /* east */
+ if (tab_android_move[Cave[y][x+1]]) goto android_e;
+ if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
+ if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
+ break;
+
+ case 6: /* south west */
+ if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
+ if (tab_android_move[Cave[y][x-1]]) goto android_w;
+ if (tab_android_move[Cave[y+1][x]]) goto android_s;
+ break;
+
+ case 7: /* south */
+ if (tab_android_move[Cave[y+1][x]]) goto android_s;
+ if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
+ if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
+ break;
+
+ case 8: /* south east */
+ if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
+ if (tab_android_move[Cave[y+1][x]]) goto android_s;
+ if (tab_android_move[Cave[y][x+1]]) goto android_e;
+ break;
+ }
+ }
+ else
+ {
+ switch (temp)
+ {
+ /* attempt counterclockwise move first if direct path is blocked */
+
+ case 0: /* north west */
+ if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
+ if (tab_android_move[Cave[y][x-1]]) goto android_w;
+ if (tab_android_move[Cave[y-1][x]]) goto android_n;
+ break;
+
+ case 1: /* north */
+ if (tab_android_move[Cave[y-1][x]]) goto android_n;
+ if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
+ if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
+ break;
+
+ case 2: /* north east */
+ if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
+ if (tab_android_move[Cave[y-1][x]]) goto android_n;
+ if (tab_android_move[Cave[y][x+1]]) goto android_e;
+ break;
+
+ case 3: /* west */
+ if (tab_android_move[Cave[y][x-1]]) goto android_w;
+ if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
+ if (tab_android_move[Cave[y-1][x-1]]) goto android_nw;
+ break;
+
+ case 4: /* nowhere */
+ break;
+
+ case 5: /* east */
+ if (tab_android_move[Cave[y][x+1]]) goto android_e;
+ if (tab_android_move[Cave[y-1][x+1]]) goto android_ne;
+ if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
+ break;
+
+ case 6: /* south west */
+ if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
+ if (tab_android_move[Cave[y+1][x]]) goto android_s;
+ if (tab_android_move[Cave[y][x-1]]) goto android_w;
+ break;
+
+ case 7: /* south */
+ if (tab_android_move[Cave[y+1][x]]) goto android_s;
+ if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
+ if (tab_android_move[Cave[y+1][x-1]]) goto android_sw;
+ break;
+
+ case 8: /* south east */
+ if (tab_android_move[Cave[y+1][x+1]]) goto android_se;
+ if (tab_android_move[Cave[y][x+1]]) goto android_e;
+ if (tab_android_move[Cave[y+1][x]]) goto android_s;
+ break;
+ }
+ }
+ }
+
+ android_still:
+ Next[y][x] = Xandroid;
+ return;
+
+ android_n:
+ Cave[y][x] = Yandroid_nB;
+ Cave[y-1][x] = Yandroid_n;
+ Next[y-1][x] = Xandroid;
+ play_element_sound(x, y, SOUND_android_move, Xandroid);
+ return;
+
+ android_ne:
+ Cave[y][x] = Yandroid_neB;
+ Cave[y-1][x+1] = Yandroid_ne;
+ Next[y-1][x+1] = Xandroid;
+ play_element_sound(x, y, SOUND_android_move, Xandroid);
+ return;
+
+ android_e:
+ Cave[y][x] = Yandroid_eB;
+ Cave[y][x+1] = Yandroid_e;
+ Next[y][x+1] = Xandroid;
+ play_element_sound(x, y, SOUND_android_move, Xandroid);
+ return;
+
+ android_se:
+ Cave[y][x] = Yandroid_seB;
+ Cave[y+1][x+1] = Yandroid_se;
+ Next[y+1][x+1] = Xandroid;
+ play_element_sound(x, y, SOUND_android_move, Xandroid);
+ return;
+
+ android_s:
+ Cave[y][x] = Yandroid_sB;
+ Cave[y+1][x] = Yandroid_s;
+ Next[y+1][x] = Xandroid;
+ play_element_sound(x, y, SOUND_android_move, Xandroid);
+ return;
+
+ android_sw:
+ Cave[y][x] = Yandroid_swB;
+ Cave[y+1][x-1] = Yandroid_sw;
+ Next[y+1][x-1] = Xandroid;
+ play_element_sound(x, y, SOUND_android_move, Xandroid);
+ return;
+
+ android_w:
+ Cave[y][x] = Yandroid_wB;
+ Cave[y][x-1] = Yandroid_w;
+ Next[y][x-1] = Xandroid;
+ play_element_sound(x, y, SOUND_android_move, Xandroid);
+ return;
+
+ android_nw:
+ Cave[y][x] = Yandroid_nwB;
+ Cave[y-1][x-1] = Yandroid_nw;
+ Next[y-1][x-1] = Xandroid;
+ play_element_sound(x, y, SOUND_android_move, Xandroid);
+ return;
+}
+
+static void Landroid_1_n(int x, int y)
+{
+ switch (Cave[y-1][x])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Yandroid_nB;
+ if (Cave[y-2][x+1] == Xblank)
+ Cave[y-2][x+1] = Xacid_splash_e;
+ if (Cave[y-2][x-1] == Xblank)
+ Cave[y-2][x-1] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ Cave[y][x] = Yandroid_nB;
+ Cave[y-1][x] = Yandroid_n;
+ Next[y][x] = Xblank;
+ Next[y-1][x] = Xandroid;
+ play_element_sound(x, y, SOUND_android_move, Xandroid_1_n);
+ return;
+
+ default:
+ Landroid(x, y);
+ return;
+ }
+}
+
+static void Landroid_2_n(int x, int y)
+{
+ switch (Cave[y-1][x])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Yandroid_nB;
+ if (Cave[y-2][x+1] == Xblank)
+ Cave[y-2][x+1] = Xacid_splash_e;
+ if (Cave[y-2][x-1] == Xblank)
+ Cave[y-2][x-1] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ Cave[y][x] = Yandroid_nB;
+ Cave[y-1][x] = Yandroid_n;
+ Next[y][x] = Xblank;
+ Next[y-1][x] = Xandroid_1_n;
+ play_element_sound(x, y, SOUND_android_move, Xandroid_2_n);
+ return;
+
+ default:
+ Landroid(x, y);
+ return;
+ }
+}
+
+static void Landroid_1_e(int x, int y)
+{
+ switch (Cave[y][x+1])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Yandroid_eB;
+ if (Cave[y-1][x+2] == Xblank)
+ Cave[y-1][x+2] = Xacid_splash_e;
+ if (Cave[y-1][x] == Xblank)
+ Cave[y-1][x] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ Cave[y][x] = Yandroid_eB;
+ Cave[y][x+1] = Yandroid_e;
+ Next[y][x] = Xblank;
+ Next[y][x+1] = Xandroid;
+ play_element_sound(x, y, SOUND_android_move, Xandroid_1_e);
+ return;
+
+ default:
+ Landroid(x, y);
+ return;
+ }
+}
+
+static void Landroid_2_e(int x, int y)
+{
+ switch (Cave[y][x+1])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Yandroid_eB;
+ if (Cave[y-1][x+2] == Xblank)
+ Cave[y-1][x+2] = Xacid_splash_e;
+ if (Cave[y-1][x] == Xblank)
+ Cave[y-1][x] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ Cave[y][x] = Yandroid_eB;
+ Cave[y][x+1] = Yandroid_e;
+ Next[y][x] = Xblank;
+ Next[y][x+1] = Xandroid_1_e;
+ play_element_sound(x, y, SOUND_android_move, Xandroid_2_e);
+ return;
+
+ default:
+ Landroid(x, y);
+ return;
+ }
+}
+
+static void Landroid_1_s(int x, int y)
+{
+ switch (Cave[y+1][x])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Yandroid_sB;
+ if (Cave[y][x+1] == Xblank)
+ Cave[y][x+1] = Xacid_splash_e;
+ if (Cave[y][x-1] == Xblank)
+ Cave[y][x-1] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ Cave[y][x] = Yandroid_sB;
+ Cave[y+1][x] = Yandroid_s;
+ Next[y][x] = Xblank;
+ Next[y+1][x] = Xandroid;
+ play_element_sound(x, y, SOUND_android_move, Xandroid_1_s);
+ return;
+
+ default:
+ Landroid(x, y);
+ return;
+ }
+}
+
+static void Landroid_2_s(int x, int y)
+{
+ switch (Cave[y+1][x])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Yandroid_sB;
+ if (Cave[y][x+1] == Xblank)
+ Cave[y][x+1] = Xacid_splash_e;
+ if (Cave[y][x-1] == Xblank)
+ Cave[y][x-1] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ Cave[y][x] = Yandroid_sB;
+ Cave[y+1][x] = Yandroid_s;
+ Next[y][x] = Xblank;
+ Next[y+1][x] = Xandroid_1_s;
+ play_element_sound(x, y, SOUND_android_move, Xandroid_2_s);
+ return;
+
+ default:
+ Landroid(x, y);
+ return;
+ }
+}
+
+static void Landroid_1_w(int x, int y)
+{
+ switch (Cave[y][x-1])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Yandroid_wB;
+ if (Cave[y-1][x] == Xblank)
+ Cave[y-1][x] = Xacid_splash_e;
+ if (Cave[y-1][x-2] == Xblank)
+ Cave[y-1][x-2] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ Cave[y][x] = Yandroid_wB;
+ Cave[y][x-1] = Yandroid_w;
+ Next[y][x] = Xblank;
+ Next[y][x-1] = Xandroid;
+ play_element_sound(x, y, SOUND_android_move, Xandroid_1_w);
+ return;
+
+ default:
+ Landroid(x, y);
+ return;
+ }
+}
+
+static void Landroid_2_w(int x, int y)
+{
+ switch (Cave[y][x-1])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Yandroid_wB;
+ if (Cave[y-1][x] == Xblank)
+ Cave[y-1][x] = Xacid_splash_e;
+ if (Cave[y-1][x-2] == Xblank)
+ Cave[y-1][x-2] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ Cave[y][x] = Yandroid_wB;
+ Cave[y][x-1] = Yandroid_w;
+ Next[y][x] = Xblank;
+ Next[y][x-1] = Xandroid_1_w;
+ play_element_sound(x, y, SOUND_android_move, Xandroid_1_w);
+ return;
+
+ default:
+ Landroid(x, y);
+ return;
+ }
+}
+
+static void Lspring(int x, int y)
+{
+ switch (Cave[y+1][x])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Yspring_sB;
+ if (Cave[y][x+1] == Xblank)
+ Cave[y][x+1] = Xacid_splash_e;
+ if (Cave[y][x-1] == Xblank)
+ Cave[y][x-1] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ case Xplant:
+ case Yplant:
+ Cave[y][x] = Yspring_sB;
+ Cave[y+1][x] = Yspring_s;
+ Next[y][x] = Xblank;
+ Next[y+1][x] = Xspring_fall;
+ return;
+
+ case Xspring:
+ case Xspring_pause:
+ case Xspring_e:
+ case Xspring_w:
+ 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:
+ case Xstone_pause:
+ case Xemerald:
+ case Xemerald_pause:
+ case Xdiamond:
+ case Xdiamond_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 Xslidewall_ns:
+ case Xslidewall_ew:
+ case Xkey_1:
+ case Xkey_2:
+ case Xkey_3:
+ case Xkey_4:
+ case Xkey_5:
+ case Xkey_6:
+ case Xkey_7:
+ case Xkey_8:
+ case Xbumper:
+ case Xswitch:
+ case Xroundwall_1:
+ case Xroundwall_2:
+ case Xroundwall_3:
+ case Xroundwall_4:
+ if (RANDOM & 1)
+ {
+ if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
+ {
+ Cave[y][x] = Yspring_eB;
+ Cave[y][x+1] = Yspring_e;
+ if (Cave[y+1][x] == Xbumper)
+ Cave[y+1][x] = XbumperB;
+ Next[y][x] = Xblank;
+
+#ifdef SPRING_ROLL
+ Next[y][x+1] = Xspring_e;
+#else
+ Next[y][x+1] = Xspring_pause;
+#endif
+ return;
+ }
+
+ if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
+ {
+ Cave[y][x] = Yspring_wB;
+ Cave[y][x-1] = Yspring_w;
+ if (Cave[y+1][x] == Xbumper)
+ Cave[y+1][x] = XbumperB;
+ Next[y][x] = Xblank;
+
+#ifdef SPRING_ROLL
+ Next[y][x-1] = Xspring_w;
+#else
+ Next[y][x-1] = Xspring_pause;
+#endif
+ return;
+ }
+ }
+ else
+ {
+ if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]])
+ {
+ Cave[y][x] = Yspring_wB;
+ Cave[y][x-1] = Yspring_w;
+ if (Cave[y+1][x] == Xbumper)
+ Cave[y+1][x] = XbumperB;
+ Next[y][x] = Xblank;
+
+#ifdef SPRING_ROLL
+ Next[y][x-1] = Xspring_w;
+#else
+ Next[y][x-1] = Xspring_pause;
+#endif
+ return;
+ }
+
+ if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]])
+ {
+ Cave[y][x] = Yspring_eB;
+ Cave[y][x+1] = Yspring_e;
+ if (Cave[y+1][x] == Xbumper)
+ Cave[y+1][x] = XbumperB;
+ Next[y][x] = Xblank;
+
+#ifdef SPRING_ROLL
+ Next[y][x+1] = Xspring_e;
+#else
+ Next[y][x+1] = Xspring_pause;
+#endif
+ return;
+ }
+ }
+ }
+}
+
+static void Lspring_pause(int x, int y)
+{
+ switch (Cave[y+1][x])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Yspring_sB;
+ if (Cave[y][x+1] == Xblank)
+ Cave[y][x+1] = Xacid_splash_e;
+ if (Cave[y][x-1] == Xblank)
+ Cave[y][x-1] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ Cave[y][x] = Yspring_sB;
+ Cave[y+1][x] = Yspring_s;
+ Next[y][x] = Xblank;
+ Next[y+1][x] = Xspring_fall;
+ return;
+
+ default:
+ Cave[y][x] = Xspring;
+ Next[y][x] = Xspring;
+ return;
+ }
+}
+
+static void Lspring_e(int x, int y)
+{
+ switch (Cave[y+1][x])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Yspring_sB;
+ if (Cave[y][x+1] == Xblank)
+ Cave[y][x+1] = Xacid_splash_e;
+ if (Cave[y][x-1] == Xblank)
+ Cave[y][x-1] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ Cave[y][x] = Yspring_sB;
+ Cave[y+1][x] = Yspring_s;
+ Next[y][x] = Xblank;
+ Next[y+1][x] = Xspring_fall;
+ return;
+
+ case Xbumper:
+ Cave[y+1][x] = XbumperB;
+ }
+
+ switch (Cave[y][x+1])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Yspring_eB;
+ if (Cave[y-1][x+2] == Xblank)
+ Cave[y-1][x+2] = Xacid_splash_e;
+ if (Cave[y-1][x] == Xblank)
+ Cave[y-1][x] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ case Yalien_nB:
+ case Yalien_eB:
+ case Yalien_sB:
+ case Yalien_wB:
+ Cave[y][x] = Yspring_eB;
+ Cave[y][x+1] = Yspring_e;
+ Next[y][x] = Xblank;
+ Next[y][x+1] = Xspring_e;
+ return;
+
+ case Xalien:
+ case Xalien_pause:
+ case Yalien_n:
+ case Yalien_e:
+ case Yalien_s:
+ case Yalien_w:
+ Cave[y][x] = Yspring_alien_eB;
+ Cave[y][x+1] = Yspring_alien_e;
+ Next[y][x] = Xblank;
+ Next[y][x+1] = Xspring_e;
+ play_element_sound(x, y, SOUND_slurp, Xalien);
+ score += lev.slurp_score;
+ return;
+
+ case Xbumper:
+ case XbumperB:
+ Cave[y][x+1] = XbumperB;
+ Next[y][x] = Xspring_w;
+ play_element_sound(x, y, SOUND_spring, Xspring);
+ return;
+
+ default:
+ Cave[y][x] = Xspring;
+ Next[y][x] = Xspring;
+ play_element_sound(x, y, SOUND_spring, Xspring);
+ return;
+ }
+}
+
+static void Lspring_w(int x, int y)
+{
+ switch (Cave[y+1][x])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Yspring_sB;
+ if (Cave[y][x+1] == Xblank)
+ Cave[y][x+1] = Xacid_splash_e;
+ if (Cave[y][x-1] == Xblank)
+ Cave[y][x-1] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ Cave[y][x] = Yspring_sB;
+ Cave[y+1][x] = Yspring_s;
+ Next[y][x] = Xblank;
+ Next[y+1][x] = Xspring_fall;
+ return;
+
+ case Xbumper:
+ Cave[y+1][x] = XbumperB;
+ }
+
+ switch (Cave[y][x-1])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Yspring_wB;
+ if (Cave[y-1][x] == Xblank)
+ Cave[y-1][x] = Xacid_splash_e;
+ if (Cave[y-1][x-2] == Xblank)
+ Cave[y-1][x-2] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ case Yalien_nB:
+ case Yalien_eB:
+ case Yalien_sB:
+ case Yalien_wB:
+ Cave[y][x] = Yspring_wB;
+ Cave[y][x-1] = Yspring_w;
+ Next[y][x] = Xblank;
+ Next[y][x-1] = Xspring_w;
+ return;
+
+ case Xalien:
+ case Xalien_pause:
+ case Yalien_n:
+ case Yalien_e:
+ case Yalien_s:
+ case Yalien_w:
+ Cave[y][x] = Yspring_alien_wB;
+ Cave[y][x-1] = Yspring_alien_w;
+ Next[y][x] = Xblank;
+ Next[y][x-1] = Xspring_w;
+ play_element_sound(x, y, SOUND_slurp, Xalien);
+ score += lev.slurp_score;
+ return;
+
+ case Xbumper:
+ case XbumperB:
+ Cave[y][x-1] = XbumperB;
+ Next[y][x] = Xspring_e;
+ play_element_sound(x, y, SOUND_spring, Xspring);
+ return;
+
+ default:
+ Cave[y][x] = Xspring;
+ Next[y][x] = Xspring;
+ play_element_sound(x, y, SOUND_spring, Xspring);
+ return;
+ }
+}
+
+static void Lspring_fall(int x, int y)
+{
+ switch (Cave[y+1][x])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Yspring_sB;
+ if (Cave[y][x+1] == Xblank)
+ Cave[y][x+1] = Xacid_splash_e;
+ if (Cave[y][x-1] == Xblank)
+ Cave[y][x-1] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ case Zplayer:
+ Cave[y][x] = Yspring_sB;
+ Cave[y+1][x] = Yspring_s;
+ Next[y][x] = Xblank;
+ Next[y+1][x] = Xspring_fall;
+ return;
+
+ case Xbomb:
+ case Xbomb_pause:
+ Cave[y+1][x] = Ybomb_blank;
+ Next[y+1][x] = Znormal;
+ Boom[y][x-1] = Xblank;
+ Boom[y][x] = Xblank;
+ Boom[y][x+1] = Xblank;
+ Boom[y+1][x-1] = Xblank;
+ Boom[y+1][x] = Xblank;
+ Boom[y+1][x+1] = Xblank;
+ Boom[y+2][x-1] = Xblank;
+ Boom[y+2][x] = Xblank;
+ Boom[y+2][x+1] = Xblank;
+#if PLAY_ELEMENT_SOUND
+ play_element_sound(x, y, SOUND_boom, Xspring_fall);
+#endif
+ return;
+
+ case Xbug_1_n:
+ case Xbug_1_e:
+ case Xbug_1_s:
+ case Xbug_1_w:
+ case Xbug_2_n:
+ case Xbug_2_e:
+ case Xbug_2_s:
+ case Xbug_2_w:
+ Cave[y][x] = Yspring_sB;
+ Cave[y+1][x] = Ybug_spring;
+ Next[y+1][x] = Znormal;
+ Boom[y][x-1] = Xemerald;
+ Boom[y][x] = Xemerald;
+ Boom[y][x+1] = Xemerald;
+ Boom[y+1][x-1] = Xemerald;
+ Boom[y+1][x] = Xdiamond;
+ Boom[y+1][x+1] = Xemerald;
+ Boom[y+2][x-1] = Xemerald;
+ Boom[y+2][x] = Xemerald;
+ Boom[y+2][x+1] = Xemerald;
+#if PLAY_ELEMENT_SOUND
+ play_element_sound(x, y, SOUND_boom, Xspring_fall);
+#endif
+ score += lev.bug_score;
+ return;
+
+ case Xtank_1_n:
+ case Xtank_1_e:
+ case Xtank_1_s:
+ case Xtank_1_w:
+ case Xtank_2_n:
+ case Xtank_2_e:
+ case Xtank_2_s:
+ case Xtank_2_w:
+ Cave[y][x] = Yspring_sB;
+ Cave[y+1][x] = Ytank_spring;
+ Next[y+1][x] = Znormal;
+ Boom[y][x-1] = Xblank;
+ Boom[y][x] = Xblank;
+ Boom[y][x+1] = Xblank;
+ Boom[y+1][x-1] = Xblank;
+ Boom[y+1][x] = Xblank;
+ Boom[y+1][x+1] = Xblank;
+ Boom[y+2][x-1] = Xblank;
+ Boom[y+2][x] = Xblank;
+ Boom[y+2][x+1] = Xblank;
+#if PLAY_ELEMENT_SOUND
+ play_element_sound(x, y, SOUND_boom, Xspring_fall);
+#endif
+ score += lev.tank_score;
+ return;
+
+ case Xeater_n:
+ case Xeater_e:
+ case Xeater_s:
+ case Xeater_w:
+ Cave[y][x] = Yspring_sB;
+ Cave[y+1][x] = Yeater_spring;
+ Next[y+1][x] = Znormal;
+ Boom[y][x-1] = lev.eater_array[lev.eater_pos][0];
+ Boom[y][x] = lev.eater_array[lev.eater_pos][1];
+ Boom[y][x+1] = lev.eater_array[lev.eater_pos][2];
+ Boom[y+1][x-1] = lev.eater_array[lev.eater_pos][3];
+ Boom[y+1][x] = lev.eater_array[lev.eater_pos][4];
+ Boom[y+1][x+1] = lev.eater_array[lev.eater_pos][5];
+ Boom[y+2][x-1] = lev.eater_array[lev.eater_pos][6];
+ Boom[y+2][x] = lev.eater_array[lev.eater_pos][7];
+ Boom[y+2][x+1] = lev.eater_array[lev.eater_pos][8];
+#if PLAY_ELEMENT_SOUND
+ play_element_sound(x, y, SOUND_boom, Xspring_fall);
+#endif
+ lev.eater_pos = (lev.eater_pos + 1) & 7;
+ score += lev.eater_score;
+ return;
+
+ case Xalien:
+ case Xalien_pause:
+ Cave[y][x] = Yspring_sB;
+ Cave[y+1][x] = Yalien_spring;
+ Next[y+1][x] = Znormal;
+ Boom[y][x-1] = Xblank;
+ Boom[y][x] = Xblank;
+ Boom[y][x+1] = Xblank;
+ Boom[y+1][x-1] = Xblank;
+ Boom[y+1][x] = Xblank;
+ Boom[y+1][x+1] = Xblank;
+ Boom[y+2][x-1] = Xblank;
+ Boom[y+2][x] = Xblank;
+ Boom[y+2][x+1] = Xblank;
+#if PLAY_ELEMENT_SOUND
+ play_element_sound(x, y, SOUND_boom, Xspring_fall);
+#endif
+ score += lev.alien_score;
+ return;
+
+ default:
+ Cave[y][x] = Xspring;
+ Next[y][x] = Xspring;
+ play_element_sound(x, y, SOUND_spring, Xspring);
+ return;
+ }
+}
+
+static void Leater_n(int x, int y)
+{
+ if (Cave[y][x+1] == Xdiamond)
+ {
+ Cave[y][x+1] = Ydiamond_blank;
+ Next[y][x+1] = Xblank;
+ play_element_sound(x, y, SOUND_eater_eat, Xeater_n);
+ return;
+ }
+
+ if (Cave[y+1][x] == Xdiamond)
+ {
+ Cave[y+1][x] = Ydiamond_blank;
+ Next[y+1][x] = Xblank;
+ play_element_sound(x, y, SOUND_eater_eat, Xeater_n);
+ return;
+ }
+
+ if (Cave[y][x-1] == Xdiamond)
+ {
+ Cave[y][x-1] = Ydiamond_blank;
+ Next[y][x-1] = Xblank;
+ play_element_sound(x, y, SOUND_eater_eat, Xeater_n);
+ return;
+ }
+
+ if (Cave[y-1][x] == Xdiamond)
+ {
+ Cave[y-1][x] = Ydiamond_blank;
+ Next[y-1][x] = Xblank;
+ play_element_sound(x, y, SOUND_eater_eat, Xeater_n);
+ return;
+ }
+
+ switch (Cave[y-1][x])
+ {
+ case Xacid_1:
+ case Xacid_2:
+ case Xacid_3:
+ case Xacid_4:
+ case Xacid_5:
+ case Xacid_6:
+ case Xacid_7:
+ case Xacid_8:
+ Cave[y][x] = Yeater_nB;
+ if (Cave[y-2][x+1] == Xblank)
+ Cave[y-2][x+1] = Xacid_splash_e;
+ if (Cave[y-2][x-1] == Xblank)
+ Cave[y-2][x-1] = Xacid_splash_w;
+ Next[y][x] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ case Xplant:
+ case Yplant:
+ case Zplayer:
+ Cave[y][x] = Yeater_nB;
+ Cave[y-1][x] = Yeater_n;
+ Next[y][x] = Xblank;
+ Next[y-1][x] = Xeater_n;
+ return;
+
+ default:
+ Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w;
+ play_element_sound(x, y, SOUND_eater, Xeater_n);
+ return;
+ }
+}
+
+static void Leater_e(int x, int y)
+{
+ if (Cave[y+1][x] == Xdiamond)
+ {
+ Cave[y+1][x] = Ydiamond_blank;
+ Next[y+1][x] = Xblank;
+ play_element_sound(x, y, SOUND_eater_eat, Xeater_e);
+ return;
+ }
+
+ if (Cave[y][x-1] == Xdiamond)
+ {
+ Cave[y][x-1] = Ydiamond_blank;
+ Next[y][x-1] = Xblank;
+ play_element_sound(x, y, SOUND_eater_eat, Xeater_e);
+ return;
+ }
+
+ if (Cave[y-1][x] == Xdiamond)
+ {
+ Cave[y-1][x] = Ydiamond_blank;
+ Next[y-1][x] = Xblank;
+ play_element_sound(x, y, SOUND_eater_eat, Xeater_e);
+ return;
+ }
+
+ if (Cave[y][x+1] == Xdiamond)
+ {
+ Cave[y][x+1] = Ydiamond_blank;
+ Next[y][x+1] = Xblank;
+ play_element_sound(x, y, SOUND_eater_eat, Xeater_e);
+ return;
+ }