From: Holger Schemel Date: Wed, 22 Jan 2020 11:51:56 +0000 (+0100) Subject: changed order of functions in EM engine source file X-Git-Tag: 4.2.0.0~185 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=26b1ccdbe8a2b714e49e1fd6c9bd40cfcce0662f changed order of functions in EM engine source file --- diff --git a/src/game_em/synchro_2.c b/src/game_em/synchro_2.c index e7d2b3a7..96a72fbc 100644 --- a/src/game_em/synchro_2.c +++ b/src/game_em/synchro_2.c @@ -44,936 +44,447 @@ static void set_nearest_player_xy(int x, int y, int *dx, int *dy) } } -static void Lpush_stone_e(int x, int y) +static void Lboom_bug(int x, int y) { - switch (Cave[y][x+1]) - { - case Zborder: - case Znormal: - case Zdynamite: - case Xboom_bug: - case Xboom_bomb: - case Xboom_android: - case Xboom_1: - case Zplayer: - Cave[y][x] = Xstone; - Next[y][x] = Xstone; - return; + 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; - default: - Cave[y][x] = Ystone_eB; - Cave[y][x+1] = Ystone_e; - Next[y][x] = Xblank; - Next[y][x+1] = Xstone_pause; - return; - } +#if PLAY_ELEMENT_SOUND + play_element_sound(x, y, SOUND_boom, element); +#endif } -static void Lpush_stone_w(int x, int y) +static void Lboom_tank(int x, int y) { - switch (Cave[y][x-1]) - { - case Zborder: - case Znormal: - case Zdynamite: - case Xboom_bug: - case Xboom_bomb: - case Xboom_android: - case Xboom_1: - case Zplayer: - Cave[y][x] = Xstone; - Next[y][x] = Xstone; - return; - - default: - Cave[y][x] = Ystone_wB; - Cave[y][x-1] = Ystone_w; - Next[y][x] = Xblank; - Next[y][x-1] = Xstone_pause; - return; - } + 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 Lpush_nut_e(int x, int y) +static void Landroid(int x, int y) { - switch (Cave[y][x+1]) - { - case Zborder: - case Znormal: - case Zdynamite: - case Xboom_bug: - case Xboom_bomb: - case Xboom_android: - case Xboom_1: - case Zplayer: - Cave[y][x] = Xnut; - Next[y][x] = Xnut; - return; - - default: - Cave[y][x] = Ynut_eB; - Cave[y][x+1] = Ynut_e; - Next[y][x] = Xblank; - Next[y][x+1] = Xnut_pause; - return; - } -} + int dx, dy, temp; -static void Lpush_nut_w(int x, int y) -{ - switch (Cave[y][x-1]) + if (lev.android_clone_cnt == 0) { - case Zborder: - case Znormal: - case Zdynamite: - case Xboom_bug: - case Xboom_bomb: - case Xboom_android: - case Xboom_1: - case Zplayer: - Cave[y][x] = Xnut; - Next[y][x] = Xnut; - return; - - default: - Cave[y][x] = Ynut_wB; - Cave[y][x-1] = Ynut_w; - Next[y][x] = Xblank; - Next[y][x-1] = Xnut_pause; - return; - } -} + 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; -static void Lpush_spring_e(int x, int y) -{ - switch (Cave[y][x+1]) - { - case Zborder: - case Znormal: - case Zdynamite: - case Xboom_bug: - case Xboom_bomb: - case Xboom_android: - case Xboom_1: - case Zplayer: - Cave[y][x] = Xspring; - Next[y][x] = Xspring; - return; + switch (RANDOM & 7) + { + /* randomly find an object to clone */ - default: - Cave[y][x] = Yspring_eB; - Cave[y][x+1] = Yspring_e; - Next[y][x] = Xblank; - Next[y][x+1] = Xspring_e; - return; - } -} + 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; -static void Lpush_spring_w(int x, int y) -{ - switch (Cave[y][x-1]) - { - case Zborder: - case Znormal: - case Zdynamite: - case Xboom_bug: - case Xboom_bomb: - case Xboom_android: - case Xboom_1: - case Zplayer: - Cave[y][x] = Xspring; - Next[y][x] = Xspring; - return; + 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; - default: - Cave[y][x] = Yspring_wB; - Cave[y][x-1] = Yspring_w; - Next[y][x] = Xblank; - Next[y][x-1] = Xspring_w; - return; - } -} + 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; -static void Lpush_emerald_e(int x, int y) -{ - switch (Cave[y][x+1]) - { - case Zborder: - case Znormal: - case Zdynamite: - case Xboom_bug: - case Xboom_bomb: - case Xboom_android: - case Xboom_1: - case Zplayer: - Cave[y][x] = Xemerald; - Next[y][x] = Xemerald; - return; + 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; - default: - Cave[y][x] = Yemerald_eB; - Cave[y][x+1] = Yemerald_e; - Next[y][x] = Xblank; - Next[y][x+1] = Xemerald_pause; - return; - } -} + 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; -static void Lpush_emerald_w(int x, int y) -{ - switch (Cave[y][x-1]) - { - case Zborder: - case Znormal: - case Zdynamite: - case Xboom_bug: - case Xboom_bomb: - case Xboom_android: - case Xboom_1: - case Zplayer: - Cave[y][x] = Xemerald; - Next[y][x] = Xemerald; - return; + 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; - default: - Cave[y][x] = Yemerald_wB; - Cave[y][x-1] = Yemerald_w; - Next[y][x] = Xblank; - Next[y][x-1] = Xemerald_pause; - return; - } -} + 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; -static void Lpush_diamond_e(int x, int y) -{ - switch (Cave[y][x+1]) - { - case Zborder: - case Znormal: - case Zdynamite: - case Xboom_bug: - case Xboom_bomb: - case Xboom_android: - case Xboom_1: - case Zplayer: - Cave[y][x] = Xdiamond; - Next[y][x] = Xdiamond; - return; + 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; + } - default: - Cave[y][x] = Ydiamond_eB; - Cave[y][x+1] = Ydiamond_e; - Next[y][x] = Xblank; - Next[y][x+1] = Xdiamond_pause; - return; - } -} + Next[y][x] = temp; /* the item we chose to clone */ + play_element_sound(x, y, SOUND_android_clone, temp); -static void Lpush_diamond_w(int x, int y) -{ - switch (Cave[y][x-1]) - { - case Zborder: - case Znormal: - case Zdynamite: - case Xboom_bug: - case Xboom_bomb: - case Xboom_android: - case Xboom_1: - case Zplayer: - Cave[y][x] = Xdiamond; - Next[y][x] = Xdiamond; - return; + switch (RANDOM & 7) + { + /* randomly find a direction to move */ - default: - Cave[y][x] = Ydiamond_wB; - Cave[y][x-1] = Ydiamond_w; - Next[y][x] = Xblank; - Next[y][x-1] = Xdiamond_pause; - return; - } -} + 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; -static void Lpush_bomb_e(int x, int y) -{ - switch (Cave[y][x+1]) - { - case Zborder: - case Znormal: - case Zdynamite: - case Xboom_bug: - case Xboom_bomb: - case Xboom_android: - case Xboom_1: - case Zplayer: - Cave[y][x] = Xbomb; - Next[y][x] = Xbomb; - return; + 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; - default: - Cave[y][x] = Ybomb_eB; - Cave[y][x+1] = Ybomb_e; - Next[y][x] = Xblank; - Next[y][x+1] = Xbomb_pause; - return; - } -} + 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; -static void Lpush_bomb_w(int x, int y) -{ - switch (Cave[y][x-1]) - { - case Zborder: - case Znormal: - case Zdynamite: - case Xboom_bug: - case Xboom_bomb: - case Xboom_android: - case Xboom_1: - case Zplayer: - Cave[y][x] = Xbomb; - Next[y][x] = Xbomb; - return; + 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; - default: - Cave[y][x] = Ybomb_wB; - Cave[y][x-1] = Ybomb_w; - Next[y][x] = Xblank; - Next[y][x-1] = Xbomb_pause; - return; - } -} + 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; -static void Lstone(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] = Ystone_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 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 Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Xplant: - case Yplant: -#if 1 - 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: -#endif - Cave[y][x] = Ystone_sB; - Cave[y+1][x] = Ystone_s; - Next[y][x] = Xblank; - Next[y+1][x] = Xstone_fall; - return; + 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 Xsand: - Cave[y][x] = Xsand_stonein_1; - Cave[y+1][x] = Xsand_sandstone_1; - Next[y][x] = Xsand_stonein_2; - Next[y+1][x] = 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: - 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 Xlenses: - case Xmagnify: - 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] = Ystone_eB; - Cave[y][x+1] = Ystone_e; - Next[y][x] = Xblank; - Next[y][x+1] = Xstone_pause; - return; - } - - if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]]) - { - Cave[y][x] = Ystone_wB; - Cave[y][x-1] = Ystone_w; - Next[y][x] = Xblank; - Next[y][x-1] = Xstone_pause; - return; - } - } - else - { - if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]]) - { - Cave[y][x] = Ystone_wB; - Cave[y][x-1] = Ystone_w; - Next[y][x] = Xblank; - Next[y][x-1] = Xstone_pause; - return; - } - - if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]]) - { - Cave[y][x] = Ystone_eB; - Cave[y][x+1] = Ystone_e; - Next[y][x] = Xblank; - Next[y][x+1] = Xstone_pause; - return; - } - } - } -} - -static void Lstone_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] = Ystone_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: -#if 1 - 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: -#endif - Cave[y][x] = Ystone_sB; - Cave[y+1][x] = Ystone_s; - Next[y][x] = Xblank; - Next[y+1][x] = Xstone_fall; - return; - - default: - Cave[y][x] = Xstone; - Next[y][x] = Xstone; - return; + 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; + } } -} -static void Lstone_fall(int x, int y) -{ - switch (Cave[y+1][x]) + android_move: + if (lev.android_move_cnt == 0) { - 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] = Ystone_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: -#if 1 - 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: -#endif - Cave[y][x] = Ystone_sB; - Cave[y+1][x] = Ystone_s; - Next[y][x] = Xblank; - Next[y+1][x] = Xstone_fall; - return; - - case Xnut: - case Xnut_pause: - Cave[y+1][x] = Ynut_stone; - Next[y][x] = Xstone; - Next[y+1][x] = Xemerald; - play_element_sound(x, y, SOUND_crack, Xnut); - score += lev.nut_score; - return; + 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; - 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] = Ystone_sB; - Cave[y+1][x] = Ybug_stone; - 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, Xstone_fall); -#endif - score += lev.bug_score; - return; + set_nearest_player_xy(x, y, &dx, &dy); - 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] = Ystone_sB; - Cave[y+1][x] = Ytank_stone; - 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 - score += lev.tank_score; - return; + Next[y][x] = Xblank; /* assume we will move */ + temp = ((x < dx) + 1 - (x > dx)) + ((y < dy) + 1 - (y > dy)) * 3; - case Xspring: - if (RANDOM & 1) + if (RANDOM & 1) + { + switch (temp) { - switch (Cave[y+1][x+1]) - { - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Xalien: - case Xalien_pause: - Cave[y+1][x] = Xspring_e; - break; + /* attempt clockwise move first if direct path is blocked */ - default: - Cave[y+1][x] = Xspring_w; - break; - } - } - else - { - switch (Cave[y+1][x-1]) - { - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Xalien: - case Xalien_pause: - Cave[y+1][x] = Xspring_w; - break; - default: - Cave[y+1][x] = Xspring_e; - break; - } - } + 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; - Next[y][x] = Xstone; - return; + 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 Xeater_n: - case Xeater_e: - case Xeater_s: - case Xeater_w: - Cave[y][x] = Ystone_sB; - Cave[y+1][x] = Yeater_stone; - 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, Xstone_fall); -#endif - lev.eater_pos = (lev.eater_pos + 1) & 7; - score += lev.eater_score; - return; + 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 Xalien: - case Xalien_pause: - Cave[y][x] = Ystone_sB; - Cave[y+1][x] = Yalien_stone; - 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 - score += lev.alien_score; - return; + 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 Xdiamond: - case Xdiamond_pause: - switch (Cave[y+2][x]) - { - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Zplayer: - 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: - 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: - 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 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: - Next[y][x] = Xstone; - play_element_sound(x, y, SOUND_stone, Xstone); - return; - } + case 4: /* nowhere */ + break; - 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 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 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 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 Xwonderwall: - if (lev.wonderwall_time) + 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) { - lev.wonderwall_state = 1; - Cave[y][x] = Ystone_sB; + /* attempt counterclockwise move first if direct path is blocked */ - if (tab_blank[Cave[y+2][x]]) - { - Cave[y+2][x] = Yemerald_s; - Next[y+2][x] = Xemerald_fall; - } + 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; - Next[y][x] = Xblank; - play_element_sound(x, y, SOUND_wonderfall, Xwonderwall); - return; - } + 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; - default: - Cave[y][x] = Xstone; - Next[y][x] = Xstone; - play_element_sound(x, y, SOUND_stone, Xstone); - return; - } -} + 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; -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 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 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 4: /* nowhere */ + break; - 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; - } + 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; - 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; - } + 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; - 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; - } + 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; } + } } -} -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; + 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; - 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; + 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; - default: - Cave[y][x] = Xnut; - Next[y][x] = Xnut; - 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 Lnut_fall(int x, int y) +static void Landroid_1_n(int x, int y) { - switch (Cave[y+1][x]) + switch (Cave[y-1][x]) { case Xacid_1: case Xacid_2: @@ -983,11 +494,11 @@ static void Lnut_fall(int x, int y) 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; + 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; @@ -995,57 +506,20 @@ static void Lnut_fall(int x, int y) case Xblank: case Xacid_splash_e: case Xacid_splash_w: - case Zplayer: - Cave[y][x] = Ynut_sB; - Cave[y+1][x] = Ynut_s; + Cave[y][x] = Yandroid_nB; + Cave[y-1][x] = Yandroid_n; Next[y][x] = Xblank; - Next[y+1][x] = Xnut_fall; + Next[y-1][x] = Xandroid; + play_element_sound(x, y, SOUND_android_move, Xandroid_1_n); return; default: - Cave[y][x] = Xnut; - Next[y][x] = Xnut; - play_element_sound(x, y, SOUND_nut, Xnut); + Landroid(x, y); 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) +static void Landroid_2_n(int x, int y) { switch (Cave[y-1][x]) { @@ -1057,7 +531,7 @@ static void Lbug_n(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Ybug_nB; + 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) @@ -1069,43 +543,23 @@ static void Lbug_n(int x, int y) 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; + Cave[y][x] = Yandroid_nB; + Cave[y-1][x] = Yandroid_n; Next[y][x] = Xblank; - Next[y-1][x] = Xbug_1_n; - play_element_sound(x, y, SOUND_bug, Xbug_1_n); + Next[y-1][x] = Xandroid_1_n; + play_element_sound(x, y, SOUND_android_move, Xandroid_2_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); + Landroid(x, y); return; } } -static void Lbug_1_n(int x, int y) +static void Landroid_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][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: @@ -1114,34 +568,32 @@ static void Lbug_1_n(int x, int y) 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); + 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; - default: - Lbug_n(x, y); + 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; - } -} - -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; + default: + Landroid(x, y); + return; } - - Lbug_n(x, y); } -static void Lbug_e(int x, int y) +static void Landroid_2_e(int x, int y) { switch (Cave[y][x+1]) { @@ -1153,7 +605,7 @@ static void Lbug_e(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Ybug_eB; + 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) @@ -1165,43 +617,23 @@ static void Lbug_e(int x, int y) 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; + Cave[y][x] = Yandroid_eB; + Cave[y][x+1] = Yandroid_e; Next[y][x] = Xblank; - Next[y][x+1] = Xbug_1_e; - play_element_sound(x, y, SOUND_bug, Xbug_1_e); + Next[y][x+1] = Xandroid_1_e; + play_element_sound(x, y, SOUND_android_move, Xandroid_2_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); + Landroid(x, y); return; } } -static void Lbug_1_e(int x, int y) +static void Landroid_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+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: @@ -1210,34 +642,32 @@ static void Lbug_1_e(int x, int y) 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); + 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; - default: - Lbug_e(x, y); + 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; - } -} - -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; + default: + Landroid(x, y); + return; } - - Lbug_e(x, y); } -static void Lbug_s(int x, int y) +static void Landroid_2_s(int x, int y) { switch (Cave[y+1][x]) { @@ -1249,7 +679,7 @@ static void Lbug_s(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Ybug_sB; + Cave[y][x] = Yandroid_sB; if (Cave[y][x+1] == Xblank) Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) @@ -1261,43 +691,23 @@ static void Lbug_s(int x, int y) 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; + Cave[y][x] = Yandroid_sB; + Cave[y+1][x] = Yandroid_s; Next[y][x] = Xblank; - Next[y+1][x] = Xbug_1_s; - play_element_sound(x, y, SOUND_bug, Xbug_1_s); + Next[y+1][x] = Xandroid_1_s; + play_element_sound(x, y, SOUND_android_move, Xandroid_2_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); + Landroid(x, y); return; } } -static void Lbug_1_s(int x, int y) +static void Landroid_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][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: @@ -1306,34 +716,32 @@ static void Lbug_1_s(int x, int y) 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); + 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; - default: - Lbug_s(x, y); + 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; - } -} - -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; + default: + Landroid(x, y); + return; } - - Lbug_s(x, y); } -static void Lbug_w(int x, int y) +static void Landroid_2_w(int x, int y) { switch (Cave[y][x-1]) { @@ -1345,7 +753,7 @@ static void Lbug_w(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Ybug_wB; + 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) @@ -1357,80 +765,53 @@ static void Lbug_w(int x, int y) 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; + Cave[y][x] = Yandroid_wB; + Cave[y][x-1] = Yandroid_w; Next[y][x] = Xblank; - Next[y][x-1] = Xbug_1_w; - play_element_sound(x, y, SOUND_bug, Xbug_1_w); + Next[y][x-1] = Xandroid_1_w; + play_element_sound(x, y, SOUND_android_move, Xandroid_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); + Landroid(x, y); return; } } -static void Lbug_1_w(int x, int y) +static void Leater_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]]) + if (Cave[y][x+1] == Xdiamond) { - Lboom_bug(x, y); - + Cave[y][x+1] = Ydiamond_blank; + Next[y][x+1] = Xblank; + play_element_sound(x, y, SOUND_eater_eat, Xeater_n); return; } - switch (Cave[y-1][x]) + if (Cave[y+1][x] == Xdiamond) { - 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; + Cave[y+1][x] = Ydiamond_blank; + Next[y+1][x] = Xblank; + play_element_sound(x, y, SOUND_eater_eat, Xeater_n); + 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]]) + if (Cave[y][x-1] == Xdiamond) { - Lboom_bug(x, y); - + Cave[y][x-1] = Ydiamond_blank; + Next[y][x-1] = Xblank; + play_element_sound(x, y, SOUND_eater_eat, Xeater_n); return; } - Lbug_w(x, 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_n); + return; + } -static void Ltank_n(int x, int y) -{ switch (Cave[y-1][x]) { case Xacid_1: @@ -1441,7 +822,7 @@ static void Ltank_n(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Ytank_nB; + 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) @@ -1456,40 +837,55 @@ static void Ltank_n(int x, int y) case Xplant: case Yplant: case Zplayer: - Cave[y][x] = Ytank_nB; - Cave[y-1][x] = Ytank_n; + Cave[y][x] = Yeater_nB; + Cave[y-1][x] = Yeater_n; Next[y][x] = Xblank; - Next[y-1][x] = Xtank_1_n; - play_element_sound(x, y, SOUND_tank, Xtank_1_n); + Next[y-1][x] = Xeater_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); + Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w; + play_element_sound(x, y, SOUND_eater, Xeater_n); return; } } -static void Ltank_1_n(int x, int y) +static void Leater_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]]) + if (Cave[y+1][x] == Xdiamond) { - Lboom_tank(x, y); + 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; } - switch (Cave[y][x-1]) + 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; + } + + 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: @@ -1498,36 +894,69 @@ static void Ltank_1_n(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: + Cave[y][x] = Yeater_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_n_w; - Next[y][x] = Xtank_2_w; - play_element_sound(x, y, SOUND_tank, Xtank_1_n); + Cave[y][x] = Yeater_eB; + Cave[y][x+1] = Yeater_e; + Next[y][x] = Xblank; + Next[y][x+1] = Xeater_e; return; default: - Ltank_n(x, y); + Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s; + play_element_sound(x, y, SOUND_eater, Xeater_e); return; } } -static void Ltank_2_n(int x, int y) +static void Leater_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]]) + if (Cave[y][x-1] == Xdiamond) { - Lboom_tank(x, y); + Cave[y][x-1] = Ydiamond_blank; + Next[y][x-1] = Xblank; + play_element_sound(x, y, SOUND_eater_eat, Xeater_s); + 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_s); + 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_s); return; } - Ltank_n(x, 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_s); + return; + } -static void Ltank_e(int x, int y) -{ - switch (Cave[y][x+1]) + switch (Cave[y+1][x]) { case Xacid_1: case Xacid_2: @@ -1537,11 +966,11 @@ static void Ltank_e(int x, int y) 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; + Cave[y][x] = Yeater_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; @@ -1552,78 +981,54 @@ static void Ltank_e(int x, int y) case Xplant: case Yplant: case Zplayer: - Cave[y][x] = Ytank_eB; - Cave[y][x+1] = Ytank_e; + Cave[y][x] = Yeater_sB; + Cave[y+1][x] = Yeater_s; Next[y][x] = Xblank; - Next[y][x+1] = Xtank_1_e; - play_element_sound(x, y, SOUND_tank, Xtank_1_e); + Next[y+1][x] = Xeater_s; return; default: - Cave[y][x] = Ytank_e_s; - Next[y][x] = Xtank_2_s; - play_element_sound(x, y, SOUND_tank, Xtank_1_e); + Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w; + play_element_sound(x, y, SOUND_eater, Xeater_s); return; } } -static void Ltank_1_e(int x, int y) +static void Leater_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]]) + if (Cave[y-1][x] == Xdiamond) { - Lboom_tank(x, y); - + Cave[y-1][x] = Ydiamond_blank; + Next[y-1][x] = Xblank; + play_element_sound(x, y, SOUND_eater_eat, Xeater_w); return; } - switch (Cave[y-1][x]) + if (Cave[y][x+1] == Xdiamond) { - 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; + Cave[y][x+1] = Ydiamond_blank; + Next[y][x+1] = Xblank; + play_element_sound(x, y, SOUND_eater_eat, Xeater_w); + 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]]) + if (Cave[y+1][x] == Xdiamond) { - Lboom_tank(x, y); - + Cave[y+1][x] = Ydiamond_blank; + Next[y+1][x] = Xblank; + play_element_sound(x, y, SOUND_eater_eat, Xeater_w); return; } - Ltank_e(x, 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_w); + return; + } -static void Ltank_s(int x, int y) -{ - switch (Cave[y+1][x]) + switch (Cave[y][x-1]) { case Xacid_1: case Xacid_2: @@ -1633,11 +1038,11 @@ static void Ltank_s(int x, int y) 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; + Cave[y][x] = Yeater_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; @@ -1648,78 +1053,189 @@ static void Ltank_s(int x, int y) case Xplant: case Yplant: case Zplayer: - Cave[y][x] = Ytank_sB; - Cave[y+1][x] = Ytank_s; + Cave[y][x] = Yeater_wB; + Cave[y][x-1] = Yeater_w; Next[y][x] = Xblank; - Next[y+1][x] = Xtank_1_s; - play_element_sound(x, y, SOUND_tank, Xtank_1_s); + Next[y][x-1] = Xeater_w; return; default: - Cave[y][x] = Ytank_s_w; - Next[y][x] = Xtank_2_w; - play_element_sound(x, y, SOUND_tank, Xtank_1_s); + Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s; + play_element_sound(x, y, SOUND_eater, Xeater_w); return; } } -static void Ltank_1_s(int x, int y) +static void Lalien(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); + int dx, dy; - return; + if (lev.wheel_cnt) + { + dx = lev.wheel_x; + dy = lev.wheel_y; + } + else + { + set_nearest_player_xy(x, y, &dx, &dy); } - switch (Cave[y][x+1]) + if (RANDOM & 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; + if (y > dy) + { + 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] = Yalien_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] = Yalien_nB; + Cave[y-1][x] = Yalien_n; + Next[y][x] = Xblank; + Next[y-1][x] = Xalien_pause; + play_element_sound(x, y, SOUND_alien, Xalien); + return; + } + } + else if (y < dy) + { + 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] = Yalien_sB; + Next[y][x] = Xblank; + 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; + 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] = Yalien_sB; + Cave[y+1][x] = Yalien_s; + Next[y][x] = Xblank; + Next[y+1][x] = Xalien_pause; + play_element_sound(x, y, SOUND_alien, Xalien); + return; + } + } + } + else + { + if (x < dx) + { + 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] = Yalien_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; - default: - Ltank_s(x, y); - return; + case Xblank: + case Xacid_splash_e: + case Xacid_splash_w: + case Xplant: + case Yplant: + case Zplayer: + Cave[y][x] = Yalien_eB; + Cave[y][x+1] = Yalien_e; + Next[y][x] = Xblank; + Next[y][x+1] = Xalien_pause; + play_element_sound(x, y, SOUND_alien, Xalien); + return; + } + } + else if (x > dx) + { + 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] = Yalien_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] = Yalien_wB; + Cave[y][x-1] = Yalien_w; + Next[y][x] = Xblank; + Next[y][x-1] = Xalien_pause; + play_element_sound(x, y, SOUND_alien, Xalien); + return; + } + } } } -static void Ltank_2_s(int x, int y) +static void Lalien_pause(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); + Next[y][x] = Xalien; } -static void Ltank_w(int x, int y) +static void Lbug_n(int x, int y) { - switch (Cave[y][x-1]) + switch (Cave[y-1][x]) { case Xacid_1: case Xacid_2: @@ -1729,11 +1245,11 @@ static void Ltank_w(int x, int y) 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; + 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; @@ -1744,34 +1260,34 @@ static void Ltank_w(int x, int y) case Xplant: case Yplant: case Zplayer: - Cave[y][x] = Ytank_wB; - Cave[y][x-1] = Ytank_w; + Cave[y][x] = Ybug_nB; + Cave[y-1][x] = Ybug_n; Next[y][x] = Xblank; - Next[y][x-1] = Xtank_1_w; - play_element_sound(x, y, SOUND_tank, Xtank_1_w); + Next[y-1][x] = Xbug_1_n; + play_element_sound(x, y, SOUND_bug, Xbug_1_n); return; default: - Cave[y][x] = Ytank_w_n; - Next[y][x] = Xtank_2_n; - play_element_sound(x, y, SOUND_tank, Xtank_1_w); + 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 Ltank_1_w(int x, int y) +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_tank(x, y); + Lboom_bug(x, y); return; } - switch (Cave[y+1][x]) + switch (Cave[y][x+1]) { case Xblank: case Xacid_splash_e: @@ -1787,438 +1303,419 @@ static void Ltank_1_w(int x, int y) 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); + Cave[y][x] = Ybug_n_e; + Next[y][x] = Xbug_2_e; + play_element_sound(x, y, SOUND_bug, Xbug_1_n); return; default: - Ltank_w(x, y); + Lbug_n(x, y); return; } } -static void Ltank_2_w(int x, int y) +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_tank(x, y); + Lboom_bug(x, y); return; } - Ltank_w(x, y); + Lbug_n(x, y); } -static void Landroid(int x, int y) +static void Lbug_e(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; + 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 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 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; - 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; + default: + Cave[y][x] = Ybug_e_n; + Next[y][x] = Xbug_2_n; + play_element_sound(x, y, SOUND_bug, Xbug_1_e); + return; + } +} - 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; +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); - 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; + return; + } - 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; + 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; - 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; - } + default: + Lbug_e(x, y); + return; } +} - android_move: - if (lev.android_move_cnt == 0) +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]]) { - 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; + Lboom_bug(x, y); - set_nearest_player_xy(x, y, &dx, &dy); + return; + } - Next[y][x] = Xblank; /* assume we will move */ - temp = ((x < dx) + 1 - (x > dx)) + ((y < dy) + 1 - (y > dy)) * 3; + Lbug_e(x, y); +} - if (RANDOM & 1) - { - switch (temp) - { - /* attempt clockwise move first if direct path is blocked */ +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 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 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; - 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; + default: + Cave[y][x] = Ybug_s_e; + Next[y][x] = Xbug_2_e; + play_element_sound(x, y, SOUND_bug, Xbug_1_s); + return; + } +} - 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; +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); - 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; + 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; + } +} - case 4: /* nowhere */ - break; +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); - 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; + return; + } - 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; + Lbug_s(x, y); +} - 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; +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 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 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; - 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; + default: + Cave[y][x] = Ybug_w_s; + Next[y][x] = Xbug_2_s; + play_element_sound(x, y, SOUND_bug, Xbug_1_w); + return; + } +} - 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; +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); - 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; + return; + } - 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; + 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; - case 4: /* nowhere */ - break; + default: + Lbug_w(x, y); + return; + } +} - 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; +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); - 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; + return; + } - 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; + Lbug_w(x, y); +} - 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; - } - } - } +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; - android_still: - Next[y][x] = Xandroid; - 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; - 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; + default: + Cave[y][x] = Ytank_n_e; + Next[y][x] = Xtank_2_e; + play_element_sound(x, y, SOUND_tank, Xtank_1_n); + 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; +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); - 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; + 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; + 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; - 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; + default: + Ltank_n(x, y); + 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; +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); - 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; + 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; + Ltank_n(x, y); } -static void Landroid_1_n(int x, int y) +static void Ltank_e(int x, int y) { - switch (Cave[y-1][x]) + switch (Cave[y][x+1]) { case Xacid_1: case Xacid_2: @@ -2228,11 +1725,11 @@ static void Landroid_1_n(int x, int y) 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; + 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; @@ -2240,23 +1737,43 @@ static void Landroid_1_n(int x, int y) case Xblank: case Xacid_splash_e: case Xacid_splash_w: - Cave[y][x] = Yandroid_nB; - Cave[y-1][x] = Yandroid_n; + case Xplant: + case Yplant: + case Zplayer: + Cave[y][x] = Ytank_eB; + Cave[y][x+1] = Ytank_e; Next[y][x] = Xblank; - Next[y-1][x] = Xandroid; - play_element_sound(x, y, SOUND_android_move, Xandroid_1_n); + Next[y][x+1] = Xtank_1_e; + play_element_sound(x, y, SOUND_tank, Xtank_1_e); return; default: - Landroid(x, y); + 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 Landroid_2_n(int x, int y) +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: @@ -2265,34 +1782,36 @@ static void Landroid_2_n(int x, int y) 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); + 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: - Landroid(x, y); + Ltank_e(x, y); return; } } -static void Landroid_1_e(int x, int y) +static void Ltank_2_e(int x, int y) { - switch (Cave[y][x+1]) + 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: @@ -2302,11 +1821,11 @@ static void Landroid_1_e(int x, int y) 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; + 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; @@ -2314,23 +1833,43 @@ static void Landroid_1_e(int x, int y) case Xblank: case Xacid_splash_e: case Xacid_splash_w: - Cave[y][x] = Yandroid_eB; - Cave[y][x+1] = Yandroid_e; + case Xplant: + case Yplant: + case Zplayer: + Cave[y][x] = Ytank_sB; + Cave[y+1][x] = Ytank_s; Next[y][x] = Xblank; - Next[y][x+1] = Xandroid; - play_element_sound(x, y, SOUND_android_move, Xandroid_1_e); + Next[y+1][x] = Xtank_1_s; + play_element_sound(x, y, SOUND_tank, Xtank_1_s); return; default: - Landroid(x, y); + 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 Landroid_2_e(int x, int y) +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: @@ -2339,11 +1878,50 @@ static void Landroid_2_e(int x, int y) 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; + 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_w; + 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; @@ -2351,23 +1929,43 @@ static void Landroid_2_e(int x, int y) case Xblank: case Xacid_splash_e: case Xacid_splash_w: - Cave[y][x] = Yandroid_eB; - Cave[y][x+1] = Yandroid_e; + 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] = Xandroid_1_e; - play_element_sound(x, y, SOUND_android_move, Xandroid_2_e); + Next[y][x-1] = Xtank_1_w; + play_element_sound(x, y, SOUND_tank, Xtank_1_w); return; default: - Landroid(x, y); + 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 Landroid_1_s(int x, int y) +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: @@ -2376,32 +1974,34 @@ static void Landroid_1_s(int x, int y) 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); + 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: - Landroid(x, y); + Ltank_w(x, y); return; } } -static void Landroid_2_s(int x, int y) +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 Lemerald(int x, int y) { switch (Cave[y+1][x]) { @@ -2413,7 +2013,7 @@ static void Landroid_2_s(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Yandroid_sB; + Cave[y][x] = Yemerald_sB; if (Cave[y][x+1] == Xblank) Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) @@ -2425,22 +2025,120 @@ static void Landroid_2_s(int x, int y) case Xblank: case Xacid_splash_e: case Xacid_splash_w: - Cave[y][x] = Yandroid_sB; - Cave[y+1][x] = Yandroid_s; + Cave[y][x] = Yemerald_sB; + Cave[y+1][x] = Yemerald_s; Next[y][x] = Xblank; - Next[y+1][x] = Xandroid_1_s; - play_element_sound(x, y, SOUND_android_move, Xandroid_2_s); + Next[y+1][x] = Xemerald_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 Xwonderwall: + 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 Xsteel_1: + case Xsteel_2: + case Xsteel_3: + case Xsteel_4: + case Xwall_1: + case Xwall_2: + case Xwall_3: + case Xwall_4: + 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] = Yemerald_eB; + Cave[y][x+1] = Yemerald_e; + Next[y][x] = Xblank; + Next[y][x+1] = Xemerald_pause; + return; + } + + if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]]) + { + Cave[y][x] = Yemerald_wB; + Cave[y][x-1] = Yemerald_w; + Next[y][x] = Xblank; + Next[y][x-1] = Xemerald_pause; + return; + } + } + else + { + if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]]) + { + Cave[y][x] = Yemerald_wB; + Cave[y][x-1] = Yemerald_w; + Next[y][x] = Xblank; + Next[y][x-1] = Xemerald_pause; + return; + } + + if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]]) + { + Cave[y][x] = Yemerald_eB; + Cave[y][x+1] = Yemerald_e; + Next[y][x] = Xblank; + Next[y][x+1] = Xemerald_pause; + return; + } + } + default: - Landroid(x, y); + if (++lev.shine_cnt > 50) + { + lev.shine_cnt = RANDOM & 7; + Cave[y][x] = Xemerald_shine; + } + return; } } -static void Landroid_1_w(int x, int y) +static void Lemerald_pause(int x, int y) { - switch (Cave[y][x-1]) + switch (Cave[y+1][x]) { case Xacid_1: case Xacid_2: @@ -2450,11 +2148,11 @@ static void Landroid_1_w(int x, int y) 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; + Cave[y][x] = Yemerald_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; @@ -2462,22 +2160,22 @@ static void Landroid_1_w(int x, int y) case Xblank: case Xacid_splash_e: case Xacid_splash_w: - Cave[y][x] = Yandroid_wB; - Cave[y][x-1] = Yandroid_w; + Cave[y][x] = Yemerald_sB; + Cave[y+1][x] = Yemerald_s; Next[y][x] = Xblank; - Next[y][x-1] = Xandroid; - play_element_sound(x, y, SOUND_android_move, Xandroid_1_w); + Next[y+1][x] = Xemerald_fall; return; default: - Landroid(x, y); + Cave[y][x] = Xemerald; + Next[y][x] = Xemerald; return; } } -static void Landroid_2_w(int x, int y) +static void Lemerald_fall(int x, int y) { - switch (Cave[y][x-1]) + switch (Cave[y+1][x]) { case Xacid_1: case Xacid_2: @@ -2487,11 +2185,11 @@ static void Landroid_2_w(int x, int y) 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; + Cave[y][x] = Yemerald_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; @@ -2499,20 +2197,38 @@ static void Landroid_2_w(int x, int y) case Xblank: case Xacid_splash_e: case Xacid_splash_w: - Cave[y][x] = Yandroid_wB; - Cave[y][x-1] = Yandroid_w; + case Zplayer: + Cave[y][x] = Yemerald_sB; + Cave[y+1][x] = Yemerald_s; Next[y][x] = Xblank; - Next[y][x-1] = Xandroid_1_w; - play_element_sound(x, y, SOUND_android_move, Xandroid_1_w); + Next[y+1][x] = Xemerald_fall; return; + case Xwonderwall: + if (lev.wonderwall_time) + { + lev.wonderwall_state = 1; + Cave[y][x] = Yemerald_sB; + if (tab_blank[Cave[y+2][x]]) + { + Cave[y+2][x] = Ydiamond_s; + Next[y+2][x] = Xdiamond_fall; + } + + Next[y][x] = Xblank; + play_element_sound(x, y, SOUND_wonderfall, Xwonderwall); + return; + } + default: - Landroid(x, y); + Cave[y][x] = Xemerald; + Next[y][x] = Xemerald; + play_element_sound(x, y, SOUND_diamond, Xemerald); return; } } -static void Lspring(int x, int y) +static void Ldiamond(int x, int y) { switch (Cave[y+1][x]) { @@ -2524,7 +2240,7 @@ static void Lspring(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Yspring_sB; + Cave[y][x] = Ydiamond_sB; if (Cave[y][x+1] == Xblank) Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) @@ -2536,12 +2252,10 @@ static void Lspring(int x, int y) 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; + Cave[y][x] = Ydiamond_sB; + Cave[y+1][x] = Ydiamond_s; Next[y][x] = Xblank; - Next[y+1][x] = Xspring_fall; + Next[y+1][x] = Xdiamond_fall; return; case Xspring: @@ -2574,6 +2288,7 @@ static void Lspring(int x, int y) case Xnut_pause: case Xslidewall_ns: case Xslidewall_ew: + case Xwonderwall: case Xkey_1: case Xkey_2: case Xkey_3: @@ -2584,41 +2299,35 @@ static void Lspring(int x, int y) case Xkey_8: case Xbumper: case Xswitch: + case Xsteel_1: + case Xsteel_2: + case Xsteel_3: + case Xsteel_4: + case Xwall_1: + case Xwall_2: + case Xwall_3: + case Xwall_4: 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 + if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]]) + { + Cave[y][x] = Ydiamond_eB; + Cave[y][x+1] = Ydiamond_e; + Next[y][x] = Xblank; + Next[y][x+1] = Xdiamond_pause; 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; + Cave[y][x] = Ydiamond_wB; + Cave[y][x-1] = Ydiamond_w; Next[y][x] = Xblank; - -#ifdef SPRING_ROLL - Next[y][x-1] = Xspring_w; -#else - Next[y][x-1] = Xspring_pause; -#endif + Next[y][x-1] = Xdiamond_pause; return; } } @@ -2626,40 +2335,35 @@ static void Lspring(int x, int y) { 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; + Cave[y][x] = Ydiamond_wB; + Cave[y][x-1] = Ydiamond_w; Next[y][x] = Xblank; - -#ifdef SPRING_ROLL - Next[y][x-1] = Xspring_w; -#else - Next[y][x-1] = Xspring_pause; -#endif + Next[y][x-1] = Xdiamond_pause; 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; + Cave[y][x] = Ydiamond_eB; + Cave[y][x+1] = Ydiamond_e; Next[y][x] = Xblank; - -#ifdef SPRING_ROLL - Next[y][x+1] = Xspring_e; -#else - Next[y][x+1] = Xspring_pause; -#endif + Next[y][x+1] = Xdiamond_pause; return; } } + + default: + if (++lev.shine_cnt > 50) + { + lev.shine_cnt = RANDOM & 7; + Cave[y][x] = Xdiamond_shine; + } + + return; } } -static void Lspring_pause(int x, int y) +static void Ldiamond_pause(int x, int y) { switch (Cave[y+1][x]) { @@ -2671,7 +2375,7 @@ static void Lspring_pause(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Yspring_sB; + Cave[y][x] = Ydiamond_sB; if (Cave[y][x+1] == Xblank) Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) @@ -2683,20 +2387,20 @@ static void Lspring_pause(int x, int y) case Xblank: case Xacid_splash_e: case Xacid_splash_w: - Cave[y][x] = Yspring_sB; - Cave[y+1][x] = Yspring_s; + Cave[y][x] = Ydiamond_sB; + Cave[y+1][x] = Ydiamond_s; Next[y][x] = Xblank; - Next[y+1][x] = Xspring_fall; + Next[y+1][x] = Xdiamond_fall; return; default: - Cave[y][x] = Xspring; - Next[y][x] = Xspring; + Cave[y][x] = Xdiamond; + Next[y][x] = Xdiamond; return; } } -static void Lspring_e(int x, int y) +static void Ldiamond_fall(int x, int y) { switch (Cave[y+1][x]) { @@ -2708,7 +2412,7 @@ static void Lspring_e(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Yspring_sB; + Cave[y][x] = Ydiamond_sB; if (Cave[y][x+1] == Xblank) Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) @@ -2720,78 +2424,38 @@ static void Lspring_e(int x, int y) 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; + case Zplayer: + Cave[y][x] = Ydiamond_sB; + Cave[y+1][x] = Ydiamond_s; Next[y][x] = Xblank; - Next[y][x+1] = Xspring_e; + Next[y+1][x] = Xdiamond_fall; 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 Xwonderwall: + if (lev.wonderwall_time) + { + lev.wonderwall_state = 1; + Cave[y][x] = Ydiamond_sB; + if (tab_blank[Cave[y+2][x]]) + { + Cave[y+2][x] = Ystone_s; + Next[y+2][x] = Xstone_fall; + } - case Xbumper: - case XbumperB: - Cave[y][x+1] = XbumperB; - Next[y][x] = Xspring_w; - play_element_sound(x, y, SOUND_spring, Xspring); - return; + Next[y][x] = Xblank; + play_element_sound(x, y, SOUND_wonderfall, Xwonderwall); + return; + } default: - Cave[y][x] = Xspring; - Next[y][x] = Xspring; - play_element_sound(x, y, SOUND_spring, Xspring); + Cave[y][x] = Xdiamond; + Next[y][x] = Xdiamond; + play_element_sound(x, y, SOUND_diamond, Xdiamond); return; } } -static void Lspring_w(int x, int y) +static void Lstone(int x, int y) { switch (Cave[y+1][x]) { @@ -2803,7 +2467,7 @@ static void Lspring_w(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Yspring_sB; + Cave[y][x] = Ystone_sB; if (Cave[y][x+1] == Xblank) Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) @@ -2815,17 +2479,123 @@ static void Lspring_w(int x, int y) case Xblank: case Xacid_splash_e: case Xacid_splash_w: - Cave[y][x] = Yspring_sB; - Cave[y+1][x] = Yspring_s; + case Xplant: + case Yplant: +#if 1 + 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: +#endif + Cave[y][x] = Ystone_sB; + Cave[y+1][x] = Ystone_s; Next[y][x] = Xblank; - Next[y+1][x] = Xspring_fall; + Next[y+1][x] = Xstone_fall; return; - case Xbumper: - Cave[y+1][x] = XbumperB; + case Xsand: + Cave[y][x] = Xsand_stonein_1; + Cave[y+1][x] = Xsand_sandstone_1; + Next[y][x] = Xsand_stonein_2; + Next[y+1][x] = 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: + 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 Xlenses: + case Xmagnify: + 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] = Ystone_eB; + Cave[y][x+1] = Ystone_e; + Next[y][x] = Xblank; + Next[y][x+1] = Xstone_pause; + return; + } + + if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]]) + { + Cave[y][x] = Ystone_wB; + Cave[y][x-1] = Ystone_w; + Next[y][x] = Xblank; + Next[y][x-1] = Xstone_pause; + return; + } + } + else + { + if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]]) + { + Cave[y][x] = Ystone_wB; + Cave[y][x-1] = Ystone_w; + Next[y][x] = Xblank; + Next[y][x-1] = Xstone_pause; + return; + } + + if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]]) + { + Cave[y][x] = Ystone_eB; + Cave[y][x+1] = Ystone_e; + Next[y][x] = Xblank; + Next[y][x+1] = Xstone_pause; + return; + } + } } +} - switch (Cave[y][x-1]) +static void Lstone_pause(int x, int y) +{ + switch (Cave[y+1][x]) { case Xacid_1: case Xacid_2: @@ -2835,11 +2605,11 @@ static void Lspring_w(int x, int y) 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; + Cave[y][x] = Ystone_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; @@ -2847,46 +2617,30 @@ static void Lspring_w(int x, int y) 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; +#if 1 + 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: +#endif + Cave[y][x] = Ystone_sB; + Cave[y+1][x] = Ystone_s; 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); + Next[y+1][x] = Xstone_fall; return; default: - Cave[y][x] = Xspring; - Next[y][x] = Xspring; - play_element_sound(x, y, SOUND_spring, Xspring); + Cave[y][x] = Xstone; + Next[y][x] = Xstone; return; } } -static void Lspring_fall(int x, int y) +static void Lstone_fall(int x, int y) { switch (Cave[y+1][x]) { @@ -2898,7 +2652,7 @@ static void Lspring_fall(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Yspring_sB; + Cave[y][x] = Ystone_sB; if (Cave[y][x+1] == Xblank) Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) @@ -2911,28 +2665,29 @@ static void Lspring_fall(int x, int y) case Xacid_splash_e: case Xacid_splash_w: case Zplayer: - Cave[y][x] = Yspring_sB; - Cave[y+1][x] = Yspring_s; +#if 1 + 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: +#endif + Cave[y][x] = Ystone_sB; + Cave[y+1][x] = Ystone_s; Next[y][x] = Xblank; - Next[y+1][x] = Xspring_fall; + Next[y+1][x] = Xstone_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 + case Xnut: + case Xnut_pause: + Cave[y+1][x] = Ynut_stone; + Next[y][x] = Xstone; + Next[y+1][x] = Xemerald; + play_element_sound(x, y, SOUND_crack, Xnut); + score += lev.nut_score; return; case Xbug_1_n: @@ -2943,8 +2698,8 @@ static void Lspring_fall(int x, int y) case Xbug_2_e: case Xbug_2_s: case Xbug_2_w: - Cave[y][x] = Yspring_sB; - Cave[y+1][x] = Ybug_spring; + Cave[y][x] = Ystone_sB; + Cave[y+1][x] = Ybug_stone; Next[y+1][x] = Znormal; Boom[y][x-1] = Xemerald; Boom[y][x] = Xemerald; @@ -2956,7 +2711,7 @@ static void Lspring_fall(int x, int y) Boom[y+2][x] = Xemerald; Boom[y+2][x+1] = Xemerald; #if PLAY_ELEMENT_SOUND - play_element_sound(x, y, SOUND_boom, Xspring_fall); + play_element_sound(x, y, SOUND_boom, Xstone_fall); #endif score += lev.bug_score; return; @@ -2969,8 +2724,8 @@ static void Lspring_fall(int x, int y) case Xtank_2_e: case Xtank_2_s: case Xtank_2_w: - Cave[y][x] = Yspring_sB; - Cave[y+1][x] = Ytank_spring; + Cave[y][x] = Ystone_sB; + Cave[y+1][x] = Ytank_stone; Next[y+1][x] = Znormal; Boom[y][x-1] = Xblank; Boom[y][x] = Xblank; @@ -2982,38 +2737,157 @@ static void Lspring_fall(int x, int y) Boom[y+2][x] = Xblank; Boom[y+2][x+1] = Xblank; #if PLAY_ELEMENT_SOUND - play_element_sound(x, y, SOUND_boom, Xspring_fall); + play_element_sound(x, y, SOUND_boom, Xstone_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; + case Xspring: + if (RANDOM & 1) + { + switch (Cave[y+1][x+1]) + { + case Xblank: + case Xacid_splash_e: + case Xacid_splash_w: + case Xalien: + case Xalien_pause: + Cave[y+1][x] = Xspring_e; + break; + + default: + Cave[y+1][x] = Xspring_w; + break; + } + } + else + { + switch (Cave[y+1][x-1]) + { + case Xblank: + case Xacid_splash_e: + case Xacid_splash_w: + case Xalien: + case Xalien_pause: + Cave[y+1][x] = Xspring_w; + break; + default: + Cave[y+1][x] = Xspring_e; + break; + } + } + + Next[y][x] = Xstone; + return; + + case Xeater_n: + case Xeater_e: + case Xeater_s: + case Xeater_w: + Cave[y][x] = Ystone_sB; + Cave[y+1][x] = Yeater_stone; + 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, Xstone_fall); +#endif + lev.eater_pos = (lev.eater_pos + 1) & 7; + score += lev.eater_score; + return; + + case Xalien: + case Xalien_pause: + Cave[y][x] = Ystone_sB; + Cave[y+1][x] = Yalien_stone; + 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 + score += lev.alien_score; + return; + + case Xdiamond: + case Xdiamond_pause: + switch (Cave[y+2][x]) + { + case Xblank: + case Xacid_splash_e: + case Xacid_splash_w: + case Zplayer: + 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: + 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: + 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 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: + Next[y][x] = Xstone; + play_element_sound(x, y, SOUND_stone, Xstone); + return; + } + + 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 Xalien: - case Xalien_pause: - Cave[y][x] = Yspring_sB; - Cave[y+1][x] = Yalien_spring; + 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; @@ -3025,54 +2899,38 @@ static void Lspring_fall(int x, int y) Boom[y+2][x] = Xblank; Boom[y+2][x+1] = Xblank; #if PLAY_ELEMENT_SOUND - play_element_sound(x, y, SOUND_boom, Xspring_fall); + play_element_sound(x, y, SOUND_boom, Xstone_fall); #endif - score += lev.alien_score; 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] = Xspring; - Next[y][x] = Xspring; - play_element_sound(x, y, SOUND_spring, Xspring); + Cave[y][x] = Xstone; + Next[y][x] = Xstone; + play_element_sound(x, y, SOUND_stone, Xstone); return; } } -static void Leater_n(int x, int y) +static void Lbomb(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]) + switch (Cave[y+1][x]) { case Xacid_1: case Xacid_2: @@ -3082,11 +2940,11 @@ static void Leater_n(int x, int y) 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; + Cave[y][x] = Ybomb_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; @@ -3094,57 +2952,102 @@ static void Leater_n(int x, int y) 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; + Cave[y][x] = Ybomb_sB; + Cave[y+1][x] = Ybomb_s; 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); + Next[y+1][x] = Xbomb_fall; 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; - } + 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] = Ybomb_eB; + Cave[y][x+1] = Ybomb_e; + Next[y][x] = Xblank; + Next[y][x+1] = Xbomb_pause; + 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 (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]]) + { + Cave[y][x] = Ybomb_wB; + Cave[y][x-1] = Ybomb_w; + Next[y][x] = Xblank; + Next[y][x-1] = Xbomb_pause; + return; + } + } + else + { + if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]]) + { + Cave[y][x] = Ybomb_wB; + Cave[y][x-1] = Ybomb_w; + Next[y][x] = Xblank; + Next[y][x-1] = Xbomb_pause; + 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 (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]]) + { + Cave[y][x] = Ybomb_eB; + Cave[y][x+1] = Ybomb_e; + Next[y][x] = Xblank; + Next[y][x+1] = Xbomb_pause; + return; + } + } } +} - switch (Cave[y][x+1]) +static void Lbomb_pause(int x, int y) +{ + switch (Cave[y+1][x]) { case Xacid_1: case Xacid_2: @@ -3152,13 +3055,13 @@ static void Leater_e(int x, int y) case Xacid_4: case Xacid_5: case Xacid_6: - case Xacid_7: - case Xacid_8: - Cave[y][x] = Yeater_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; + case Xacid_7: + case Xacid_8: + Cave[y][x] = Ybomb_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; @@ -3166,56 +3069,21 @@ static void Leater_e(int x, int y) case Xblank: case Xacid_splash_e: case Xacid_splash_w: - case Xplant: - case Yplant: - case Zplayer: - Cave[y][x] = Yeater_eB; - Cave[y][x+1] = Yeater_e; + Cave[y][x] = Ybomb_sB; + Cave[y+1][x] = Ybomb_s; Next[y][x] = Xblank; - Next[y][x+1] = Xeater_e; + Next[y+1][x] = Xbomb_fall; return; default: - Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s; - play_element_sound(x, y, SOUND_eater, Xeater_e); + Cave[y][x] = Xbomb; + Next[y][x] = Xbomb; return; } } -static void Leater_s(int x, int y) +static void Lbomb_fall(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_s); - 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_s); - 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_s); - 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_s); - return; - } - switch (Cave[y+1][x]) { case Xacid_1: @@ -3226,7 +3094,7 @@ static void Leater_s(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Yeater_sB; + Cave[y][x] = Ybomb_sB; if (Cave[y][x+1] == Xblank) Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) @@ -3238,57 +3106,34 @@ static void Leater_s(int x, int y) case Xblank: case Xacid_splash_e: case Xacid_splash_w: - case Xplant: - case Yplant: - case Zplayer: - Cave[y][x] = Yeater_sB; - Cave[y+1][x] = Yeater_s; + Cave[y][x] = Ybomb_sB; + Cave[y+1][x] = Ybomb_s; Next[y][x] = Xblank; - Next[y+1][x] = Xeater_s; + Next[y+1][x] = Xbomb_fall; return; default: - Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w; - play_element_sound(x, y, SOUND_eater, Xeater_s); + Cave[y][x] = Ybomb_blank; + 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, Xbomb_fall); +#endif return; } } -static void Leater_w(int x, int y) +static void Lnut(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_w); - 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_w); - 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_w); - 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_w); - return; - } - - switch (Cave[y][x-1]) + switch (Cave[y+1][x]) { case Xacid_1: case Xacid_2: @@ -3298,11 +3143,11 @@ static void Leater_w(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Yeater_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; + 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; @@ -3310,190 +3155,137 @@ static void Leater_w(int x, int y) case Xblank: case Xacid_splash_e: case Xacid_splash_w: - case Xplant: - case Yplant: - case Zplayer: - Cave[y][x] = Yeater_wB; - Cave[y][x-1] = Yeater_w; + Cave[y][x] = Ynut_sB; + Cave[y+1][x] = Ynut_s; Next[y][x] = Xblank; - Next[y][x-1] = Xeater_w; - return; - - default: - Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s; - play_element_sound(x, y, SOUND_eater, Xeater_w); + Next[y+1][x] = Xnut_fall; return; - } -} - -static void Lalien(int x, int y) -{ - int dx, dy; - - if (lev.wheel_cnt) - { - dx = lev.wheel_x; - dy = lev.wheel_y; - } - else - { - set_nearest_player_xy(x, y, &dx, &dy); - } - - if (RANDOM & 1) - { - if (y > dy) - { - 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] = Yalien_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] = Yalien_nB; - Cave[y-1][x] = Yalien_n; - Next[y][x] = Xblank; - Next[y-1][x] = Xalien_pause; - play_element_sound(x, y, SOUND_alien, Xalien); - return; - } - } - else if (y < dy) - { - 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] = Yalien_sB; - Next[y][x] = Xblank; - 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; - 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] = Yalien_sB; - Cave[y+1][x] = Yalien_s; - Next[y][x] = Xblank; - Next[y+1][x] = Xalien_pause; - play_element_sound(x, y, SOUND_alien, Xalien); - return; - } - } - } - else - { - if (x < dx) - { - switch (Cave[y][x+1]) + 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) { - 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] = Yalien_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; + 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; - play_element_sound(x, y, SOUND_acid, Xacid_1); + Next[y][x+1] = Xnut_pause; return; + } - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Xplant: - case Yplant: - case Zplayer: - Cave[y][x] = Yalien_eB; - Cave[y][x+1] = Yalien_e; + 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] = Xalien_pause; - play_element_sound(x, y, SOUND_alien, Xalien); + Next[y][x-1] = Xnut_pause; return; + } } - } - else if (x > dx) - { - switch (Cave[y][x-1]) + else { - 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] = Yalien_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; + 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; - play_element_sound(x, y, SOUND_acid, Xacid_1); + Next[y][x-1] = Xnut_pause; return; + } - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Xplant: - case Yplant: - case Zplayer: - Cave[y][x] = Yalien_wB; - Cave[y][x-1] = Yalien_w; + 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] = Xalien_pause; - play_element_sound(x, y, SOUND_alien, Xalien); + Next[y][x+1] = Xnut_pause; return; + } } - } } } -static void Lalien_pause(int x, int y) +static void Lnut_pause(int x, int y) { - Next[y][x] = Xalien; + 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 Lemerald(int x, int y) +static void Lnut_fall(int x, int y) { switch (Cave[y+1][x]) { @@ -3505,7 +3297,7 @@ static void Lemerald(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Yemerald_sB; + Cave[y][x] = Ynut_sB; if (Cave[y][x+1] == Xblank) Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) @@ -3517,10 +3309,51 @@ static void Lemerald(int x, int y) case Xblank: case Xacid_splash_e: case Xacid_splash_w: - Cave[y][x] = Yemerald_sB; - Cave[y+1][x] = Yemerald_s; + case Zplayer: + Cave[y][x] = Ynut_sB; + Cave[y+1][x] = Ynut_s; Next[y][x] = Xblank; - Next[y+1][x] = Xemerald_fall; + 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 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: @@ -3553,7 +3386,6 @@ static void Lemerald(int x, int y) case Xnut_pause: case Xslidewall_ns: case Xslidewall_ew: - case Xwonderwall: case Xkey_1: case Xkey_2: case Xkey_3: @@ -3564,14 +3396,6 @@ static void Lemerald(int x, int y) case Xkey_8: case Xbumper: case Xswitch: - case Xsteel_1: - case Xsteel_2: - case Xsteel_3: - case Xsteel_4: - case Xwall_1: - case Xwall_2: - case Xwall_3: - case Xwall_4: case Xroundwall_1: case Xroundwall_2: case Xroundwall_3: @@ -3580,19 +3404,33 @@ static void Lemerald(int x, int y) { if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]]) { - Cave[y][x] = Yemerald_eB; - Cave[y][x+1] = Yemerald_e; + 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; - Next[y][x+1] = Xemerald_pause; + +#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] = Yemerald_wB; - Cave[y][x-1] = Yemerald_w; + 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; - Next[y][x-1] = Xemerald_pause; + +#ifdef SPRING_ROLL + Next[y][x-1] = Xspring_w; +#else + Next[y][x-1] = Xspring_pause; +#endif return; } } @@ -3600,35 +3438,40 @@ static void Lemerald(int x, int y) { if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]]) { - Cave[y][x] = Yemerald_wB; - Cave[y][x-1] = Yemerald_w; + 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; - Next[y][x-1] = Xemerald_pause; + +#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] = Yemerald_eB; - Cave[y][x+1] = Yemerald_e; + 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; - Next[y][x+1] = Xemerald_pause; - return; - } - } - default: - if (++lev.shine_cnt > 50) - { - lev.shine_cnt = RANDOM & 7; - Cave[y][x] = Xemerald_shine; +#ifdef SPRING_ROLL + Next[y][x+1] = Xspring_e; +#else + Next[y][x+1] = Xspring_pause; +#endif + return; + } } - - return; } } -static void Lemerald_pause(int x, int y) +static void Lspring_pause(int x, int y) { switch (Cave[y+1][x]) { @@ -3640,7 +3483,7 @@ static void Lemerald_pause(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Yemerald_sB; + Cave[y][x] = Yspring_sB; if (Cave[y][x+1] == Xblank) Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) @@ -3652,20 +3495,20 @@ static void Lemerald_pause(int x, int y) case Xblank: case Xacid_splash_e: case Xacid_splash_w: - Cave[y][x] = Yemerald_sB; - Cave[y+1][x] = Yemerald_s; + Cave[y][x] = Yspring_sB; + Cave[y+1][x] = Yspring_s; Next[y][x] = Xblank; - Next[y+1][x] = Xemerald_fall; + Next[y+1][x] = Xspring_fall; return; default: - Cave[y][x] = Xemerald; - Next[y][x] = Xemerald; + Cave[y][x] = Xspring; + Next[y][x] = Xspring; return; } } -static void Lemerald_fall(int x, int y) +static void Lspring_e(int x, int y) { switch (Cave[y+1][x]) { @@ -3677,7 +3520,7 @@ static void Lemerald_fall(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Yemerald_sB; + Cave[y][x] = Yspring_sB; if (Cave[y][x+1] == Xblank) Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) @@ -3689,38 +3532,78 @@ static void Lemerald_fall(int x, int y) case Xblank: case Xacid_splash_e: case Xacid_splash_w: - case Zplayer: - Cave[y][x] = Yemerald_sB; - Cave[y+1][x] = Yemerald_s; + Cave[y][x] = Yspring_sB; + Cave[y+1][x] = Yspring_s; Next[y][x] = Xblank; - Next[y+1][x] = Xemerald_fall; + Next[y+1][x] = Xspring_fall; return; - case Xwonderwall: - if (lev.wonderwall_time) - { - lev.wonderwall_state = 1; - Cave[y][x] = Yemerald_sB; - if (tab_blank[Cave[y+2][x]]) - { - Cave[y+2][x] = Ydiamond_s; - Next[y+2][x] = Xdiamond_fall; - } + case Xbumper: + Cave[y+1][x] = XbumperB; + } - Next[y][x] = Xblank; - play_element_sound(x, y, SOUND_wonderfall, Xwonderwall); - return; - } + 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] = Xemerald; - Next[y][x] = Xemerald; - play_element_sound(x, y, SOUND_diamond, Xemerald); + Cave[y][x] = Xspring; + Next[y][x] = Xspring; + play_element_sound(x, y, SOUND_spring, Xspring); return; } } -static void Ldiamond(int x, int y) +static void Lspring_w(int x, int y) { switch (Cave[y+1][x]) { @@ -3732,7 +3615,7 @@ static void Ldiamond(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Ydiamond_sB; + Cave[y][x] = Yspring_sB; if (Cave[y][x+1] == Xblank) Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) @@ -3744,118 +3627,78 @@ static void Ldiamond(int x, int y) case Xblank: case Xacid_splash_e: case Xacid_splash_w: - Cave[y][x] = Ydiamond_sB; - Cave[y+1][x] = Ydiamond_s; + Cave[y][x] = Yspring_sB; + Cave[y+1][x] = Yspring_s; Next[y][x] = Xblank; - Next[y+1][x] = Xdiamond_fall; + 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 Xwonderwall: - 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 Xsteel_1: - case Xsteel_2: - case Xsteel_3: - case Xsteel_4: - case Xwall_1: - case Xwall_2: - case Xwall_3: - case Xwall_4: - 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] = Ydiamond_eB; - Cave[y][x+1] = Ydiamond_e; - Next[y][x] = Xblank; - Next[y][x+1] = Xdiamond_pause; - return; - } + Cave[y+1][x] = XbumperB; + } - if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]]) - { - Cave[y][x] = Ydiamond_wB; - Cave[y][x-1] = Ydiamond_w; - Next[y][x] = Xblank; - Next[y][x-1] = Xdiamond_pause; - return; - } - } - else - { - if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]]) - { - Cave[y][x] = Ydiamond_wB; - Cave[y][x-1] = Ydiamond_w; - Next[y][x] = Xblank; - Next[y][x-1] = Xdiamond_pause; - return; - } + 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; - if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]]) - { - Cave[y][x] = Ydiamond_eB; - Cave[y][x+1] = Ydiamond_e; - Next[y][x] = Xblank; - Next[y][x+1] = Xdiamond_pause; - 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: - if (++lev.shine_cnt > 50) - { - lev.shine_cnt = RANDOM & 7; - Cave[y][x] = Xdiamond_shine; - } - + Cave[y][x] = Xspring; + Next[y][x] = Xspring; + play_element_sound(x, y, SOUND_spring, Xspring); return; } } -static void Ldiamond_pause(int x, int y) +static void Lspring_fall(int x, int y) { switch (Cave[y+1][x]) { @@ -3867,7 +3710,7 @@ static void Ldiamond_pause(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Ydiamond_sB; + Cave[y][x] = Yspring_sB; if (Cave[y][x+1] == Xblank) Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) @@ -3879,368 +3722,430 @@ static void Ldiamond_pause(int x, int y) case Xblank: case Xacid_splash_e: case Xacid_splash_w: - Cave[y][x] = Ydiamond_sB; - Cave[y+1][x] = Ydiamond_s; + case Zplayer: + Cave[y][x] = Yspring_sB; + Cave[y+1][x] = Yspring_s; Next[y][x] = Xblank; - Next[y+1][x] = Xdiamond_fall; + 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] = Xdiamond; - Next[y][x] = Xdiamond; + Cave[y][x] = Xspring; + Next[y][x] = Xspring; + play_element_sound(x, y, SOUND_spring, Xspring); return; } } -static void Ldiamond_fall(int x, int y) +static void Lpush_emerald_e(int x, int y) { - switch (Cave[y+1][x]) + 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] = Ydiamond_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; + case Zborder: + case Znormal: + case Zdynamite: + case Xboom_bug: + case Xboom_bomb: + case Xboom_android: + case Xboom_1: + case Zplayer: + Cave[y][x] = Xemerald; + Next[y][x] = Xemerald; + return; + + default: + Cave[y][x] = Yemerald_eB; + Cave[y][x+1] = Yemerald_e; Next[y][x] = Xblank; - play_element_sound(x, y, SOUND_acid, Xacid_1); + Next[y][x+1] = Xemerald_pause; return; + } +} - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: +static void Lpush_emerald_w(int x, int y) +{ + switch (Cave[y][x-1]) + { + case Zborder: + case Znormal: + case Zdynamite: + case Xboom_bug: + case Xboom_bomb: + case Xboom_android: + case Xboom_1: case Zplayer: - Cave[y][x] = Ydiamond_sB; - Cave[y+1][x] = Ydiamond_s; - Next[y][x] = Xblank; - Next[y+1][x] = Xdiamond_fall; + Cave[y][x] = Xemerald; + Next[y][x] = Xemerald; return; - case Xwonderwall: - if (lev.wonderwall_time) - { - lev.wonderwall_state = 1; - Cave[y][x] = Ydiamond_sB; - if (tab_blank[Cave[y+2][x]]) - { - Cave[y+2][x] = Ystone_s; - Next[y+2][x] = Xstone_fall; - } + default: + Cave[y][x] = Yemerald_wB; + Cave[y][x-1] = Yemerald_w; + Next[y][x] = Xblank; + Next[y][x-1] = Xemerald_pause; + return; + } +} - Next[y][x] = Xblank; - play_element_sound(x, y, SOUND_wonderfall, Xwonderwall); - return; - } +static void Lpush_diamond_e(int x, int y) +{ + switch (Cave[y][x+1]) + { + case Zborder: + case Znormal: + case Zdynamite: + case Xboom_bug: + case Xboom_bomb: + case Xboom_android: + case Xboom_1: + case Zplayer: + Cave[y][x] = Xdiamond; + Next[y][x] = Xdiamond; + return; default: + Cave[y][x] = Ydiamond_eB; + Cave[y][x+1] = Ydiamond_e; + Next[y][x] = Xblank; + Next[y][x+1] = Xdiamond_pause; + return; + } +} + +static void Lpush_diamond_w(int x, int y) +{ + switch (Cave[y][x-1]) + { + case Zborder: + case Znormal: + case Zdynamite: + case Xboom_bug: + case Xboom_bomb: + case Xboom_android: + case Xboom_1: + case Zplayer: Cave[y][x] = Xdiamond; Next[y][x] = Xdiamond; - play_element_sound(x, y, SOUND_diamond, Xdiamond); + return; + + default: + Cave[y][x] = Ydiamond_wB; + Cave[y][x-1] = Ydiamond_w; + Next[y][x] = Xblank; + Next[y][x-1] = Xdiamond_pause; return; } } -static void Ldrip_fall(int x, int y) +static void Lpush_stone_e(int x, int y) { - int temp; - - switch (Cave[y+1][x]) + 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] = Ydrip_1_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] = Xdrip_stretchB; - 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 Zborder: + case Znormal: + case Zdynamite: + case Xboom_bug: + case Xboom_bomb: + case Xboom_android: + case Xboom_1: case Zplayer: - Cave[y][x] = Ydrip_1_sB; - Cave[y+1][x] = Ydrip_1_s; - Next[y][x] = Xdrip_stretchB; - Next[y+1][x] = Xdrip_stretch; + Cave[y][x] = Xstone; + Next[y][x] = Xstone; return; default: - switch (RANDOM & 7) - { - case 0: - temp = Xamoeba_1; - break; - - case 1: - temp = Xamoeba_2; - break; - - case 2: - temp = Xamoeba_3; - break; - - case 3: - temp = Xamoeba_4; - break; - - case 4: - temp = Xamoeba_5; - break; - - case 5: - temp = Xamoeba_6; - break; - - case 6: - temp = Xamoeba_7; - break; - - case 7: - temp = Xamoeba_8; - break; - } - - Cave[y][x] = temp; - Next[y][x] = temp; - play_element_sound(x, y, SOUND_drip, Xdrip_fall); + Cave[y][x] = Ystone_eB; + Cave[y][x+1] = Ystone_e; + Next[y][x] = Xblank; + Next[y][x+1] = Xstone_pause; return; } } -static void Ldrip_stretch(int x, int y) -{ - Cave[y][x] = Ydrip_2_s; - Next[y][x] = Xdrip_fall; -} - -static void Ldrip_stretchB(int x, int y) +static void Lpush_stone_w(int x, int y) { - Cave[y][x] = Ydrip_2_sB; - Next[y][x] = Xblank; -} + switch (Cave[y][x-1]) + { + case Zborder: + case Znormal: + case Zdynamite: + case Xboom_bug: + case Xboom_bomb: + case Xboom_android: + case Xboom_1: + case Zplayer: + Cave[y][x] = Xstone; + Next[y][x] = Xstone; + return; -static void Ldrip(int x, int y) -{ - Next[y][x] = Xdrip_fall; + default: + Cave[y][x] = Ystone_wB; + Cave[y][x-1] = Ystone_w; + Next[y][x] = Xblank; + Next[y][x-1] = Xstone_pause; + return; + } } -static void Lbomb(int x, int y) +static void Lpush_bomb_e(int x, int y) { - switch (Cave[y+1][x]) + 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] = Ybomb_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); + case Zborder: + case Znormal: + case Zdynamite: + case Xboom_bug: + case Xboom_bomb: + case Xboom_android: + case Xboom_1: + case Zplayer: + Cave[y][x] = Xbomb; + Next[y][x] = Xbomb; return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[y][x] = Ybomb_sB; - Cave[y+1][x] = Ybomb_s; + default: + Cave[y][x] = Ybomb_eB; + Cave[y][x+1] = Ybomb_e; Next[y][x] = Xblank; - Next[y+1][x] = Xbomb_fall; + Next[y][x+1] = Xbomb_pause; 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] = Ybomb_eB; - Cave[y][x+1] = Ybomb_e; - Next[y][x] = Xblank; - Next[y][x+1] = Xbomb_pause; - return; - } - - if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]]) - { - Cave[y][x] = Ybomb_wB; - Cave[y][x-1] = Ybomb_w; - Next[y][x] = Xblank; - Next[y][x-1] = Xbomb_pause; - return; - } - } - else - { - if (tab_blank[Cave[y][x-1]] && tab_acid[Cave[y+1][x-1]]) - { - Cave[y][x] = Ybomb_wB; - Cave[y][x-1] = Ybomb_w; - Next[y][x] = Xblank; - Next[y][x-1] = Xbomb_pause; - return; - } - - if (tab_blank[Cave[y][x+1]] && tab_acid[Cave[y+1][x+1]]) - { - Cave[y][x] = Ybomb_eB; - Cave[y][x+1] = Ybomb_e; - Next[y][x] = Xblank; - Next[y][x+1] = Xbomb_pause; - return; - } - } +static void Lpush_bomb_w(int x, int y) +{ + switch (Cave[y][x-1]) + { + case Zborder: + case Znormal: + case Zdynamite: + case Xboom_bug: + case Xboom_bomb: + case Xboom_android: + case Xboom_1: + case Zplayer: + Cave[y][x] = Xbomb; + Next[y][x] = Xbomb; + return; + + default: + Cave[y][x] = Ybomb_wB; + Cave[y][x-1] = Ybomb_w; + Next[y][x] = Xblank; + Next[y][x-1] = Xbomb_pause; + return; } } -static void Lbomb_pause(int x, int y) +static void Lpush_nut_e(int x, int y) { - switch (Cave[y+1][x]) + 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] = Ybomb_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); + case Zborder: + case Znormal: + case Zdynamite: + case Xboom_bug: + case Xboom_bomb: + case Xboom_android: + case Xboom_1: + case Zplayer: + Cave[y][x] = Xnut; + Next[y][x] = Xnut; return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[y][x] = Ybomb_sB; - Cave[y+1][x] = Ybomb_s; + default: + Cave[y][x] = Ynut_eB; + Cave[y][x+1] = Ynut_e; Next[y][x] = Xblank; - Next[y+1][x] = Xbomb_fall; + Next[y][x+1] = Xnut_pause; + return; + } +} + +static void Lpush_nut_w(int x, int y) +{ + switch (Cave[y][x-1]) + { + case Zborder: + case Znormal: + case Zdynamite: + case Xboom_bug: + case Xboom_bomb: + case Xboom_android: + case Xboom_1: + case Zplayer: + Cave[y][x] = Xnut; + Next[y][x] = Xnut; return; default: - Cave[y][x] = Xbomb; - Next[y][x] = Xbomb; + Cave[y][x] = Ynut_wB; + Cave[y][x-1] = Ynut_w; + Next[y][x] = Xblank; + Next[y][x-1] = Xnut_pause; return; } } -static void Lbomb_fall(int x, int y) +static void Lpush_spring_e(int x, int y) { - switch (Cave[y+1][x]) + 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] = Ybomb_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); + case Zborder: + case Znormal: + case Zdynamite: + case Xboom_bug: + case Xboom_bomb: + case Xboom_android: + case Xboom_1: + case Zplayer: + Cave[y][x] = Xspring; + Next[y][x] = Xspring; return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[y][x] = Ybomb_sB; - Cave[y+1][x] = Ybomb_s; + default: + Cave[y][x] = Yspring_eB; + Cave[y][x+1] = Yspring_e; Next[y][x] = Xblank; - Next[y+1][x] = Xbomb_fall; + Next[y][x+1] = Xspring_e; + return; + } +} + +static void Lpush_spring_w(int x, int y) +{ + switch (Cave[y][x-1]) + { + case Zborder: + case Znormal: + case Zdynamite: + case Xboom_bug: + case Xboom_bomb: + case Xboom_android: + case Xboom_1: + case Zplayer: + Cave[y][x] = Xspring; + Next[y][x] = Xspring; return; default: - Cave[y][x] = Ybomb_blank; - 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, Xbomb_fall); -#endif + Cave[y][x] = Yspring_wB; + Cave[y][x-1] = Yspring_w; + Next[y][x] = Xblank; + Next[y][x-1] = Xspring_w; return; } } @@ -4347,115 +4252,35 @@ static void Lballoon(int x, int y) case 3: /* west */ 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] = Yballoon_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] = Yballoon_wB; - Cave[y][x-1] = Yballoon_w; - Next[y][x] = Xblank; - Next[y][x-1] = Xballoon; - return; - } - break; - } -} - -static void Lacid_1(int x, int y) -{ - Next[y][x] = Xacid_2; -} - -static void Lacid_2(int x, int y) -{ - Next[y][x] = Xacid_3; -} - -static void Lacid_3(int x, int y) -{ - Next[y][x] = Xacid_4; -} - -static void Lacid_4(int x, int y) -{ - Next[y][x] = Xacid_5; -} - -static void Lacid_5(int x, int y) -{ - Next[y][x] = Xacid_6; -} - -static void Lacid_6(int x, int y) -{ - Next[y][x] = Xacid_7; -} - -static void Lacid_7(int x, int y) -{ - Next[y][x] = Xacid_8; -} - -static void Lacid_8(int x, int y) -{ - Next[y][x] = Xacid_1; -} - -static void Lfake_acid_1(int x, int y) -{ - Next[y][x] = Xfake_acid_2; -} - -static void Lfake_acid_2(int x, int y) -{ - Next[y][x] = Xfake_acid_3; -} - -static void Lfake_acid_3(int x, int y) -{ - Next[y][x] = Xfake_acid_4; -} - -static void Lfake_acid_4(int x, int y) -{ - Next[y][x] = Xfake_acid_5; -} - -static void Lfake_acid_5(int x, int y) -{ - Next[y][x] = Xfake_acid_6; -} - -static void Lfake_acid_6(int x, int y) -{ - Next[y][x] = Xfake_acid_7; -} - -static void Lfake_acid_7(int x, int y) -{ - Next[y][x] = Xfake_acid_8; -} + { + 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] = Yballoon_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; -static void Lfake_acid_8(int x, int y) -{ - Next[y][x] = Xfake_acid_1; + case Xblank: + case Xacid_splash_e: + case Xacid_splash_w: + Cave[y][x] = Yballoon_wB; + Cave[y][x-1] = Yballoon_w; + Next[y][x] = Xblank; + Next[y][x-1] = Xballoon; + return; + } + break; + } } static void Lball_common(int x, int y) @@ -4569,62 +4394,287 @@ static void Lball_common(int x, int y) Next[y][x-1] = lev.ball_array[lev.ball_pos][3]; } - if (lev.ball_array[lev.ball_pos][4] != Xblank && - tab_blank[Cave[y][x+1]]) - { - Cave[y][x+1] = Yball_blank; - Next[y][x+1] = lev.ball_array[lev.ball_pos][4]; - } + if (lev.ball_array[lev.ball_pos][4] != Xblank && + tab_blank[Cave[y][x+1]]) + { + Cave[y][x+1] = Yball_blank; + Next[y][x+1] = lev.ball_array[lev.ball_pos][4]; + } + + if (lev.ball_array[lev.ball_pos][5] != Xblank && + tab_blank[Cave[y+1][x-1]]) + { + Cave[y+1][x-1] = Yball_blank; + Next[y+1][x-1] = lev.ball_array[lev.ball_pos][5]; + } + + if (lev.ball_array[lev.ball_pos][6] != Xblank && + tab_blank[Cave[y+1][x]]) + { + Cave[y+1][x] = Yball_blank; + Next[y+1][x] = lev.ball_array[lev.ball_pos][6]; + } + + if (lev.ball_array[lev.ball_pos][7] != Xblank && + tab_blank[Cave[y+1][x+1]]) + { + Cave[y+1][x+1] = Yball_blank; + Next[y+1][x+1] = lev.ball_array[lev.ball_pos][7]; + } + } + + lev.ball_pos = (lev.ball_pos + 1) % lev.num_ball_arrays; +} + +static void Lball_1(int x, int y) +{ + if (lev.ball_state == 0) + return; + + Cave[y][x] = Yball_1; + Next[y][x] = Xball_2; + if (lev.ball_cnt) + return; + + Lball_common(x, y); +} + +static void Lball_2(int x, int y) +{ + if (lev.ball_state == 0) + return; + + Cave[y][x] = Yball_2; + Next[y][x] = Xball_1; + if (lev.ball_cnt) + return; + + Lball_common(x, y); +} + +static void Ldrip(int x, int y) +{ + Next[y][x] = Xdrip_fall; +} + +static void Ldrip_fall(int x, int y) +{ + int temp; + + 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] = Ydrip_1_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] = Xdrip_stretchB; + 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] = Ydrip_1_sB; + Cave[y+1][x] = Ydrip_1_s; + Next[y][x] = Xdrip_stretchB; + Next[y+1][x] = Xdrip_stretch; + return; + + default: + switch (RANDOM & 7) + { + case 0: + temp = Xamoeba_1; + break; + + case 1: + temp = Xamoeba_2; + break; + + case 2: + temp = Xamoeba_3; + break; + + case 3: + temp = Xamoeba_4; + break; + + case 4: + temp = Xamoeba_5; + break; + + case 5: + temp = Xamoeba_6; + break; + + case 6: + temp = Xamoeba_7; + break; + + case 7: + temp = Xamoeba_8; + break; + } + + Cave[y][x] = temp; + Next[y][x] = temp; + play_element_sound(x, y, SOUND_drip, Xdrip_fall); + return; + } +} + +static void Ldrip_stretch(int x, int y) +{ + Cave[y][x] = Ydrip_2_s; + Next[y][x] = Xdrip_fall; +} + +static void Ldrip_stretchB(int x, int y) +{ + Cave[y][x] = Ydrip_2_sB; + Next[y][x] = Xblank; +} + +static void Lwonderwall(int x, int y) +{ + if (lev.wonderwall_time && lev.wonderwall_state) + { + Cave[y][x] = XwonderwallB; + play_element_sound(x, y, SOUND_wonder, Xwonderwall); + } +} + +static void Lsand_stone(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] = Xsand_stonesand_quickout_1; + 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] = Xsand_stonesand_quickout_2; + play_element_sound(x, y, SOUND_acid, Xacid_1); + return; + + case Xblank: + case Xacid_splash_e: + case Xacid_splash_w: + Cave[y][x] = Xsand_stonesand_quickout_1; + Cave[y+1][x] = Xsand_stoneout_1; + Next[y][x] = Xsand_stonesand_quickout_2; + Next[y+1][x] = Xsand_stoneout_2; + return; + + case Xsand: + Cave[y][x] = Xsand_stonesand_1; + Cave[y+1][x] = Xsand_sandstone_1; + Next[y][x] = Xsand_stonesand_2; + Next[y+1][x] = Xsand_sandstone_2; + return; + } +} + +static void Lsand_stonein_1(int x, int y) +{ + Next[y][x] = Xsand_stonein_2; +} + +static void Lsand_stonein_2(int x, int y) +{ + Next[y][x] = Xsand_stonein_3; +} + +static void Lsand_stonein_3(int x, int y) +{ + Next[y][x] = Xsand_stonein_4; +} + +static void Lsand_stonein_4(int x, int y) +{ + Next[y][x] = Xblank; +} + +static void Lsand_stonesand_1(int x, int y) +{ + Next[y][x] = Xsand_stonesand_2; +} + +static void Lsand_stonesand_2(int x, int y) +{ + Next[y][x] = Xsand_stonesand_3; +} - if (lev.ball_array[lev.ball_pos][5] != Xblank && - tab_blank[Cave[y+1][x-1]]) - { - Cave[y+1][x-1] = Yball_blank; - Next[y+1][x-1] = lev.ball_array[lev.ball_pos][5]; - } +static void Lsand_stonesand_3(int x, int y) +{ + Next[y][x] = Xsand_stonesand_4; +} - if (lev.ball_array[lev.ball_pos][6] != Xblank && - tab_blank[Cave[y+1][x]]) - { - Cave[y+1][x] = Yball_blank; - Next[y+1][x] = lev.ball_array[lev.ball_pos][6]; - } +static void Lsand_stonesand_4(int x, int y) +{ + Next[y][x] = Xsand; +} - if (lev.ball_array[lev.ball_pos][7] != Xblank && - tab_blank[Cave[y+1][x+1]]) - { - Cave[y+1][x+1] = Yball_blank; - Next[y+1][x+1] = lev.ball_array[lev.ball_pos][7]; - } - } +#if 1 +static void Lsand_stonesand_quickout_1(int x, int y) +{ + Next[y][x] = Xsand_stonesand_quickout_2; +} - lev.ball_pos = (lev.ball_pos + 1) % lev.num_ball_arrays; +static void Lsand_stonesand_quickout_2(int x, int y) +{ + Next[y][x] = Xsand; } +#endif -static void Lball_1(int x, int y) +static void Lsand_stoneout_1(int x, int y) { - if (lev.ball_state == 0) - return; + Next[y][x] = Xsand_stoneout_2; +} - Cave[y][x] = Yball_1; - Next[y][x] = Xball_2; - if (lev.ball_cnt) - return; +static void Lsand_stoneout_2(int x, int y) +{ + Next[y][x] = Xstone_fall; +} - Lball_common(x, y); +static void Lsand_sandstone_1(int x, int y) +{ + Next[y][x] = Xsand_sandstone_2; } -static void Lball_2(int x, int y) +static void Lsand_sandstone_2(int x, int y) { - if (lev.ball_state == 0) - return; + Next[y][x] = Xsand_sandstone_3; +} - Cave[y][x] = Yball_2; - Next[y][x] = Xball_1; - if (lev.ball_cnt) - return; +static void Lsand_sandstone_3(int x, int y) +{ + Next[y][x] = Xsand_sandstone_4; +} - Lball_common(x, y); +static void Lsand_sandstone_4(int x, int y) +{ + Next[y][x] = Xsand_stone; } static void Lslidewall_ns(int x, int y) @@ -4661,15 +4711,6 @@ static void Lslidewall_ew(int x, int y) } } -static void Lwonderwall(int x, int y) -{ - if (lev.wonderwall_time && lev.wonderwall_state) - { - Cave[y][x] = XwonderwallB; - play_element_sound(x, y, SOUND_wonder, Xwonderwall); - } -} - static void Lexit(int x, int y) { if (lev.required > 0) @@ -4711,175 +4752,134 @@ static void Lexit_3(int x, int y) Next[y][x] = Xexit_1; } -static void Lpause(int x, int y) -{ - Next[y][x] = Xblank; -} - -static void Ldynamite_1(int x, int y) +static void Lacid_1(int x, int y) { - play_element_sound(x, y, SOUND_tick, Xdynamite_1); - Next[y][x] = Xdynamite_2; + Next[y][x] = Xacid_2; } -static void Ldynamite_2(int x, int y) +static void Lacid_2(int x, int y) { - play_element_sound(x, y, SOUND_tick, Xdynamite_2); - Next[y][x] = Xdynamite_3; + Next[y][x] = Xacid_3; } -static void Ldynamite_3(int x, int y) +static void Lacid_3(int x, int y) { - play_element_sound(x, y, SOUND_tick, Xdynamite_3); - Next[y][x] = Xdynamite_4; + Next[y][x] = Xacid_4; } -static void Ldynamite_4(int x, int y) +static void Lacid_4(int x, int y) { - play_element_sound(x, y, SOUND_tick, Xdynamite_4); - Next[y][x] = Zdynamite; - 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; + Next[y][x] = Xacid_5; } -static void Lwheel(int x, int y) +static void Lacid_5(int x, int y) { - if (lev.wheel_cnt && x == lev.wheel_x && y == lev.wheel_y) - Cave[y][x] = XwheelB; + Next[y][x] = Xacid_6; } -static void Lswitch(int x, int y) +static void Lacid_6(int x, int y) { - if (lev.ball_state) - Cave[y][x] = XswitchB; + Next[y][x] = Xacid_7; } -static void Lsand_stone(int x, int y) +static void Lacid_7(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] = Xsand_stonesand_quickout_1; - 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] = Xsand_stonesand_quickout_2; - play_element_sound(x, y, SOUND_acid, Xacid_1); - return; - - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[y][x] = Xsand_stonesand_quickout_1; - Cave[y+1][x] = Xsand_stoneout_1; - Next[y][x] = Xsand_stonesand_quickout_2; - Next[y+1][x] = Xsand_stoneout_2; - return; - - case Xsand: - Cave[y][x] = Xsand_stonesand_1; - Cave[y+1][x] = Xsand_sandstone_1; - Next[y][x] = Xsand_stonesand_2; - Next[y+1][x] = Xsand_sandstone_2; - return; - } + Next[y][x] = Xacid_8; } -static void Lsand_stonein_1(int x, int y) +static void Lacid_8(int x, int y) { - Next[y][x] = Xsand_stonein_2; + Next[y][x] = Xacid_1; } -static void Lsand_stonein_2(int x, int y) +static void Lfake_acid_1(int x, int y) { - Next[y][x] = Xsand_stonein_3; + Next[y][x] = Xfake_acid_2; } -static void Lsand_stonein_3(int x, int y) +static void Lfake_acid_2(int x, int y) { - Next[y][x] = Xsand_stonein_4; + Next[y][x] = Xfake_acid_3; } -static void Lsand_stonein_4(int x, int y) +static void Lfake_acid_3(int x, int y) { - Next[y][x] = Xblank; + Next[y][x] = Xfake_acid_4; } -static void Lsand_stonesand_1(int x, int y) +static void Lfake_acid_4(int x, int y) { - Next[y][x] = Xsand_stonesand_2; + Next[y][x] = Xfake_acid_5; } -static void Lsand_stonesand_2(int x, int y) +static void Lfake_acid_5(int x, int y) { - Next[y][x] = Xsand_stonesand_3; + Next[y][x] = Xfake_acid_6; } -static void Lsand_stonesand_3(int x, int y) +static void Lfake_acid_6(int x, int y) { - Next[y][x] = Xsand_stonesand_4; + Next[y][x] = Xfake_acid_7; } -static void Lsand_stonesand_4(int x, int y) +static void Lfake_acid_7(int x, int y) { - Next[y][x] = Xsand; + Next[y][x] = Xfake_acid_8; } -#if 1 -static void Lsand_stonesand_quickout_1(int x, int y) +static void Lfake_acid_8(int x, int y) { - Next[y][x] = Xsand_stonesand_quickout_2; + Next[y][x] = Xfake_acid_1; } -static void Lsand_stonesand_quickout_2(int x, int y) +static void Lpause(int x, int y) { - Next[y][x] = Xsand; + Next[y][x] = Xblank; } -#endif -static void Lsand_stoneout_1(int x, int y) +static void Ldynamite_1(int x, int y) { - Next[y][x] = Xsand_stoneout_2; + play_element_sound(x, y, SOUND_tick, Xdynamite_1); + Next[y][x] = Xdynamite_2; } -static void Lsand_stoneout_2(int x, int y) +static void Ldynamite_2(int x, int y) { - Next[y][x] = Xstone_fall; + play_element_sound(x, y, SOUND_tick, Xdynamite_2); + Next[y][x] = Xdynamite_3; } -static void Lsand_sandstone_1(int x, int y) +static void Ldynamite_3(int x, int y) { - Next[y][x] = Xsand_sandstone_2; + play_element_sound(x, y, SOUND_tick, Xdynamite_3); + Next[y][x] = Xdynamite_4; } -static void Lsand_sandstone_2(int x, int y) +static void Ldynamite_4(int x, int y) { - Next[y][x] = Xsand_sandstone_3; + play_element_sound(x, y, SOUND_tick, Xdynamite_4); + Next[y][x] = Zdynamite; + 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; } -static void Lsand_sandstone_3(int x, int y) +static void Lwheel(int x, int y) { - Next[y][x] = Xsand_sandstone_4; + if (lev.wheel_cnt && x == lev.wheel_x && y == lev.wheel_y) + Cave[y][x] = XwheelB; } -static void Lsand_sandstone_4(int x, int y) +static void Lswitch(int x, int y) { - Next[y][x] = Xsand_stone; + if (lev.ball_state) + Cave[y][x] = XswitchB; } static void Lfake_amoeba(int x, int y)