X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgame_em%2Fsynchro_2.c;h=98188da61259e617c0d9f1ed6ae254fc2504bf70;hb=afeec80878187293b10f7dcdd6ff3c094cc97e5d;hp=685672357a55abce8deed33db81d8739e7f717c5;hpb=c5321d9d36d0a74062651d0352fbbaccbe125eca;p=rocksndiamonds.git diff --git a/src/game_em/synchro_2.c b/src/game_em/synchro_2.c index 68567235..98188da6 100644 --- a/src/game_em/synchro_2.c +++ b/src/game_em/synchro_2.c @@ -8,35 +8,55 @@ * compilers suck. */ -#include "display.h" -#include "tile.h" -#include "level.h" -#include "sample.h" +#include "main_em.h" #define RANDOM (random = random << 31 | random >> 1) -#define PLAY(sample) { if ((unsigned int)(y - top) <= 12 && (unsigned int)(x - left) <= 20) play[sample] = 1; } -extern unsigned int screen_x; -extern unsigned int screen_y; +static void set_nearest_player_xy(int x, int y, int *dx, int *dy) +{ + int distance, distance_shortest = EM_MAX_CAVE_WIDTH + EM_MAX_CAVE_HEIGHT; + int i; + + /* default values if no players are alive anymore */ + *dx = 0; + *dy = 0; + + for (i = 0; i < MAX_PLAYERS; i++) + { + if (!ply[i].alive) + continue; + + distance = ABS(ply[i].x - x) + ABS(ply[i].y - y); + + if (distance < distance_shortest) + { + *dx = ply[i].x; + *dy = ply[i].y; + + distance_shortest = distance; + } + } +} void synchro_2(void) { - register unsigned int x = 0; - register unsigned int y = 1; - register unsigned long random = Random; - register unsigned short *cave_cache = Cave[y]; /* might be a win */ - unsigned long score = 0; - - unsigned int temp = 0; /* initialized to make compilers happy */ - unsigned int left = screen_x / TILEX; /* only needed for sounds */ - unsigned int top = screen_y / TILEY; - unsigned int dx; /* only needed to find closest player */ - unsigned int dy; + int x = 0; + int y = 1; + unsigned int random = RandomEM; + short *cave_cache = Cave[y]; /* might be a win */ + int score = 0; + + int temp = 0; /* initialized to make compilers happy */ + int dx; /* only needed to find closest player */ + int dy; + int element; loop: - switch (cave_cache[++x]) + element = cave_cache[++x]; + + switch (element) { default: goto loop; @@ -44,10 +64,10 @@ void synchro_2(void) /* --------------------------------------------------------------------- */ #ifdef BAD_ROLL - case Xstone_force_e: + case Xpush_stone_e: switch (Cave[y][x+1]) { - case ZBORDER: + case Zborder: case Znormal: case Zdynamite: case Xboom_bug: @@ -67,10 +87,10 @@ void synchro_2(void) goto loop; } - case Xstone_force_w: + case Xpush_stone_w: switch (Cave[y][x-1]) { - case ZBORDER: + case Zborder: case Znormal: case Zdynamite: case Xboom_bug: @@ -90,10 +110,10 @@ void synchro_2(void) goto loop; } - case Xnut_force_e: + case Xpush_nut_e: switch (Cave[y][x+1]) { - case ZBORDER: + case Zborder: case Znormal: case Zdynamite: case Xboom_bug: @@ -113,10 +133,10 @@ void synchro_2(void) goto loop; } - case Xnut_force_w: + case Xpush_nut_w: switch (Cave[y][x-1]) { - case ZBORDER: + case Zborder: case Znormal: case Zdynamite: case Xboom_bug: @@ -136,10 +156,10 @@ void synchro_2(void) goto loop; } - case Xspring_force_e: + case Xpush_spring_e: switch (Cave[y][x+1]) { - case ZBORDER: + case Zborder: case Znormal: case Zdynamite: case Xboom_bug: @@ -165,10 +185,10 @@ void synchro_2(void) goto loop; } - case Xspring_force_w: + case Xpush_spring_w: switch (Cave[y][x-1]) { - case ZBORDER: + case Zborder: case Znormal: case Zdynamite: case Xboom_bug: @@ -193,10 +213,10 @@ void synchro_2(void) goto loop; } - case Xemerald_force_e: + case Xpush_emerald_e: switch (Cave[y][x+1]) { - case ZBORDER: + case Zborder: case Znormal: case Zdynamite: case Xboom_bug: @@ -216,10 +236,10 @@ void synchro_2(void) goto loop; } - case Xemerald_force_w: + case Xpush_emerald_w: switch (Cave[y][x-1]) { - case ZBORDER: + case Zborder: case Znormal: case Zdynamite: case Xboom_bug: @@ -239,10 +259,10 @@ void synchro_2(void) goto loop; } - case Xdiamond_force_e: + case Xpush_diamond_e: switch (Cave[y][x+1]) { - case ZBORDER: + case Zborder: case Znormal: case Zdynamite: case Xboom_bug: @@ -262,10 +282,10 @@ void synchro_2(void) goto loop; } - case Xdiamond_force_w: + case Xpush_diamond_w: switch (Cave[y][x-1]) { - case ZBORDER: + case Zborder: case Znormal: case Zdynamite: case Xboom_bug: @@ -285,10 +305,10 @@ void synchro_2(void) goto loop; } - case Xbomb_force_e: + case Xpush_bomb_e: switch (Cave[y][x+1]) { - case ZBORDER: + case Zborder: case Znormal: case Zdynamite: case Xboom_bug: @@ -308,10 +328,10 @@ void synchro_2(void) goto loop; } - case Xbomb_force_w: + case Xpush_bomb_w: switch (Cave[y][x-1]) { - case ZBORDER: + case Zborder: case Znormal: case Zdynamite: case Xboom_bug: @@ -347,18 +367,28 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ystone_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + 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; @@ -400,8 +430,8 @@ void synchro_2(void) case Xball_2: case Xnut: case Xnut_pause: - case Xgrow_ns: - case Xgrow_ew: + case Xslidewall_ns: + case Xslidewall_ew: case Xkey_1: case Xkey_2: case Xkey_3: @@ -414,10 +444,10 @@ void synchro_2(void) case Xswitch: case Xlenses: case Xmagnify: - case Xround_wall_1: - case Xround_wall_2: - case Xround_wall_3: - case Xround_wall_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]]) @@ -478,16 +508,26 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ystone_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + 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; @@ -515,17 +555,27 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ystone_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + 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; @@ -534,21 +584,21 @@ void synchro_2(void) case Xnut: case Xnut_pause: - Cave[y+1][x] = Yemerald_stone; + Cave[y+1][x] = Ynut_stone; Next[y][x] = Xstone; Next[y+1][x] = Xemerald; - play[SAMPLE_crack] = 1; + play_element_sound(x, y, SOUND_crack, Xnut); score += lev.nut_score; goto loop; - case Xbug_n: - case Xbug_e: - case Xbug_s: - case Xbug_w: - case Xbug_gon: - case Xbug_goe: - case Xbug_gos: - case Xbug_gow: + 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; @@ -561,17 +611,20 @@ void synchro_2(void) 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, element); +#endif score += lev.bug_score; goto loop; - case Xtank_n: - case Xtank_e: - case Xtank_s: - case Xtank_w: - case Xtank_gon: - case Xtank_goe: - case Xtank_gos: - case Xtank_gow: + 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; @@ -584,6 +637,9 @@ void synchro_2(void) 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, element); +#endif score += lev.tank_score; goto loop; @@ -593,8 +649,8 @@ void synchro_2(void) switch (Cave[y+1][x+1]) { case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xalien: case Xalien_pause: Cave[y+1][x] = Xspring_e; @@ -610,8 +666,8 @@ void synchro_2(void) switch (Cave[y+1][x-1]) { case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xalien: case Xalien_pause: Cave[y+1][x] = Xspring_w; @@ -641,6 +697,9 @@ void synchro_2(void) 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, element); +#endif lev.eater_pos = (lev.eater_pos + 1) & 7; score += lev.eater_score; goto loop; @@ -659,6 +718,9 @@ void synchro_2(void) 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, element); +#endif score += lev.alien_score; goto loop; @@ -667,25 +729,25 @@ void synchro_2(void) switch (Cave[y+2][x]) { case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Zplayer: - case Xbug_n: - case Xbug_e: - case Xbug_s: - case Xbug_w: - case Xbug_gon: - case Xbug_goe: - case Xbug_gos: - case Xbug_gow: - case Xtank_n: - case Xtank_e: - case Xtank_s: - case Xtank_w: - case Xtank_gon: - case Xtank_goe: - case Xtank_gos: - case Xtank_gow: + 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: @@ -713,7 +775,7 @@ void synchro_2(void) case Xplant: case Yplant: Next[y][x] = Xstone; - PLAY(SAMPLE_stone); + play_element_sound(x, y, SOUND_stone, Xstone); goto loop; } @@ -721,12 +783,12 @@ void synchro_2(void) Cave[y+1][x] = Ydiamond_stone; Next[y][x] = Xblank; Next[y+1][x] = Xstone_pause; - play[SAMPLE_squash] = 1; + play_element_sound(x, y, SOUND_squash, Xdiamond); goto loop; case Xbomb: case Xbomb_pause: - Cave[y+1][x] = Ybomb_eat; + Cave[y+1][x] = Ybomb_blank; Next[y+1][x] = Znormal; Boom[y][x-1] = Xblank; Boom[y][x] = Xblank; @@ -737,6 +799,9 @@ void synchro_2(void) 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, element); +#endif goto loop; case Xwonderwall: @@ -752,14 +817,14 @@ void synchro_2(void) } Next[y][x] = Xblank; - play[SAMPLE_squash] = 1; + play_element_sound(x, y, SOUND_wonderfall, Xwonderwall); goto loop; } default: Cave[y][x] = Xstone; Next[y][x] = Xstone; - PLAY(SAMPLE_stone); + play_element_sound(x, y, SOUND_stone, Xstone); goto loop; } @@ -778,16 +843,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ynut_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Ynut_sB; Cave[y+1][x] = Ynut_s; Next[y][x] = Xblank; @@ -822,8 +887,8 @@ void synchro_2(void) case Xball_2: case Xnut: case Xnut_pause: - case Xgrow_ns: - case Xgrow_ew: + case Xslidewall_ns: + case Xslidewall_ew: case Xkey_1: case Xkey_2: case Xkey_3: @@ -834,10 +899,10 @@ void synchro_2(void) case Xkey_8: case Xbumper: case Xswitch: - case Xround_wall_1: - case Xround_wall_2: - case Xround_wall_3: - case Xround_wall_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]]) @@ -899,16 +964,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ynut_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Ynut_sB; Cave[y+1][x] = Ynut_s; Next[y][x] = Xblank; @@ -936,16 +1001,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ynut_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Zplayer: Cave[y][x] = Ynut_sB; Cave[y+1][x] = Ynut_s; @@ -956,24 +1021,24 @@ void synchro_2(void) default: Cave[y][x] = Xnut; Next[y][x] = Xnut; - PLAY(SAMPLE_nut); + play_element_sound(x, y, SOUND_nut, Xnut); goto loop; } /* --------------------------------------------------------------------- */ - case Xbug_n: - if (tab_ameuba[Cave[y-1][x]] || - tab_ameuba[Cave[y][x+1]] || - tab_ameuba[Cave[y+1][x]] || - tab_ameuba[Cave[y][x-1]]) + case Xbug_1_n: + 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]]) goto bug_boom; switch (Cave[y][x+1]) { case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Xacid_1: @@ -986,19 +1051,19 @@ void synchro_2(void) case Xacid_8: case Zplayer: Cave[y][x] = Ybug_n_e; - Next[y][x] = Xbug_goe; - PLAY(SAMPLE_bug); + Next[y][x] = Xbug_2_e; + play_element_sound(x, y, SOUND_bug, element); goto loop; default: goto bug_gon; } - case Xbug_gon: - if (tab_ameuba[Cave[y-1][x]] || - tab_ameuba[Cave[y][x+1]] || - tab_ameuba[Cave[y+1][x]] || - tab_ameuba[Cave[y][x-1]]) + case Xbug_2_n: + 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]]) goto bug_boom; bug_gon: @@ -1015,47 +1080,47 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ybug_nB; if (Cave[y-2][x+1] == Xblank) - Cave[y-2][x+1] = Yacid_splash_eB; + Cave[y-2][x+1] = Xacid_splash_e; if (Cave[y-2][x-1] == Xblank) - Cave[y-2][x-1] = Yacid_splash_wB; + Cave[y-2][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Zplayer: Cave[y][x] = Ybug_nB; Cave[y-1][x] = Ybug_n; Next[y][x] = Xblank; - Next[y-1][x] = Xbug_n; - PLAY(SAMPLE_bug); + Next[y-1][x] = Xbug_1_n; + play_element_sound(x, y, SOUND_bug, element); goto loop; default: Cave[y][x] = Ybug_n_w; - Next[y][x] = Xbug_gow; - PLAY(SAMPLE_bug); + Next[y][x] = Xbug_2_w; + play_element_sound(x, y, SOUND_bug, element); goto loop; } /* --------------------------------------------------------------------- */ - case Xbug_e: - if (tab_ameuba[Cave[y-1][x]] || - tab_ameuba[Cave[y][x+1]] || - tab_ameuba[Cave[y+1][x]] || - tab_ameuba[Cave[y][x-1]]) + case Xbug_1_e: + 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]]) goto bug_boom; switch (Cave[y+1][x]) { case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Xacid_1: @@ -1068,19 +1133,19 @@ void synchro_2(void) case Xacid_8: case Zplayer: Cave[y][x] = Ybug_e_s; - Next[y][x] = Xbug_gos; - PLAY(SAMPLE_bug); + Next[y][x] = Xbug_2_s; + play_element_sound(x, y, SOUND_bug, element); goto loop; default: goto bug_goe; } - case Xbug_goe: - if (tab_ameuba[Cave[y-1][x]] || - tab_ameuba[Cave[y][x+1]] || - tab_ameuba[Cave[y+1][x]] || - tab_ameuba[Cave[y][x-1]]) + case Xbug_2_e: + 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]]) goto bug_boom; bug_goe: @@ -1097,47 +1162,47 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ybug_eB; if (Cave[y-1][x+2] == Xblank) - Cave[y-1][x+2] = Yacid_splash_eB; + Cave[y-1][x+2] = Xacid_splash_e; if (Cave[y-1][x] == Xblank) - Cave[y-1][x] = Yacid_splash_wB; + Cave[y-1][x] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + 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_e; - PLAY(SAMPLE_bug); + Next[y][x+1] = Xbug_1_e; + play_element_sound(x, y, SOUND_bug, element); goto loop; default: Cave[y][x] = Ybug_e_n; - Next[y][x] = Xbug_gon; - PLAY(SAMPLE_bug); + Next[y][x] = Xbug_2_n; + play_element_sound(x, y, SOUND_bug, element); goto loop; } /* --------------------------------------------------------------------- */ - case Xbug_s: - if (tab_ameuba[Cave[y-1][x]] || - tab_ameuba[Cave[y][x+1]] || - tab_ameuba[Cave[y+1][x]] || - tab_ameuba[Cave[y][x-1]]) + case Xbug_1_s: + 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]]) goto bug_boom; switch (Cave[y][x-1]) { case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Xacid_1: @@ -1150,19 +1215,19 @@ void synchro_2(void) case Xacid_8: case Zplayer: Cave[y][x] = Ybug_s_w; - Next[y][x] = Xbug_gow; - PLAY(SAMPLE_bug); + Next[y][x] = Xbug_2_w; + play_element_sound(x, y, SOUND_bug, element); goto loop; default: goto bug_gos; } - case Xbug_gos: - if (tab_ameuba[Cave[y-1][x]] || - tab_ameuba[Cave[y][x+1]] || - tab_ameuba[Cave[y+1][x]] || - tab_ameuba[Cave[y][x-1]]) + case Xbug_2_s: + 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]]) goto bug_boom; bug_gos: @@ -1179,47 +1244,47 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ybug_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + 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_s; - PLAY(SAMPLE_bug); + Next[y+1][x] = Xbug_1_s; + play_element_sound(x, y, SOUND_bug, element); goto loop; default: Cave[y][x] = Ybug_s_e; - Next[y][x] = Xbug_goe; - PLAY(SAMPLE_bug); + Next[y][x] = Xbug_2_e; + play_element_sound(x, y, SOUND_bug, element); goto loop; } /* --------------------------------------------------------------------- */ - case Xbug_w: - if (tab_ameuba[Cave[y-1][x]] || - tab_ameuba[Cave[y][x+1]] || - tab_ameuba[Cave[y+1][x]] || - tab_ameuba[Cave[y][x-1]]) + case Xbug_1_w: + 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]]) goto bug_boom; switch (Cave[y-1][x]) { case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Xacid_1: @@ -1232,19 +1297,19 @@ void synchro_2(void) case Xacid_8: case Zplayer: Cave[y][x] = Ybug_w_n; - Next[y][x] = Xbug_gon; - PLAY(SAMPLE_bug); + Next[y][x] = Xbug_2_n; + play_element_sound(x, y, SOUND_bug, element); goto loop; default: goto bug_gow; } - case Xbug_gow: - if (tab_ameuba[Cave[y-1][x]] || - tab_ameuba[Cave[y][x+1]] || - tab_ameuba[Cave[y+1][x]] || - tab_ameuba[Cave[y][x-1]]) + case Xbug_2_w: + 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]]) goto bug_boom; bug_gow: @@ -1261,47 +1326,47 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ybug_wB; if (Cave[y-1][x] == Xblank) - Cave[y-1][x] = Yacid_splash_eB; + Cave[y-1][x] = Xacid_splash_e; if (Cave[y-1][x-2] == Xblank) - Cave[y-1][x-2] = Yacid_splash_wB; + Cave[y-1][x-2] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + 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_w; - PLAY(SAMPLE_bug); + Next[y][x-1] = Xbug_1_w; + play_element_sound(x, y, SOUND_bug, element); goto loop; default: Cave[y][x] = Ybug_w_s; - Next[y][x] = Xbug_gos; - PLAY(SAMPLE_bug); + Next[y][x] = Xbug_2_s; + play_element_sound(x, y, SOUND_bug, element); goto loop; } /* --------------------------------------------------------------------- */ - case Xtank_n: - if (tab_ameuba[Cave[y-1][x]] || - tab_ameuba[Cave[y][x+1]] || - tab_ameuba[Cave[y+1][x]] || - tab_ameuba[Cave[y][x-1]]) + case Xtank_1_n: + 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]]) goto tank_boom; switch (Cave[y][x-1]) { case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Xacid_1: @@ -1314,19 +1379,19 @@ void synchro_2(void) case Xacid_8: case Zplayer: Cave[y][x] = Ytank_n_w; - Next[y][x] = Xtank_gow; - PLAY(SAMPLE_tank); + Next[y][x] = Xtank_2_w; + play_element_sound(x, y, SOUND_tank, element); goto loop; default: goto tank_gon; } - case Xtank_gon: - if (tab_ameuba[Cave[y-1][x]] || - tab_ameuba[Cave[y][x+1]] || - tab_ameuba[Cave[y+1][x]] || - tab_ameuba[Cave[y][x-1]]) + case Xtank_2_n: + 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]]) goto tank_boom; tank_gon: @@ -1343,47 +1408,47 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ytank_nB; if (Cave[y-2][x+1] == Xblank) - Cave[y-2][x+1] = Yacid_splash_eB; + Cave[y-2][x+1] = Xacid_splash_e; if (Cave[y-2][x-1] == Xblank) - Cave[y-2][x-1] = Yacid_splash_wB; + Cave[y-2][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + 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_n; - PLAY(SAMPLE_tank); + Next[y-1][x] = Xtank_1_n; + play_element_sound(x, y, SOUND_tank, element); goto loop; default: Cave[y][x] = Ytank_n_e; - Next[y][x] = Xtank_goe; - PLAY(SAMPLE_tank); + Next[y][x] = Xtank_2_e; + play_element_sound(x, y, SOUND_tank, element); goto loop; } /* --------------------------------------------------------------------- */ - case Xtank_e: - if (tab_ameuba[Cave[y-1][x]] || - tab_ameuba[Cave[y][x+1]] || - tab_ameuba[Cave[y+1][x]] || - tab_ameuba[Cave[y][x-1]]) + case Xtank_1_e: + 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]]) goto tank_boom; switch (Cave[y-1][x]) { case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Xacid_1: @@ -1396,19 +1461,19 @@ void synchro_2(void) case Xacid_8: case Zplayer: Cave[y][x] = Ytank_e_n; - Next[y][x] = Xtank_gon; - PLAY(SAMPLE_tank); + Next[y][x] = Xtank_2_n; + play_element_sound(x, y, SOUND_tank, element); goto loop; default: goto tank_goe; } - case Xtank_goe: - if (tab_ameuba[Cave[y-1][x]] || - tab_ameuba[Cave[y][x+1]] || - tab_ameuba[Cave[y+1][x]] || - tab_ameuba[Cave[y][x-1]]) + case Xtank_2_e: + 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]]) goto tank_boom; tank_goe: @@ -1425,47 +1490,47 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ytank_eB; if (Cave[y-1][x+2] == Xblank) - Cave[y-1][x+2] = Yacid_splash_eB; + Cave[y-1][x+2] = Xacid_splash_e; if (Cave[y-1][x] == Xblank) - Cave[y-1][x] = Yacid_splash_wB; + Cave[y-1][x] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Zplayer: Cave[y][x] = Ytank_eB; Cave[y][x+1] = Ytank_e; Next[y][x] = Xblank; - Next[y][x+1] = Xtank_e; - PLAY(SAMPLE_tank); + Next[y][x+1] = Xtank_1_e; + play_element_sound(x, y, SOUND_tank, element); goto loop; default: Cave[y][x] = Ytank_e_s; - Next[y][x] = Xtank_gos; - PLAY(SAMPLE_tank); + Next[y][x] = Xtank_2_s; + play_element_sound(x, y, SOUND_tank, element); goto loop; } /* --------------------------------------------------------------------- */ - case Xtank_s: - if (tab_ameuba[Cave[y-1][x]] || - tab_ameuba[Cave[y][x+1]] || - tab_ameuba[Cave[y+1][x]] || - tab_ameuba[Cave[y][x-1]]) + case Xtank_1_s: + 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]]) goto tank_boom; switch (Cave[y][x+1]) { case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Xacid_1: @@ -1478,19 +1543,19 @@ void synchro_2(void) case Xacid_8: case Zplayer: Cave[y][x] = Ytank_s_e; - Next[y][x] = Xtank_goe; - PLAY(SAMPLE_tank); + Next[y][x] = Xtank_2_e; + play_element_sound(x, y, SOUND_tank, element); goto loop; default: goto tank_gos; } - case Xtank_gos: - if (tab_ameuba[Cave[y-1][x]] || - tab_ameuba[Cave[y][x+1]] || - tab_ameuba[Cave[y+1][x]] || - tab_ameuba[Cave[y][x-1]]) + case Xtank_2_s: + 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]]) goto tank_boom; tank_gos: @@ -1507,47 +1572,47 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ytank_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Zplayer: Cave[y][x] = Ytank_sB; Cave[y+1][x] = Ytank_s; Next[y][x] = Xblank; - Next[y+1][x] = Xtank_s; - PLAY(SAMPLE_tank); + Next[y+1][x] = Xtank_1_s; + play_element_sound(x, y, SOUND_tank, element); goto loop; default: Cave[y][x] = Ytank_s_w; - Next[y][x] = Xtank_gow; - PLAY(SAMPLE_tank); + Next[y][x] = Xtank_2_w; + play_element_sound(x, y, SOUND_tank, element); goto loop; } /* --------------------------------------------------------------------- */ - case Xtank_w: - if (tab_ameuba[Cave[y-1][x]] || - tab_ameuba[Cave[y][x+1]] || - tab_ameuba[Cave[y+1][x]] || - tab_ameuba[Cave[y][x-1]]) + case Xtank_1_w: + 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]]) goto tank_boom; switch (Cave[y+1][x]) { case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Xacid_1: @@ -1560,19 +1625,19 @@ void synchro_2(void) case Xacid_8: case Zplayer: Cave[y][x] = Ytank_w_s; - Next[y][x] = Xtank_gos; - PLAY(SAMPLE_tank); + Next[y][x] = Xtank_2_s; + play_element_sound(x, y, SOUND_tank, element); goto loop; default: goto tank_gow; } - case Xtank_gow: - if (tab_ameuba[Cave[y-1][x]] || - tab_ameuba[Cave[y][x+1]] || - tab_ameuba[Cave[y+1][x]] || - tab_ameuba[Cave[y][x-1]]) + case Xtank_2_w: + 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]]) goto tank_boom; tank_gow: @@ -1589,30 +1654,30 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ytank_wB; if (Cave[y-1][x] == Xblank) - Cave[y-1][x] = Yacid_splash_eB; + Cave[y-1][x] = Xacid_splash_e; if (Cave[y-1][x-2] == Xblank) - Cave[y-1][x-2] = Yacid_splash_wB; + Cave[y-1][x-2] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Zplayer: Cave[y][x] = Ytank_wB; Cave[y][x-1] = Ytank_w; Next[y][x] = Xblank; - Next[y][x-1] = Xtank_w; - PLAY(SAMPLE_tank); + Next[y][x-1] = Xtank_1_w; + play_element_sound(x, y, SOUND_tank, element); goto loop; default: Cave[y][x] = Ytank_w_n; - Next[y][x] = Xtank_gon; - PLAY(SAMPLE_tank); + Next[y][x] = Xtank_2_n; + play_element_sound(x, y, SOUND_tank, element); goto loop; } @@ -1727,8 +1792,8 @@ void synchro_2(void) goto android_move; } - Next[y][x] = temp; /* the item we chose to clone */ - play[SAMPLE_android] = 1; + Next[y][x] = temp; /* the item we chose to clone */ + play_element_sound(x, y, SOUND_android_clone, temp); switch (RANDOM & 7) { @@ -1837,39 +1902,9 @@ void synchro_2(void) Cave[y+1][x+1] == Zplayer) goto android_still; - if (ply1.alive && ply2.alive) - { - if ((ply1.x > x ? ply1.x - x : x - ply1.x) + - (ply1.y > y ? ply1.y - y : y - ply1.y) < - (ply2.x > x ? ply2.x - x : x - ply2.x) + - (ply2.y > y ? ply2.y - y : y - ply2.y)) - { - dx = ply1.x; - dy = ply1.y; - } - else - { - dx = ply2.x; - dy = ply2.y; - } - } - else if (ply1.alive) - { - dx = ply1.x; - dy = ply1.y; - } - else if (ply2.alive) - { - dx = ply2.x; - dy = ply2.y; - } - else - { - dx = 0; - dy = 0; - } + set_nearest_player_xy(x, y, &dx, &dy); - Next[y][x] = Xblank; /* assume we will move */ + Next[y][x] = Xblank; /* assume we will move */ temp = ((x < dx) + 1 - (x > dx)) + ((y < dy) + 1 - (y > dy)) * 3; if (RANDOM & 1) @@ -2000,7 +2035,7 @@ void synchro_2(void) Cave[y][x] = Yandroid_nB; Cave[y-1][x] = Yandroid_n; Next[y-1][x] = Xandroid; - PLAY(SAMPLE_tank); + play_element_sound(x, y, SOUND_android_move, element); goto loop; android_ne: @@ -2008,7 +2043,7 @@ void synchro_2(void) Cave[y][x] = Yandroid_neB; Cave[y-1][x+1] = Yandroid_ne; Next[y-1][x+1] = Xandroid; - PLAY(SAMPLE_tank); + play_element_sound(x, y, SOUND_android_move, element); goto loop; android_e: @@ -2016,7 +2051,7 @@ void synchro_2(void) Cave[y][x] = Yandroid_eB; Cave[y][x+1] = Yandroid_e; Next[y][x+1] = Xandroid; - PLAY(SAMPLE_tank); + play_element_sound(x, y, SOUND_android_move, element); goto loop; android_se: @@ -2024,7 +2059,7 @@ void synchro_2(void) Cave[y][x] = Yandroid_seB; Cave[y+1][x+1] = Yandroid_se; Next[y+1][x+1] = Xandroid; - PLAY(SAMPLE_tank); + play_element_sound(x, y, SOUND_android_move, element); goto loop; android_s: @@ -2032,7 +2067,7 @@ void synchro_2(void) Cave[y][x] = Yandroid_sB; Cave[y+1][x] = Yandroid_s; Next[y+1][x] = Xandroid; - PLAY(SAMPLE_tank); + play_element_sound(x, y, SOUND_android_move, element); goto loop; android_sw: @@ -2040,7 +2075,7 @@ void synchro_2(void) Cave[y][x] = Yandroid_swB; Cave[y+1][x-1] = Yandroid_sw; Next[y+1][x-1] = Xandroid; - PLAY(SAMPLE_tank); + play_element_sound(x, y, SOUND_android_move, element); goto loop; android_w: @@ -2048,7 +2083,7 @@ void synchro_2(void) Cave[y][x] = Yandroid_wB; Cave[y][x-1] = Yandroid_w; Next[y][x-1] = Xandroid; - PLAY(SAMPLE_tank); + play_element_sound(x, y, SOUND_android_move, element); goto loop; android_nw: @@ -2056,7 +2091,7 @@ void synchro_2(void) Cave[y][x] = Yandroid_nwB; Cave[y-1][x-1] = Yandroid_nw; Next[y-1][x-1] = Xandroid; - PLAY(SAMPLE_tank); + play_element_sound(x, y, SOUND_android_move, element); goto loop; /* --------------------------------------------------------------------- */ @@ -2074,21 +2109,21 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yandroid_nB; if (Cave[y-2][x+1] == Xblank) - Cave[y-2][x+1] = Yacid_splash_eB; + Cave[y-2][x+1] = Xacid_splash_e; if (Cave[y-2][x-1] == Xblank) - Cave[y-2][x-1] = Yacid_splash_wB; + Cave[y-2][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Yandroid_nB; Cave[y-1][x] = Yandroid_n; Next[y][x] = Xblank; Next[y-1][x] = Xandroid; - PLAY(SAMPLE_tank); + play_element_sound(x, y, SOUND_android_move, element); goto loop; default: @@ -2108,21 +2143,21 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yandroid_nB; if (Cave[y-2][x+1] == Xblank) - Cave[y-2][x+1] = Yacid_splash_eB; + Cave[y-2][x+1] = Xacid_splash_e; if (Cave[y-2][x-1] == Xblank) - Cave[y-2][x-1] = Yacid_splash_wB; + Cave[y-2][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + 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(SAMPLE_tank); + play_element_sound(x, y, SOUND_android_move, element); goto loop; default: @@ -2144,21 +2179,21 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yandroid_eB; if (Cave[y-1][x+2] == Xblank) - Cave[y-1][x+2] = Yacid_splash_eB; + Cave[y-1][x+2] = Xacid_splash_e; if (Cave[y-1][x] == Xblank) - Cave[y-1][x] = Yacid_splash_wB; + Cave[y-1][x] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + 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(SAMPLE_tank); + play_element_sound(x, y, SOUND_android_move, element); goto loop; default: @@ -2178,21 +2213,21 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yandroid_eB; if (Cave[y-1][x+2] == Xblank) - Cave[y-1][x+2] = Yacid_splash_eB; + Cave[y-1][x+2] = Xacid_splash_e; if (Cave[y-1][x] == Xblank) - Cave[y-1][x] = Yacid_splash_wB; + Cave[y-1][x] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Yandroid_eB; Cave[y][x+1] = Yandroid_e; Next[y][x] = Xblank; Next[y][x+1] = Xandroid_1_e; - PLAY(SAMPLE_tank); + play_element_sound(x, y, SOUND_android_move, element); goto loop; default: @@ -2214,21 +2249,21 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yandroid_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + 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(SAMPLE_tank); + play_element_sound(x, y, SOUND_android_move, element); goto loop; default: @@ -2248,21 +2283,21 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yandroid_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Yandroid_sB; Cave[y+1][x] = Yandroid_s; Next[y][x] = Xblank; Next[y+1][x] = Xandroid_1_s; - PLAY(SAMPLE_tank); + play_element_sound(x, y, SOUND_android_move, element); goto loop; default: @@ -2284,21 +2319,21 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yandroid_wB; if (Cave[y-1][x] == Xblank) - Cave[y-1][x] = Yacid_splash_eB; + Cave[y-1][x] = Xacid_splash_e; if (Cave[y-1][x-2] == Xblank) - Cave[y-1][x-2] = Yacid_splash_wB; + Cave[y-1][x-2] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + 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(SAMPLE_tank); + play_element_sound(x, y, SOUND_android_move, element); goto loop; default: @@ -2318,21 +2353,21 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yandroid_wB; if (Cave[y-1][x] == Xblank) - Cave[y-1][x] = Yacid_splash_eB; + Cave[y-1][x] = Xacid_splash_e; if (Cave[y-1][x-2] == Xblank) - Cave[y-1][x-2] = Yacid_splash_wB; + Cave[y-1][x-2] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Yandroid_wB; Cave[y][x-1] = Yandroid_w; Next[y][x] = Xblank; Next[y][x-1] = Xandroid_1_w; - PLAY(SAMPLE_tank); + play_element_sound(x, y, SOUND_android_move, element); goto loop; default: @@ -2354,16 +2389,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yspring_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: Cave[y][x] = Yspring_sB; @@ -2400,8 +2435,8 @@ void synchro_2(void) case Xball_2: case Xnut: case Xnut_pause: - case Xgrow_ns: - case Xgrow_ew: + case Xslidewall_ns: + case Xslidewall_ew: case Xkey_1: case Xkey_2: case Xkey_3: @@ -2412,10 +2447,10 @@ void synchro_2(void) case Xkey_8: case Xbumper: case Xswitch: - case Xround_wall_1: - case Xround_wall_2: - case Xround_wall_3: - case Xround_wall_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]]) @@ -2508,16 +2543,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yspring_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Yspring_sB; Cave[y+1][x] = Yspring_s; Next[y][x] = Xblank; @@ -2545,16 +2580,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yspring_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Yspring_sB; Cave[y+1][x] = Yspring_s; Next[y][x] = Xblank; @@ -2577,16 +2612,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yspring_eB; if (Cave[y-1][x+2] == Xblank) - Cave[y-1][x+2] = Yacid_splash_eB; + Cave[y-1][x+2] = Xacid_splash_e; if (Cave[y-1][x] == Xblank) - Cave[y-1][x] = Yacid_splash_wB; + Cave[y-1][x] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Yalien_nB: case Yalien_eB: case Yalien_sB: @@ -2603,11 +2638,11 @@ void synchro_2(void) case Yalien_e: case Yalien_s: case Yalien_w: - Cave[y][x] = Yspring_kill_eB; - Cave[y][x+1] = Yspring_kill_e; + Cave[y][x] = Yspring_alien_eB; + Cave[y][x+1] = Yspring_alien_e; Next[y][x] = Xblank; Next[y][x+1] = Xspring_e; - play[SAMPLE_slurp] = 1; + play_element_sound(x, y, SOUND_slurp, Xalien); score += lev.slurp_score; goto loop; @@ -2615,13 +2650,13 @@ void synchro_2(void) case XbumperB: Cave[y][x+1] = XbumperB; Next[y][x] = Xspring_w; - PLAY(SAMPLE_spring); + play_element_sound(x, y, SOUND_spring, Xspring); goto loop; default: Cave[y][x] = Xspring; Next[y][x] = Xspring; - PLAY(SAMPLE_spring); + play_element_sound(x, y, SOUND_spring, Xspring); goto loop; } @@ -2640,16 +2675,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yspring_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Yspring_sB; Cave[y+1][x] = Yspring_s; Next[y][x] = Xblank; @@ -2672,16 +2707,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yspring_wB; if (Cave[y-1][x] == Xblank) - Cave[y-1][x] = Yacid_splash_eB; + Cave[y-1][x] = Xacid_splash_e; if (Cave[y-1][x-2] == Xblank) - Cave[y-1][x-2] = Yacid_splash_wB; + Cave[y-1][x-2] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Yalien_nB: case Yalien_eB: case Yalien_sB: @@ -2698,11 +2733,11 @@ void synchro_2(void) case Yalien_e: case Yalien_s: case Yalien_w: - Cave[y][x] = Yspring_kill_wB; - Cave[y][x-1] = Yspring_kill_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[SAMPLE_slurp] = 1; + play_element_sound(x, y, SOUND_slurp, Xalien); score += lev.slurp_score; goto loop; @@ -2710,13 +2745,13 @@ void synchro_2(void) case XbumperB: Cave[y][x-1] = XbumperB; Next[y][x] = Xspring_e; - PLAY(SAMPLE_spring); + play_element_sound(x, y, SOUND_spring, Xspring); goto loop; default: Cave[y][x] = Xspring; Next[y][x] = Xspring; - PLAY(SAMPLE_spring); + play_element_sound(x, y, SOUND_spring, Xspring); goto loop; } @@ -2735,16 +2770,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yspring_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Zplayer: Cave[y][x] = Yspring_sB; Cave[y+1][x] = Yspring_s; @@ -2754,7 +2789,7 @@ void synchro_2(void) case Xbomb: case Xbomb_pause: - Cave[y+1][x] = Ybomb_eat; + Cave[y+1][x] = Ybomb_blank; Next[y+1][x] = Znormal; Boom[y][x-1] = Xblank; Boom[y][x] = Xblank; @@ -2765,16 +2800,19 @@ void synchro_2(void) 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, element); +#endif goto loop; - case Xbug_n: - case Xbug_e: - case Xbug_s: - case Xbug_w: - case Xbug_gon: - case Xbug_goe: - case Xbug_gos: - case Xbug_gow: + 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; @@ -2787,17 +2825,20 @@ void synchro_2(void) 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, element); +#endif score += lev.bug_score; goto loop; - case Xtank_n: - case Xtank_e: - case Xtank_s: - case Xtank_w: - case Xtank_gon: - case Xtank_goe: - case Xtank_gos: - case Xtank_gow: + 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; @@ -2810,6 +2851,9 @@ void synchro_2(void) 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, element); +#endif score += lev.tank_score; goto loop; @@ -2829,6 +2873,9 @@ void synchro_2(void) 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, element); +#endif lev.eater_pos = (lev.eater_pos + 1) & 7; score += lev.eater_score; goto loop; @@ -2847,13 +2894,16 @@ void synchro_2(void) 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, element); +#endif score += lev.alien_score; goto loop; default: Cave[y][x] = Xspring; Next[y][x] = Xspring; - PLAY(SAMPLE_spring); + play_element_sound(x, y, SOUND_spring, Xspring); goto loop; } @@ -2862,33 +2912,33 @@ void synchro_2(void) case Xeater_n: if (Cave[y][x+1] == Xdiamond) { - Cave[y][x+1] = Ydiamond_eat; + Cave[y][x+1] = Ydiamond_blank; Next[y][x+1] = Xblank; - play[SAMPLE_eater] = 1; + play_element_sound(x, y, SOUND_eater_eat, element); goto loop; } if (Cave[y+1][x] == Xdiamond) { - Cave[y+1][x] = Ydiamond_eat; + Cave[y+1][x] = Ydiamond_blank; Next[y+1][x] = Xblank; - play[SAMPLE_eater] = 1; + play_element_sound(x, y, SOUND_eater_eat, element); goto loop; } if (Cave[y][x-1] == Xdiamond) { - Cave[y][x-1] = Ydiamond_eat; + Cave[y][x-1] = Ydiamond_blank; Next[y][x-1] = Xblank; - play[SAMPLE_eater] = 1; + play_element_sound(x, y, SOUND_eater_eat, element); goto loop; } if (Cave[y-1][x] == Xdiamond) { - Cave[y-1][x] = Ydiamond_eat; + Cave[y-1][x] = Ydiamond_blank; Next[y-1][x] = Xblank; - play[SAMPLE_eater] = 1; + play_element_sound(x, y, SOUND_eater_eat, element); goto loop; } @@ -2904,16 +2954,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yeater_nB; if (Cave[y-2][x+1] == Xblank) - Cave[y-2][x+1] = Yacid_splash_eB; + Cave[y-2][x+1] = Xacid_splash_e; if (Cave[y-2][x-1] == Xblank) - Cave[y-2][x-1] = Yacid_splash_wB; + Cave[y-2][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Zplayer: @@ -2925,7 +2975,7 @@ void synchro_2(void) default: Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w; - PLAY(SAMPLE_eater); + play_element_sound(x, y, SOUND_eater, element); goto loop; } @@ -2934,33 +2984,33 @@ void synchro_2(void) case Xeater_e: if (Cave[y+1][x] == Xdiamond) { - Cave[y+1][x] = Ydiamond_eat; + Cave[y+1][x] = Ydiamond_blank; Next[y+1][x] = Xblank; - play[SAMPLE_eater] = 1; + play_element_sound(x, y, SOUND_eater_eat, element); goto loop; } if (Cave[y][x-1] == Xdiamond) { - Cave[y][x-1] = Ydiamond_eat; + Cave[y][x-1] = Ydiamond_blank; Next[y][x-1] = Xblank; - play[SAMPLE_eater] = 1; + play_element_sound(x, y, SOUND_eater_eat, element); goto loop; } if (Cave[y-1][x] == Xdiamond) { - Cave[y-1][x] = Ydiamond_eat; + Cave[y-1][x] = Ydiamond_blank; Next[y-1][x] = Xblank; - play[SAMPLE_eater] = 1; + play_element_sound(x, y, SOUND_eater_eat, element); goto loop; } if (Cave[y][x+1] == Xdiamond) { - Cave[y][x+1] = Ydiamond_eat; + Cave[y][x+1] = Ydiamond_blank; Next[y][x+1] = Xblank; - play[SAMPLE_eater] = 1; + play_element_sound(x, y, SOUND_eater_eat, element); goto loop; } @@ -2976,16 +3026,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yeater_eB; if (Cave[y-1][x+2] == Xblank) - Cave[y-1][x+2] = Yacid_splash_eB; + Cave[y-1][x+2] = Xacid_splash_e; if (Cave[y-1][x] == Xblank) - Cave[y-1][x] = Yacid_splash_wB; + Cave[y-1][x] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Zplayer: @@ -2997,7 +3047,7 @@ void synchro_2(void) default: Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s; - PLAY(SAMPLE_eater); + play_element_sound(x, y, SOUND_eater, element); goto loop; } @@ -3006,33 +3056,33 @@ void synchro_2(void) case Xeater_s: if (Cave[y][x-1] == Xdiamond) { - Cave[y][x-1] = Ydiamond_eat; + Cave[y][x-1] = Ydiamond_blank; Next[y][x-1] = Xblank; - play[SAMPLE_eater] = 1; + play_element_sound(x, y, SOUND_eater_eat, element); goto loop; } if (Cave[y-1][x] == Xdiamond) { - Cave[y-1][x] = Ydiamond_eat; + Cave[y-1][x] = Ydiamond_blank; Next[y-1][x] = Xblank; - play[SAMPLE_eater] = 1; + play_element_sound(x, y, SOUND_eater_eat, element); goto loop; } if (Cave[y][x+1] == Xdiamond) { - Cave[y][x+1] = Ydiamond_eat; + Cave[y][x+1] = Ydiamond_blank; Next[y][x+1] = Xblank; - play[SAMPLE_eater] = 1; + play_element_sound(x, y, SOUND_eater_eat, element); goto loop; } if (Cave[y+1][x] == Xdiamond) { - Cave[y+1][x] = Ydiamond_eat; + Cave[y+1][x] = Ydiamond_blank; Next[y+1][x] = Xblank; - play[SAMPLE_eater] = 1; + play_element_sound(x, y, SOUND_eater_eat, element); goto loop; } @@ -3048,16 +3098,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yeater_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Zplayer: @@ -3069,7 +3119,7 @@ void synchro_2(void) default: Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w; - PLAY(SAMPLE_eater); + play_element_sound(x, y, SOUND_eater, element); goto loop; } @@ -3078,33 +3128,33 @@ void synchro_2(void) case Xeater_w: if (Cave[y-1][x] == Xdiamond) { - Cave[y-1][x] = Ydiamond_eat; + Cave[y-1][x] = Ydiamond_blank; Next[y-1][x] = Xblank; - play[SAMPLE_eater] = 1; + play_element_sound(x, y, SOUND_eater_eat, element); goto loop; } if (Cave[y][x+1] == Xdiamond) { - Cave[y][x+1] = Ydiamond_eat; + Cave[y][x+1] = Ydiamond_blank; Next[y][x+1] = Xblank; - play[SAMPLE_eater] = 1; + play_element_sound(x, y, SOUND_eater_eat, element); goto loop; } if (Cave[y+1][x] == Xdiamond) { - Cave[y+1][x] = Ydiamond_eat; + Cave[y+1][x] = Ydiamond_blank; Next[y+1][x] = Xblank; - play[SAMPLE_eater] = 1; + play_element_sound(x, y, SOUND_eater_eat, element); goto loop; } if (Cave[y][x-1] == Xdiamond) { - Cave[y][x-1] = Ydiamond_eat; + Cave[y][x-1] = Ydiamond_blank; Next[y][x-1] = Xblank; - play[SAMPLE_eater] = 1; + play_element_sound(x, y, SOUND_eater_eat, element); goto loop; } @@ -3120,16 +3170,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yeater_wB; if (Cave[y-1][x] == Xblank) - Cave[y-1][x] = Yacid_splash_eB; + Cave[y-1][x] = Xacid_splash_e; if (Cave[y-1][x-2] == Xblank) - Cave[y-1][x-2] = Yacid_splash_wB; + Cave[y-1][x-2] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Zplayer: @@ -3141,48 +3191,22 @@ void synchro_2(void) default: Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s; - PLAY(SAMPLE_eater); + play_element_sound(x, y, SOUND_eater, element); goto loop; } /* --------------------------------------------------------------------- */ case Xalien: + if (lev.wheel_cnt) { dx = lev.wheel_x; dy = lev.wheel_y; } - else if (ply1.alive && ply2.alive) - { - if ((ply1.x > x ? ply1.x - x : x - ply1.x) + - (ply1.y > y ? ply1.y - y : y - ply1.y) < - (ply2.x > x ? ply2.x - x : x - ply2.x) + - (ply2.y > y ? ply2.y - y : y - ply2.y)) - { - dx = ply1.x; - dy = ply1.y; - } - else - { - dx = ply2.x; - dy = ply2.y; - } - } - else if (ply1.alive) - { - dx = ply1.x; - dy = ply1.y; - } - else if (ply2.alive) - { - dx = ply2.x; - dy = ply2.y; - } else { - dx = 0; - dy = 0; + set_nearest_player_xy(x, y, &dx, &dy); } if (RANDOM & 1) @@ -3201,16 +3225,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yalien_nB; if (Cave[y-2][x+1] == Xblank) - Cave[y-2][x+1] = Yacid_splash_eB; + Cave[y-2][x+1] = Xacid_splash_e; if (Cave[y-2][x-1] == Xblank) - Cave[y-2][x-1] = Yacid_splash_wB; + Cave[y-2][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Zplayer: @@ -3218,7 +3242,7 @@ void synchro_2(void) Cave[y-1][x] = Yalien_n; Next[y][x] = Xblank; Next[y-1][x] = Xalien_pause; - PLAY(SAMPLE_alien); + play_element_sound(x, y, SOUND_alien, Xalien); goto loop; } } @@ -3237,15 +3261,15 @@ void synchro_2(void) Cave[y][x] = Yalien_sB; Next[y][x] = Xblank; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; - PLAY(SAMPLE_acid); + Cave[y][x-1] = Xacid_splash_w; + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Zplayer: @@ -3253,7 +3277,7 @@ void synchro_2(void) Cave[y+1][x] = Yalien_s; Next[y][x] = Xblank; Next[y+1][x] = Xalien_pause; - PLAY(SAMPLE_alien); + play_element_sound(x, y, SOUND_alien, Xalien); goto loop; } } @@ -3274,16 +3298,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yalien_eB; if (Cave[y-1][x+2] == Xblank) - Cave[y-1][x+2] = Yacid_splash_eB; + Cave[y-1][x+2] = Xacid_splash_e; if (Cave[y-1][x] == Xblank) - Cave[y-1][x] = Yacid_splash_wB; + Cave[y-1][x] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Zplayer: @@ -3291,7 +3315,7 @@ void synchro_2(void) Cave[y][x+1] = Yalien_e; Next[y][x] = Xblank; Next[y][x+1] = Xalien_pause; - PLAY(SAMPLE_alien); + play_element_sound(x, y, SOUND_alien, Xalien); goto loop; } } @@ -3309,16 +3333,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yalien_wB; if (Cave[y-1][x] == Xblank) - Cave[y-1][x] = Yacid_splash_eB; + Cave[y-1][x] = Xacid_splash_e; if (Cave[y-1][x-2] == Xblank) - Cave[y-1][x-2] = Yacid_splash_wB; + Cave[y-1][x-2] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Zplayer: @@ -3326,7 +3350,7 @@ void synchro_2(void) Cave[y][x-1] = Yalien_w; Next[y][x] = Xblank; Next[y][x-1] = Xalien_pause; - PLAY(SAMPLE_alien); + play_element_sound(x, y, SOUND_alien, Xalien); goto loop; } } @@ -3353,16 +3377,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yemerald_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Yemerald_sB; Cave[y+1][x] = Yemerald_s; Next[y][x] = Xblank; @@ -3397,8 +3421,8 @@ void synchro_2(void) case Xball_2: case Xnut: case Xnut_pause: - case Xgrow_ns: - case Xgrow_ew: + case Xslidewall_ns: + case Xslidewall_ew: case Xwonderwall: case Xkey_1: case Xkey_2: @@ -3418,10 +3442,10 @@ void synchro_2(void) case Xwall_2: case Xwall_3: case Xwall_4: - case Xround_wall_1: - case Xround_wall_2: - case Xround_wall_3: - case Xround_wall_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]]) @@ -3488,16 +3512,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yemerald_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Yemerald_sB; Cave[y+1][x] = Yemerald_s; Next[y][x] = Xblank; @@ -3525,16 +3549,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yemerald_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Zplayer: Cave[y][x] = Yemerald_sB; Cave[y+1][x] = Yemerald_s; @@ -3554,14 +3578,14 @@ void synchro_2(void) } Next[y][x] = Xblank; - play[SAMPLE_squash] = 1; + play_element_sound(x, y, SOUND_wonderfall, Xwonderwall); goto loop; } default: Cave[y][x] = Xemerald; Next[y][x] = Xemerald; - PLAY(SAMPLE_diamond); + play_element_sound(x, y, SOUND_diamond, Xemerald); goto loop; } @@ -3580,16 +3604,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ydiamond_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Ydiamond_sB; Cave[y+1][x] = Ydiamond_s; Next[y][x] = Xblank; @@ -3624,8 +3648,8 @@ void synchro_2(void) case Xball_2: case Xnut: case Xnut_pause: - case Xgrow_ns: - case Xgrow_ew: + case Xslidewall_ns: + case Xslidewall_ew: case Xwonderwall: case Xkey_1: case Xkey_2: @@ -3645,10 +3669,10 @@ void synchro_2(void) case Xwall_2: case Xwall_3: case Xwall_4: - case Xround_wall_1: - case Xround_wall_2: - case Xround_wall_3: - case Xround_wall_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]]) @@ -3715,16 +3739,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ydiamond_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Ydiamond_sB; Cave[y+1][x] = Ydiamond_s; Next[y][x] = Xblank; @@ -3752,16 +3776,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ydiamond_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Zplayer: Cave[y][x] = Ydiamond_sB; Cave[y+1][x] = Ydiamond_s; @@ -3781,14 +3805,14 @@ void synchro_2(void) } Next[y][x] = Xblank; - play[SAMPLE_squash] = 1; + play_element_sound(x, y, SOUND_wonderfall, Xwonderwall); goto loop; } default: Cave[y][x] = Xdiamond; Next[y][x] = Xdiamond; - PLAY(SAMPLE_diamond); + play_element_sound(x, y, SOUND_diamond, Xdiamond); goto loop; } @@ -3805,23 +3829,23 @@ void synchro_2(void) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Ydrip_s1B; + Cave[y][x] = Ydrip_1_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xdrip_stretchB; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: case Xplant: case Yplant: case Zplayer: - Cave[y][x] = Ydrip_s1B; - Cave[y+1][x] = Ydrip_s1; + Cave[y][x] = Ydrip_1_sB; + Cave[y+1][x] = Ydrip_1_s; Next[y][x] = Xdrip_stretchB; Next[y+1][x] = Xdrip_stretch; goto loop; @@ -3830,57 +3854,57 @@ void synchro_2(void) switch (RANDOM & 7) { case 0: - temp = Xameuba_1; + temp = Xamoeba_1; break; case 1: - temp = Xameuba_2; + temp = Xamoeba_2; break; case 2: - temp = Xameuba_3; + temp = Xamoeba_3; break; case 3: - temp = Xameuba_4; + temp = Xamoeba_4; break; case 4: - temp = Xameuba_5; + temp = Xamoeba_5; break; case 5: - temp = Xameuba_6; + temp = Xamoeba_6; break; case 6: - temp = Xameuba_7; + temp = Xamoeba_7; break; case 7: - temp = Xameuba_8; + temp = Xamoeba_8; break; } Cave[y][x] = temp; Next[y][x] = temp; - play[SAMPLE_drip] = 1; + play_element_sound(x, y, SOUND_drip, Xdrip_fall); goto loop; } /* --------------------------------------------------------------------- */ case Xdrip_stretch: - Cave[y][x] = Ydrip_s2; + Cave[y][x] = Ydrip_2_s; Next[y][x] = Xdrip_fall; goto loop; case Xdrip_stretchB: - Cave[y][x] = Ydrip_s2B; + Cave[y][x] = Ydrip_2_sB; Next[y][x] = Xblank; goto loop; - case Xdrip_eat: + case Xdrip: Next[y][x] = Xdrip_fall; goto loop; @@ -3899,16 +3923,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ybomb_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Ybomb_sB; Cave[y+1][x] = Ybomb_s; Next[y][x] = Xblank; @@ -3943,8 +3967,8 @@ void synchro_2(void) case Xball_2: case Xnut: case Xnut_pause: - case Xgrow_ns: - case Xgrow_ew: + case Xslidewall_ns: + case Xslidewall_ew: case Xkey_1: case Xkey_2: case Xkey_3: @@ -3955,10 +3979,10 @@ void synchro_2(void) case Xkey_8: case Xbumper: case Xswitch: - case Xround_wall_1: - case Xround_wall_2: - case Xround_wall_3: - case Xround_wall_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]]) @@ -4019,16 +4043,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ybomb_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Ybomb_sB; Cave[y+1][x] = Ybomb_s; Next[y][x] = Xblank; @@ -4056,16 +4080,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Ybomb_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Ybomb_sB; Cave[y+1][x] = Ybomb_s; Next[y][x] = Xblank; @@ -4073,7 +4097,7 @@ void synchro_2(void) goto loop; default: - Cave[y][x] = Ybomb_eat; + Cave[y][x] = Ybomb_blank; Next[y][x] = Znormal; Boom[y-1][x-1] = Xblank; Boom[y-1][x] = Xblank; @@ -4084,6 +4108,9 @@ void synchro_2(void) 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 goto loop; } @@ -4108,16 +4135,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yballoon_nB; if (Cave[y-2][x+1] == Xblank) - Cave[y-2][x+1] = Yacid_splash_eB; + Cave[y-2][x+1] = Xacid_splash_e; if (Cave[y-2][x-1] == Xblank) - Cave[y-2][x-1] = Yacid_splash_wB; + Cave[y-2][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Yballoon_nB; Cave[y-1][x] = Yballoon_n; Next[y][x] = Xblank; @@ -4141,16 +4168,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yballoon_eB; if (Cave[y-1][x+2] == Xblank) - Cave[y-1][x+2] = Yacid_splash_eB; + Cave[y-1][x+2] = Xacid_splash_e; if (Cave[y-1][x] == Xblank) - Cave[y-1][x] = Yacid_splash_wB; + Cave[y-1][x] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Yballoon_eB; Cave[y][x+1] = Yballoon_e; Next[y][x] = Xblank; @@ -4174,16 +4201,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yballoon_sB; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; + Cave[y][x-1] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Yballoon_sB; Cave[y+1][x] = Yballoon_s; Next[y][x] = Xblank; @@ -4207,16 +4234,16 @@ void synchro_2(void) case Xacid_8: Cave[y][x] = Yballoon_wB; if (Cave[y-1][x] == Xblank) - Cave[y-1][x] = Yacid_splash_eB; + Cave[y-1][x] = Xacid_splash_e; if (Cave[y-1][x-2] == Xblank) - Cave[y-1][x-2] = Yacid_splash_wB; + Cave[y-1][x-2] = Xacid_splash_w; Next[y][x] = Xblank; - PLAY(SAMPLE_acid); + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: + case Xacid_splash_e: + case Xacid_splash_w: Cave[y][x] = Yballoon_wB; Cave[y][x-1] = Yballoon_w; Next[y][x] = Xblank; @@ -4262,13 +4289,45 @@ void synchro_2(void) Next[y][x] = Xacid_1; goto loop; + case Xfake_acid_1: + Next[y][x] = Xfake_acid_2; + goto loop; + + case Xfake_acid_2: + Next[y][x] = Xfake_acid_3; + goto loop; + + case Xfake_acid_3: + Next[y][x] = Xfake_acid_4; + goto loop; + + case Xfake_acid_4: + Next[y][x] = Xfake_acid_5; + goto loop; + + case Xfake_acid_5: + Next[y][x] = Xfake_acid_6; + goto loop; + + case Xfake_acid_6: + Next[y][x] = Xfake_acid_7; + goto loop; + + case Xfake_acid_7: + Next[y][x] = Xfake_acid_8; + goto loop; + + case Xfake_acid_8: + Next[y][x] = Xfake_acid_1; + goto loop; + /* --------------------------------------------------------------------- */ case Xball_1: if (lev.ball_state == 0) goto loop; - Cave[y][x] = Xball_1B; + Cave[y][x] = Yball_1; Next[y][x] = Xball_2; if (lev.ball_cnt) goto loop; @@ -4279,7 +4338,7 @@ void synchro_2(void) if (lev.ball_state == 0) goto loop; - Cave[y][x] = Xball_2B; + Cave[y][x] = Yball_2; Next[y][x] = Xball_1; if (lev.ball_cnt) goto loop; @@ -4288,7 +4347,7 @@ void synchro_2(void) ball_common: - play[SAMPLE_ball] = 1; + play_element_sound(x, y, SOUND_ball, element); if (lev.ball_random) { switch (RANDOM & 7) @@ -4297,7 +4356,7 @@ void synchro_2(void) if (lev.ball_array[lev.ball_pos][0] != Xblank && tab_blank[Cave[y-1][x-1]]) { - Cave[y-1][x-1] = Yball_eat; + Cave[y-1][x-1] = Yball_blank; Next[y-1][x-1] = lev.ball_array[lev.ball_pos][0]; } break; @@ -4306,7 +4365,7 @@ void synchro_2(void) if (lev.ball_array[lev.ball_pos][1] != Xblank && tab_blank[Cave[y-1][x]]) { - Cave[y-1][x] = Yball_eat; + Cave[y-1][x] = Yball_blank; Next[y-1][x] = lev.ball_array[lev.ball_pos][1]; } break; @@ -4315,7 +4374,7 @@ void synchro_2(void) if (lev.ball_array[lev.ball_pos][2] != Xblank && tab_blank[Cave[y-1][x+1]]) { - Cave[y-1][x+1] = Yball_eat; + Cave[y-1][x+1] = Yball_blank; Next[y-1][x+1] = lev.ball_array[lev.ball_pos][2]; } break; @@ -4324,7 +4383,7 @@ void synchro_2(void) if (lev.ball_array[lev.ball_pos][3] != Xblank && tab_blank[Cave[y][x-1]]) { - Cave[y][x-1] = Yball_eat; + Cave[y][x-1] = Yball_blank; Next[y][x-1] = lev.ball_array[lev.ball_pos][3]; } break; @@ -4333,7 +4392,7 @@ void synchro_2(void) if (lev.ball_array[lev.ball_pos][4] != Xblank && tab_blank[Cave[y][x+1]]) { - Cave[y][x+1] = Yball_eat; + Cave[y][x+1] = Yball_blank; Next[y][x+1] = lev.ball_array[lev.ball_pos][4]; } break; @@ -4342,7 +4401,7 @@ void synchro_2(void) if (lev.ball_array[lev.ball_pos][5] != Xblank && tab_blank[Cave[y+1][x-1]]) { - Cave[y+1][x-1] = Yball_eat; + Cave[y+1][x-1] = Yball_blank; Next[y+1][x-1] = lev.ball_array[lev.ball_pos][5]; } break; @@ -4351,7 +4410,7 @@ void synchro_2(void) if (lev.ball_array[lev.ball_pos][6] != Xblank && tab_blank[Cave[y+1][x]]) { - Cave[y+1][x] = Yball_eat; + Cave[y+1][x] = Yball_blank; Next[y+1][x] = lev.ball_array[lev.ball_pos][6]; } break; @@ -4360,7 +4419,7 @@ void synchro_2(void) if (lev.ball_array[lev.ball_pos][7] != Xblank && tab_blank[Cave[y+1][x+1]]) { - Cave[y+1][x+1] = Yball_eat; + Cave[y+1][x+1] = Yball_blank; Next[y+1][x+1] = lev.ball_array[lev.ball_pos][7]; } break; @@ -4371,95 +4430,96 @@ void synchro_2(void) if (lev.ball_array[lev.ball_pos][0] != Xblank && tab_blank[Cave[y-1][x-1]]) { - Cave[y-1][x-1] = Yball_eat; + Cave[y-1][x-1] = Yball_blank; Next[y-1][x-1] = lev.ball_array[lev.ball_pos][0]; } if (lev.ball_array[lev.ball_pos][1] != Xblank && tab_blank[Cave[y-1][x]]) { - Cave[y-1][x] = Yball_eat; + Cave[y-1][x] = Yball_blank; Next[y-1][x] = lev.ball_array[lev.ball_pos][1]; } if (lev.ball_array[lev.ball_pos][2] != Xblank && tab_blank[Cave[y-1][x+1]]) { - Cave[y-1][x+1] = Yball_eat; + Cave[y-1][x+1] = Yball_blank; Next[y-1][x+1] = lev.ball_array[lev.ball_pos][2]; } if (lev.ball_array[lev.ball_pos][3] != Xblank && tab_blank[Cave[y][x-1]]) { - Cave[y][x-1] = Yball_eat; + Cave[y][x-1] = Yball_blank; 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_eat; + 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_eat; + 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_eat; + 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_eat; + 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) & 7; + lev.ball_pos = (lev.ball_pos + 1) % lev.num_ball_arrays; + goto loop; /* --------------------------------------------------------------------- */ - case Xgrow_ns: + case Xslidewall_ns: if (tab_blank[Cave[y-1][x]]) { - Cave[y-1][x] = Ygrow_ns_eat; - Next[y-1][x] = Xgrow_ns; - play[SAMPLE_grow] = 1; + Cave[y-1][x] = Yslidewall_ns_blank; + Next[y-1][x] = Xslidewall_ns; + play_element_sound(x, y, SOUND_slidewall, Xslidewall_ns); } if (tab_blank[Cave[y+1][x]]) { - Cave[y+1][x] = Ygrow_ns_eat; - Next[y+1][x] = Xgrow_ns; - play[SAMPLE_grow] = 1; + Cave[y+1][x] = Yslidewall_ns_blank; + Next[y+1][x] = Xslidewall_ns; + play_element_sound(x, y, SOUND_slidewall, Xslidewall_ns); } goto loop; - case Xgrow_ew: + case Xslidewall_ew: if (tab_blank[Cave[y][x+1]]) { - Cave[y][x+1] = Ygrow_ew_eat; - Next[y][x+1] = Xgrow_ew; - play[SAMPLE_grow] = 1; + Cave[y][x+1] = Yslidewall_ew_blank; + Next[y][x+1] = Xslidewall_ew; + play_element_sound(x, y, SOUND_slidewall, Xslidewall_ew); } if (tab_blank[Cave[y][x-1]]) { - Cave[y][x-1] = Ygrow_ew_eat; - Next[y][x-1] = Xgrow_ew; - play[SAMPLE_grow] = 1; + Cave[y][x-1] = Yslidewall_ew_blank; + Next[y][x-1] = Xslidewall_ew; + play_element_sound(x, y, SOUND_slidewall, Xslidewall_ew); } goto loop; @@ -4470,7 +4530,7 @@ void synchro_2(void) if (lev.wonderwall_time && lev.wonderwall_state) { Cave[y][x] = XwonderwallB; - play[SAMPLE_wonder] = 1; + play_element_sound(x, y, SOUND_wonder, Xwonderwall); } goto loop; @@ -4498,6 +4558,8 @@ void synchro_2(void) Next[y][x] = Xexit_1; } + play_element_sound(x, y, SOUND_exit_open, Xexit); + goto loop; case Xexit_1: @@ -4515,22 +4577,22 @@ void synchro_2(void) /* --------------------------------------------------------------------- */ case Xdynamite_1: - play[SAMPLE_tick] = 1; + play_element_sound(x, y, SOUND_tick, Xdynamite_1); Next[y][x] = Xdynamite_2; goto loop; case Xdynamite_2: - play[SAMPLE_tick] = 1; + play_element_sound(x, y, SOUND_tick, Xdynamite_2); Next[y][x] = Xdynamite_3; goto loop; case Xdynamite_3: - play[SAMPLE_tick] = 1; + play_element_sound(x, y, SOUND_tick, Xdynamite_3); Next[y][x] = Xdynamite_4; goto loop; case Xdynamite_4: - play[SAMPLE_tick] = 1; + play_element_sound(x, y, SOUND_tick, Xdynamite_4); Next[y][x] = Zdynamite; Boom[y-1][x-1] = Xblank; Boom[y-1][x] = Xblank; @@ -4570,21 +4632,21 @@ void synchro_2(void) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[y][x] = Xsand_stonesand_3; + Cave[y][x] = Xsand_stonesand_quickout_1; if (Cave[y][x+1] == Xblank) - Cave[y][x+1] = Yacid_splash_eB; + Cave[y][x+1] = Xacid_splash_e; if (Cave[y][x-1] == Xblank) - Cave[y][x-1] = Yacid_splash_wB; - Next[y][x] = Xsand_stonesand_4; - PLAY(SAMPLE_acid); + Cave[y][x-1] = Xacid_splash_w; + Next[y][x] = Xsand_stonesand_quickout_2; + play_element_sound(x, y, SOUND_acid, Xacid_1); goto loop; case Xblank: - case Yacid_splash_eB: - case Yacid_splash_wB: - Cave[y][x] = Xsand_stonesand_3; + 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_4; + Next[y][x] = Xsand_stonesand_quickout_2; Next[y+1][x] = Xsand_stoneout_2; goto loop; @@ -4631,6 +4693,16 @@ void synchro_2(void) Next[y][x] = Xsand; goto loop; +#if 1 + case Xsand_stonesand_quickout_1: + Next[y][x] = Xsand_stonesand_quickout_2; + goto loop; + + case Xsand_stonesand_quickout_2: + Next[y][x] = Xsand; + goto loop; +#endif + case Xsand_stoneout_1: Next[y][x] = Xsand_stoneout_2; goto loop; @@ -4657,9 +4729,9 @@ void synchro_2(void) /* --------------------------------------------------------------------- */ - case Xdripper: + case Xfake_amoeba: if (lev.lenses_cnt) - Cave[y][x] = XdripperB; + Cave[y][x] = Xfake_amoebaB; goto loop; /* --------------------------------------------------------------------- */ @@ -4732,6 +4804,9 @@ void synchro_2(void) 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 goto loop; case Xboom_bomb: @@ -4748,12 +4823,23 @@ void synchro_2(void) 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 goto loop; case Xboom_android: +#if PLAY_ELEMENT_SOUND + play_element_sound(x, y, SOUND_boom, Xandroid); +#endif case Xboom_1: Next[y][x] = Xboom_2; - play[SAMPLE_boom] = 1; +#if !PLAY_ELEMENT_SOUND + if (x != lev.exit_x && y != lev.exit_y) + play_sound(x, y, SOUND_boom); + else + lev.exit_x = lev.exit_y = -1; +#endif goto loop; case Xboom_2: @@ -4762,7 +4848,7 @@ void synchro_2(void) /* --------------------------------------------------------------------- */ - case ZBORDER: + case Zborder: if (++y < HEIGHT - 1) { x = 0; @@ -4779,10 +4865,12 @@ void synchro_2(void) done: - if (ply1.alive || ply2.alive) - lev.score += score; /* only get a score if someone is alive */ + if (ply[0].alive || ply[1].alive || ply[2].alive || ply[3].alive) + lev.score += score; /* only add a score if someone is alive */ + else + game_em.game_over = TRUE; - Random = random; + RandomEM = random; { void *temp = Cave;