+static void Lspring_pause(int x, int y)
+{
+ switch (Cave[x][y+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[x][y] = Yspring_sB;
+ if (Cave[x+1][y] == Xblank)
+ Cave[x+1][y] = Xacid_splash_e;
+ if (Cave[x-1][y] == Xblank)
+ Cave[x-1][y] = Xacid_splash_w;
+ Next[x][y] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ Cave[x][y] = Yspring_sB;
+ Cave[x][y+1] = Yspring_s;
+ Next[x][y] = Xblank;
+ Next[x][y+1] = Xspring_fall;
+ return;
+
+ default:
+ Cave[x][y] = Xspring;
+ Next[x][y] = Xspring;
+ return;
+ }
+}
+
+static void Lspring_e(int x, int y)
+{
+ switch (Cave[x][y+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[x][y] = Yspring_sB;
+ if (Cave[x+1][y] == Xblank)
+ Cave[x+1][y] = Xacid_splash_e;
+ if (Cave[x-1][y] == Xblank)
+ Cave[x-1][y] = Xacid_splash_w;
+ Next[x][y] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ Cave[x][y] = Yspring_sB;
+ Cave[x][y+1] = Yspring_s;
+ Next[x][y] = Xblank;
+ Next[x][y+1] = Xspring_fall;
+ return;
+
+ case Xbumper:
+ Cave[x][y+1] = XbumperB;
+ }
+
+ switch (Cave[x+1][y])
+ {
+ 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[x][y] = Yspring_eB;
+ if (Cave[x+2][y-1] == Xblank)
+ Cave[x+2][y-1] = Xacid_splash_e;
+ if (Cave[x][y-1] == Xblank)
+ Cave[x][y-1] = Xacid_splash_w;
+ Next[x][y] = 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[x][y] = Yspring_eB;
+ Cave[x+1][y] = Yspring_e;
+ Next[x][y] = Xblank;
+ Next[x+1][y] = Xspring_e;
+ return;
+
+ case Xalien:
+ case Xalien_pause:
+ case Yalien_n:
+ case Yalien_e:
+ case Yalien_s:
+ case Yalien_w:
+ Cave[x][y] = Yspring_alien_eB;
+ Cave[x+1][y] = Yspring_alien_e;
+ Next[x][y] = Xblank;
+ Next[x+1][y] = Xspring_e;
+ play_element_sound(x, y, SOUND_slurp, Xalien);
+ score += lev.slurp_score;
+ return;
+
+ case Xbumper:
+ case XbumperB:
+ Cave[x+1][y] = XbumperB;
+ Next[x][y] = Xspring_w;
+ play_element_sound(x, y, SOUND_spring, Xspring);
+ return;
+
+ default:
+ Cave[x][y] = Xspring;
+ Next[x][y] = Xspring;
+ play_element_sound(x, y, SOUND_spring, Xspring);
+ return;
+ }
+}
+
+static void Lspring_w(int x, int y)
+{
+ switch (Cave[x][y+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[x][y] = Yspring_sB;
+ if (Cave[x+1][y] == Xblank)
+ Cave[x+1][y] = Xacid_splash_e;
+ if (Cave[x-1][y] == Xblank)
+ Cave[x-1][y] = Xacid_splash_w;
+ Next[x][y] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ Cave[x][y] = Yspring_sB;
+ Cave[x][y+1] = Yspring_s;
+ Next[x][y] = Xblank;
+ Next[x][y+1] = Xspring_fall;
+ return;
+
+ case Xbumper:
+ Cave[x][y+1] = XbumperB;
+ }
+
+ switch (Cave[x-1][y])
+ {
+ 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[x][y] = Yspring_wB;
+ if (Cave[x][y-1] == Xblank)
+ Cave[x][y-1] = Xacid_splash_e;
+ if (Cave[x-2][y-1] == Xblank)
+ Cave[x-2][y-1] = Xacid_splash_w;
+ Next[x][y] = 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[x][y] = Yspring_wB;
+ Cave[x-1][y] = Yspring_w;
+ Next[x][y] = Xblank;
+ Next[x-1][y] = Xspring_w;
+ return;
+
+ case Xalien:
+ case Xalien_pause:
+ case Yalien_n:
+ case Yalien_e:
+ case Yalien_s:
+ case Yalien_w:
+ Cave[x][y] = Yspring_alien_wB;
+ Cave[x-1][y] = Yspring_alien_w;
+ Next[x][y] = Xblank;
+ Next[x-1][y] = Xspring_w;
+ play_element_sound(x, y, SOUND_slurp, Xalien);
+ score += lev.slurp_score;
+ return;
+
+ case Xbumper:
+ case XbumperB:
+ Cave[x-1][y] = XbumperB;
+ Next[x][y] = Xspring_e;
+ play_element_sound(x, y, SOUND_spring, Xspring);
+ return;
+
+ default:
+ Cave[x][y] = Xspring;
+ Next[x][y] = Xspring;
+ play_element_sound(x, y, SOUND_spring, Xspring);
+ return;
+ }
+}
+
+static void Lspring_fall(int x, int y)
+{
+ switch (Cave[x][y+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[x][y] = Yspring_sB;
+ if (Cave[x+1][y] == Xblank)
+ Cave[x+1][y] = Xacid_splash_e;
+ if (Cave[x-1][y] == Xblank)
+ Cave[x-1][y] = Xacid_splash_w;
+ Next[x][y] = Xblank;
+ play_element_sound(x, y, SOUND_acid, Xacid_1);
+ return;
+
+ case Xblank:
+ case Xacid_splash_e:
+ case Xacid_splash_w:
+ case Zplayer:
+ Cave[x][y] = Yspring_sB;
+ Cave[x][y+1] = Yspring_s;
+ Next[x][y] = Xblank;
+ Next[x][y+1] = Xspring_fall;
+ return;
+
+ case Xbomb:
+ case Xbomb_pause:
+ Cave[x][y+1] = Ybomb_blank;
+ Next[x][y+1] = Znormal;
+ Boom[x-1][y] = Xblank;
+ Boom[x][y] = Xblank;
+ Boom[x+1][y] = Xblank;
+ Boom[x-1][y+1] = Xblank;
+ Boom[x][y+1] = Xblank;
+ Boom[x+1][y+1] = Xblank;
+ Boom[x-1][y+2] = Xblank;
+ Boom[x][y+2] = Xblank;
+ Boom[x+1][y+2] = 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[x][y] = Yspring_sB;
+ Cave[x][y+1] = Ybug_spring;
+ Next[x][y+1] = Znormal;
+ Boom[x-1][y] = Xemerald;
+ Boom[x][y] = Xemerald;
+ Boom[x+1][y] = Xemerald;
+ Boom[x-1][y+1] = Xemerald;
+ Boom[x][y+1] = Xdiamond;
+ Boom[x+1][y+1] = Xemerald;
+ Boom[x-1][y+2] = Xemerald;
+ Boom[x][y+2] = Xemerald;
+ Boom[x+1][y+2] = 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[x][y] = Yspring_sB;
+ Cave[x][y+1] = Ytank_spring;
+ Next[x][y+1] = Znormal;
+ Boom[x-1][y] = Xblank;
+ Boom[x][y] = Xblank;
+ Boom[x+1][y] = Xblank;
+ Boom[x-1][y+1] = Xblank;
+ Boom[x][y+1] = Xblank;
+ Boom[x+1][y+1] = Xblank;
+ Boom[x-1][y+2] = Xblank;
+ Boom[x][y+2] = Xblank;
+ Boom[x+1][y+2] = 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[x][y] = Yspring_sB;
+ Cave[x][y+1] = Yeater_spring;
+ Next[x][y+1] = Znormal;
+ Boom[x-1][y] = lev.eater_array[lev.eater_pos][0];
+ Boom[x][y] = lev.eater_array[lev.eater_pos][1];
+ Boom[x+1][y] = lev.eater_array[lev.eater_pos][2];
+ Boom[x-1][y+1] = lev.eater_array[lev.eater_pos][3];
+ Boom[x][y+1] = lev.eater_array[lev.eater_pos][4];
+ Boom[x+1][y+1] = lev.eater_array[lev.eater_pos][5];
+ Boom[x-1][y+2] = lev.eater_array[lev.eater_pos][6];
+ Boom[x][y+2] = lev.eater_array[lev.eater_pos][7];
+ Boom[x+1][y+2] = 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[x][y] = Yspring_sB;
+ Cave[x][y+1] = Yalien_spring;
+ Next[x][y+1] = Znormal;
+ Boom[x-1][y] = Xblank;
+ Boom[x][y] = Xblank;
+ Boom[x+1][y] = Xblank;
+ Boom[x-1][y+1] = Xblank;
+ Boom[x][y+1] = Xblank;
+ Boom[x+1][y+1] = Xblank;
+ Boom[x-1][y+2] = Xblank;
+ Boom[x][y+2] = Xblank;
+ Boom[x+1][y+2] = Xblank;
+#if PLAY_ELEMENT_SOUND
+ play_element_sound(x, y, SOUND_boom, Xspring_fall);
+#endif
+ score += lev.alien_score;
+ return;
+
+ default:
+ Cave[x][y] = Xspring;
+ Next[x][y] = Xspring;
+ play_element_sound(x, y, SOUND_spring, Xspring);
+ return;
+ }
+}
+
+static void Lpush_emerald_e(int x, int y)
+{
+ switch (Cave[x+1][y])
+ {
+ case Zborder:
+ case Znormal:
+ case Zdynamite:
+ case Xboom_bug:
+ case Xboom_bomb:
+ case Xboom_android:
+ case Xboom_1:
+ case Zplayer:
+ Cave[x][y] = Xemerald;
+ Next[x][y] = Xemerald;
+ return;
+
+ default:
+ Cave[x][y] = Yemerald_eB;
+ Cave[x+1][y] = Yemerald_e;
+ Next[x][y] = Xblank;
+ Next[x+1][y] = Xemerald_pause;
+ return;
+ }
+}
+
+static void Lpush_emerald_w(int x, int y)
+{
+ switch (Cave[x-1][y])
+ {
+ case Zborder:
+ case Znormal:
+ case Zdynamite:
+ case Xboom_bug:
+ case Xboom_bomb:
+ case Xboom_android:
+ case Xboom_1:
+ case Zplayer:
+ Cave[x][y] = Xemerald;
+ Next[x][y] = Xemerald;
+ return;
+
+ default:
+ Cave[x][y] = Yemerald_wB;
+ Cave[x-1][y] = Yemerald_w;
+ Next[x][y] = Xblank;
+ Next[x-1][y] = Xemerald_pause;
+ return;
+ }
+}
+
+static void Lpush_diamond_e(int x, int y)
+{
+ switch (Cave[x+1][y])
+ {
+ case Zborder:
+ case Znormal:
+ case Zdynamite:
+ case Xboom_bug:
+ case Xboom_bomb:
+ case Xboom_android:
+ case Xboom_1:
+ case Zplayer:
+ Cave[x][y] = Xdiamond;
+ Next[x][y] = Xdiamond;
+ return;
+
+ default:
+ Cave[x][y] = Ydiamond_eB;
+ Cave[x+1][y] = Ydiamond_e;
+ Next[x][y] = Xblank;
+ Next[x+1][y] = Xdiamond_pause;
+ return;
+ }
+}
+
+static void Lpush_diamond_w(int x, int y)
+{
+ switch (Cave[x-1][y])
+ {
+ case Zborder:
+ case Znormal:
+ case Zdynamite:
+ case Xboom_bug:
+ case Xboom_bomb:
+ case Xboom_android:
+ case Xboom_1:
+ case Zplayer:
+ Cave[x][y] = Xdiamond;
+ Next[x][y] = Xdiamond;
+ return;
+
+ default:
+ Cave[x][y] = Ydiamond_wB;
+ Cave[x-1][y] = Ydiamond_w;
+ Next[x][y] = Xblank;
+ Next[x-1][y] = Xdiamond_pause;
+ return;
+ }
+}
+
+static void Lpush_stone_e(int x, int y)
+{
+ switch (Cave[x+1][y])
+ {
+ case Zborder:
+ case Znormal:
+ case Zdynamite:
+ case Xboom_bug:
+ case Xboom_bomb:
+ case Xboom_android:
+ case Xboom_1:
+ case Zplayer:
+ Cave[x][y] = Xstone;
+ Next[x][y] = Xstone;
+ return;
+
+ default:
+ Cave[x][y] = Ystone_eB;
+ Cave[x+1][y] = Ystone_e;
+ Next[x][y] = Xblank;
+ Next[x+1][y] = Xstone_pause;
+ return;
+ }
+}
+
+static void Lpush_stone_w(int x, int y)
+{
+ switch (Cave[x-1][y])
+ {
+ case Zborder:
+ case Znormal:
+ case Zdynamite:
+ case Xboom_bug:
+ case Xboom_bomb:
+ case Xboom_android:
+ case Xboom_1:
+ case Zplayer:
+ Cave[x][y] = Xstone;
+ Next[x][y] = Xstone;
+ return;
+
+ default:
+ Cave[x][y] = Ystone_wB;
+ Cave[x-1][y] = Ystone_w;
+ Next[x][y] = Xblank;
+ Next[x-1][y] = Xstone_pause;
+ return;
+ }
+}
+
+static void Lpush_bomb_e(int x, int y)
+{
+ switch (Cave[x+1][y])
+ {
+ case Zborder:
+ case Znormal:
+ case Zdynamite:
+ case Xboom_bug:
+ case Xboom_bomb:
+ case Xboom_android:
+ case Xboom_1:
+ case Zplayer:
+ Cave[x][y] = Xbomb;
+ Next[x][y] = Xbomb;
+ return;