X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_em%2Flogic.c;h=3c68bfb9f73ea6250de9abf3ef47b29ec65ad8a1;hb=6eaf8f1f31cd229a7315063f4434389d00aa5cff;hp=d71c1d06e42ee317ea2153d9d931c2e693a44b27;hpb=f56483b6cfc5602fc93b26d92274897552b0741d;p=rocksndiamonds.git diff --git a/src/game_em/logic.c b/src/game_em/logic.c index d71c1d06..3c68bfb9 100644 --- a/src/game_em/logic.c +++ b/src/game_em/logic.c @@ -9,49 +9,242 @@ #define SPRING_ROLL /* spring rolling off round things continues to roll */ -#define USE_CHANGED_ACID_STUFF +#define ACID_ROLL /* rolling objects go into acid rather than remove it */ +#define ACID_PLAYER /* player gets killed by acid, but without explosion */ -#define RANDOM_RAW (seed = seed << 31 | seed >> 1) -#define RANDOM(x) (RANDOM_RAW & (x - 1)) +#define RANDOM(x) ((seed = seed << 31 | seed >> 1) % x) +static short **cave, **next, **boom; static unsigned int seed; static int score; +static const byte is_blank[GAME_TILE_MAX] = +{ + [Xblank] = 1, + [Xsplash_e] = 1, + [Xsplash_w] = 1, + [Xfake_acid_1] = 1, + [Xfake_acid_2] = 1, + [Xfake_acid_3] = 1, + [Xfake_acid_4] = 1, + [Xfake_acid_5] = 1, + [Xfake_acid_6] = 1, + [Xfake_acid_7] = 1, + [Xfake_acid_8] = 1 +}; + +static const byte is_blank_or_acid[GAME_TILE_MAX] = +{ + [Xblank] = 1, + [Xsplash_e] = 1, + [Xsplash_w] = 1, + [Xfake_acid_1] = 1, + [Xfake_acid_2] = 1, + [Xfake_acid_3] = 1, + [Xfake_acid_4] = 1, + [Xfake_acid_5] = 1, + [Xfake_acid_6] = 1, + [Xfake_acid_7] = 1, + [Xfake_acid_8] = 1, + [Xacid_1] = 1, + [Xacid_2] = 1, + [Xacid_3] = 1, + [Xacid_4] = 1, + [Xacid_5] = 1, + [Xacid_6] = 1, + [Xacid_7] = 1, + [Xacid_8] = 1 +}; + +static const byte is_fake_acid[GAME_TILE_MAX] = +{ + [Xfake_acid_1] = 1, + [Xfake_acid_2] = 1, + [Xfake_acid_3] = 1, + [Xfake_acid_4] = 1, + [Xfake_acid_5] = 1, + [Xfake_acid_6] = 1, + [Xfake_acid_7] = 1, + [Xfake_acid_8] = 1 +}; + +static const byte is_amoeba[GAME_TILE_MAX] = +{ + [Xfake_amoeba] = 1, + [Yfake_amoeba] = 1, + [Xamoeba_1] = 1, + [Xamoeba_2] = 1, + [Xamoeba_3] = 1, + [Xamoeba_4] = 1, + [Xamoeba_5] = 1, + [Xamoeba_6] = 1, + [Xamoeba_7] = 1, + [Xamoeba_8] = 1 +}; + +static byte is_android_blank[GAME_TILE_MAX] = +{ + [Xblank] = 1, + [Xsplash_e] = 1, + [Xsplash_w] = 1, + [Xfake_acid_1] = 1, + [Xfake_acid_2] = 1, + [Xfake_acid_3] = 1, + [Xfake_acid_4] = 1, + [Xfake_acid_5] = 1, + [Xfake_acid_6] = 1, + [Xfake_acid_7] = 1, + [Xfake_acid_8] = 1 +}; + +static const byte is_android_walkable[GAME_TILE_MAX] = +{ + [Xblank] = 1, + [Xsplash_e] = 1, + [Xsplash_w] = 1, + [Xfake_acid_1] = 1, + [Xfake_acid_2] = 1, + [Xfake_acid_3] = 1, + [Xfake_acid_4] = 1, + [Xfake_acid_5] = 1, + [Xfake_acid_6] = 1, + [Xfake_acid_7] = 1, + [Xfake_acid_8] = 1, + [Xplant] = 1 +}; + +static void Lboom_generic(int x, int y, int element, int element_middle) +{ + boom[x-1][y-1] = element; + boom[x][y-1] = element; + boom[x+1][y-1] = element; + boom[x-1][y] = element; + boom[x][y] = element_middle; + boom[x+1][y] = element; + boom[x-1][y+1] = element; + boom[x][y+1] = element; + boom[x+1][y+1] = element; +} + static void Lboom_bug(int x, int y) { - Next[x][y] = Znormal; - Boom[x-1][y-1] = Xemerald; - Boom[x][y-1] = Xemerald; - Boom[x+1][y-1] = Xemerald; - Boom[x-1][y] = Xemerald; - Boom[x][y] = Xdiamond; - Boom[x+1][y] = Xemerald; - Boom[x-1][y+1] = Xemerald; - Boom[x][y+1] = Xemerald; - Boom[x+1][y+1] = Xemerald; + if (game_em.use_old_explosions) + next[x][y] = Zbug; + + Lboom_generic(x, y, Xemerald, Xdiamond); #if PLAY_ELEMENT_SOUND - play_element_sound(x, y, SOUND_boom, element); + play_element_sound(x, y, SOUND_boom, Xbug_1_n); #endif } static void Lboom_tank(int x, int y) { - Next[x][y] = Znormal; - Boom[x-1][y-1] = Xblank; - Boom[x][y-1] = Xblank; - Boom[x+1][y-1] = Xblank; - Boom[x-1][y] = Xblank; - Boom[x][y] = Xblank; - Boom[x+1][y] = Xblank; - Boom[x-1][y+1] = Xblank; - Boom[x][y+1] = Xblank; - Boom[x+1][y+1] = Xblank; + if (game_em.use_old_explosions) + next[x][y] = Ztank; + + Lboom_generic(x, y, Xblank, Xblank); + +#if PLAY_ELEMENT_SOUND + play_element_sound(x, y, SOUND_boom, Xtank_1_n); +#endif +} + +static void Lboom_eater(int x, int y) +{ + if (game_em.use_old_explosions) + next[x][y] = Zeater; + + boom[x-1][y-1] = lev.eater_array[lev.eater_pos][0]; + boom[x][y-1] = lev.eater_array[lev.eater_pos][1]; + boom[x+1][y-1] = lev.eater_array[lev.eater_pos][2]; + boom[x-1][y] = lev.eater_array[lev.eater_pos][3]; + boom[x][y] = lev.eater_array[lev.eater_pos][4]; + boom[x+1][y] = lev.eater_array[lev.eater_pos][5]; + boom[x-1][y+1] = lev.eater_array[lev.eater_pos][6]; + boom[x][y+1] = lev.eater_array[lev.eater_pos][7]; + boom[x+1][y+1] = lev.eater_array[lev.eater_pos][8]; + + lev.eater_pos = (lev.eater_pos + 1) % 8; + #if PLAY_ELEMENT_SOUND - play_element_sound(x, y, SOUND_boom, element); + play_element_sound(x, y, SOUND_boom, Xeater_n); #endif } +static void Lboom_bug_old(int x, int y) +{ + if (!game_em.use_old_explosions) + return; + + Lboom_bug(x, y); +} + +static void Lboom_tank_old(int x, int y) +{ + if (!game_em.use_old_explosions) + return; + + Lboom_tank(x, y); +} + +static void Lboom_eater_old(int x, int y) +{ + if (!game_em.use_old_explosions) + return; + + Lboom_eater(x, y); +} + +static void Lboom_bug_new(int x, int y, boolean chain_explosion) +{ + if (game_em.use_old_explosions) + return; + + if (chain_explosion) + cave[x][y] = Xchain; + + Lboom_bug(x, y); +} + +static void Lboom_tank_new(int x, int y, boolean chain_explosion) +{ + if (game_em.use_old_explosions) + return; + + if (chain_explosion) + cave[x][y] = Xchain; + + Lboom_tank(x, y); +} + +static void Lboom_eater_new(int x, int y, boolean chain_explosion) +{ + if (game_em.use_old_explosions) + return; + + if (chain_explosion) + cave[x][y] = Xchain; + + Lboom_eater(x, y); +} + +static void Lboom_cave_new(int x, int y, int element) +{ + if (game_em.use_old_explosions) + return; + + cave[x][y] = element; +} + +static void Lboom_next_new(int x, int y, int element) +{ + if (game_em.use_old_explosions) + return; + + next[x][y] = element; +} + static boolean player_killed(struct PLAYER *ply) { int x = ply->x; @@ -63,7 +256,7 @@ static boolean player_killed(struct PLAYER *ply) if (lev.killed_out_of_time && setup.time_limit) return TRUE; - switch(Cave[x][y-1]) + switch (cave[x][y-1]) { case Xbug_1_n: case Xbug_1_e: @@ -84,7 +277,7 @@ static boolean player_killed(struct PLAYER *ply) return TRUE; } - switch(Cave[x+1][y]) + switch (cave[x+1][y]) { case Xbug_1_n: case Xbug_1_e: @@ -105,7 +298,7 @@ static boolean player_killed(struct PLAYER *ply) return TRUE; } - switch(Cave[x][y+1]) + switch (cave[x][y+1]) { case Xbug_1_n: case Xbug_1_e: @@ -126,7 +319,7 @@ static boolean player_killed(struct PLAYER *ply) return TRUE; } - switch(Cave[x-1][y]) + switch (cave[x-1][y]) { case Xbug_1_n: case Xbug_1_e: @@ -147,17 +340,12 @@ static boolean player_killed(struct PLAYER *ply) return TRUE; } - switch(Cave[x][y]) + switch (cave[x][y]) { - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: case Zplayer: - case Xdynamite_1: - case Xdynamite_2: - case Xdynamite_3: - case Xdynamite_4: -#ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS + case Xblank: + case Xsplash_e: + case Xsplash_w: case Xfake_acid_1: case Xfake_acid_2: case Xfake_acid_3: @@ -166,7 +354,10 @@ static boolean player_killed(struct PLAYER *ply) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xdynamite_1: + case Xdynamite_2: + case Xdynamite_3: + case Xdynamite_4: return FALSE; } @@ -178,9 +369,9 @@ static void kill_player(struct PLAYER *ply) int x = ply->x; int y = ply->y; - ply->alive = 0; + ply->alive = FALSE; - switch(Cave[x][y-1]) + switch (cave[x][y-1]) { case Xbug_1_n: case Xbug_1_e: @@ -190,7 +381,8 @@ static void kill_player(struct PLAYER *ply) case Xbug_2_e: case Xbug_2_s: case Xbug_2_w: - Cave[x][y-1] = Xboom_bug; + cave[x][y-1] = Xboom_bug; + Lboom_bug_new(x, y-1, TRUE); break; case Xtank_1_n: @@ -201,11 +393,12 @@ static void kill_player(struct PLAYER *ply) case Xtank_2_e: case Xtank_2_s: case Xtank_2_w: - Cave[x][y-1] = Xboom_bomb; + cave[x][y-1] = Xboom_tank; + Lboom_tank_new(x, y-1, TRUE); break; } - switch(Cave[x+1][y]) + switch (cave[x+1][y]) { case Xbug_1_n: case Xbug_1_e: @@ -215,7 +408,8 @@ static void kill_player(struct PLAYER *ply) case Xbug_2_e: case Xbug_2_s: case Xbug_2_w: - Cave[x+1][y] = Xboom_bug; + cave[x+1][y] = Xboom_bug; + Lboom_bug_new(x+1, y, TRUE); break; case Xtank_1_n: @@ -226,11 +420,12 @@ static void kill_player(struct PLAYER *ply) case Xtank_2_e: case Xtank_2_s: case Xtank_2_w: - Cave[x+1][y] = Xboom_bomb; + cave[x+1][y] = Xboom_tank; + Lboom_tank_new(x+1, y, TRUE); break; } - switch(Cave[x][y+1]) + switch (cave[x][y+1]) { case Xbug_1_n: case Xbug_1_e: @@ -240,7 +435,8 @@ static void kill_player(struct PLAYER *ply) case Xbug_2_e: case Xbug_2_s: case Xbug_2_w: - Cave[x][y+1] = Xboom_bug; + cave[x][y+1] = Xboom_bug; + Lboom_bug_new(x, y+1, TRUE); break; case Xtank_1_n: @@ -251,11 +447,12 @@ static void kill_player(struct PLAYER *ply) case Xtank_2_e: case Xtank_2_s: case Xtank_2_w: - Cave[x][y+1] = Xboom_bomb; + cave[x][y+1] = Xboom_tank; + Lboom_tank_new(x, y+1, TRUE); break; } - switch(Cave[x-1][y]) + switch (cave[x-1][y]) { case Xbug_1_n: case Xbug_1_e: @@ -265,7 +462,8 @@ static void kill_player(struct PLAYER *ply) case Xbug_2_e: case Xbug_2_s: case Xbug_2_w: - Cave[x-1][y] = Xboom_bug; + cave[x-1][y] = Xboom_bug; + Lboom_bug_new(x-1, y, TRUE); break; case Xtank_1_n: @@ -276,11 +474,12 @@ static void kill_player(struct PLAYER *ply) case Xtank_2_e: case Xtank_2_s: case Xtank_2_w: - Cave[x-1][y] = Xboom_bomb; + cave[x-1][y] = Xboom_tank; + Lboom_tank_new(x-1, y, TRUE); break; } - switch(Cave[x][y]) + switch (cave[x][y]) { case Xexit_1: case Xexit_2: @@ -295,9 +494,9 @@ static void kill_player(struct PLAYER *ply) break; } - switch(Cave[x][y]) + switch (cave[x][y]) { -#ifdef USE_CHANGED_ACID_STUFF +#ifdef ACID_PLAYER case Xacid_1: case Xacid_2: case Xacid_3: @@ -310,8 +509,8 @@ static void kill_player(struct PLAYER *ply) #endif default: - Cave[x][y] = Xboom_1; - Boom[x][y] = Xblank; + cave[x][y] = Xboom_1; + boom[x][y] = Xblank; break; } } @@ -331,19 +530,20 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) if (dx && dy && ply->joy_snap) /* more than one direction specified */ return FALSE; - if (ply->joy_snap == 0) /* player wants to move */ + if (!ply->joy_snap) /* player wants to move */ { - int element = Cave[x][y]; + int element = cave[x][y]; - switch(Cave[x][y]) + switch (cave[x][y]) { /* fire is released */ case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Zplayer; - Next[x][y] = Zplayer; -#ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS + case Xsplash_e: + case Xsplash_w: + cave[x][y] = Zplayer; + next[x][y] = Zplayer; + // FALL THROUGH + case Xfake_acid_1: case Xfake_acid_2: case Xfake_acid_3: @@ -352,14 +552,12 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif play_element_sound(x, y, SOUND_blank, Xblank); ply->anim = PLY_walk_n + anim; ply->x = x; ply->y = y; break; -#ifdef USE_CHANGED_ACID_STUFF case Xacid_1: case Xacid_2: case Xacid_3: @@ -368,13 +566,14 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xacid_6: case Xacid_7: case Xacid_8: - if (Cave[x+1][y-1] == Xblank) - Cave[x+1][y-1] = Xacid_splash_e; - if (Cave[x-1][y-1] == Xblank) - Cave[x-1][y-1] = Xacid_splash_w; +#ifdef ACID_PLAYER + if (cave[x+1][y-1] == Xblank) + cave[x+1][y-1] = Xsplash_e; + if (cave[x-1][y-1] == Xblank) + cave[x-1][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); + // FALL THROUGH #endif - case Xboom_android: case Xboom_1: case Xbug_1_n: @@ -393,26 +592,15 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xtank_2_e: case Xtank_2_s: case Xtank_2_w: - -#ifndef USE_CHANGED_ACID_STUFF - case Xacid_1: - case Xacid_2: - case Xacid_3: - case Xacid_4: - case Xacid_5: - case Xacid_6: - case Xacid_7: - case Xacid_8: -#endif ply->anim = PLY_walk_n + anim; ply->x = x; ply->y = y; break; case Xgrass: - Cave[x][y] = (dy ? (dy < 0 ? Ygrass_nB : Ygrass_sB) : + cave[x][y] = (dy ? (dy < 0 ? Ygrass_nB : Ygrass_sB) : (dx > 0 ? Ygrass_eB : Ygrass_wB)); - Next[x][y] = Zplayer; + next[x][y] = Zplayer; play_element_sound(x, y, SOUND_dirt, Xgrass); ply->anim = PLY_walk_n + anim; ply->x = x; @@ -420,9 +608,9 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) break; case Xdirt: - Cave[x][y] = (dy ? (dy < 0 ? Ydirt_nB : Ydirt_sB) : + cave[x][y] = (dy ? (dy < 0 ? Ydirt_nB : Ydirt_sB) : (dx > 0 ? Ydirt_eB : Ydirt_wB)); - Next[x][y] = Zplayer; + next[x][y] = Zplayer; play_element_sound(x, y, SOUND_dirt, Xdirt); ply->anim = PLY_walk_n + anim; ply->x = x; @@ -431,11 +619,11 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xdiamond: case Xdiamond_pause: - Cave[x][y] = Ydiamond_blank; - Next[x][y] = Zplayer; + cave[x][y] = Ydiamond_blank; + next[x][y] = Zplayer; play_element_sound(x, y, SOUND_collect, element); lev.score += lev.diamond_score; - lev.required = lev.required < 3 ? 0 : lev.required - 3; + lev.gems_needed = lev.gems_needed < 3 ? 0 : lev.gems_needed - 3; game.snapshot.collected_item = TRUE; ply->anim = PLY_walk_n + anim; ply->x = x; @@ -444,11 +632,11 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xemerald: case Xemerald_pause: - Cave[x][y] = Yemerald_blank; - Next[x][y] = Zplayer; + cave[x][y] = Yemerald_blank; + next[x][y] = Zplayer; play_element_sound(x, y, SOUND_collect, element); lev.score += lev.emerald_score; - lev.required = lev.required < 1 ? 0 : lev.required - 1; + lev.gems_needed = lev.gems_needed < 1 ? 0 : lev.gems_needed - 1; game.snapshot.collected_item = TRUE; ply->anim = PLY_walk_n + anim; ply->x = x; @@ -456,8 +644,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) break; case Xdynamite: - Cave[x][y] = Ydynamite_blank; - Next[x][y] = Zplayer; + cave[x][y] = Ydynamite_blank; + next[x][y] = Zplayer; play_element_sound(x, y, SOUND_collect, element); lev.score += lev.dynamite_score; ply->dynamite = ply->dynamite > 9998 ? 9999 : ply->dynamite + 1; @@ -468,47 +656,47 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xkey_1: ply->keys |= 0x01; - Cave[x][y] = Ykey_1_blank; + cave[x][y] = Ykey_1_blank; goto key_walk; case Xkey_2: ply->keys |= 0x02; - Cave[x][y] = Ykey_2_blank; + cave[x][y] = Ykey_2_blank; goto key_walk; case Xkey_3: ply->keys |= 0x04; - Cave[x][y] = Ykey_3_blank; + cave[x][y] = Ykey_3_blank; goto key_walk; case Xkey_4: ply->keys |= 0x08; - Cave[x][y] = Ykey_4_blank; + cave[x][y] = Ykey_4_blank; goto key_walk; case Xkey_5: ply->keys |= 0x10; - Cave[x][y] = Ykey_5_blank; + cave[x][y] = Ykey_5_blank; goto key_walk; case Xkey_6: ply->keys |= 0x20; - Cave[x][y] = Ykey_6_blank; + cave[x][y] = Ykey_6_blank; goto key_walk; case Xkey_7: ply->keys |= 0x40; - Cave[x][y] = Ykey_7_blank; + cave[x][y] = Ykey_7_blank; goto key_walk; case Xkey_8: ply->keys |= 0x80; - Cave[x][y] = Ykey_8_blank; + cave[x][y] = Ykey_8_blank; goto key_walk; key_walk: - Next[x][y] = Zplayer; + next[x][y] = Zplayer; play_element_sound(x, y, SOUND_collect, element); lev.score += lev.key_score; ply->anim = PLY_walk_n + anim; @@ -517,8 +705,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) break; case Xlenses: - Cave[x][y] = Ylenses_blank; - Next[x][y] = Zplayer; + cave[x][y] = Ylenses_blank; + next[x][y] = Zplayer; play_element_sound(x, y, SOUND_collect, element); lev.score += lev.lenses_score; lev.lenses_cnt = lev.lenses_time; @@ -528,8 +716,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) break; case Xmagnify: - Cave[x][y] = Ymagnify_blank; - Next[x][y] = Zplayer; + cave[x][y] = Ymagnify_blank; + next[x][y] = Zplayer; play_element_sound(x, y, SOUND_collect, element); lev.score += lev.magnify_score; lev.magnify_cnt = lev.magnify_time; @@ -542,8 +730,23 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) if (dy) break; - switch(Cave[x+dx][y]) + switch (cave[x+dx][y]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x+dx][y] = dx > 0 ? Ystone_e : Ystone_w; + next[x+dx][y] = Xstone_pause; + goto stone_walk; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -552,25 +755,19 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xacid_6: case Xacid_7: case Xacid_8: - if (Cave[x+dx+1][y-1] == Xblank) - Cave[x+dx+1][y-1] = Xacid_splash_e; - if (Cave[x+dx-1][y-1] == Xblank) - Cave[x+dx-1][y-1] = Xacid_splash_w; + if (cave[x+dx+1][y-1] == Xblank) + cave[x+dx+1][y-1] = Xsplash_e; + if (cave[x+dx-1][y-1] == Xblank) + cave[x+dx-1][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); - goto stone_walk; - - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x+dx][y] = dx > 0 ? Ystone_e : Ystone_w; - Next[x+dx][y] = Xstone_pause; stone_walk: - Cave[x][y] = dx > 0 ? Ystone_eB : Ystone_wB; - Next[x][y] = Zplayer; + cave[x][y] = dx > 0 ? Ystone_eB : Ystone_wB; + next[x][y] = Zplayer; play_element_sound(x, y, SOUND_roll, Xstone); ply->x = x; + break; } ply->anim = PLY_push_n + anim; @@ -580,8 +777,23 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) if (dy) break; - switch(Cave[x+dx][y]) + switch (cave[x+dx][y]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x+dx][y] = dx > 0 ? Ybomb_e : Ybomb_w; + next[x+dx][y] = Xbomb_pause; + goto bomb_walk; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -590,25 +802,19 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xacid_6: case Xacid_7: case Xacid_8: - if (Cave[x+dx+1][y-1] == Xblank) - Cave[x+dx+1][y-1] = Xacid_splash_e; - if (Cave[x+dx-1][y-1] == Xblank) - Cave[x+dx-1][y-1] = Xacid_splash_w; + if (cave[x+dx+1][y-1] == Xblank) + cave[x+dx+1][y-1] = Xsplash_e; + if (cave[x+dx-1][y-1] == Xblank) + cave[x+dx-1][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); - goto bomb_walk; - - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x+dx][y] = dx > 0 ? Ybomb_e : Ybomb_w; - Next[x+dx][y] = Xbomb_pause; bomb_walk: - Cave[x][y] = dx > 0 ? Ybomb_eB : Ybomb_wB; - Next[x][y] = Zplayer; + cave[x][y] = dx > 0 ? Ybomb_eB : Ybomb_wB; + next[x][y] = Zplayer; play_element_sound(x, y, SOUND_roll, Xbomb); ply->x = x; + break; } ply->anim = PLY_push_n + anim; @@ -618,8 +824,23 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) if (dy) break; - switch(Cave[x+dx][y]) + switch (cave[x+dx][y]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x+dx][y] = dx > 0 ? Ynut_e : Ynut_w; + next[x+dx][y] = Xnut_pause; + goto nut_walk; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -628,25 +849,19 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xacid_6: case Xacid_7: case Xacid_8: - if (Cave[x+dx+1][y-1] == Xblank) - Cave[x+dx+1][y-1] = Xacid_splash_e; - if (Cave[x+dx-1][y-1] == Xblank) - Cave[x+dx-1][y-1] = Xacid_splash_w; + if (cave[x+dx+1][y-1] == Xblank) + cave[x+dx+1][y-1] = Xsplash_e; + if (cave[x+dx-1][y-1] == Xblank) + cave[x+dx-1][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); - goto nut_walk; - - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x+dx][y] = dx > 0 ? Ynut_e : Ynut_w; - Next[x+dx][y] = Xnut_pause; nut_walk: - Cave[x][y] = dx > 0 ? Ynut_eB : Ynut_wB; - Next[x][y] = Zplayer; + cave[x][y] = dx > 0 ? Ynut_eB : Ynut_wB; + next[x][y] = Zplayer; play_element_sound(x, y, SOUND_roll, Xnut); ply->x = x; + break; } ply->anim = PLY_push_n + anim; @@ -656,18 +871,22 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) if (dy) break; - switch(Cave[x+dx][y]) + switch (cave[x+dx][y]) { - case Xalien: - case Xalien_pause: - Cave[x][y] = dx > 0 ? Yspring_alien_eB : Yspring_alien_wB; - Cave[x+dx][y] = dx > 0 ? Yspring_alien_e : Yspring_alien_w; - Next[x][y] = Zplayer; - Next[x+dx][y] = dx > 0 ? Xspring_e : Xspring_w; - play_element_sound(x, y, SOUND_slurp, Xalien); - lev.score += lev.slurp_score; - ply->x = x; - break; + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x+dx][y] = dx > 0 ? Yspring_e : Yspring_w; + next[x+dx][y] = dx > 0 ? Xspring_e : Xspring_w; + goto spring_walk; case Xacid_1: case Xacid_2: @@ -677,24 +896,30 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xacid_6: case Xacid_7: case Xacid_8: - if (Cave[x+dx+1][y-1] == Xblank) - Cave[x+dx+1][y-1] = Xacid_splash_e; - if (Cave[x+dx-1][y-1] == Xblank) - Cave[x+dx-1][y-1] = Xacid_splash_w; + if (cave[x+dx+1][y-1] == Xblank) + cave[x+dx+1][y-1] = Xsplash_e; + if (cave[x+dx-1][y-1] == Xblank) + cave[x+dx-1][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); - goto spring_walk; - - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x+dx][y] = dx > 0 ? Yspring_e : Yspring_w; - Next[x+dx][y] = dx > 0 ? Xspring_e : Xspring_w; spring_walk: - Cave[x][y] = dx > 0 ? Yspring_eB : Yspring_wB; - Next[x][y] = Zplayer; + + cave[x][y] = dx > 0 ? Yspring_eB : Yspring_wB; + next[x][y] = Zplayer; play_element_sound(x, y, SOUND_roll, Xspring); ply->x = x; + break; + + case Xalien: + case Xalien_pause: + cave[x][y] = dx > 0 ? Yspring_alien_eB : Yspring_alien_wB; + cave[x+dx][y] = dx > 0 ? Yspring_alien_e : Yspring_alien_w; + next[x][y] = Zplayer; + next[x+dx][y] = dx > 0 ? Xspring_e : Xspring_w; + play_element_sound(x, y, SOUND_slurp, Xalien); + lev.score += lev.slurp_score; + ply->x = x; + break; } ply->anim = PLY_push_n + anim; @@ -715,8 +940,24 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) break; case Xballoon: - switch(Cave[x+dx][y+dy]) + switch (cave[x+dx][y+dy]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x+dx][y+dy] = (dy ? (dy < 0 ? Yballoon_n : Yballoon_s) : + (dx > 0 ? Yballoon_e : Yballoon_w)); + next[x+dx][y+dy] = Xballoon; + goto balloon_walk; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -725,27 +966,21 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xacid_6: case Xacid_7: case Xacid_8: - if (Cave[x+dx+1][y+dy-1] == Xblank) - Cave[x+dx+1][y+dy-1] = Xacid_splash_e; - if (Cave[x+dx-1][y+dy-1] == Xblank) - Cave[x+dx-1][y+dy-1] = Xacid_splash_w; + if (cave[x+dx+1][y+dy-1] == Xblank) + cave[x+dx+1][y+dy-1] = Xsplash_e; + if (cave[x+dx-1][y+dy-1] == Xblank) + cave[x+dx-1][y+dy-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); - goto balloon_walk; - - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x+dx][y+dy] = (dy ? (dy < 0 ? Yballoon_n : Yballoon_s) : - (dx > 0 ? Yballoon_e : Yballoon_w)); - Next[x+dx][y+dy] = Xballoon; balloon_walk: - Cave[x][y] = (dy ? (dy < 0 ? Yballoon_nB : Yballoon_sB) : + + cave[x][y] = (dy ? (dy < 0 ? Yballoon_nB : Yballoon_sB) : (dx > 0 ? Yballoon_eB : Yballoon_wB)); - Next[x][y] = Zplayer; + next[x][y] = Zplayer; play_element_sound(x, y, SOUND_push, Xballoon); ply->x = x; ply->y = y; + break; } ply->anim = PLY_push_n + anim; @@ -760,8 +995,25 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xandroid_2_s: case Xandroid_1_w: case Xandroid_2_w: - switch(Cave[x+dx][y+dy]) + switch (cave[x+dx][y+dy]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x+dx][y+dy] = (dy ? (dy < 0 ? Yandroid_n : Yandroid_s) : + (dx > 0 ? Yandroid_e : Yandroid_w)); + next[x+dx][y+dy] = (dy ? (dy < 0 ? Xandroid_2_n : Xandroid_2_s) : + (dx > 0 ? Xandroid_2_e : Xandroid_2_w)); + goto android_walk; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -770,28 +1022,21 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xacid_6: case Xacid_7: case Xacid_8: - if (Cave[x+dx+1][y+dy-1] == Xblank) - Cave[x+dx+1][y+dy-1] = Xacid_splash_e; - if (Cave[x+dx-1][y+dy-1] == Xblank) - Cave[x+dx-1][y+dy-1] = Xacid_splash_w; + if (cave[x+dx+1][y+dy-1] == Xblank) + cave[x+dx+1][y+dy-1] = Xsplash_e; + if (cave[x+dx-1][y+dy-1] == Xblank) + cave[x+dx-1][y+dy-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); - goto android_walk; - - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x+dx][y+dy] = (dy ? (dy < 0 ? Yandroid_n : Yandroid_s) : - (dx > 0 ? Yandroid_e : Yandroid_w)); - Next[x+dx][y+dy] = (dy ? (dy < 0 ? Xandroid_2_n : Xandroid_2_s) : - (dx > 0 ? Xandroid_2_e : Xandroid_2_w)); android_walk: - Cave[x][y] = (dy ? (dy < 0 ? Yandroid_nB : Yandroid_sB) : + + cave[x][y] = (dy ? (dy < 0 ? Yandroid_nB : Yandroid_sB) : (dx > 0 ? Yandroid_eB : Yandroid_wB)); - Next[x][y] = Zplayer; + next[x][y] = Zplayer; play_element_sound(x, y, SOUND_push, Xandroid); ply->x = x; ply->y = y; + break; } ply->anim = PLY_push_n + anim; @@ -854,11 +1099,16 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) break; door_walk: - if (!tab_blank[Cave[x+dx][y+dy]]) + + if (!is_blank[cave[x+dx][y+dy]]) break; - Cave[x+dx][y+dy] = Zplayer; - Next[x+dx][y+dy] = Zplayer; + if (!is_fake_acid[cave[x+dx][y+dy]]) + { + cave[x+dx][y+dy] = Zplayer; + next[x+dx][y+dy] = Zplayer; + } + play_element_sound(x, y, SOUND_door, element); ply->anim = PLY_walk_n + anim; ply->x = x + dx; @@ -893,6 +1143,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) goto wind_walk; wind_walk: + play_element_sound(x, y, SOUND_press, element); lev.wind_cnt = lev.wind_time; break; @@ -905,12 +1156,12 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xswitch: play_element_sound(x, y, SOUND_press, element); lev.ball_cnt = lev.ball_time; - lev.ball_state = !lev.ball_state; + lev.ball_active = !lev.ball_active; break; case Xplant: - Cave[x][y] = Yplant; - Next[x][y] = Xplant; + cave[x][y] = Yplant; + next[x][y] = Xplant; play_element_sound(x, y, SOUND_blank, Xplant); ply->anim = PLY_walk_n + anim; ply->x = x; @@ -937,51 +1188,51 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) } else /* player wants to snap */ { - int element = Cave[x][y]; + int element = cave[x][y]; - switch(Cave[x][y]) + switch (cave[x][y]) { /* fire is pressed */ case Xgrass: - Cave[x][y] = Ygrass_blank; - Next[x][y] = Xblank; + cave[x][y] = Ygrass_blank; + next[x][y] = Xblank; play_element_sound(x, y, SOUND_dirt, element); ply->anim = PLY_shoot_n + anim; break; case Xdirt: - Cave[x][y] = Ydirt_blank; - Next[x][y] = Xblank; + cave[x][y] = Ydirt_blank; + next[x][y] = Xblank; play_element_sound(x, y, SOUND_dirt, element); ply->anim = PLY_shoot_n + anim; break; case Xdiamond: case Xdiamond_pause: - Cave[x][y] = Ydiamond_blank; - Next[x][y] = Xblank; + cave[x][y] = Ydiamond_blank; + next[x][y] = Xblank; play_element_sound(x, y, SOUND_collect, element); lev.score += lev.diamond_score; - lev.required = lev.required < 3 ? 0 : lev.required - 3; + lev.gems_needed = lev.gems_needed < 3 ? 0 : lev.gems_needed - 3; game.snapshot.collected_item = TRUE; ply->anim = PLY_walk_n + anim; break; case Xemerald: case Xemerald_pause: - Cave[x][y] = Yemerald_blank; - Next[x][y] = Xblank; + cave[x][y] = Yemerald_blank; + next[x][y] = Xblank; play_element_sound(x, y, SOUND_collect, element); lev.score += lev.emerald_score; - lev.required = lev.required < 1 ? 0 : lev.required - 1; + lev.gems_needed = lev.gems_needed < 1 ? 0 : lev.gems_needed - 1; game.snapshot.collected_item = TRUE; ply->anim = PLY_walk_n + anim; break; case Xdynamite: - Cave[x][y] = Ydynamite_blank; - Next[x][y] = Xblank; + cave[x][y] = Ydynamite_blank; + next[x][y] = Xblank; play_element_sound(x, y, SOUND_collect, element); lev.score += lev.dynamite_score; ply->dynamite = ply->dynamite > 9998 ? 9999 : ply->dynamite + 1; @@ -990,54 +1241,55 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xkey_1: ply->keys |= 0x01; - Cave[x][y] = Ykey_1_blank; + cave[x][y] = Ykey_1_blank; goto key_shoot; case Xkey_2: ply->keys |= 0x02; - Cave[x][y] = Ykey_2_blank; + cave[x][y] = Ykey_2_blank; goto key_shoot; case Xkey_3: ply->keys |= 0x04; - Cave[x][y] = Ykey_3_blank; + cave[x][y] = Ykey_3_blank; goto key_shoot; case Xkey_4: ply->keys |= 0x08; - Cave[x][y] = Ykey_4_blank; + cave[x][y] = Ykey_4_blank; goto key_shoot; case Xkey_5: ply->keys |= 0x10; - Cave[x][y] = Ykey_5_blank; + cave[x][y] = Ykey_5_blank; goto key_shoot; case Xkey_6: ply->keys |= 0x20; - Cave[x][y] = Ykey_6_blank; + cave[x][y] = Ykey_6_blank; goto key_shoot; case Xkey_7: ply->keys |= 0x40; - Cave[x][y] = Ykey_7_blank; + cave[x][y] = Ykey_7_blank; goto key_shoot; case Xkey_8: ply->keys |= 0x80; - Cave[x][y] = Ykey_8_blank; + cave[x][y] = Ykey_8_blank; goto key_shoot; key_shoot: - Next[x][y] = Xblank; + + next[x][y] = Xblank; play_element_sound(x, y, SOUND_collect, element); lev.score += lev.key_score; ply->anim = PLY_walk_n + anim; break; case Xlenses: - Cave[x][y] = Ylenses_blank; - Next[x][y] = Xblank; + cave[x][y] = Ylenses_blank; + next[x][y] = Xblank; play_element_sound(x, y, SOUND_collect, element); lev.score += lev.lenses_score; lev.lenses_cnt = lev.lenses_time; @@ -1045,8 +1297,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) break; case Xmagnify: - Cave[x][y] = Ymagnify_blank; - Next[x][y] = Xblank; + cave[x][y] = Ymagnify_blank; + next[x][y] = Xblank; play_element_sound(x, y, SOUND_collect, element); lev.score += lev.magnify_score; lev.magnify_cnt = lev.magnify_time; @@ -1058,6 +1310,11 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) } } + /* check for wrap-around movement */ + if (ply->x < lev.left || + ply->x > lev.right - 1) + play_element_sound(oldx, oldy, SOUND_door, Xdoor_1); + return result; } @@ -1125,7 +1382,10 @@ static void check_player(struct PLAYER *ply) if (!can_move) { - ply->joy_n = ply->joy_e = ply->joy_s = ply->joy_w = 0; + ply->joy_n = FALSE; + ply->joy_e = FALSE; + ply->joy_s = FALSE; + ply->joy_w = FALSE; return; } @@ -1133,13 +1393,13 @@ static void check_player(struct PLAYER *ply) if (dx == 0 && dy == 0) { - ply->joy_stick = 0; + ply->joy_stick = FALSE; if (ply->joy_drop) { if (++ply->dynamite_cnt == 5 && ply->dynamite) { - Cave[x][y] = Xdynamite_1; + cave[x][y] = Xdynamite_1; play_element_sound(x, y, SOUND_dynamite, Xdynamite_1); ply->dynamite--; } @@ -1149,17 +1409,21 @@ static void check_player(struct PLAYER *ply) ply->dynamite_cnt = 0; } - RandomEM += 7; /* be a bit more random if the player doesn't move */ + /* be a bit more random if the player doesn't move */ + game_em.random += 7; return; } - ply->joy_stick = 1; - ply->joy_n = ply->joy_e = ply->joy_s = ply->joy_w = 0; + ply->joy_stick = TRUE; + ply->joy_n = FALSE; + ply->joy_e = FALSE; + ply->joy_s = FALSE; + ply->joy_w = FALSE; + ply->dynamite_cnt = 0; /* reset dynamite timer if we move */ - ply->joy_spin = !ply->joy_spin; - if (ply->joy_snap == 0) /* player wants to move */ + if (!ply->joy_snap) /* player wants to move */ { boolean moved = FALSE; @@ -1194,7 +1458,7 @@ static void check_player(struct PLAYER *ply) 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 distance, distance_shortest = CAVE_WIDTH + CAVE_HEIGHT; int i; /* default values if no players are alive anymore */ @@ -1220,85 +1484,83 @@ static void set_nearest_player_xy(int x, int y, int *dx, int *dy) static void Lacid_1(int x, int y) { - Next[x][y] = Xacid_2; + next[x][y] = Xacid_2; } static void Lacid_2(int x, int y) { - Next[x][y] = Xacid_3; + next[x][y] = Xacid_3; } static void Lacid_3(int x, int y) { - Next[x][y] = Xacid_4; + next[x][y] = Xacid_4; } static void Lacid_4(int x, int y) { - Next[x][y] = Xacid_5; + next[x][y] = Xacid_5; } static void Lacid_5(int x, int y) { - Next[x][y] = Xacid_6; + next[x][y] = Xacid_6; } static void Lacid_6(int x, int y) { - Next[x][y] = Xacid_7; + next[x][y] = Xacid_7; } static void Lacid_7(int x, int y) { - Next[x][y] = Xacid_8; + next[x][y] = Xacid_8; } static void Lacid_8(int x, int y) { - Next[x][y] = Xacid_1; + next[x][y] = Xacid_1; } -#ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS static void Lfake_acid_1(int x, int y) { - Next[x][y] = Xfake_acid_2; + next[x][y] = Xfake_acid_2; } static void Lfake_acid_2(int x, int y) { - Next[x][y] = Xfake_acid_3; + next[x][y] = Xfake_acid_3; } static void Lfake_acid_3(int x, int y) { - Next[x][y] = Xfake_acid_4; + next[x][y] = Xfake_acid_4; } static void Lfake_acid_4(int x, int y) { - Next[x][y] = Xfake_acid_5; + next[x][y] = Xfake_acid_5; } static void Lfake_acid_5(int x, int y) { - Next[x][y] = Xfake_acid_6; + next[x][y] = Xfake_acid_6; } static void Lfake_acid_6(int x, int y) { - Next[x][y] = Xfake_acid_7; + next[x][y] = Xfake_acid_7; } static void Lfake_acid_7(int x, int y) { - Next[x][y] = Xfake_acid_8; + next[x][y] = Xfake_acid_8; } static void Lfake_acid_8(int x, int y) { - Next[x][y] = Xfake_acid_1; + next[x][y] = Xfake_acid_1; } -#endif static void Landroid(int x, int y) { @@ -1306,14 +1568,14 @@ static void Landroid(int x, int y) if (lev.android_clone_cnt == 0) { - if (Cave[x-1][y-1] != Xblank && - Cave[x][y-1] != Xblank && - Cave[x+1][y-1] != Xblank && - Cave[x-1][y] != Xblank && - Cave[x+1][y] != Xblank && - Cave[x-1][y+1] != Xblank && - Cave[x][y+1] != Xblank && - Cave[x+1][y+1] != Xblank) + if (!is_android_blank[cave[x-1][y-1]] && + !is_android_blank[cave[x][y-1]] && + !is_android_blank[cave[x+1][y-1]] && + !is_android_blank[cave[x-1][y]] && + !is_android_blank[cave[x+1][y]] && + !is_android_blank[cave[x-1][y+1]] && + !is_android_blank[cave[x][y+1]] && + !is_android_blank[cave[x+1][y+1]]) goto android_move; switch (RANDOM(8)) @@ -1321,95 +1583,95 @@ static void Landroid(int x, int y) /* randomly find an object to clone */ case 0: /* S,NE,W,NW,SE,E,SW,N */ - temp = lev.android_array[Cave[x][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x][y-1]]; if (temp != Xblank) break; goto android_move; case 1: /* NW,SE,N,S,NE,SW,E,W */ - temp = lev.android_array[Cave[x-1][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y]]; if (temp != Xblank) break; goto android_move; case 2: /* SW,E,S,W,N,NW,SE,NE */ - temp = lev.android_array[Cave[x-1][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y-1]]; if (temp != Xblank) break; goto android_move; case 3: /* N,SE,NE,E,W,S,NW,SW */ - temp = lev.android_array[Cave[x][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y+1]]; if (temp != Xblank) break; goto android_move; case 4: /* SE,NW,E,NE,SW,W,N,S */ - temp = lev.android_array[Cave[x+1][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x][y+1]]; if (temp != Xblank) break; goto android_move; case 5: /* NE,W,SE,SW,S,N,E,NW */ - temp = lev.android_array[Cave[x+1][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y-1]]; if (temp != Xblank) break; goto android_move; case 6: /* E,N,SW,S,NW,NE,SE,W */ - temp = lev.android_array[Cave[x+1][y]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y]]; if (temp != Xblank) break; goto android_move; case 7: /* W,SW,NW,N,E,SE,NE,S */ - temp = lev.android_array[Cave[x-1][y]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x-1][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y+1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x+1][y-1]]; if (temp != Xblank) break; - temp = lev.android_array[Cave[x][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x-1][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y+1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x+1][y-1]]; if (temp != Xblank) break; + temp = lev.android_array[cave[x][y+1]]; if (temp != Xblank) break; goto android_move; } - Next[x][y] = temp; /* the item we chose to clone */ + next[x][y] = temp; /* the item we chose to clone */ play_element_sound(x, y, SOUND_android_clone, temp); switch (RANDOM(8)) @@ -1417,91 +1679,91 @@ static void Landroid(int x, int y) /* randomly find a direction to move */ case 0: /* S,NE,W,NW,SE,E,SW,N */ - if (Cave[x][y+1] == Xblank) goto android_s; - if (Cave[x+1][y-1] == Xblank) goto android_ne; - if (Cave[x-1][y] == Xblank) goto android_w; - if (Cave[x-1][y-1] == Xblank) goto android_nw; - if (Cave[x+1][y+1] == Xblank) goto android_se; - if (Cave[x+1][y] == Xblank) goto android_e; - if (Cave[x-1][y+1] == Xblank) goto android_sw; - if (Cave[x][y-1] == Xblank) goto android_n; + if (is_android_blank[cave[x][y+1]]) goto android_s; + if (is_android_blank[cave[x+1][y-1]]) goto android_ne; + if (is_android_blank[cave[x-1][y]]) goto android_w; + if (is_android_blank[cave[x-1][y-1]]) goto android_nw; + if (is_android_blank[cave[x+1][y+1]]) goto android_se; + if (is_android_blank[cave[x+1][y]]) goto android_e; + if (is_android_blank[cave[x-1][y+1]]) goto android_sw; + if (is_android_blank[cave[x][y-1]]) goto android_n; goto android_move; case 1: /* NW,SE,N,S,NE,SW,E,W */ - if (Cave[x-1][y-1] == Xblank) goto android_nw; - if (Cave[x+1][y+1] == Xblank) goto android_se; - if (Cave[x][y-1] == Xblank) goto android_n; - if (Cave[x][y+1] == Xblank) goto android_s; - if (Cave[x+1][y-1] == Xblank) goto android_ne; - if (Cave[x-1][y+1] == Xblank) goto android_sw; - if (Cave[x+1][y] == Xblank) goto android_e; - if (Cave[x-1][y] == Xblank) goto android_w; + if (is_android_blank[cave[x-1][y-1]]) goto android_nw; + if (is_android_blank[cave[x+1][y+1]]) goto android_se; + if (is_android_blank[cave[x][y-1]]) goto android_n; + if (is_android_blank[cave[x][y+1]]) goto android_s; + if (is_android_blank[cave[x+1][y-1]]) goto android_ne; + if (is_android_blank[cave[x-1][y+1]]) goto android_sw; + if (is_android_blank[cave[x+1][y]]) goto android_e; + if (is_android_blank[cave[x-1][y]]) goto android_w; goto android_move; case 2: /* SW,E,S,W,N,NW,SE,NE */ - if (Cave[x-1][y+1] == Xblank) goto android_sw; - if (Cave[x+1][y] == Xblank) goto android_e; - if (Cave[x][y+1] == Xblank) goto android_s; - if (Cave[x-1][y] == Xblank) goto android_w; - if (Cave[x][y-1] == Xblank) goto android_n; - if (Cave[x-1][y-1] == Xblank) goto android_nw; - if (Cave[x+1][y+1] == Xblank) goto android_se; - if (Cave[x+1][y-1] == Xblank) goto android_ne; + if (is_android_blank[cave[x-1][y+1]]) goto android_sw; + if (is_android_blank[cave[x+1][y]]) goto android_e; + if (is_android_blank[cave[x][y+1]]) goto android_s; + if (is_android_blank[cave[x-1][y]]) goto android_w; + if (is_android_blank[cave[x][y-1]]) goto android_n; + if (is_android_blank[cave[x-1][y-1]]) goto android_nw; + if (is_android_blank[cave[x+1][y+1]]) goto android_se; + if (is_android_blank[cave[x+1][y-1]]) goto android_ne; goto android_move; case 3: /* N,SE,NE,E,W,S,NW,SW */ - if (Cave[x][y-1] == Xblank) goto android_n; - if (Cave[x+1][y+1] == Xblank) goto android_se; - if (Cave[x+1][y-1] == Xblank) goto android_ne; - if (Cave[x+1][y] == Xblank) goto android_e; - if (Cave[x-1][y] == Xblank) goto android_w; - if (Cave[x][y+1] == Xblank) goto android_s; - if (Cave[x-1][y-1] == Xblank) goto android_nw; - if (Cave[x-1][y+1] == Xblank) goto android_sw; + if (is_android_blank[cave[x][y-1]]) goto android_n; + if (is_android_blank[cave[x+1][y+1]]) goto android_se; + if (is_android_blank[cave[x+1][y-1]]) goto android_ne; + if (is_android_blank[cave[x+1][y]]) goto android_e; + if (is_android_blank[cave[x-1][y]]) goto android_w; + if (is_android_blank[cave[x][y+1]]) goto android_s; + if (is_android_blank[cave[x-1][y-1]]) goto android_nw; + if (is_android_blank[cave[x-1][y+1]]) goto android_sw; goto android_move; case 4: /* SE,NW,E,NE,SW,W,N,S */ - if (Cave[x+1][y+1] == Xblank) goto android_se; - if (Cave[x-1][y-1] == Xblank) goto android_nw; - if (Cave[x+1][y] == Xblank) goto android_e; - if (Cave[x+1][y-1] == Xblank) goto android_ne; - if (Cave[x-1][y+1] == Xblank) goto android_sw; - if (Cave[x-1][y] == Xblank) goto android_w; - if (Cave[x][y-1] == Xblank) goto android_n; - if (Cave[x][y+1] == Xblank) goto android_s; + if (is_android_blank[cave[x+1][y+1]]) goto android_se; + if (is_android_blank[cave[x-1][y-1]]) goto android_nw; + if (is_android_blank[cave[x+1][y]]) goto android_e; + if (is_android_blank[cave[x+1][y-1]]) goto android_ne; + if (is_android_blank[cave[x-1][y+1]]) goto android_sw; + if (is_android_blank[cave[x-1][y]]) goto android_w; + if (is_android_blank[cave[x][y-1]]) goto android_n; + if (is_android_blank[cave[x][y+1]]) goto android_s; goto android_move; case 5: /* NE,W,SE,SW,S,N,E,NW */ - if (Cave[x+1][y-1] == Xblank) goto android_ne; - if (Cave[x-1][y] == Xblank) goto android_w; - if (Cave[x+1][y+1] == Xblank) goto android_se; - if (Cave[x-1][y+1] == Xblank) goto android_sw; - if (Cave[x][y+1] == Xblank) goto android_s; - if (Cave[x][y-1] == Xblank) goto android_n; - if (Cave[x+1][y] == Xblank) goto android_e; - if (Cave[x-1][y-1] == Xblank) goto android_nw; + if (is_android_blank[cave[x+1][y-1]]) goto android_ne; + if (is_android_blank[cave[x-1][y]]) goto android_w; + if (is_android_blank[cave[x+1][y+1]]) goto android_se; + if (is_android_blank[cave[x-1][y+1]]) goto android_sw; + if (is_android_blank[cave[x][y+1]]) goto android_s; + if (is_android_blank[cave[x][y-1]]) goto android_n; + if (is_android_blank[cave[x+1][y]]) goto android_e; + if (is_android_blank[cave[x-1][y-1]]) goto android_nw; goto android_move; case 6: /* E,N,SW,S,NW,NE,SE,W */ - if (Cave[x+1][y] == Xblank) goto android_e; - if (Cave[x][y-1] == Xblank) goto android_n; - if (Cave[x-1][y+1] == Xblank) goto android_sw; - if (Cave[x][y+1] == Xblank) goto android_s; - if (Cave[x-1][y-1] == Xblank) goto android_nw; - if (Cave[x+1][y-1] == Xblank) goto android_ne; - if (Cave[x+1][y+1] == Xblank) goto android_se; - if (Cave[x-1][y] == Xblank) goto android_w; + if (is_android_blank[cave[x+1][y]]) goto android_e; + if (is_android_blank[cave[x][y-1]]) goto android_n; + if (is_android_blank[cave[x-1][y+1]]) goto android_sw; + if (is_android_blank[cave[x][y+1]]) goto android_s; + if (is_android_blank[cave[x-1][y-1]]) goto android_nw; + if (is_android_blank[cave[x+1][y-1]]) goto android_ne; + if (is_android_blank[cave[x+1][y+1]]) goto android_se; + if (is_android_blank[cave[x-1][y]]) goto android_w; goto android_move; case 7: /* W,SW,NW,N,E,SE,NE,S */ - if (Cave[x-1][y] == Xblank) goto android_w; - if (Cave[x-1][y+1] == Xblank) goto android_sw; - if (Cave[x-1][y-1] == Xblank) goto android_nw; - if (Cave[x][y-1] == Xblank) goto android_n; - if (Cave[x+1][y] == Xblank) goto android_e; - if (Cave[x+1][y+1] == Xblank) goto android_se; - if (Cave[x+1][y-1] == Xblank) goto android_ne; - if (Cave[x][y+1] == Xblank) goto android_s; + if (is_android_blank[cave[x-1][y]]) goto android_w; + if (is_android_blank[cave[x-1][y+1]]) goto android_sw; + if (is_android_blank[cave[x-1][y-1]]) goto android_nw; + if (is_android_blank[cave[x][y-1]]) goto android_n; + if (is_android_blank[cave[x+1][y]]) goto android_e; + if (is_android_blank[cave[x+1][y+1]]) goto android_se; + if (is_android_blank[cave[x+1][y-1]]) goto android_ne; + if (is_android_blank[cave[x][y+1]]) goto android_s; goto android_move; } } @@ -1509,19 +1771,19 @@ static void Landroid(int x, int y) android_move: if (lev.android_move_cnt == 0) { - if (Cave[x-1][y-1] == Zplayer || - Cave[x][y-1] == Zplayer || - Cave[x+1][y-1] == Zplayer || - Cave[x-1][y] == Zplayer || - Cave[x+1][y] == Zplayer || - Cave[x-1][y+1] == Zplayer || - Cave[x][y+1] == Zplayer || - Cave[x+1][y+1] == Zplayer) + if (cave[x-1][y-1] == Zplayer || + cave[x][y-1] == Zplayer || + cave[x+1][y-1] == Zplayer || + cave[x-1][y] == Zplayer || + cave[x+1][y] == Zplayer || + cave[x-1][y+1] == Zplayer || + cave[x][y+1] == Zplayer || + cave[x+1][y+1] == Zplayer) goto android_still; set_nearest_player_xy(x, y, &dx, &dy); - Next[x][y] = Xblank; /* assume we will move */ + next[x][y] = Xblank; /* assume we will move */ temp = ((x < dx) + 1 - (x > dx)) + ((y < dy) + 1 - (y > dy)) * 3; if (RANDOM(2)) @@ -1531,54 +1793,54 @@ static void Landroid(int x, int y) /* attempt clockwise move first if direct path is blocked */ case 0: /* north west */ - if (tab_android_move[Cave[x-1][y-1]]) goto android_nw; - if (tab_android_move[Cave[x][y-1]]) goto android_n; - if (tab_android_move[Cave[x-1][y]]) goto android_w; + if (is_android_walkable[cave[x-1][y-1]]) goto android_nw; + if (is_android_walkable[cave[x][y-1]]) goto android_n; + if (is_android_walkable[cave[x-1][y]]) goto android_w; break; case 1: /* north */ - if (tab_android_move[Cave[x][y-1]]) goto android_n; - if (tab_android_move[Cave[x+1][y-1]]) goto android_ne; - if (tab_android_move[Cave[x-1][y-1]]) goto android_nw; + if (is_android_walkable[cave[x][y-1]]) goto android_n; + if (is_android_walkable[cave[x+1][y-1]]) goto android_ne; + if (is_android_walkable[cave[x-1][y-1]]) goto android_nw; break; case 2: /* north east */ - if (tab_android_move[Cave[x+1][y-1]]) goto android_ne; - if (tab_android_move[Cave[x+1][y]]) goto android_e; - if (tab_android_move[Cave[x][y-1]]) goto android_n; + if (is_android_walkable[cave[x+1][y-1]]) goto android_ne; + if (is_android_walkable[cave[x+1][y]]) goto android_e; + if (is_android_walkable[cave[x][y-1]]) goto android_n; break; case 3: /* west */ - if (tab_android_move[Cave[x-1][y]]) goto android_w; - if (tab_android_move[Cave[x-1][y-1]]) goto android_nw; - if (tab_android_move[Cave[x-1][y+1]]) goto android_sw; + if (is_android_walkable[cave[x-1][y]]) goto android_w; + if (is_android_walkable[cave[x-1][y-1]]) goto android_nw; + if (is_android_walkable[cave[x-1][y+1]]) goto android_sw; break; case 4: /* nowhere */ break; case 5: /* east */ - if (tab_android_move[Cave[x+1][y]]) goto android_e; - if (tab_android_move[Cave[x+1][y+1]]) goto android_se; - if (tab_android_move[Cave[x+1][y-1]]) goto android_ne; + if (is_android_walkable[cave[x+1][y]]) goto android_e; + if (is_android_walkable[cave[x+1][y+1]]) goto android_se; + if (is_android_walkable[cave[x+1][y-1]]) goto android_ne; break; case 6: /* south west */ - if (tab_android_move[Cave[x-1][y+1]]) goto android_sw; - if (tab_android_move[Cave[x-1][y]]) goto android_w; - if (tab_android_move[Cave[x][y+1]]) goto android_s; + if (is_android_walkable[cave[x-1][y+1]]) goto android_sw; + if (is_android_walkable[cave[x-1][y]]) goto android_w; + if (is_android_walkable[cave[x][y+1]]) goto android_s; break; case 7: /* south */ - if (tab_android_move[Cave[x][y+1]]) goto android_s; - if (tab_android_move[Cave[x-1][y+1]]) goto android_sw; - if (tab_android_move[Cave[x+1][y+1]]) goto android_se; + if (is_android_walkable[cave[x][y+1]]) goto android_s; + if (is_android_walkable[cave[x-1][y+1]]) goto android_sw; + if (is_android_walkable[cave[x+1][y+1]]) goto android_se; break; case 8: /* south east */ - if (tab_android_move[Cave[x+1][y+1]]) goto android_se; - if (tab_android_move[Cave[x][y+1]]) goto android_s; - if (tab_android_move[Cave[x+1][y]]) goto android_e; + if (is_android_walkable[cave[x+1][y+1]]) goto android_se; + if (is_android_walkable[cave[x][y+1]]) goto android_s; + if (is_android_walkable[cave[x+1][y]]) goto android_e; break; } } @@ -1589,124 +1851,142 @@ static void Landroid(int x, int y) /* attempt counterclockwise move first if direct path is blocked */ case 0: /* north west */ - if (tab_android_move[Cave[x-1][y-1]]) goto android_nw; - if (tab_android_move[Cave[x-1][y]]) goto android_w; - if (tab_android_move[Cave[x][y-1]]) goto android_n; + if (is_android_walkable[cave[x-1][y-1]]) goto android_nw; + if (is_android_walkable[cave[x-1][y]]) goto android_w; + if (is_android_walkable[cave[x][y-1]]) goto android_n; break; case 1: /* north */ - if (tab_android_move[Cave[x][y-1]]) goto android_n; - if (tab_android_move[Cave[x-1][y-1]]) goto android_nw; - if (tab_android_move[Cave[x+1][y-1]]) goto android_ne; + if (is_android_walkable[cave[x][y-1]]) goto android_n; + if (is_android_walkable[cave[x-1][y-1]]) goto android_nw; + if (is_android_walkable[cave[x+1][y-1]]) goto android_ne; break; case 2: /* north east */ - if (tab_android_move[Cave[x+1][y-1]]) goto android_ne; - if (tab_android_move[Cave[x][y-1]]) goto android_n; - if (tab_android_move[Cave[x+1][y]]) goto android_e; + if (is_android_walkable[cave[x+1][y-1]]) goto android_ne; + if (is_android_walkable[cave[x][y-1]]) goto android_n; + if (is_android_walkable[cave[x+1][y]]) goto android_e; break; case 3: /* west */ - if (tab_android_move[Cave[x-1][y]]) goto android_w; - if (tab_android_move[Cave[x-1][y+1]]) goto android_sw; - if (tab_android_move[Cave[x-1][y-1]]) goto android_nw; + if (is_android_walkable[cave[x-1][y]]) goto android_w; + if (is_android_walkable[cave[x-1][y+1]]) goto android_sw; + if (is_android_walkable[cave[x-1][y-1]]) goto android_nw; break; case 4: /* nowhere */ break; case 5: /* east */ - if (tab_android_move[Cave[x+1][y]]) goto android_e; - if (tab_android_move[Cave[x+1][y-1]]) goto android_ne; - if (tab_android_move[Cave[x+1][y+1]]) goto android_se; + if (is_android_walkable[cave[x+1][y]]) goto android_e; + if (is_android_walkable[cave[x+1][y-1]]) goto android_ne; + if (is_android_walkable[cave[x+1][y+1]]) goto android_se; break; case 6: /* south west */ - if (tab_android_move[Cave[x-1][y+1]]) goto android_sw; - if (tab_android_move[Cave[x][y+1]]) goto android_s; - if (tab_android_move[Cave[x-1][y]]) goto android_w; + if (is_android_walkable[cave[x-1][y+1]]) goto android_sw; + if (is_android_walkable[cave[x][y+1]]) goto android_s; + if (is_android_walkable[cave[x-1][y]]) goto android_w; break; case 7: /* south */ - if (tab_android_move[Cave[x][y+1]]) goto android_s; - if (tab_android_move[Cave[x+1][y+1]]) goto android_se; - if (tab_android_move[Cave[x-1][y+1]]) goto android_sw; + if (is_android_walkable[cave[x][y+1]]) goto android_s; + if (is_android_walkable[cave[x+1][y+1]]) goto android_se; + if (is_android_walkable[cave[x-1][y+1]]) goto android_sw; break; case 8: /* south east */ - if (tab_android_move[Cave[x+1][y+1]]) goto android_se; - if (tab_android_move[Cave[x+1][y]]) goto android_e; - if (tab_android_move[Cave[x][y+1]]) goto android_s; + if (is_android_walkable[cave[x+1][y+1]]) goto android_se; + if (is_android_walkable[cave[x+1][y]]) goto android_e; + if (is_android_walkable[cave[x][y+1]]) goto android_s; break; } } } android_still: - Next[x][y] = Xandroid; + next[x][y] = Xandroid; return; android_n: - Cave[x][y] = Yandroid_nB; - Cave[x][y-1] = Yandroid_n; - Next[x][y-1] = Xandroid; + cave[x][y] = Yandroid_nB; + cave[x][y-1] = Yandroid_n; + next[x][y-1] = Xandroid; play_element_sound(x, y, SOUND_android_move, Xandroid); return; android_ne: - Cave[x][y] = Yandroid_neB; - Cave[x+1][y-1] = Yandroid_ne; - Next[x+1][y-1] = Xandroid; + cave[x][y] = Yandroid_neB; + cave[x+1][y-1] = Yandroid_ne; + next[x+1][y-1] = Xandroid; play_element_sound(x, y, SOUND_android_move, Xandroid); return; android_e: - Cave[x][y] = Yandroid_eB; - Cave[x+1][y] = Yandroid_e; - Next[x+1][y] = Xandroid; + cave[x][y] = Yandroid_eB; + cave[x+1][y] = Yandroid_e; + next[x+1][y] = Xandroid; play_element_sound(x, y, SOUND_android_move, Xandroid); return; android_se: - Cave[x][y] = Yandroid_seB; - Cave[x+1][y+1] = Yandroid_se; - Next[x+1][y+1] = Xandroid; + cave[x][y] = Yandroid_seB; + cave[x+1][y+1] = Yandroid_se; + next[x+1][y+1] = Xandroid; play_element_sound(x, y, SOUND_android_move, Xandroid); return; android_s: - Cave[x][y] = Yandroid_sB; - Cave[x][y+1] = Yandroid_s; - Next[x][y+1] = Xandroid; + cave[x][y] = Yandroid_sB; + cave[x][y+1] = Yandroid_s; + next[x][y+1] = Xandroid; play_element_sound(x, y, SOUND_android_move, Xandroid); return; android_sw: - Cave[x][y] = Yandroid_swB; - Cave[x-1][y+1] = Yandroid_sw; - Next[x-1][y+1] = Xandroid; + cave[x][y] = Yandroid_swB; + cave[x-1][y+1] = Yandroid_sw; + next[x-1][y+1] = Xandroid; play_element_sound(x, y, SOUND_android_move, Xandroid); return; android_w: - Cave[x][y] = Yandroid_wB; - Cave[x-1][y] = Yandroid_w; - Next[x-1][y] = Xandroid; + cave[x][y] = Yandroid_wB; + cave[x-1][y] = Yandroid_w; + next[x-1][y] = Xandroid; play_element_sound(x, y, SOUND_android_move, Xandroid); return; android_nw: - Cave[x][y] = Yandroid_nwB; - Cave[x-1][y-1] = Yandroid_nw; - Next[x-1][y-1] = Xandroid; + cave[x][y] = Yandroid_nwB; + cave[x-1][y-1] = Yandroid_nw; + next[x-1][y-1] = Xandroid; play_element_sound(x, y, SOUND_android_move, Xandroid); return; } static void Landroid_1_n(int x, int y) { - switch (Cave[x][y-1]) + switch (cave[x][y-1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yandroid_nB; + next[x][y] = Xblank; + cave[x][y-1] = Yandroid_n; + next[x][y-1] = Xandroid; + play_element_sound(x, y, SOUND_android_move, Xandroid_1_n); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -1715,25 +1995,15 @@ static void Landroid_1_n(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yandroid_nB; - if (Cave[x+1][y-2] == Xblank) - Cave[x+1][y-2] = Xacid_splash_e; - if (Cave[x-1][y-2] == Xblank) - Cave[x-1][y-2] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yandroid_nB; + next[x][y] = Xblank; + if (cave[x+1][y-2] == Xblank) + cave[x+1][y-2] = Xsplash_e; + if (cave[x-1][y-2] == Xblank) + cave[x-1][y-2] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Yandroid_nB; - Cave[x][y-1] = Yandroid_n; - Next[x][y] = Xblank; - Next[x][y-1] = Xandroid; - play_element_sound(x, y, SOUND_android_move, Xandroid_1_n); - return; - default: Landroid(x, y); return; @@ -1742,8 +2012,26 @@ static void Landroid_1_n(int x, int y) static void Landroid_2_n(int x, int y) { - switch (Cave[x][y-1]) + switch (cave[x][y-1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yandroid_nB; + next[x][y] = Xblank; + cave[x][y-1] = Yandroid_n; + next[x][y-1] = Xandroid_1_n; + play_element_sound(x, y, SOUND_android_move, Xandroid_2_n); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -1752,25 +2040,15 @@ static void Landroid_2_n(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yandroid_nB; - if (Cave[x+1][y-2] == Xblank) - Cave[x+1][y-2] = Xacid_splash_e; - if (Cave[x-1][y-2] == Xblank) - Cave[x-1][y-2] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yandroid_nB; + next[x][y] = Xblank; + if (cave[x+1][y-2] == Xblank) + cave[x+1][y-2] = Xsplash_e; + if (cave[x-1][y-2] == Xblank) + cave[x-1][y-2] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Yandroid_nB; - Cave[x][y-1] = Yandroid_n; - Next[x][y] = Xblank; - Next[x][y-1] = Xandroid_1_n; - play_element_sound(x, y, SOUND_android_move, Xandroid_2_n); - return; - default: Landroid(x, y); return; @@ -1779,8 +2057,26 @@ static void Landroid_2_n(int x, int y) static void Landroid_1_e(int x, int y) { - switch (Cave[x+1][y]) + switch (cave[x+1][y]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yandroid_eB; + next[x][y] = Xblank; + cave[x+1][y] = Yandroid_e; + next[x+1][y] = Xandroid; + play_element_sound(x, y, SOUND_android_move, Xandroid_1_e); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -1789,25 +2085,15 @@ static void Landroid_1_e(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yandroid_eB; - if (Cave[x+2][y-1] == Xblank) - Cave[x+2][y-1] = Xacid_splash_e; - if (Cave[x][y-1] == Xblank) - Cave[x][y-1] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yandroid_eB; + next[x][y] = Xblank; + if (cave[x+2][y-1] == Xblank) + cave[x+2][y-1] = Xsplash_e; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Yandroid_eB; - Cave[x+1][y] = Yandroid_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xandroid; - play_element_sound(x, y, SOUND_android_move, Xandroid_1_e); - return; - default: Landroid(x, y); return; @@ -1816,8 +2102,26 @@ static void Landroid_1_e(int x, int y) static void Landroid_2_e(int x, int y) { - switch (Cave[x+1][y]) + switch (cave[x+1][y]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yandroid_eB; + next[x][y] = Xblank; + cave[x+1][y] = Yandroid_e; + next[x+1][y] = Xandroid_1_e; + play_element_sound(x, y, SOUND_android_move, Xandroid_2_e); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -1826,25 +2130,15 @@ static void Landroid_2_e(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yandroid_eB; - if (Cave[x+2][y-1] == Xblank) - Cave[x+2][y-1] = Xacid_splash_e; - if (Cave[x][y-1] == Xblank) - Cave[x][y-1] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yandroid_eB; + next[x][y] = Xblank; + if (cave[x+2][y-1] == Xblank) + cave[x+2][y-1] = Xsplash_e; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Yandroid_eB; - Cave[x+1][y] = Yandroid_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xandroid_1_e; - play_element_sound(x, y, SOUND_android_move, Xandroid_2_e); - return; - default: Landroid(x, y); return; @@ -1853,8 +2147,26 @@ static void Landroid_2_e(int x, int y) static void Landroid_1_s(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yandroid_sB; + next[x][y] = Xblank; + cave[x][y+1] = Yandroid_s; + next[x][y+1] = Xandroid; + play_element_sound(x, y, SOUND_android_move, Xandroid_1_s); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -1863,25 +2175,15 @@ static void Landroid_1_s(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yandroid_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yandroid_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Yandroid_sB; - Cave[x][y+1] = Yandroid_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xandroid; - play_element_sound(x, y, SOUND_android_move, Xandroid_1_s); - return; - default: Landroid(x, y); return; @@ -1890,8 +2192,26 @@ static void Landroid_1_s(int x, int y) static void Landroid_2_s(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yandroid_sB; + next[x][y] = Xblank; + cave[x][y+1] = Yandroid_s; + next[x][y+1] = Xandroid_1_s; + play_element_sound(x, y, SOUND_android_move, Xandroid_2_s); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -1900,25 +2220,15 @@ static void Landroid_2_s(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yandroid_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yandroid_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Yandroid_sB; - Cave[x][y+1] = Yandroid_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xandroid_1_s; - play_element_sound(x, y, SOUND_android_move, Xandroid_2_s); - return; - default: Landroid(x, y); return; @@ -1927,35 +2237,43 @@ static void Landroid_2_s(int x, int y) static void Landroid_1_w(int x, int y) { - switch (Cave[x-1][y]) + switch (cave[x-1][y]) { - case Xacid_1: - case Xacid_2: - case Xacid_3: - case Xacid_4: - case Xacid_5: - case Xacid_6: - case Xacid_7: - case Xacid_8: - Cave[x][y] = Yandroid_wB; - if (Cave[x][y-1] == Xblank) - Cave[x][y-1] = Xacid_splash_e; - if (Cave[x-2][y-1] == Xblank) - Cave[x-2][y-1] = Xacid_splash_w; - Next[x][y] = Xblank; - play_element_sound(x, y, SOUND_acid, Xacid_1); - return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Yandroid_wB; - Cave[x-1][y] = Yandroid_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xandroid; + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yandroid_wB; + next[x][y] = Xblank; + cave[x-1][y] = Yandroid_w; + next[x-1][y] = Xandroid; play_element_sound(x, y, SOUND_android_move, Xandroid_1_w); return; + case Xacid_1: + case Xacid_2: + case Xacid_3: + case Xacid_4: + case Xacid_5: + case Xacid_6: + case Xacid_7: + case Xacid_8: + cave[x][y] = Yandroid_wB; + next[x][y] = Xblank; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_e; + if (cave[x-2][y-1] == Xblank) + cave[x-2][y-1] = Xsplash_w; + play_element_sound(x, y, SOUND_acid, Xacid_1); + return; + default: Landroid(x, y); return; @@ -1964,8 +2282,26 @@ static void Landroid_1_w(int x, int y) static void Landroid_2_w(int x, int y) { - switch (Cave[x-1][y]) + switch (cave[x-1][y]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yandroid_wB; + next[x][y] = Xblank; + cave[x-1][y] = Yandroid_w; + next[x-1][y] = Xandroid_1_w; + play_element_sound(x, y, SOUND_android_move, Xandroid_1_w); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -1974,25 +2310,15 @@ static void Landroid_2_w(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yandroid_wB; - if (Cave[x][y-1] == Xblank) - Cave[x][y-1] = Xacid_splash_e; - if (Cave[x-2][y-1] == Xblank) - Cave[x-2][y-1] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yandroid_wB; + next[x][y] = Xblank; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_e; + if (cave[x-2][y-1] == Xblank) + cave[x-2][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Yandroid_wB; - Cave[x-1][y] = Yandroid_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xandroid_1_w; - play_element_sound(x, y, SOUND_android_move, Xandroid_1_w); - return; - default: Landroid(x, y); return; @@ -2001,40 +2327,60 @@ static void Landroid_2_w(int x, int y) static void Leater_n(int x, int y) { - if (Cave[x+1][y] == Xdiamond) + if (cave[x+1][y] == Xdiamond) { - Cave[x+1][y] = Ydiamond_blank; - Next[x+1][y] = Xblank; + cave[x+1][y] = Ydiamond_blank; + next[x+1][y] = Xblank; play_element_sound(x, y, SOUND_eater_eat, Xeater_n); return; } - if (Cave[x][y+1] == Xdiamond) + if (cave[x][y+1] == Xdiamond) { - Cave[x][y+1] = Ydiamond_blank; - Next[x][y+1] = Xblank; + cave[x][y+1] = Ydiamond_blank; + next[x][y+1] = Xblank; play_element_sound(x, y, SOUND_eater_eat, Xeater_n); return; } - if (Cave[x-1][y] == Xdiamond) + if (cave[x-1][y] == Xdiamond) { - Cave[x-1][y] = Ydiamond_blank; - Next[x-1][y] = Xblank; + cave[x-1][y] = Ydiamond_blank; + next[x-1][y] = Xblank; play_element_sound(x, y, SOUND_eater_eat, Xeater_n); return; } - if (Cave[x][y-1] == Xdiamond) + if (cave[x][y-1] == Xdiamond) { - Cave[x][y-1] = Ydiamond_blank; - Next[x][y-1] = Xblank; + cave[x][y-1] = Ydiamond_blank; + next[x][y-1] = Xblank; play_element_sound(x, y, SOUND_eater_eat, Xeater_n); return; } - switch (Cave[x][y-1]) + switch (cave[x][y-1]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + cave[x][y] = Yeater_nB; + next[x][y] = Xblank; + cave[x][y-1] = Yeater_n; + next[x][y-1] = Xeater_n; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -2043,29 +2389,17 @@ static void Leater_n(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yeater_nB; - if (Cave[x+1][y-2] == Xblank) - Cave[x+1][y-2] = Xacid_splash_e; - if (Cave[x-1][y-2] == Xblank) - Cave[x-1][y-2] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yeater_nB; + next[x][y] = Xblank; + if (cave[x+1][y-2] == Xblank) + cave[x+1][y-2] = Xsplash_e; + if (cave[x-1][y-2] == Xblank) + cave[x-1][y-2] = Xsplash_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[x][y] = Yeater_nB; - Cave[x][y-1] = Yeater_n; - Next[x][y] = Xblank; - Next[x][y-1] = Xeater_n; - return; - default: - Next[x][y] = RANDOM(2) ? Xeater_e : Xeater_w; + next[x][y] = RANDOM(2) ? Xeater_e : Xeater_w; play_element_sound(x, y, SOUND_eater, Xeater_n); return; } @@ -2073,40 +2407,60 @@ static void Leater_n(int x, int y) static void Leater_e(int x, int y) { - if (Cave[x][y+1] == Xdiamond) + if (cave[x][y+1] == Xdiamond) { - Cave[x][y+1] = Ydiamond_blank; - Next[x][y+1] = Xblank; + cave[x][y+1] = Ydiamond_blank; + next[x][y+1] = Xblank; play_element_sound(x, y, SOUND_eater_eat, Xeater_e); return; } - if (Cave[x-1][y] == Xdiamond) + if (cave[x-1][y] == Xdiamond) { - Cave[x-1][y] = Ydiamond_blank; - Next[x-1][y] = Xblank; + cave[x-1][y] = Ydiamond_blank; + next[x-1][y] = Xblank; play_element_sound(x, y, SOUND_eater_eat, Xeater_e); return; } - if (Cave[x][y-1] == Xdiamond) + if (cave[x][y-1] == Xdiamond) { - Cave[x][y-1] = Ydiamond_blank; - Next[x][y-1] = Xblank; + cave[x][y-1] = Ydiamond_blank; + next[x][y-1] = Xblank; play_element_sound(x, y, SOUND_eater_eat, Xeater_e); return; } - if (Cave[x+1][y] == Xdiamond) + if (cave[x+1][y] == Xdiamond) { - Cave[x+1][y] = Ydiamond_blank; - Next[x+1][y] = Xblank; + cave[x+1][y] = Ydiamond_blank; + next[x+1][y] = Xblank; play_element_sound(x, y, SOUND_eater_eat, Xeater_e); return; } - switch (Cave[x+1][y]) + switch (cave[x+1][y]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + cave[x][y] = Yeater_eB; + next[x][y] = Xblank; + cave[x+1][y] = Yeater_e; + next[x+1][y] = Xeater_e; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -2115,29 +2469,17 @@ static void Leater_e(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yeater_eB; - if (Cave[x+2][y-1] == Xblank) - Cave[x+2][y-1] = Xacid_splash_e; - if (Cave[x][y-1] == Xblank) - Cave[x][y-1] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yeater_eB; + next[x][y] = Xblank; + if (cave[x+2][y-1] == Xblank) + cave[x+2][y-1] = Xsplash_e; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Xplant: - case Yplant: - case Zplayer: - Cave[x][y] = Yeater_eB; - Cave[x+1][y] = Yeater_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xeater_e; - return; - default: - Next[x][y] = RANDOM(2) ? Xeater_n : Xeater_s; + next[x][y] = RANDOM(2) ? Xeater_n : Xeater_s; play_element_sound(x, y, SOUND_eater, Xeater_e); return; } @@ -2145,40 +2487,60 @@ static void Leater_e(int x, int y) static void Leater_s(int x, int y) { - if (Cave[x-1][y] == Xdiamond) + if (cave[x-1][y] == Xdiamond) { - Cave[x-1][y] = Ydiamond_blank; - Next[x-1][y] = Xblank; + cave[x-1][y] = Ydiamond_blank; + next[x-1][y] = Xblank; play_element_sound(x, y, SOUND_eater_eat, Xeater_s); return; } - if (Cave[x][y-1] == Xdiamond) + if (cave[x][y-1] == Xdiamond) { - Cave[x][y-1] = Ydiamond_blank; - Next[x][y-1] = Xblank; + cave[x][y-1] = Ydiamond_blank; + next[x][y-1] = Xblank; play_element_sound(x, y, SOUND_eater_eat, Xeater_s); return; } - if (Cave[x+1][y] == Xdiamond) + if (cave[x+1][y] == Xdiamond) { - Cave[x+1][y] = Ydiamond_blank; - Next[x+1][y] = Xblank; + cave[x+1][y] = Ydiamond_blank; + next[x+1][y] = Xblank; play_element_sound(x, y, SOUND_eater_eat, Xeater_s); return; } - if (Cave[x][y+1] == Xdiamond) + if (cave[x][y+1] == Xdiamond) { - Cave[x][y+1] = Ydiamond_blank; - Next[x][y+1] = Xblank; + cave[x][y+1] = Ydiamond_blank; + next[x][y+1] = Xblank; play_element_sound(x, y, SOUND_eater_eat, Xeater_s); return; } - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + cave[x][y] = Yeater_sB; + next[x][y] = Xblank; + cave[x][y+1] = Yeater_s; + next[x][y+1] = Xeater_s; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -2187,29 +2549,17 @@ static void Leater_s(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yeater_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yeater_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_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[x][y] = Yeater_sB; - Cave[x][y+1] = Yeater_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xeater_s; - return; - default: - Next[x][y] = RANDOM(2) ? Xeater_e : Xeater_w; + next[x][y] = RANDOM(2) ? Xeater_e : Xeater_w; play_element_sound(x, y, SOUND_eater, Xeater_s); return; } @@ -2217,40 +2567,60 @@ static void Leater_s(int x, int y) static void Leater_w(int x, int y) { - if (Cave[x][y-1] == Xdiamond) + if (cave[x][y-1] == Xdiamond) { - Cave[x][y-1] = Ydiamond_blank; - Next[x][y-1] = Xblank; + cave[x][y-1] = Ydiamond_blank; + next[x][y-1] = Xblank; play_element_sound(x, y, SOUND_eater_eat, Xeater_w); return; } - if (Cave[x+1][y] == Xdiamond) + if (cave[x+1][y] == Xdiamond) { - Cave[x+1][y] = Ydiamond_blank; - Next[x+1][y] = Xblank; + cave[x+1][y] = Ydiamond_blank; + next[x+1][y] = Xblank; play_element_sound(x, y, SOUND_eater_eat, Xeater_w); return; } - if (Cave[x][y+1] == Xdiamond) + if (cave[x][y+1] == Xdiamond) { - Cave[x][y+1] = Ydiamond_blank; - Next[x][y+1] = Xblank; + cave[x][y+1] = Ydiamond_blank; + next[x][y+1] = Xblank; play_element_sound(x, y, SOUND_eater_eat, Xeater_w); return; } - if (Cave[x-1][y] == Xdiamond) + if (cave[x-1][y] == Xdiamond) { - Cave[x-1][y] = Ydiamond_blank; - Next[x-1][y] = Xblank; + cave[x-1][y] = Ydiamond_blank; + next[x-1][y] = Xblank; play_element_sound(x, y, SOUND_eater_eat, Xeater_w); return; } - switch (Cave[x-1][y]) + switch (cave[x-1][y]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + cave[x][y] = Yeater_wB; + next[x][y] = Xblank; + cave[x-1][y] = Yeater_w; + next[x-1][y] = Xeater_w; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -2259,29 +2629,17 @@ static void Leater_w(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yeater_wB; - if (Cave[x][y-1] == Xblank) - Cave[x][y-1] = Xacid_splash_e; - if (Cave[x-2][y-1] == Xblank) - Cave[x-2][y-1] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yeater_wB; + next[x][y] = Xblank; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_e; + if (cave[x-2][y-1] == Xblank) + cave[x-2][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Xplant: - case Yplant: - case Zplayer: - Cave[x][y] = Yeater_wB; - Cave[x-1][y] = Yeater_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xeater_w; - return; - default: - Next[x][y] = RANDOM(2) ? Xeater_n : Xeater_s; + next[x][y] = RANDOM(2) ? Xeater_n : Xeater_s; play_element_sound(x, y, SOUND_eater, Xeater_w); return; } @@ -2305,8 +2663,29 @@ static void Lalien(int x, int y) { if (y > dy) { - switch (Cave[x][y-1]) + switch (cave[x][y-1]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + cave[x][y] = Yalien_nB; + next[x][y] = Xblank; + cave[x][y-1] = Yalien_n; + next[x][y-1] = Xalien_pause; + play_element_sound(x, y, SOUND_alien, Xalien); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -2315,33 +2694,41 @@ static void Lalien(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yalien_nB; - if (Cave[x+1][y-2] == Xblank) - Cave[x+1][y-2] = Xacid_splash_e; - if (Cave[x-1][y-2] == Xblank) - Cave[x-1][y-2] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yalien_nB; + next[x][y] = Xblank; + if (cave[x+1][y-2] == Xblank) + cave[x+1][y-2] = Xsplash_e; + if (cave[x-1][y-2] == Xblank) + cave[x-1][y-2] = Xsplash_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[x][y] = Yalien_nB; - Cave[x][y-1] = Yalien_n; - Next[x][y] = Xblank; - Next[x][y-1] = Xalien_pause; - play_element_sound(x, y, SOUND_alien, Xalien); - return; } } else if (y < dy) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + cave[x][y] = Yalien_sB; + next[x][y] = Xblank; + cave[x][y+1] = Yalien_s; + next[x][y+1] = Xalien_pause; + play_element_sound(x, y, SOUND_alien, Xalien); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -2350,27 +2737,14 @@ static void Lalien(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yalien_sB; - Next[x][y] = Xblank; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; + cave[x][y] = Yalien_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_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[x][y] = Yalien_sB; - Cave[x][y+1] = Yalien_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xalien_pause; - play_element_sound(x, y, SOUND_alien, Xalien); - return; } } } @@ -2378,8 +2752,29 @@ static void Lalien(int x, int y) { if (x < dx) { - switch (Cave[x+1][y]) + switch (cave[x+1][y]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + cave[x][y] = Yalien_eB; + next[x][y] = Xblank; + cave[x+1][y] = Yalien_e; + next[x+1][y] = Xalien_pause; + play_element_sound(x, y, SOUND_alien, Xalien); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -2388,33 +2783,41 @@ static void Lalien(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yalien_eB; - if (Cave[x+2][y-1] == Xblank) - Cave[x+2][y-1] = Xacid_splash_e; - if (Cave[x][y-1] == Xblank) - Cave[x][y-1] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yalien_eB; + next[x][y] = Xblank; + if (cave[x+2][y-1] == Xblank) + cave[x+2][y-1] = Xsplash_e; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Xplant: - case Yplant: - case Zplayer: - Cave[x][y] = Yalien_eB; - Cave[x+1][y] = Yalien_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xalien_pause; - play_element_sound(x, y, SOUND_alien, Xalien); - return; } } else if (x > dx) { - switch (Cave[x-1][y]) + switch (cave[x-1][y]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + cave[x][y] = Yalien_wB; + next[x][y] = Xblank; + cave[x-1][y] = Yalien_w; + next[x-1][y] = Xalien_pause; + play_element_sound(x, y, SOUND_alien, Xalien); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -2423,27 +2826,14 @@ static void Lalien(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yalien_wB; - if (Cave[x][y-1] == Xblank) - Cave[x][y-1] = Xacid_splash_e; - if (Cave[x-2][y-1] == Xblank) - Cave[x-2][y-1] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yalien_wB; + next[x][y] = Xblank; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_e; + if (cave[x-2][y-1] == Xblank) + cave[x-2][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Xplant: - case Yplant: - case Zplayer: - Cave[x][y] = Yalien_wB; - Cave[x-1][y] = Yalien_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xalien_pause; - play_element_sound(x, y, SOUND_alien, Xalien); - return; } } } @@ -2451,13 +2841,34 @@ static void Lalien(int x, int y) static void Lalien_pause(int x, int y) { - Next[x][y] = Xalien; + next[x][y] = Xalien; } static void Lbug_n(int x, int y) { - switch (Cave[x][y-1]) + switch (cave[x][y-1]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + cave[x][y] = Ybug_nB; + next[x][y] = Xblank; + cave[x][y-1] = Ybug_n; + next[x][y-1] = Xbug_1_n; + play_element_sound(x, y, SOUND_bug, Xbug_1_n); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -2466,31 +2877,18 @@ static void Lbug_n(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ybug_nB; - if (Cave[x+1][y-2] == Xblank) - Cave[x+1][y-2] = Xacid_splash_e; - if (Cave[x-1][y-2] == Xblank) - Cave[x-1][y-2] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ybug_nB; + next[x][y] = Xblank; + if (cave[x+1][y-2] == Xblank) + cave[x+1][y-2] = Xsplash_e; + if (cave[x-1][y-2] == Xblank) + cave[x-1][y-2] = Xsplash_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[x][y] = Ybug_nB; - Cave[x][y-1] = Ybug_n; - Next[x][y] = Xblank; - Next[x][y-1] = Xbug_1_n; - play_element_sound(x, y, SOUND_bug, Xbug_1_n); - return; - default: - Cave[x][y] = Ybug_n_w; - Next[x][y] = Xbug_2_w; + cave[x][y] = Ybug_n_w; + next[x][y] = Xbug_2_w; play_element_sound(x, y, SOUND_bug, Xbug_1_n); return; } @@ -2498,21 +2896,31 @@ static void Lbug_n(int x, int y) static void Lbug_1_n(int x, int y) { - if (tab_amoeba[Cave[x][y-1]] || - tab_amoeba[Cave[x+1][y]] || - tab_amoeba[Cave[x][y+1]] || - tab_amoeba[Cave[x-1][y]]) + if (is_amoeba[cave[x][y-1]] || + is_amoeba[cave[x+1][y]] || + is_amoeba[cave[x][y+1]] || + is_amoeba[cave[x-1][y]]) { + next[x][y] = Zboom; Lboom_bug(x, y); return; } - switch (Cave[x+1][y]) + switch (cave[x+1][y]) { + case Zplayer: case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: case Xplant: case Yplant: case Xacid_1: @@ -2523,9 +2931,8 @@ static void Lbug_1_n(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - case Zplayer: - Cave[x][y] = Ybug_n_e; - Next[x][y] = Xbug_2_e; + cave[x][y] = Ybug_n_e; + next[x][y] = Xbug_2_e; play_element_sound(x, y, SOUND_bug, Xbug_1_n); return; @@ -2537,11 +2944,12 @@ static void Lbug_1_n(int x, int y) static void Lbug_2_n(int x, int y) { - if (tab_amoeba[Cave[x][y-1]] || - tab_amoeba[Cave[x+1][y]] || - tab_amoeba[Cave[x][y+1]] || - tab_amoeba[Cave[x-1][y]]) + if (is_amoeba[cave[x][y-1]] || + is_amoeba[cave[x+1][y]] || + is_amoeba[cave[x][y+1]] || + is_amoeba[cave[x-1][y]]) { + next[x][y] = Zboom; Lboom_bug(x, y); return; @@ -2552,8 +2960,29 @@ static void Lbug_2_n(int x, int y) static void Lbug_e(int x, int y) { - switch (Cave[x+1][y]) + switch (cave[x+1][y]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + cave[x][y] = Ybug_eB; + next[x][y] = Xblank; + cave[x+1][y] = Ybug_e; + next[x+1][y] = Xbug_1_e; + play_element_sound(x, y, SOUND_bug, Xbug_1_e); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -2562,31 +2991,18 @@ static void Lbug_e(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ybug_eB; - if (Cave[x+2][y-1] == Xblank) - Cave[x+2][y-1] = Xacid_splash_e; - if (Cave[x][y-1] == Xblank) - Cave[x][y-1] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ybug_eB; + next[x][y] = Xblank; + if (cave[x+2][y-1] == Xblank) + cave[x+2][y-1] = Xsplash_e; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Xplant: - case Yplant: - case Zplayer: - Cave[x][y] = Ybug_eB; - Cave[x+1][y] = Ybug_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xbug_1_e; - play_element_sound(x, y, SOUND_bug, Xbug_1_e); - return; - default: - Cave[x][y] = Ybug_e_n; - Next[x][y] = Xbug_2_n; + cave[x][y] = Ybug_e_n; + next[x][y] = Xbug_2_n; play_element_sound(x, y, SOUND_bug, Xbug_1_e); return; } @@ -2594,21 +3010,31 @@ static void Lbug_e(int x, int y) static void Lbug_1_e(int x, int y) { - if (tab_amoeba[Cave[x][y-1]] || - tab_amoeba[Cave[x+1][y]] || - tab_amoeba[Cave[x][y+1]] || - tab_amoeba[Cave[x-1][y]]) + if (is_amoeba[cave[x][y-1]] || + is_amoeba[cave[x+1][y]] || + is_amoeba[cave[x][y+1]] || + is_amoeba[cave[x-1][y]]) { + next[x][y] = Zboom; Lboom_bug(x, y); return; } - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Zplayer: case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: case Xplant: case Yplant: case Xacid_1: @@ -2619,9 +3045,8 @@ static void Lbug_1_e(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - case Zplayer: - Cave[x][y] = Ybug_e_s; - Next[x][y] = Xbug_2_s; + cave[x][y] = Ybug_e_s; + next[x][y] = Xbug_2_s; play_element_sound(x, y, SOUND_bug, Xbug_1_e); return; @@ -2633,11 +3058,12 @@ static void Lbug_1_e(int x, int y) static void Lbug_2_e(int x, int y) { - if (tab_amoeba[Cave[x][y-1]] || - tab_amoeba[Cave[x+1][y]] || - tab_amoeba[Cave[x][y+1]] || - tab_amoeba[Cave[x-1][y]]) + if (is_amoeba[cave[x][y-1]] || + is_amoeba[cave[x+1][y]] || + is_amoeba[cave[x][y+1]] || + is_amoeba[cave[x-1][y]]) { + next[x][y] = Zboom; Lboom_bug(x, y); return; @@ -2648,8 +3074,29 @@ static void Lbug_2_e(int x, int y) static void Lbug_s(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + cave[x][y] = Ybug_sB; + next[x][y] = Xblank; + cave[x][y+1] = Ybug_s; + next[x][y+1] = Xbug_1_s; + play_element_sound(x, y, SOUND_bug, Xbug_1_s); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -2658,31 +3105,18 @@ static void Lbug_s(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ybug_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ybug_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_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[x][y] = Ybug_sB; - Cave[x][y+1] = Ybug_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xbug_1_s; - play_element_sound(x, y, SOUND_bug, Xbug_1_s); - return; - default: - Cave[x][y] = Ybug_s_e; - Next[x][y] = Xbug_2_e; + cave[x][y] = Ybug_s_e; + next[x][y] = Xbug_2_e; play_element_sound(x, y, SOUND_bug, Xbug_1_s); return; } @@ -2690,21 +3124,31 @@ static void Lbug_s(int x, int y) static void Lbug_1_s(int x, int y) { - if (tab_amoeba[Cave[x][y-1]] || - tab_amoeba[Cave[x+1][y]] || - tab_amoeba[Cave[x][y+1]] || - tab_amoeba[Cave[x-1][y]]) + if (is_amoeba[cave[x][y-1]] || + is_amoeba[cave[x+1][y]] || + is_amoeba[cave[x][y+1]] || + is_amoeba[cave[x-1][y]]) { + next[x][y] = Zboom; Lboom_bug(x, y); return; } - switch (Cave[x-1][y]) + switch (cave[x-1][y]) { + case Zplayer: case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: case Xplant: case Yplant: case Xacid_1: @@ -2715,9 +3159,8 @@ static void Lbug_1_s(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - case Zplayer: - Cave[x][y] = Ybug_s_w; - Next[x][y] = Xbug_2_w; + cave[x][y] = Ybug_s_w; + next[x][y] = Xbug_2_w; play_element_sound(x, y, SOUND_bug, Xbug_1_s); return; @@ -2729,11 +3172,12 @@ static void Lbug_1_s(int x, int y) static void Lbug_2_s(int x, int y) { - if (tab_amoeba[Cave[x][y-1]] || - tab_amoeba[Cave[x+1][y]] || - tab_amoeba[Cave[x][y+1]] || - tab_amoeba[Cave[x-1][y]]) + if (is_amoeba[cave[x][y-1]] || + is_amoeba[cave[x+1][y]] || + is_amoeba[cave[x][y+1]] || + is_amoeba[cave[x-1][y]]) { + next[x][y] = Zboom; Lboom_bug(x, y); return; @@ -2744,8 +3188,29 @@ static void Lbug_2_s(int x, int y) static void Lbug_w(int x, int y) { - switch (Cave[x-1][y]) + switch (cave[x-1][y]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + cave[x][y] = Ybug_wB; + next[x][y] = Xblank; + cave[x-1][y] = Ybug_w; + next[x-1][y] = Xbug_1_w; + play_element_sound(x, y, SOUND_bug, Xbug_1_w); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -2754,31 +3219,18 @@ static void Lbug_w(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ybug_wB; - if (Cave[x][y-1] == Xblank) - Cave[x][y-1] = Xacid_splash_e; - if (Cave[x-2][y-1] == Xblank) - Cave[x-2][y-1] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ybug_wB; + next[x][y] = Xblank; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_e; + if (cave[x-2][y-1] == Xblank) + cave[x-2][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Xplant: - case Yplant: - case Zplayer: - Cave[x][y] = Ybug_wB; - Cave[x-1][y] = Ybug_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xbug_1_w; - play_element_sound(x, y, SOUND_bug, Xbug_1_w); - return; - default: - Cave[x][y] = Ybug_w_s; - Next[x][y] = Xbug_2_s; + cave[x][y] = Ybug_w_s; + next[x][y] = Xbug_2_s; play_element_sound(x, y, SOUND_bug, Xbug_1_w); return; } @@ -2786,21 +3238,31 @@ static void Lbug_w(int x, int y) static void Lbug_1_w(int x, int y) { - if (tab_amoeba[Cave[x][y-1]] || - tab_amoeba[Cave[x+1][y]] || - tab_amoeba[Cave[x][y+1]] || - tab_amoeba[Cave[x-1][y]]) + if (is_amoeba[cave[x][y-1]] || + is_amoeba[cave[x+1][y]] || + is_amoeba[cave[x][y+1]] || + is_amoeba[cave[x-1][y]]) { + next[x][y] = Zboom; Lboom_bug(x, y); return; } - switch (Cave[x][y-1]) + switch (cave[x][y-1]) { + case Zplayer: case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: case Xplant: case Yplant: case Xacid_1: @@ -2811,9 +3273,8 @@ static void Lbug_1_w(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - case Zplayer: - Cave[x][y] = Ybug_w_n; - Next[x][y] = Xbug_2_n; + cave[x][y] = Ybug_w_n; + next[x][y] = Xbug_2_n; play_element_sound(x, y, SOUND_bug, Xbug_1_w); return; @@ -2825,11 +3286,12 @@ static void Lbug_1_w(int x, int y) static void Lbug_2_w(int x, int y) { - if (tab_amoeba[Cave[x][y-1]] || - tab_amoeba[Cave[x+1][y]] || - tab_amoeba[Cave[x][y+1]] || - tab_amoeba[Cave[x-1][y]]) + if (is_amoeba[cave[x][y-1]] || + is_amoeba[cave[x+1][y]] || + is_amoeba[cave[x][y+1]] || + is_amoeba[cave[x-1][y]]) { + next[x][y] = Zboom; Lboom_bug(x, y); return; @@ -2840,8 +3302,29 @@ static void Lbug_2_w(int x, int y) static void Ltank_n(int x, int y) { - switch (Cave[x][y-1]) + switch (cave[x][y-1]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + cave[x][y] = Ytank_nB; + next[x][y] = Xblank; + cave[x][y-1] = Ytank_n; + next[x][y-1] = Xtank_1_n; + play_element_sound(x, y, SOUND_tank, Xtank_1_n); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -2850,31 +3333,18 @@ static void Ltank_n(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ytank_nB; - if (Cave[x+1][y-2] == Xblank) - Cave[x+1][y-2] = Xacid_splash_e; - if (Cave[x-1][y-2] == Xblank) - Cave[x-1][y-2] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ytank_nB; + next[x][y] = Xblank; + if (cave[x+1][y-2] == Xblank) + cave[x+1][y-2] = Xsplash_e; + if (cave[x-1][y-2] == Xblank) + cave[x-1][y-2] = Xsplash_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[x][y] = Ytank_nB; - Cave[x][y-1] = Ytank_n; - Next[x][y] = Xblank; - Next[x][y-1] = Xtank_1_n; - play_element_sound(x, y, SOUND_tank, Xtank_1_n); - return; - default: - Cave[x][y] = Ytank_n_e; - Next[x][y] = Xtank_2_e; + cave[x][y] = Ytank_n_e; + next[x][y] = Xtank_2_e; play_element_sound(x, y, SOUND_tank, Xtank_1_n); return; } @@ -2882,21 +3352,31 @@ static void Ltank_n(int x, int y) static void Ltank_1_n(int x, int y) { - if (tab_amoeba[Cave[x][y-1]] || - tab_amoeba[Cave[x+1][y]] || - tab_amoeba[Cave[x][y+1]] || - tab_amoeba[Cave[x-1][y]]) + if (is_amoeba[cave[x][y-1]] || + is_amoeba[cave[x+1][y]] || + is_amoeba[cave[x][y+1]] || + is_amoeba[cave[x-1][y]]) { + next[x][y] = Zboom; Lboom_tank(x, y); return; } - switch (Cave[x-1][y]) + switch (cave[x-1][y]) { + case Zplayer: case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: case Xplant: case Yplant: case Xacid_1: @@ -2907,9 +3387,8 @@ static void Ltank_1_n(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - case Zplayer: - Cave[x][y] = Ytank_n_w; - Next[x][y] = Xtank_2_w; + cave[x][y] = Ytank_n_w; + next[x][y] = Xtank_2_w; play_element_sound(x, y, SOUND_tank, Xtank_1_n); return; @@ -2921,11 +3400,12 @@ static void Ltank_1_n(int x, int y) static void Ltank_2_n(int x, int y) { - if (tab_amoeba[Cave[x][y-1]] || - tab_amoeba[Cave[x+1][y]] || - tab_amoeba[Cave[x][y+1]] || - tab_amoeba[Cave[x-1][y]]) + if (is_amoeba[cave[x][y-1]] || + is_amoeba[cave[x+1][y]] || + is_amoeba[cave[x][y+1]] || + is_amoeba[cave[x-1][y]]) { + next[x][y] = Zboom; Lboom_tank(x, y); return; @@ -2936,8 +3416,29 @@ static void Ltank_2_n(int x, int y) static void Ltank_e(int x, int y) { - switch (Cave[x+1][y]) + switch (cave[x+1][y]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + cave[x][y] = Ytank_eB; + next[x][y] = Xblank; + cave[x+1][y] = Ytank_e; + next[x+1][y] = Xtank_1_e; + play_element_sound(x, y, SOUND_tank, Xtank_1_e); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -2946,31 +3447,18 @@ static void Ltank_e(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ytank_eB; - if (Cave[x+2][y-1] == Xblank) - Cave[x+2][y-1] = Xacid_splash_e; - if (Cave[x][y-1] == Xblank) - Cave[x][y-1] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ytank_eB; + next[x][y] = Xblank; + if (cave[x+2][y-1] == Xblank) + cave[x+2][y-1] = Xsplash_e; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Xplant: - case Yplant: - case Zplayer: - Cave[x][y] = Ytank_eB; - Cave[x+1][y] = Ytank_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xtank_1_e; - play_element_sound(x, y, SOUND_tank, Xtank_1_e); - return; - default: - Cave[x][y] = Ytank_e_s; - Next[x][y] = Xtank_2_s; + cave[x][y] = Ytank_e_s; + next[x][y] = Xtank_2_s; play_element_sound(x, y, SOUND_tank, Xtank_1_e); return; } @@ -2978,21 +3466,31 @@ static void Ltank_e(int x, int y) static void Ltank_1_e(int x, int y) { - if (tab_amoeba[Cave[x][y-1]] || - tab_amoeba[Cave[x+1][y]] || - tab_amoeba[Cave[x][y+1]] || - tab_amoeba[Cave[x-1][y]]) + if (is_amoeba[cave[x][y-1]] || + is_amoeba[cave[x+1][y]] || + is_amoeba[cave[x][y+1]] || + is_amoeba[cave[x-1][y]]) { + next[x][y] = Zboom; Lboom_tank(x, y); return; } - switch (Cave[x][y-1]) + switch (cave[x][y-1]) { + case Zplayer: case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: case Xplant: case Yplant: case Xacid_1: @@ -3003,9 +3501,8 @@ static void Ltank_1_e(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - case Zplayer: - Cave[x][y] = Ytank_e_n; - Next[x][y] = Xtank_2_n; + cave[x][y] = Ytank_e_n; + next[x][y] = Xtank_2_n; play_element_sound(x, y, SOUND_tank, Xtank_1_e); return; @@ -3017,11 +3514,12 @@ static void Ltank_1_e(int x, int y) static void Ltank_2_e(int x, int y) { - if (tab_amoeba[Cave[x][y-1]] || - tab_amoeba[Cave[x+1][y]] || - tab_amoeba[Cave[x][y+1]] || - tab_amoeba[Cave[x-1][y]]) + if (is_amoeba[cave[x][y-1]] || + is_amoeba[cave[x+1][y]] || + is_amoeba[cave[x][y+1]] || + is_amoeba[cave[x-1][y]]) { + next[x][y] = Zboom; Lboom_tank(x, y); return; @@ -3032,8 +3530,29 @@ static void Ltank_2_e(int x, int y) static void Ltank_s(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + cave[x][y] = Ytank_sB; + next[x][y] = Xblank; + cave[x][y+1] = Ytank_s; + next[x][y+1] = Xtank_1_s; + play_element_sound(x, y, SOUND_tank, Xtank_1_s); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -3042,31 +3561,18 @@ static void Ltank_s(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ytank_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ytank_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_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[x][y] = Ytank_sB; - Cave[x][y+1] = Ytank_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xtank_1_s; - play_element_sound(x, y, SOUND_tank, Xtank_1_s); - return; - default: - Cave[x][y] = Ytank_s_w; - Next[x][y] = Xtank_2_w; + cave[x][y] = Ytank_s_w; + next[x][y] = Xtank_2_w; play_element_sound(x, y, SOUND_tank, Xtank_1_s); return; } @@ -3074,21 +3580,31 @@ static void Ltank_s(int x, int y) static void Ltank_1_s(int x, int y) { - if (tab_amoeba[Cave[x][y-1]] || - tab_amoeba[Cave[x+1][y]] || - tab_amoeba[Cave[x][y+1]] || - tab_amoeba[Cave[x-1][y]]) + if (is_amoeba[cave[x][y-1]] || + is_amoeba[cave[x+1][y]] || + is_amoeba[cave[x][y+1]] || + is_amoeba[cave[x-1][y]]) { + next[x][y] = Zboom; Lboom_tank(x, y); return; } - switch (Cave[x+1][y]) + switch (cave[x+1][y]) { + case Zplayer: case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: case Xplant: case Yplant: case Xacid_1: @@ -3099,9 +3615,8 @@ static void Ltank_1_s(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - case Zplayer: - Cave[x][y] = Ytank_s_e; - Next[x][y] = Xtank_2_e; + cave[x][y] = Ytank_s_e; + next[x][y] = Xtank_2_e; play_element_sound(x, y, SOUND_tank, Xtank_1_s); return; @@ -3113,11 +3628,12 @@ static void Ltank_1_s(int x, int y) static void Ltank_2_s(int x, int y) { - if (tab_amoeba[Cave[x][y-1]] || - tab_amoeba[Cave[x+1][y]] || - tab_amoeba[Cave[x][y+1]] || - tab_amoeba[Cave[x-1][y]]) + if (is_amoeba[cave[x][y-1]] || + is_amoeba[cave[x+1][y]] || + is_amoeba[cave[x][y+1]] || + is_amoeba[cave[x-1][y]]) { + next[x][y] = Zboom; Lboom_tank(x, y); return; @@ -3128,8 +3644,29 @@ static void Ltank_2_s(int x, int y) static void Ltank_w(int x, int y) { - switch (Cave[x-1][y]) + switch (cave[x-1][y]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + cave[x][y] = Ytank_wB; + next[x][y] = Xblank; + cave[x-1][y] = Ytank_w; + next[x-1][y] = Xtank_1_w; + play_element_sound(x, y, SOUND_tank, Xtank_1_w); + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -3138,31 +3675,18 @@ static void Ltank_w(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ytank_wB; - if (Cave[x][y-1] == Xblank) - Cave[x][y-1] = Xacid_splash_e; - if (Cave[x-2][y-1] == Xblank) - Cave[x-2][y-1] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ytank_wB; + next[x][y] = Xblank; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_e; + if (cave[x-2][y-1] == Xblank) + cave[x-2][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Xplant: - case Yplant: - case Zplayer: - Cave[x][y] = Ytank_wB; - Cave[x-1][y] = Ytank_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xtank_1_w; - play_element_sound(x, y, SOUND_tank, Xtank_1_w); - return; - default: - Cave[x][y] = Ytank_w_n; - Next[x][y] = Xtank_2_n; + cave[x][y] = Ytank_w_n; + next[x][y] = Xtank_2_n; play_element_sound(x, y, SOUND_tank, Xtank_1_w); return; } @@ -3170,21 +3694,31 @@ static void Ltank_w(int x, int y) static void Ltank_1_w(int x, int y) { - if (tab_amoeba[Cave[x][y-1]] || - tab_amoeba[Cave[x+1][y]] || - tab_amoeba[Cave[x][y+1]] || - tab_amoeba[Cave[x-1][y]]) + if (is_amoeba[cave[x][y-1]] || + is_amoeba[cave[x+1][y]] || + is_amoeba[cave[x][y+1]] || + is_amoeba[cave[x-1][y]]) { + next[x][y] = Zboom; Lboom_tank(x, y); return; } - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Zplayer: case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: case Xplant: case Yplant: case Xacid_1: @@ -3195,9 +3729,8 @@ static void Ltank_1_w(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - case Zplayer: - Cave[x][y] = Ytank_w_s; - Next[x][y] = Xtank_2_s; + cave[x][y] = Ytank_w_s; + next[x][y] = Xtank_2_s; play_element_sound(x, y, SOUND_tank, Xtank_1_w); return; @@ -3209,11 +3742,12 @@ static void Ltank_1_w(int x, int y) static void Ltank_2_w(int x, int y) { - if (tab_amoeba[Cave[x][y-1]] || - tab_amoeba[Cave[x+1][y]] || - tab_amoeba[Cave[x][y+1]] || - tab_amoeba[Cave[x-1][y]]) + if (is_amoeba[cave[x][y-1]] || + is_amoeba[cave[x+1][y]] || + is_amoeba[cave[x][y+1]] || + is_amoeba[cave[x-1][y]]) { + next[x][y] = Zboom; Lboom_tank(x, y); return; @@ -3224,8 +3758,25 @@ static void Ltank_2_w(int x, int y) static void Lemerald(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yemerald_sB; + next[x][y] = Xblank; + cave[x][y+1] = Yemerald_s; + next[x][y+1] = Xemerald_fall; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -3234,28 +3785,15 @@ static void Lemerald(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yemerald_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yemerald_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Yemerald_sB; - Cave[x][y+1] = Yemerald_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xemerald_fall; - return; - - case Xspring: - case Xspring_pause: - case Xspring_e: - case Xspring_w: case Xandroid: case Xandroid_1_n: case Xandroid_2_n: @@ -3265,24 +3803,20 @@ static void Lemerald(int x, int y) case Xandroid_2_s: case Xandroid_1_w: case Xandroid_2_w: - case Xstone: - case Xstone_pause: case Xemerald: case Xemerald_pause: case Xdiamond: case Xdiamond_pause: + case Xstone: + case Xstone_pause: case Xbomb: case Xbomb_pause: - case Xballoon: - case Xacid_ne: - case Xacid_nw: - case Xball_1: - case Xball_2: case Xnut: case Xnut_pause: - case Xslidewall_ns: - case Xslidewall_ew: - case Xwonderwall: + case Xspring: + case Xspring_pause: + case Xspring_e: + case Xspring_w: case Xkey_1: case Xkey_2: case Xkey_3: @@ -3291,12 +3825,17 @@ static void Lemerald(int x, int y) case Xkey_6: case Xkey_7: case Xkey_8: - case Xbumper: + case Xballoon: + case Xball_1: + case Xball_2: + case Xwonderwall: case Xswitch: - case Xsteel_1: - case Xsteel_2: - case Xsteel_3: - case Xsteel_4: + case Xbumper: + case Ybumper: + case Xacid_ne: + case Xacid_nw: + case Xslide_ns: + case Xslide_ew: case Xwall_1: case Xwall_2: case Xwall_3: @@ -3305,43 +3844,55 @@ static void Lemerald(int x, int y) case Xroundwall_2: case Xroundwall_3: case Xroundwall_4: + case Xsteel_1: + case Xsteel_2: + case Xsteel_3: + case Xsteel_4: if (RANDOM(2)) { - if (tab_blank[Cave[x+1][y]] && tab_acid[Cave[x+1][y+1]]) + if (is_blank[cave[x+1][y]] && is_blank_or_acid[cave[x+1][y+1]]) { - Cave[x][y] = Yemerald_eB; - Cave[x+1][y] = Yemerald_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xemerald_pause; + cave[x][y] = Yemerald_eB; + next[x][y] = Xblank; + cave[x+1][y] = Yemerald_e; + next[x+1][y] = Xemerald_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } - if (tab_blank[Cave[x-1][y]] && tab_acid[Cave[x-1][y+1]]) + if (is_blank[cave[x-1][y]] && is_blank_or_acid[cave[x-1][y+1]]) { - Cave[x][y] = Yemerald_wB; - Cave[x-1][y] = Yemerald_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xemerald_pause; + cave[x][y] = Yemerald_wB; + next[x][y] = Xblank; + cave[x-1][y] = Yemerald_w; + next[x-1][y] = Xemerald_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } } else { - if (tab_blank[Cave[x-1][y]] && tab_acid[Cave[x-1][y+1]]) + if (is_blank[cave[x-1][y]] && is_blank_or_acid[cave[x-1][y+1]]) { - Cave[x][y] = Yemerald_wB; - Cave[x-1][y] = Yemerald_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xemerald_pause; + cave[x][y] = Yemerald_wB; + next[x][y] = Xblank; + cave[x-1][y] = Yemerald_w; + next[x-1][y] = Xemerald_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } - if (tab_blank[Cave[x+1][y]] && tab_acid[Cave[x+1][y+1]]) + if (is_blank[cave[x+1][y]] && is_blank_or_acid[cave[x+1][y+1]]) { - Cave[x][y] = Yemerald_eB; - Cave[x+1][y] = Yemerald_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xemerald_pause; + cave[x][y] = Yemerald_eB; + next[x][y] = Xblank; + cave[x+1][y] = Yemerald_e; + next[x+1][y] = Xemerald_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } } @@ -3350,7 +3901,7 @@ static void Lemerald(int x, int y) if (++lev.shine_cnt > 50) { lev.shine_cnt = RANDOM(8); - Cave[x][y] = Xemerald_shine; + cave[x][y] = Xemerald_shine; } return; @@ -3359,8 +3910,25 @@ static void Lemerald(int x, int y) static void Lemerald_pause(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yemerald_sB; + next[x][y] = Xblank; + cave[x][y+1] = Yemerald_s; + next[x][y+1] = Xemerald_fall; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -3369,35 +3937,44 @@ static void Lemerald_pause(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yemerald_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yemerald_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Yemerald_sB; - Cave[x][y+1] = Yemerald_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xemerald_fall; - return; - default: - Cave[x][y] = Xemerald; - Next[x][y] = Xemerald; + cave[x][y] = Xemerald; + next[x][y] = Xemerald; return; } } static void Lemerald_fall(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yemerald_sB; + next[x][y] = Xblank; + cave[x][y+1] = Yemerald_s; + next[x][y+1] = Xemerald_fall; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -3406,44 +3983,33 @@ static void Lemerald_fall(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yemerald_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yemerald_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Zplayer: - Cave[x][y] = Yemerald_sB; - Cave[x][y+1] = Yemerald_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xemerald_fall; - return; - case Xwonderwall: - if (lev.wonderwall_time) + if (lev.wonderwall_time > 0) { - lev.wonderwall_state = 1; - Cave[x][y] = Yemerald_sB; - if (tab_blank[Cave[x][y+2]]) + lev.wonderwall_active = TRUE; + cave[x][y] = Yemerald_sB; + next[x][y] = Xblank; + if (is_blank[cave[x][y+2]]) { - Cave[x][y+2] = Ydiamond_s; - Next[x][y+2] = Xdiamond_fall; + cave[x][y+2] = Ydiamond_s; + next[x][y+2] = Xdiamond_fall; } - - Next[x][y] = Xblank; play_element_sound(x, y, SOUND_wonderfall, Xwonderwall); return; } default: - Cave[x][y] = Xemerald; - Next[x][y] = Xemerald; + cave[x][y] = Xemerald; + next[x][y] = Xemerald; play_element_sound(x, y, SOUND_diamond, Xemerald); return; } @@ -3451,38 +4017,42 @@ static void Lemerald_fall(int x, int y) static void Ldiamond(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { - case Xacid_1: - case Xacid_2: - case Xacid_3: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Ydiamond_sB; + next[x][y] = Xblank; + cave[x][y+1] = Ydiamond_s; + next[x][y+1] = Xdiamond_fall; + return; + + case Xacid_1: + case Xacid_2: + case Xacid_3: case Xacid_4: case Xacid_5: case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ydiamond_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ydiamond_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Ydiamond_sB; - Cave[x][y+1] = Ydiamond_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xdiamond_fall; - return; - - case Xspring: - case Xspring_pause: - case Xspring_e: - case Xspring_w: case Xandroid: case Xandroid_1_n: case Xandroid_2_n: @@ -3492,24 +4062,20 @@ static void Ldiamond(int x, int y) case Xandroid_2_s: case Xandroid_1_w: case Xandroid_2_w: - case Xstone: - case Xstone_pause: case Xemerald: case Xemerald_pause: case Xdiamond: case Xdiamond_pause: + case Xstone: + case Xstone_pause: case Xbomb: case Xbomb_pause: - case Xballoon: - case Xacid_ne: - case Xacid_nw: - case Xball_1: - case Xball_2: case Xnut: case Xnut_pause: - case Xslidewall_ns: - case Xslidewall_ew: - case Xwonderwall: + case Xspring: + case Xspring_pause: + case Xspring_e: + case Xspring_w: case Xkey_1: case Xkey_2: case Xkey_3: @@ -3518,12 +4084,17 @@ static void Ldiamond(int x, int y) case Xkey_6: case Xkey_7: case Xkey_8: - case Xbumper: + case Xballoon: + case Xball_1: + case Xball_2: + case Xwonderwall: case Xswitch: - case Xsteel_1: - case Xsteel_2: - case Xsteel_3: - case Xsteel_4: + case Xbumper: + case Ybumper: + case Xacid_ne: + case Xacid_nw: + case Xslide_ns: + case Xslide_ew: case Xwall_1: case Xwall_2: case Xwall_3: @@ -3532,43 +4103,55 @@ static void Ldiamond(int x, int y) case Xroundwall_2: case Xroundwall_3: case Xroundwall_4: + case Xsteel_1: + case Xsteel_2: + case Xsteel_3: + case Xsteel_4: if (RANDOM(2)) { - if (tab_blank[Cave[x+1][y]] && tab_acid[Cave[x+1][y+1]]) + if (is_blank[cave[x+1][y]] && is_blank_or_acid[cave[x+1][y+1]]) { - Cave[x][y] = Ydiamond_eB; - Cave[x+1][y] = Ydiamond_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xdiamond_pause; + cave[x][y] = Ydiamond_eB; + next[x][y] = Xblank; + cave[x+1][y] = Ydiamond_e; + next[x+1][y] = Xdiamond_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } - if (tab_blank[Cave[x-1][y]] && tab_acid[Cave[x-1][y+1]]) + if (is_blank[cave[x-1][y]] && is_blank_or_acid[cave[x-1][y+1]]) { - Cave[x][y] = Ydiamond_wB; - Cave[x-1][y] = Ydiamond_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xdiamond_pause; + cave[x][y] = Ydiamond_wB; + next[x][y] = Xblank; + cave[x-1][y] = Ydiamond_w; + next[x-1][y] = Xdiamond_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } } else { - if (tab_blank[Cave[x-1][y]] && tab_acid[Cave[x-1][y+1]]) + if (is_blank[cave[x-1][y]] && is_blank_or_acid[cave[x-1][y+1]]) { - Cave[x][y] = Ydiamond_wB; - Cave[x-1][y] = Ydiamond_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xdiamond_pause; + cave[x][y] = Ydiamond_wB; + next[x][y] = Xblank; + cave[x-1][y] = Ydiamond_w; + next[x-1][y] = Xdiamond_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } - if (tab_blank[Cave[x+1][y]] && tab_acid[Cave[x+1][y+1]]) + if (is_blank[cave[x+1][y]] && is_blank_or_acid[cave[x+1][y+1]]) { - Cave[x][y] = Ydiamond_eB; - Cave[x+1][y] = Ydiamond_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xdiamond_pause; + cave[x][y] = Ydiamond_eB; + next[x][y] = Xblank; + cave[x+1][y] = Ydiamond_e; + next[x+1][y] = Xdiamond_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } } @@ -3577,7 +4160,7 @@ static void Ldiamond(int x, int y) if (++lev.shine_cnt > 50) { lev.shine_cnt = RANDOM(8); - Cave[x][y] = Xdiamond_shine; + cave[x][y] = Xdiamond_shine; } return; @@ -3586,8 +4169,25 @@ static void Ldiamond(int x, int y) static void Ldiamond_pause(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Ydiamond_sB; + next[x][y] = Xblank; + cave[x][y+1] = Ydiamond_s; + next[x][y+1] = Xdiamond_fall; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -3596,35 +4196,44 @@ static void Ldiamond_pause(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ydiamond_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ydiamond_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Ydiamond_sB; - Cave[x][y+1] = Ydiamond_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xdiamond_fall; - return; - default: - Cave[x][y] = Xdiamond; - Next[x][y] = Xdiamond; + cave[x][y] = Xdiamond; + next[x][y] = Xdiamond; return; } } static void Ldiamond_fall(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Ydiamond_sB; + next[x][y] = Xblank; + cave[x][y+1] = Ydiamond_s; + next[x][y+1] = Xdiamond_fall; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -3633,44 +4242,33 @@ static void Ldiamond_fall(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ydiamond_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ydiamond_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Zplayer: - Cave[x][y] = Ydiamond_sB; - Cave[x][y+1] = Ydiamond_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xdiamond_fall; - return; - case Xwonderwall: - if (lev.wonderwall_time) + if (lev.wonderwall_time > 0) { - lev.wonderwall_state = 1; - Cave[x][y] = Ydiamond_sB; - if (tab_blank[Cave[x][y+2]]) + lev.wonderwall_active = TRUE; + cave[x][y] = Ydiamond_sB; + next[x][y] = Xblank; + if (is_blank[cave[x][y+2]]) { - Cave[x][y+2] = Ystone_s; - Next[x][y+2] = Xstone_fall; + cave[x][y+2] = Ystone_s; + next[x][y+2] = Xstone_fall; } - - Next[x][y] = Xblank; play_element_sound(x, y, SOUND_wonderfall, Xwonderwall); return; } default: - Cave[x][y] = Xdiamond; - Next[x][y] = Xdiamond; + cave[x][y] = Xdiamond; + next[x][y] = Xdiamond; play_element_sound(x, y, SOUND_diamond, Xdiamond); return; } @@ -3678,31 +4276,11 @@ static void Ldiamond_fall(int x, int y) static void Lstone(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { - case Xacid_1: - case Xacid_2: - case Xacid_3: - case Xacid_4: - case Xacid_5: - case Xacid_6: - case Xacid_7: - case Xacid_8: - Cave[x][y] = Ystone_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; - play_element_sound(x, y, SOUND_acid, Xacid_1); - return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Xplant: - case Yplant: -#ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS + case Xsplash_e: + case Xsplash_w: case Xfake_acid_1: case Xfake_acid_2: case Xfake_acid_3: @@ -3711,24 +4289,38 @@ static void Lstone(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif - Cave[x][y] = Ystone_sB; - Cave[x][y+1] = Ystone_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xstone_fall; + case Xplant: + case Yplant: + cave[x][y] = Ystone_sB; + next[x][y] = Xblank; + cave[x][y+1] = Ystone_s; + next[x][y+1] = Xstone_fall; + return; + + case Xacid_1: + case Xacid_2: + case Xacid_3: + case Xacid_4: + case Xacid_5: + case Xacid_6: + case Xacid_7: + case Xacid_8: + cave[x][y] = Ystone_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; + play_element_sound(x, y, SOUND_acid, Xacid_1); return; case Xsand: - Cave[x][y] = Xsand_stonein_1; - Cave[x][y+1] = Xsand_sandstone_1; - Next[x][y] = Xsand_stonein_2; - Next[x][y+1] = Xsand_sandstone_2; + cave[x][y] = Xsand_stonein_1; + next[x][y] = Xsand_stonein_2; + cave[x][y+1] = Xsand_sandstone_1; + next[x][y+1] = Xsand_sandstone_2; return; - case Xspring: - case Xspring_pause: - case Xspring_e: - case Xspring_w: case Xandroid: case Xandroid_1_n: case Xandroid_2_n: @@ -3738,23 +4330,20 @@ static void Lstone(int x, int y) case Xandroid_2_s: case Xandroid_1_w: case Xandroid_2_w: - case Xstone: - case Xstone_pause: case Xemerald: case Xemerald_pause: case Xdiamond: case Xdiamond_pause: + case Xstone: + case Xstone_pause: case Xbomb: case Xbomb_pause: - case Xballoon: - case Xacid_ne: - case Xacid_nw: - case Xball_1: - case Xball_2: case Xnut: case Xnut_pause: - case Xslidewall_ns: - case Xslidewall_ew: + case Xspring: + case Xspring_pause: + case Xspring_e: + case Xspring_w: case Xkey_1: case Xkey_2: case Xkey_3: @@ -3763,51 +4352,67 @@ static void Lstone(int x, int y) case Xkey_6: case Xkey_7: case Xkey_8: - case Xbumper: + case Xballoon: + case Xball_1: + case Xball_2: case Xswitch: + case Xbumper: + case Ybumper: + case Xacid_ne: + case Xacid_nw: case Xlenses: case Xmagnify: + case Xslide_ns: + case Xslide_ew: case Xroundwall_1: case Xroundwall_2: case Xroundwall_3: case Xroundwall_4: if (RANDOM(2)) { - if (tab_blank[Cave[x+1][y]] && tab_acid[Cave[x+1][y+1]]) + if (is_blank[cave[x+1][y]] && is_blank_or_acid[cave[x+1][y+1]]) { - Cave[x][y] = Ystone_eB; - Cave[x+1][y] = Ystone_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xstone_pause; + cave[x][y] = Ystone_eB; + next[x][y] = Xblank; + cave[x+1][y] = Ystone_e; + next[x+1][y] = Xstone_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } - if (tab_blank[Cave[x-1][y]] && tab_acid[Cave[x-1][y+1]]) + if (is_blank[cave[x-1][y]] && is_blank_or_acid[cave[x-1][y+1]]) { - Cave[x][y] = Ystone_wB; - Cave[x-1][y] = Ystone_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xstone_pause; + cave[x][y] = Ystone_wB; + next[x][y] = Xblank; + cave[x-1][y] = Ystone_w; + next[x-1][y] = Xstone_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } } else { - if (tab_blank[Cave[x-1][y]] && tab_acid[Cave[x-1][y+1]]) + if (is_blank[cave[x-1][y]] && is_blank_or_acid[cave[x-1][y+1]]) { - Cave[x][y] = Ystone_wB; - Cave[x-1][y] = Ystone_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xstone_pause; + cave[x][y] = Ystone_wB; + next[x][y] = Xblank; + cave[x-1][y] = Ystone_w; + next[x-1][y] = Xstone_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } - if (tab_blank[Cave[x+1][y]] && tab_acid[Cave[x+1][y+1]]) + if (is_blank[cave[x+1][y]] && is_blank_or_acid[cave[x+1][y+1]]) { - Cave[x][y] = Ystone_eB; - Cave[x+1][y] = Ystone_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xstone_pause; + cave[x][y] = Ystone_eB; + next[x][y] = Xblank; + cave[x+1][y] = Ystone_e; + next[x+1][y] = Xstone_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } } @@ -3816,8 +4421,25 @@ static void Lstone(int x, int y) static void Lstone_pause(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Ystone_sB; + next[x][y] = Xblank; + cave[x][y+1] = Ystone_s; + next[x][y+1] = Xstone_fall; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -3826,19 +4448,30 @@ static void Lstone_pause(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ystone_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ystone_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; + default: + cave[x][y] = Xstone; + next[x][y] = Xstone; + return; + } +} + +static void Lstone_fall(int x, int y) +{ + switch (cave[x][y+1]) + { + case Zplayer: case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: -#ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS + case Xsplash_e: + case Xsplash_w: case Xfake_acid_1: case Xfake_acid_2: case Xfake_acid_3: @@ -3847,24 +4480,12 @@ static void Lstone_pause(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif - Cave[x][y] = Ystone_sB; - Cave[x][y+1] = Ystone_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xstone_fall; + cave[x][y] = Ystone_sB; + next[x][y] = Xblank; + cave[x][y+1] = Ystone_s; + next[x][y+1] = Xstone_fall; return; - default: - Cave[x][y] = Xstone; - Next[x][y] = Xstone; - return; - } -} - -static void Lstone_fall(int x, int y) -{ - switch (Cave[x][y+1]) - { case Xacid_1: case Xacid_2: case Xacid_3: @@ -3873,42 +4494,35 @@ static void Lstone_fall(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ystone_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ystone_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Zplayer: -#ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS - 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[x][y] = Ystone_sB; - Cave[x][y+1] = Ystone_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xstone_fall; + case Xeater_n: + case Xeater_e: + case Xeater_s: + case Xeater_w: + cave[x][y] = Ystone_sB; + Lboom_next_new(x, y, Xblank); + cave[x][y+1] = Yeater_stone; + next[x][y+1] = Zeater; + Lboom_eater_old(x, y+1); + score += lev.eater_score; return; - case Xnut: - case Xnut_pause: - Cave[x][y+1] = Ynut_stone; - Next[x][y] = Xstone; - Next[x][y+1] = Xemerald; - play_element_sound(x, y, SOUND_crack, Xnut); - score += lev.nut_score; + case Xalien: + case Xalien_pause: + cave[x][y] = Ystone_sB; + Lboom_next_new(x, y, Xblank); + cave[x][y+1] = Yalien_stone; + next[x][y+1] = Ztank; + Lboom_tank_old(x, y+1); + score += lev.alien_score; return; case Xbug_1_n: @@ -3919,21 +4533,11 @@ static void Lstone_fall(int x, int y) case Xbug_2_e: case Xbug_2_s: case Xbug_2_w: - Cave[x][y] = Ystone_sB; - Cave[x][y+1] = Ybug_stone; - Next[x][y+1] = Znormal; - Boom[x-1][y] = Xemerald; - Boom[x][y] = Xemerald; - Boom[x+1][y] = Xemerald; - Boom[x-1][y+1] = Xemerald; - Boom[x][y+1] = Xdiamond; - Boom[x+1][y+1] = Xemerald; - Boom[x-1][y+2] = Xemerald; - Boom[x][y+2] = Xemerald; - Boom[x+1][y+2] = Xemerald; -#if PLAY_ELEMENT_SOUND - play_element_sound(x, y, SOUND_boom, Xstone_fall); -#endif + cave[x][y] = Ystone_sB; + Lboom_next_new(x, y, Xblank); + cave[x][y+1] = Ybug_stone; + next[x][y+1] = Zbug; + Lboom_bug_old(x, y+1); score += lev.bug_score; return; @@ -3945,113 +4549,49 @@ static void Lstone_fall(int x, int y) case Xtank_2_e: case Xtank_2_s: case Xtank_2_w: - Cave[x][y] = Ystone_sB; - Cave[x][y+1] = Ytank_stone; - Next[x][y+1] = Znormal; - Boom[x-1][y] = Xblank; - Boom[x][y] = Xblank; - Boom[x+1][y] = Xblank; - Boom[x-1][y+1] = Xblank; - Boom[x][y+1] = Xblank; - Boom[x+1][y+1] = Xblank; - Boom[x-1][y+2] = Xblank; - Boom[x][y+2] = Xblank; - Boom[x+1][y+2] = Xblank; -#if PLAY_ELEMENT_SOUND - play_element_sound(x, y, SOUND_boom, Xstone_fall); -#endif + cave[x][y] = Ystone_sB; + Lboom_next_new(x, y, Xblank); + cave[x][y+1] = Ytank_stone; + next[x][y+1] = Ztank; + Lboom_tank_old(x, y+1); score += lev.tank_score; return; - case Xspring: - if (RANDOM(2)) - { - switch (Cave[x+1][y+1]) - { - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Xalien: - case Xalien_pause: - Cave[x][y+1] = Xspring_e; - break; - - default: - Cave[x][y+1] = Xspring_w; - break; - } - } - else - { - switch (Cave[x-1][y+1]) - { - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Xalien: - case Xalien_pause: - Cave[x][y+1] = Xspring_w; - break; - default: - Cave[x][y+1] = Xspring_e; - break; - } - } - - Next[x][y] = Xstone; - return; - - case Xeater_n: - case Xeater_e: - case Xeater_s: - case Xeater_w: - Cave[x][y] = Ystone_sB; - Cave[x][y+1] = Yeater_stone; - Next[x][y+1] = Znormal; - Boom[x-1][y] = lev.eater_array[lev.eater_pos][0]; - Boom[x][y] = lev.eater_array[lev.eater_pos][1]; - Boom[x+1][y] = lev.eater_array[lev.eater_pos][2]; - Boom[x-1][y+1] = lev.eater_array[lev.eater_pos][3]; - Boom[x][y+1] = lev.eater_array[lev.eater_pos][4]; - Boom[x+1][y+1] = lev.eater_array[lev.eater_pos][5]; - Boom[x-1][y+2] = lev.eater_array[lev.eater_pos][6]; - Boom[x][y+2] = lev.eater_array[lev.eater_pos][7]; - Boom[x+1][y+2] = lev.eater_array[lev.eater_pos][8]; -#if PLAY_ELEMENT_SOUND - play_element_sound(x, y, SOUND_boom, Xstone_fall); -#endif - lev.eater_pos = (lev.eater_pos + 1) & 7; - score += lev.eater_score; - return; - - case Xalien: - case Xalien_pause: - Cave[x][y] = Ystone_sB; - Cave[x][y+1] = Yalien_stone; - Next[x][y+1] = Znormal; - Boom[x-1][y] = Xblank; - Boom[x][y] = Xblank; - Boom[x+1][y] = Xblank; - Boom[x-1][y+1] = Xblank; - Boom[x][y+1] = Xblank; - Boom[x+1][y+1] = Xblank; - Boom[x-1][y+2] = Xblank; - Boom[x][y+2] = Xblank; - Boom[x+1][y+2] = Xblank; -#if PLAY_ELEMENT_SOUND - play_element_sound(x, y, SOUND_boom, Xstone_fall); -#endif - score += lev.alien_score; - return; - case Xdiamond: case Xdiamond_pause: - switch (Cave[x][y+2]) + switch (cave[x][y+2]) { - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + case Xacid_1: + case Xacid_2: + case Xacid_3: + case Xacid_4: + case Xacid_5: + case Xacid_6: + case Xacid_7: + case Xacid_8: + case Xandroid: + case Xandroid_1_n: + case Xandroid_2_n: + case Xandroid_1_e: + case Xandroid_2_e: + case Xandroid_1_s: + case Xandroid_2_s: + case Xandroid_1_w: + case Xandroid_2_w: case Xbug_1_n: case Xbug_1_e: case Xbug_1_s: @@ -4068,82 +4608,115 @@ static void Lstone_fall(int x, int y) case Xtank_2_e: case Xtank_2_s: case Xtank_2_w: - case Xspring_fall: - case Xandroid: - case Xandroid_1_n: - case Xandroid_2_n: - case Xandroid_1_e: - case Xandroid_2_e: - case Xandroid_1_s: - case Xandroid_2_s: - case Xandroid_1_w: - case Xandroid_2_w: - case Xstone_fall: case Xemerald_fall: case Xdiamond_fall: + case Xstone_fall: case Xbomb_fall: - case Xacid_s: - case Xacid_1: - case Xacid_2: - case Xacid_3: - case Xacid_4: - case Xacid_5: - case Xacid_6: - case Xacid_7: - case Xacid_8: case Xnut_fall: - case Xplant: - case Yplant: - Next[x][y] = Xstone; + case Xspring_fall: + case Xacid_s: + next[x][y] = Xstone; play_element_sound(x, y, SOUND_stone, Xstone); return; } - Cave[x][y] = Ystone_sB; - Cave[x][y+1] = Ydiamond_stone; - Next[x][y] = Xblank; - Next[x][y+1] = Xstone_pause; + cave[x][y] = Ystone_sB; + next[x][y] = Xblank; + cave[x][y+1] = Ydiamond_stone; + next[x][y+1] = Xstone_pause; play_element_sound(x, y, SOUND_squash, Xdiamond); return; case Xbomb: case Xbomb_pause: - Cave[x][y+1] = Ybomb_blank; - Next[x][y+1] = Znormal; - Boom[x-1][y] = Xblank; - Boom[x][y] = Xblank; - Boom[x+1][y] = Xblank; - Boom[x-1][y+1] = Xblank; - Boom[x][y+1] = Xblank; - Boom[x+1][y+1] = Xblank; - Boom[x-1][y+2] = Xblank; - Boom[x][y+2] = Xblank; - Boom[x+1][y+2] = Xblank; -#if PLAY_ELEMENT_SOUND - play_element_sound(x, y, SOUND_boom, Xstone_fall); -#endif + Lboom_cave_new(x, y, Xstone); + Lboom_next_new(x, y, Xstone); + cave[x][y+1] = Ybomb_blank; + next[x][y+1] = Ztank; + Lboom_tank_old(x, y+1); return; - case Xwonderwall: - if (lev.wonderwall_time) + case Xnut: + case Xnut_pause: + next[x][y] = Xstone; + cave[x][y+1] = Ynut_stone; + next[x][y+1] = Xemerald; + play_element_sound(x, y, SOUND_crack, Xnut); + score += lev.nut_score; + return; + + case Xspring: + if (RANDOM(2)) { - lev.wonderwall_state = 1; - Cave[x][y] = Ystone_sB; + switch (cave[x+1][y+1]) + { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xalien: + case Xalien_pause: + cave[x][y+1] = Xspring_e; + break; - if (tab_blank[Cave[x][y+2]]) + default: + cave[x][y+1] = Xspring_w; + break; + } + } + else + { + switch (cave[x-1][y+1]) { - Cave[x][y+2] = Yemerald_s; - Next[x][y+2] = Xemerald_fall; + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xalien: + case Xalien_pause: + cave[x][y+1] = Xspring_w; + break; + default: + cave[x][y+1] = Xspring_e; + break; } + } + + next[x][y] = Xstone; + return; - Next[x][y] = Xblank; + case Xwonderwall: + if (lev.wonderwall_time > 0) + { + lev.wonderwall_active = TRUE; + cave[x][y] = Ystone_sB; + next[x][y] = Xblank; + if (is_blank[cave[x][y+2]]) + { + cave[x][y+2] = Yemerald_s; + next[x][y+2] = Xemerald_fall; + } play_element_sound(x, y, SOUND_wonderfall, Xwonderwall); return; } default: - Cave[x][y] = Xstone; - Next[x][y] = Xstone; + cave[x][y] = Xstone; + next[x][y] = Xstone; play_element_sound(x, y, SOUND_stone, Xstone); return; } @@ -4151,8 +4724,25 @@ static void Lstone_fall(int x, int y) static void Lbomb(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Ybomb_sB; + next[x][y] = Xblank; + cave[x][y+1] = Ybomb_s; + next[x][y+1] = Xbomb_fall; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -4161,28 +4751,15 @@ static void Lbomb(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ybomb_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ybomb_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Ybomb_sB; - Cave[x][y+1] = Ybomb_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xbomb_fall; - return; - - case Xspring: - case Xspring_pause: - case Xspring_e: - case Xspring_w: case Xandroid: case Xandroid_1_n: case Xandroid_2_n: @@ -4192,23 +4769,20 @@ static void Lbomb(int x, int y) case Xandroid_2_s: case Xandroid_1_w: case Xandroid_2_w: - case Xstone: - case Xstone_pause: case Xemerald: case Xemerald_pause: case Xdiamond: case Xdiamond_pause: + case Xstone: + case Xstone_pause: case Xbomb: case Xbomb_pause: - case Xballoon: - case Xacid_ne: - case Xacid_nw: - case Xball_1: - case Xball_2: case Xnut: case Xnut_pause: - case Xslidewall_ns: - case Xslidewall_ew: + case Xspring: + case Xspring_pause: + case Xspring_e: + case Xspring_w: case Xkey_1: case Xkey_2: case Xkey_3: @@ -4217,49 +4791,65 @@ static void Lbomb(int x, int y) case Xkey_6: case Xkey_7: case Xkey_8: - case Xbumper: + case Xballoon: + case Xball_1: + case Xball_2: case Xswitch: + case Xbumper: + case Ybumper: + case Xacid_ne: + case Xacid_nw: + case Xslide_ns: + case Xslide_ew: case Xroundwall_1: case Xroundwall_2: case Xroundwall_3: case Xroundwall_4: if (RANDOM(2)) { - if (tab_blank[Cave[x+1][y]] && tab_acid[Cave[x+1][y+1]]) + if (is_blank[cave[x+1][y]] && is_blank_or_acid[cave[x+1][y+1]]) { - Cave[x][y] = Ybomb_eB; - Cave[x+1][y] = Ybomb_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xbomb_pause; + cave[x][y] = Ybomb_eB; + next[x][y] = Xblank; + cave[x+1][y] = Ybomb_e; + next[x+1][y] = Xbomb_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } - if (tab_blank[Cave[x-1][y]] && tab_acid[Cave[x-1][y+1]]) + if (is_blank[cave[x-1][y]] && is_blank_or_acid[cave[x-1][y+1]]) { - Cave[x][y] = Ybomb_wB; - Cave[x-1][y] = Ybomb_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xbomb_pause; + cave[x][y] = Ybomb_wB; + next[x][y] = Xblank; + cave[x-1][y] = Ybomb_w; + next[x-1][y] = Xbomb_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } } else { - if (tab_blank[Cave[x-1][y]] && tab_acid[Cave[x-1][y+1]]) + if (is_blank[cave[x-1][y]] && is_blank_or_acid[cave[x-1][y+1]]) { - Cave[x][y] = Ybomb_wB; - Cave[x-1][y] = Ybomb_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xbomb_pause; + cave[x][y] = Ybomb_wB; + next[x][y] = Xblank; + cave[x-1][y] = Ybomb_w; + next[x-1][y] = Xbomb_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } - if (tab_blank[Cave[x+1][y]] && tab_acid[Cave[x+1][y+1]]) + if (is_blank[cave[x+1][y]] && is_blank_or_acid[cave[x+1][y+1]]) { - Cave[x][y] = Ybomb_eB; - Cave[x+1][y] = Ybomb_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xbomb_pause; + cave[x][y] = Ybomb_eB; + next[x][y] = Xblank; + cave[x+1][y] = Ybomb_e; + next[x+1][y] = Xbomb_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } } @@ -4268,8 +4858,25 @@ static void Lbomb(int x, int y) static void Lbomb_pause(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Ybomb_sB; + next[x][y] = Xblank; + cave[x][y+1] = Ybomb_s; + next[x][y+1] = Xbomb_fall; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -4278,35 +4885,43 @@ static void Lbomb_pause(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ybomb_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ybomb_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Ybomb_sB; - Cave[x][y+1] = Ybomb_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xbomb_fall; - return; - default: - Cave[x][y] = Xbomb; - Next[x][y] = Xbomb; + cave[x][y] = Xbomb; + next[x][y] = Xbomb; return; } } static void Lbomb_fall(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Ybomb_sB; + next[x][y] = Xblank; + cave[x][y+1] = Ybomb_s; + next[x][y+1] = Xbomb_fall; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -4315,47 +4930,44 @@ static void Lbomb_fall(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ybomb_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ybomb_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Ybomb_sB; - Cave[x][y+1] = Ybomb_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xbomb_fall; - return; - default: - Cave[x][y] = Ybomb_blank; - Next[x][y] = Znormal; - Boom[x-1][y-1] = Xblank; - Boom[x][y-1] = Xblank; - Boom[x+1][y-1] = Xblank; - Boom[x-1][y] = Xblank; - Boom[x][y] = Xblank; - Boom[x+1][y] = Xblank; - Boom[x-1][y+1] = Xblank; - Boom[x][y+1] = Xblank; - Boom[x+1][y+1] = Xblank; -#if PLAY_ELEMENT_SOUND - play_element_sound(x, y, SOUND_boom, Xbomb_fall); -#endif + cave[x][y] = Ybomb_blank; + next[x][y] = Ztank; + Lboom_tank_old(x, y); return; } } static void Lnut(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Ynut_sB; + next[x][y] = Xblank; + cave[x][y+1] = Ynut_s; + next[x][y+1] = Xnut_fall; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -4364,28 +4976,15 @@ static void Lnut(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ynut_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ynut_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Ynut_sB; - Cave[x][y+1] = Ynut_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xnut_fall; - return; - - case Xspring: - case Xspring_pause: - case Xspring_e: - case Xspring_w: case Xandroid: case Xandroid_1_n: case Xandroid_2_n: @@ -4395,23 +4994,20 @@ static void Lnut(int x, int y) case Xandroid_2_s: case Xandroid_1_w: case Xandroid_2_w: - case Xstone: - case Xstone_pause: case Xemerald: case Xemerald_pause: case Xdiamond: case Xdiamond_pause: + case Xstone: + case Xstone_pause: case Xbomb: case Xbomb_pause: - case Xballoon: - case Xacid_ne: - case Xacid_nw: - case Xball_1: - case Xball_2: case Xnut: case Xnut_pause: - case Xslidewall_ns: - case Xslidewall_ew: + case Xspring: + case Xspring_pause: + case Xspring_e: + case Xspring_w: case Xkey_1: case Xkey_2: case Xkey_3: @@ -4420,49 +5016,65 @@ static void Lnut(int x, int y) case Xkey_6: case Xkey_7: case Xkey_8: - case Xbumper: + case Xballoon: + case Xball_1: + case Xball_2: case Xswitch: + case Xbumper: + case Ybumper: + case Xacid_ne: + case Xacid_nw: + case Xslide_ns: + case Xslide_ew: case Xroundwall_1: case Xroundwall_2: case Xroundwall_3: case Xroundwall_4: if (RANDOM(2)) { - if (tab_blank[Cave[x+1][y]] && tab_acid[Cave[x+1][y+1]]) + if (is_blank[cave[x+1][y]] && is_blank_or_acid[cave[x+1][y+1]]) { - Cave[x][y] = Ynut_eB; - Cave[x+1][y] = Ynut_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xnut_pause; + cave[x][y] = Ynut_eB; + next[x][y] = Xblank; + cave[x+1][y] = Ynut_e; + next[x+1][y] = Xnut_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } - if (tab_blank[Cave[x-1][y]] && tab_acid[Cave[x-1][y+1]]) + if (is_blank[cave[x-1][y]] && is_blank_or_acid[cave[x-1][y+1]]) { - Cave[x][y] = Ynut_wB; - Cave[x-1][y] = Ynut_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xnut_pause; + cave[x][y] = Ynut_wB; + next[x][y] = Xblank; + cave[x-1][y] = Ynut_w; + next[x-1][y] = Xnut_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } } else { - if (tab_blank[Cave[x-1][y]] && tab_acid[Cave[x-1][y+1]]) + if (is_blank[cave[x-1][y]] && is_blank_or_acid[cave[x-1][y+1]]) { - Cave[x][y] = Ynut_wB; - Cave[x-1][y] = Ynut_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xnut_pause; + cave[x][y] = Ynut_wB; + next[x][y] = Xblank; + cave[x-1][y] = Ynut_w; + next[x-1][y] = Xnut_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } - if (tab_blank[Cave[x+1][y]] && tab_acid[Cave[x+1][y+1]]) + if (is_blank[cave[x+1][y]] && is_blank_or_acid[cave[x+1][y+1]]) { - Cave[x][y] = Ynut_eB; - Cave[x+1][y] = Ynut_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xnut_pause; + cave[x][y] = Ynut_eB; + next[x][y] = Xblank; + cave[x+1][y] = Ynut_e; + next[x+1][y] = Xnut_pause; + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } } @@ -4471,8 +5083,25 @@ static void Lnut(int x, int y) static void Lnut_pause(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Ynut_sB; + next[x][y] = Xblank; + cave[x][y+1] = Ynut_s; + next[x][y+1] = Xnut_fall; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -4481,35 +5110,44 @@ static void Lnut_pause(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ynut_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ynut_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Ynut_sB; - Cave[x][y+1] = Ynut_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xnut_fall; - return; - default: - Cave[x][y] = Xnut; - Next[x][y] = Xnut; + cave[x][y] = Xnut; + next[x][y] = Xnut; return; } } static void Lnut_fall(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Ynut_sB; + next[x][y] = Xblank; + cave[x][y+1] = Ynut_s; + next[x][y+1] = Xnut_fall; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -4518,28 +5156,18 @@ static void Lnut_fall(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ynut_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Ynut_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Zplayer: - Cave[x][y] = Ynut_sB; - Cave[x][y+1] = Ynut_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xnut_fall; - return; - default: - Cave[x][y] = Xnut; - Next[x][y] = Xnut; + cave[x][y] = Xnut; + next[x][y] = Xnut; play_element_sound(x, y, SOUND_nut, Xnut); return; } @@ -4547,8 +5175,27 @@ static void Lnut_fall(int x, int y) static void Lspring(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + cave[x][y] = Yspring_sB; + next[x][y] = Xblank; + cave[x][y+1] = Yspring_s; + next[x][y+1] = Xspring_fall; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -4557,30 +5204,15 @@ static void Lspring(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yspring_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yspring_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_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: - Cave[x][y] = Yspring_sB; - Cave[x][y+1] = Yspring_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xspring_fall; - return; - - case Xspring: - case Xspring_pause: - case Xspring_e: - case Xspring_w: case Xandroid: case Xandroid_1_n: case Xandroid_2_n: @@ -4590,23 +5222,20 @@ static void Lspring(int x, int y) case Xandroid_2_s: case Xandroid_1_w: case Xandroid_2_w: - case Xstone: - case Xstone_pause: case Xemerald: case Xemerald_pause: case Xdiamond: case Xdiamond_pause: + case Xstone: + case Xstone_pause: case Xbomb: case Xbomb_pause: - case Xballoon: - case Xacid_ne: - case Xacid_nw: - case Xball_1: - case Xball_2: case Xnut: case Xnut_pause: - case Xslidewall_ns: - case Xslidewall_ew: + case Xspring: + case Xspring_pause: + case Xspring_e: + case Xspring_w: case Xkey_1: case Xkey_2: case Xkey_3: @@ -4615,77 +5244,81 @@ static void Lspring(int x, int y) case Xkey_6: case Xkey_7: case Xkey_8: - case Xbumper: + case Xballoon: + case Xball_1: + case Xball_2: case Xswitch: + case Xbumper: + case Ybumper: + case Xacid_ne: + case Xacid_nw: + case Xslide_ns: + case Xslide_ew: case Xroundwall_1: case Xroundwall_2: case Xroundwall_3: case Xroundwall_4: if (RANDOM(2)) { - if (tab_blank[Cave[x+1][y]] && tab_acid[Cave[x+1][y+1]]) + if (is_blank[cave[x+1][y]] && is_blank_or_acid[cave[x+1][y+1]]) { - Cave[x][y] = Yspring_eB; - Cave[x+1][y] = Yspring_e; - if (Cave[x][y+1] == Xbumper) - Cave[x][y+1] = XbumperB; - Next[x][y] = Xblank; - + cave[x][y] = Yspring_eB; + next[x][y] = Xblank; + cave[x+1][y] = Yspring_e; #ifdef SPRING_ROLL - Next[x+1][y] = Xspring_e; + next[x+1][y] = Xspring_e; #else - Next[x+1][y] = Xspring_pause; + next[x+1][y] = Xspring_pause; #endif + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } - if (tab_blank[Cave[x-1][y]] && tab_acid[Cave[x-1][y+1]]) + if (is_blank[cave[x-1][y]] && is_blank_or_acid[cave[x-1][y+1]]) { - Cave[x][y] = Yspring_wB; - Cave[x-1][y] = Yspring_w; - if (Cave[x][y+1] == Xbumper) - Cave[x][y+1] = XbumperB; - Next[x][y] = Xblank; - + cave[x][y] = Yspring_wB; + next[x][y] = Xblank; + cave[x-1][y] = Yspring_w; #ifdef SPRING_ROLL - Next[x-1][y] = Xspring_w; + next[x-1][y] = Xspring_w; #else - Next[x-1][y] = Xspring_pause; + next[x-1][y] = Xspring_pause; #endif + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } } else { - if (tab_blank[Cave[x-1][y]] && tab_acid[Cave[x-1][y+1]]) + if (is_blank[cave[x-1][y]] && is_blank_or_acid[cave[x-1][y+1]]) { - Cave[x][y] = Yspring_wB; - Cave[x-1][y] = Yspring_w; - if (Cave[x][y+1] == Xbumper) - Cave[x][y+1] = XbumperB; - Next[x][y] = Xblank; - + cave[x][y] = Yspring_wB; + next[x][y] = Xblank; + cave[x-1][y] = Yspring_w; #ifdef SPRING_ROLL - Next[x-1][y] = Xspring_w; + next[x-1][y] = Xspring_w; #else - Next[x-1][y] = Xspring_pause; + next[x-1][y] = Xspring_pause; #endif + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } - if (tab_blank[Cave[x+1][y]] && tab_acid[Cave[x+1][y+1]]) + if (is_blank[cave[x+1][y]] && is_blank_or_acid[cave[x+1][y+1]]) { - Cave[x][y] = Yspring_eB; - Cave[x+1][y] = Yspring_e; - if (Cave[x][y+1] == Xbumper) - Cave[x][y+1] = XbumperB; - Next[x][y] = Xblank; - + cave[x][y] = Yspring_eB; + next[x][y] = Xblank; + cave[x+1][y] = Yspring_e; #ifdef SPRING_ROLL - Next[x+1][y] = Xspring_e; + next[x+1][y] = Xspring_e; #else - Next[x+1][y] = Xspring_pause; + next[x+1][y] = Xspring_pause; #endif + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } } @@ -4694,8 +5327,25 @@ static void Lspring(int x, int y) static void Lspring_pause(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yspring_sB; + next[x][y] = Xblank; + cave[x][y+1] = Yspring_s; + next[x][y+1] = Xspring_fall; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -4704,35 +5354,43 @@ static void Lspring_pause(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yspring_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yspring_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Yspring_sB; - Cave[x][y+1] = Yspring_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xspring_fall; - return; - default: - Cave[x][y] = Xspring; - Next[x][y] = Xspring; + cave[x][y] = Xspring; + next[x][y] = Xspring; return; } } static void Lspring_e(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yspring_sB; + next[x][y] = Xblank; + cave[x][y+1] = Yspring_s; + next[x][y+1] = Xspring_fall; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -4741,30 +5399,42 @@ static void Lspring_e(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yspring_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yspring_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Yspring_sB; - Cave[x][y+1] = Yspring_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xspring_fall; - return; - case Xbumper: - Cave[x][y+1] = XbumperB; + cave[x][y+1] = Ybumper; } - switch (Cave[x+1][y]) + switch (cave[x+1][y]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Yalien_nB: + case Yalien_eB: + case Yalien_sB: + case Yalien_wB: + cave[x][y] = Yspring_eB; + next[x][y] = Xblank; + cave[x+1][y] = Yspring_e; + next[x+1][y] = Xspring_e; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -4773,52 +5443,39 @@ static void Lspring_e(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yspring_eB; - if (Cave[x+2][y-1] == Xblank) - Cave[x+2][y-1] = Xacid_splash_e; - if (Cave[x][y-1] == Xblank) - Cave[x][y-1] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yspring_eB; + next[x][y] = Xblank; + if (cave[x+2][y-1] == Xblank) + cave[x+2][y-1] = Xsplash_e; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Yalien_nB: - case Yalien_eB: - case Yalien_sB: - case Yalien_wB: - Cave[x][y] = Yspring_eB; - Cave[x+1][y] = Yspring_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xspring_e; - return; - case Xalien: case Xalien_pause: case Yalien_n: case Yalien_e: case Yalien_s: case Yalien_w: - Cave[x][y] = Yspring_alien_eB; - Cave[x+1][y] = Yspring_alien_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xspring_e; + cave[x][y] = Yspring_alien_eB; + next[x][y] = Xblank; + cave[x+1][y] = Yspring_alien_e; + next[x+1][y] = Xspring_e; play_element_sound(x, y, SOUND_slurp, Xalien); score += lev.slurp_score; return; case Xbumper: - case XbumperB: - Cave[x+1][y] = XbumperB; - Next[x][y] = Xspring_w; + case Ybumper: + cave[x+1][y] = Ybumper; + next[x][y] = Xspring_w; play_element_sound(x, y, SOUND_spring, Xspring); return; default: - Cave[x][y] = Xspring; - Next[x][y] = Xspring; + cave[x][y] = Xspring; + next[x][y] = Xspring; play_element_sound(x, y, SOUND_spring, Xspring); return; } @@ -4826,8 +5483,25 @@ static void Lspring_e(int x, int y) static void Lspring_w(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yspring_sB; + next[x][y] = Xblank; + cave[x][y+1] = Yspring_s; + next[x][y+1] = Xspring_fall; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -4836,30 +5510,42 @@ static void Lspring_w(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yspring_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yspring_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Yspring_sB; - Cave[x][y+1] = Yspring_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xspring_fall; - return; - case Xbumper: - Cave[x][y+1] = XbumperB; + cave[x][y+1] = Ybumper; } - switch (Cave[x-1][y]) + switch (cave[x-1][y]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Yalien_nB: + case Yalien_eB: + case Yalien_sB: + case Yalien_wB: + cave[x][y] = Yspring_wB; + next[x][y] = Xblank; + cave[x-1][y] = Yspring_w; + next[x-1][y] = Xspring_w; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -4868,52 +5554,39 @@ static void Lspring_w(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yspring_wB; - if (Cave[x][y-1] == Xblank) - Cave[x][y-1] = Xacid_splash_e; - if (Cave[x-2][y-1] == Xblank) - Cave[x-2][y-1] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yspring_wB; + next[x][y] = Xblank; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_e; + if (cave[x-2][y-1] == Xblank) + cave[x-2][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Yalien_nB: - case Yalien_eB: - case Yalien_sB: - case Yalien_wB: - Cave[x][y] = Yspring_wB; - Cave[x-1][y] = Yspring_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xspring_w; - return; - case Xalien: case Xalien_pause: case Yalien_n: case Yalien_e: case Yalien_s: case Yalien_w: - Cave[x][y] = Yspring_alien_wB; - Cave[x-1][y] = Yspring_alien_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xspring_w; + cave[x][y] = Yspring_alien_wB; + next[x][y] = Xblank; + cave[x-1][y] = Yspring_alien_w; + next[x-1][y] = Xspring_w; play_element_sound(x, y, SOUND_slurp, Xalien); score += lev.slurp_score; return; case Xbumper: - case XbumperB: - Cave[x-1][y] = XbumperB; - Next[x][y] = Xspring_e; + case Ybumper: + cave[x-1][y] = Ybumper; + next[x][y] = Xspring_e; play_element_sound(x, y, SOUND_spring, Xspring); return; default: - Cave[x][y] = Xspring; - Next[x][y] = Xspring; + cave[x][y] = Xspring; + next[x][y] = Xspring; play_element_sound(x, y, SOUND_spring, Xspring); return; } @@ -4921,8 +5594,26 @@ static void Lspring_w(int x, int y) static void Lspring_fall(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yspring_sB; + next[x][y] = Xblank; + cave[x][y+1] = Yspring_s; + next[x][y+1] = Xspring_fall; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -4931,41 +5622,35 @@ static void Lspring_fall(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yspring_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yspring_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - case Zplayer: - Cave[x][y] = Yspring_sB; - Cave[x][y+1] = Yspring_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xspring_fall; + case Xeater_n: + case Xeater_e: + case Xeater_s: + case Xeater_w: + cave[x][y] = Yspring_sB; + next[x][y] = Xblank; + cave[x][y+1] = Yeater_spring; + next[x][y+1] = Zeater; + Lboom_eater_old(x, y+1); + score += lev.eater_score; return; - case Xbomb: - case Xbomb_pause: - Cave[x][y+1] = Ybomb_blank; - Next[x][y+1] = Znormal; - Boom[x-1][y] = Xblank; - Boom[x][y] = Xblank; - Boom[x+1][y] = Xblank; - Boom[x-1][y+1] = Xblank; - Boom[x][y+1] = Xblank; - Boom[x+1][y+1] = Xblank; - Boom[x-1][y+2] = Xblank; - Boom[x][y+2] = Xblank; - Boom[x+1][y+2] = Xblank; -#if PLAY_ELEMENT_SOUND - play_element_sound(x, y, SOUND_boom, Xspring_fall); -#endif + case Xalien: + case Xalien_pause: + cave[x][y] = Yspring_sB; + next[x][y] = Xblank; + cave[x][y+1] = Yalien_spring; + next[x][y+1] = Ztank; + Lboom_tank_old(x, y+1); + score += lev.alien_score; return; case Xbug_1_n: @@ -4976,21 +5661,11 @@ static void Lspring_fall(int x, int y) case Xbug_2_e: case Xbug_2_s: case Xbug_2_w: - Cave[x][y] = Yspring_sB; - Cave[x][y+1] = Ybug_spring; - Next[x][y+1] = Znormal; - Boom[x-1][y] = Xemerald; - Boom[x][y] = Xemerald; - Boom[x+1][y] = Xemerald; - Boom[x-1][y+1] = Xemerald; - Boom[x][y+1] = Xdiamond; - Boom[x+1][y+1] = Xemerald; - Boom[x-1][y+2] = Xemerald; - Boom[x][y+2] = Xemerald; - Boom[x+1][y+2] = Xemerald; -#if PLAY_ELEMENT_SOUND - play_element_sound(x, y, SOUND_boom, Xspring_fall); -#endif + cave[x][y] = Yspring_sB; + next[x][y] = Xblank; + cave[x][y+1] = Ybug_spring; + next[x][y+1] = Zbug; + Lboom_bug_old(x, y+1); score += lev.bug_score; return; @@ -5002,70 +5677,26 @@ static void Lspring_fall(int x, int y) case Xtank_2_e: case Xtank_2_s: case Xtank_2_w: - Cave[x][y] = Yspring_sB; - Cave[x][y+1] = Ytank_spring; - Next[x][y+1] = Znormal; - Boom[x-1][y] = Xblank; - Boom[x][y] = Xblank; - Boom[x+1][y] = Xblank; - Boom[x-1][y+1] = Xblank; - Boom[x][y+1] = Xblank; - Boom[x+1][y+1] = Xblank; - Boom[x-1][y+2] = Xblank; - Boom[x][y+2] = Xblank; - Boom[x+1][y+2] = Xblank; -#if PLAY_ELEMENT_SOUND - play_element_sound(x, y, SOUND_boom, Xspring_fall); -#endif + cave[x][y] = Yspring_sB; + next[x][y] = Xblank; + cave[x][y+1] = Ytank_spring; + next[x][y+1] = Ztank; + Lboom_tank_old(x, y+1); score += lev.tank_score; return; - case Xeater_n: - case Xeater_e: - case Xeater_s: - case Xeater_w: - Cave[x][y] = Yspring_sB; - Cave[x][y+1] = Yeater_spring; - Next[x][y+1] = Znormal; - Boom[x-1][y] = lev.eater_array[lev.eater_pos][0]; - Boom[x][y] = lev.eater_array[lev.eater_pos][1]; - Boom[x+1][y] = lev.eater_array[lev.eater_pos][2]; - Boom[x-1][y+1] = lev.eater_array[lev.eater_pos][3]; - Boom[x][y+1] = lev.eater_array[lev.eater_pos][4]; - Boom[x+1][y+1] = lev.eater_array[lev.eater_pos][5]; - Boom[x-1][y+2] = lev.eater_array[lev.eater_pos][6]; - Boom[x][y+2] = lev.eater_array[lev.eater_pos][7]; - Boom[x+1][y+2] = lev.eater_array[lev.eater_pos][8]; -#if PLAY_ELEMENT_SOUND - play_element_sound(x, y, SOUND_boom, Xspring_fall); -#endif - lev.eater_pos = (lev.eater_pos + 1) & 7; - score += lev.eater_score; - return; - - case Xalien: - case Xalien_pause: - Cave[x][y] = Yspring_sB; - Cave[x][y+1] = Yalien_spring; - Next[x][y+1] = Znormal; - Boom[x-1][y] = Xblank; - Boom[x][y] = Xblank; - Boom[x+1][y] = Xblank; - Boom[x-1][y+1] = Xblank; - Boom[x][y+1] = Xblank; - Boom[x+1][y+1] = Xblank; - Boom[x-1][y+2] = Xblank; - Boom[x][y+2] = Xblank; - Boom[x+1][y+2] = Xblank; -#if PLAY_ELEMENT_SOUND - play_element_sound(x, y, SOUND_boom, Xspring_fall); -#endif - score += lev.alien_score; + case Xbomb: + case Xbomb_pause: + cave[x][y] = Xspring; + next[x][y] = Xspring; + cave[x][y+1] = Ybomb_blank; + next[x][y+1] = Ztank; + Lboom_tank_old(x, y+1); return; default: - Cave[x][y] = Xspring; - Next[x][y] = Xspring; + cave[x][y] = Xspring; + next[x][y] = Xspring; play_element_sound(x, y, SOUND_spring, Xspring); return; } @@ -5073,383 +5704,580 @@ static void Lspring_fall(int x, int y) static void Lpush_emerald_e(int x, int y) { - switch (Cave[x+1][y]) + cave[x][y] = Yemerald_eB; + next[x][y] = Xblank; + + switch (cave[x+1][y]) { case Zborder: - case Znormal: + case Zbug: + case Ztank: + case Zeater: case Zdynamite: + case Zboom: + case Xchain: case Xboom_bug: - case Xboom_bomb: + case Xboom_tank: case Xboom_android: case Xboom_1: - case Zplayer: - Cave[x][y] = Xemerald; - Next[x][y] = Xemerald; return; - default: - Cave[x][y] = Yemerald_eB; - Cave[x+1][y] = Yemerald_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xemerald_pause; +#ifdef ACID_ROLL + case Xacid_1: + case Xacid_2: + case Xacid_3: + case Xacid_4: + case Xacid_5: + case Xacid_6: + case Xacid_7: + case Xacid_8: + if (cave[x+2][y-1] == Xblank) + cave[x+2][y-1] = Xsplash_e; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_w; + play_element_sound(x, y, SOUND_acid, Xacid_1); return; +#endif } + + cave[x+1][y] = Yemerald_e; + next[x+1][y] = Xemerald_pause; } static void Lpush_emerald_w(int x, int y) { - switch (Cave[x-1][y]) + cave[x][y] = Yemerald_wB; + next[x][y] = Xblank; + + switch (cave[x-1][y]) { case Zborder: - case Znormal: + case Zbug: + case Ztank: + case Zeater: case Zdynamite: + case Zboom: + case Xchain: case Xboom_bug: - case Xboom_bomb: + case Xboom_tank: case Xboom_android: case Xboom_1: - case Zplayer: - Cave[x][y] = Xemerald; - Next[x][y] = Xemerald; return; - default: - Cave[x][y] = Yemerald_wB; - Cave[x-1][y] = Yemerald_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xemerald_pause; +#ifdef ACID_ROLL + case Xacid_1: + case Xacid_2: + case Xacid_3: + case Xacid_4: + case Xacid_5: + case Xacid_6: + case Xacid_7: + case Xacid_8: + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_e; + if (cave[x-2][y-1] == Xblank) + cave[x-2][y-1] = Xsplash_w; + play_element_sound(x, y, SOUND_acid, Xacid_1); return; +#endif } + + cave[x-1][y] = Yemerald_w; + next[x-1][y] = Xemerald_pause; } static void Lpush_diamond_e(int x, int y) { - switch (Cave[x+1][y]) + cave[x][y] = Ydiamond_eB; + next[x][y] = Xblank; + + switch (cave[x+1][y]) { case Zborder: - case Znormal: + case Zbug: + case Ztank: + case Zeater: case Zdynamite: + case Zboom: + case Xchain: case Xboom_bug: - case Xboom_bomb: + case Xboom_tank: case Xboom_android: case Xboom_1: - case Zplayer: - Cave[x][y] = Xdiamond; - Next[x][y] = Xdiamond; return; - default: - Cave[x][y] = Ydiamond_eB; - Cave[x+1][y] = Ydiamond_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xdiamond_pause; +#ifdef ACID_ROLL + case Xacid_1: + case Xacid_2: + case Xacid_3: + case Xacid_4: + case Xacid_5: + case Xacid_6: + case Xacid_7: + case Xacid_8: + if (cave[x+2][y-1] == Xblank) + cave[x+2][y-1] = Xsplash_e; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_w; + play_element_sound(x, y, SOUND_acid, Xacid_1); return; +#endif } + + cave[x+1][y] = Ydiamond_e; + next[x+1][y] = Xdiamond_pause; } static void Lpush_diamond_w(int x, int y) { - switch (Cave[x-1][y]) + cave[x][y] = Ydiamond_wB; + next[x][y] = Xblank; + + switch (cave[x-1][y]) { case Zborder: - case Znormal: + case Zbug: + case Ztank: + case Zeater: case Zdynamite: + case Zboom: + case Xchain: case Xboom_bug: - case Xboom_bomb: + case Xboom_tank: case Xboom_android: case Xboom_1: - case Zplayer: - Cave[x][y] = Xdiamond; - Next[x][y] = Xdiamond; return; - default: - Cave[x][y] = Ydiamond_wB; - Cave[x-1][y] = Ydiamond_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xdiamond_pause; +#ifdef ACID_ROLL + case Xacid_1: + case Xacid_2: + case Xacid_3: + case Xacid_4: + case Xacid_5: + case Xacid_6: + case Xacid_7: + case Xacid_8: + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_e; + if (cave[x-2][y-1] == Xblank) + cave[x-2][y-1] = Xsplash_w; + play_element_sound(x, y, SOUND_acid, Xacid_1); return; +#endif } + + cave[x-1][y] = Ydiamond_w; + next[x-1][y] = Xdiamond_pause; } static void Lpush_stone_e(int x, int y) { - switch (Cave[x+1][y]) + cave[x][y] = Ystone_eB; + next[x][y] = Xblank; + + switch (cave[x+1][y]) { case Zborder: - case Znormal: + case Zbug: + case Ztank: + case Zeater: case Zdynamite: + case Zboom: + case Xchain: case Xboom_bug: - case Xboom_bomb: + case Xboom_tank: case Xboom_android: case Xboom_1: - case Zplayer: - Cave[x][y] = Xstone; - Next[x][y] = Xstone; return; - default: - Cave[x][y] = Ystone_eB; - Cave[x+1][y] = Ystone_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xstone_pause; +#ifdef ACID_ROLL + case Xacid_1: + case Xacid_2: + case Xacid_3: + case Xacid_4: + case Xacid_5: + case Xacid_6: + case Xacid_7: + case Xacid_8: + if (cave[x+2][y-1] == Xblank) + cave[x+2][y-1] = Xsplash_e; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_w; + play_element_sound(x, y, SOUND_acid, Xacid_1); return; +#endif } + + cave[x+1][y] = Ystone_e; + next[x+1][y] = Xstone_pause; } static void Lpush_stone_w(int x, int y) { - switch (Cave[x-1][y]) + cave[x][y] = Ystone_wB; + next[x][y] = Xblank; + + switch (cave[x-1][y]) { case Zborder: - case Znormal: + case Zbug: + case Ztank: + case Zeater: case Zdynamite: + case Zboom: + case Xchain: case Xboom_bug: - case Xboom_bomb: + case Xboom_tank: case Xboom_android: case Xboom_1: - case Zplayer: - Cave[x][y] = Xstone; - Next[x][y] = Xstone; return; - default: - Cave[x][y] = Ystone_wB; - Cave[x-1][y] = Ystone_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xstone_pause; +#ifdef ACID_ROLL + case Xacid_1: + case Xacid_2: + case Xacid_3: + case Xacid_4: + case Xacid_5: + case Xacid_6: + case Xacid_7: + case Xacid_8: + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_e; + if (cave[x-2][y-1] == Xblank) + cave[x-2][y-1] = Xsplash_w; + play_element_sound(x, y, SOUND_acid, Xacid_1); return; +#endif } + + cave[x-1][y] = Ystone_w; + next[x-1][y] = Xstone_pause; } static void Lpush_bomb_e(int x, int y) { - switch (Cave[x+1][y]) + cave[x][y] = Ybomb_eB; + next[x][y] = Xblank; + + switch (cave[x+1][y]) { case Zborder: - case Znormal: + case Zbug: + case Ztank: + case Zeater: case Zdynamite: + case Zboom: + case Xchain: case Xboom_bug: - case Xboom_bomb: + case Xboom_tank: case Xboom_android: case Xboom_1: - case Zplayer: - Cave[x][y] = Xbomb; - Next[x][y] = Xbomb; return; - default: - Cave[x][y] = Ybomb_eB; - Cave[x+1][y] = Ybomb_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xbomb_pause; +#ifdef ACID_ROLL + case Xacid_1: + case Xacid_2: + case Xacid_3: + case Xacid_4: + case Xacid_5: + case Xacid_6: + case Xacid_7: + case Xacid_8: + if (cave[x+2][y-1] == Xblank) + cave[x+2][y-1] = Xsplash_e; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_w; + play_element_sound(x, y, SOUND_acid, Xacid_1); return; +#endif } + + cave[x+1][y] = Ybomb_e; + next[x+1][y] = Xbomb_pause; } static void Lpush_bomb_w(int x, int y) { - switch (Cave[x-1][y]) + cave[x][y] = Ybomb_wB; + next[x][y] = Xblank; + + switch (cave[x-1][y]) { case Zborder: - case Znormal: + case Zbug: + case Ztank: + case Zeater: case Zdynamite: + case Zboom: + case Xchain: case Xboom_bug: - case Xboom_bomb: + case Xboom_tank: case Xboom_android: case Xboom_1: - case Zplayer: - Cave[x][y] = Xbomb; - Next[x][y] = Xbomb; return; - default: - Cave[x][y] = Ybomb_wB; - Cave[x-1][y] = Ybomb_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xbomb_pause; +#ifdef ACID_ROLL + case Xacid_1: + case Xacid_2: + case Xacid_3: + case Xacid_4: + case Xacid_5: + case Xacid_6: + case Xacid_7: + case Xacid_8: + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_e; + if (cave[x-2][y-1] == Xblank) + cave[x-2][y-1] = Xsplash_w; + play_element_sound(x, y, SOUND_acid, Xacid_1); return; +#endif } + + cave[x-1][y] = Ybomb_w; + next[x-1][y] = Xbomb_pause; } static void Lpush_nut_e(int x, int y) { - switch (Cave[x+1][y]) + cave[x][y] = Ynut_eB; + next[x][y] = Xblank; + + switch (cave[x+1][y]) { case Zborder: - case Znormal: + case Zbug: + case Ztank: + case Zeater: case Zdynamite: + case Zboom: + case Xchain: case Xboom_bug: - case Xboom_bomb: + case Xboom_tank: case Xboom_android: case Xboom_1: - case Zplayer: - Cave[x][y] = Xnut; - Next[x][y] = Xnut; return; - default: - Cave[x][y] = Ynut_eB; - Cave[x+1][y] = Ynut_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xnut_pause; +#ifdef ACID_ROLL + case Xacid_1: + case Xacid_2: + case Xacid_3: + case Xacid_4: + case Xacid_5: + case Xacid_6: + case Xacid_7: + case Xacid_8: + if (cave[x+2][y-1] == Xblank) + cave[x+2][y-1] = Xsplash_e; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_w; + play_element_sound(x, y, SOUND_acid, Xacid_1); return; +#endif } + + cave[x+1][y] = Ynut_e; + next[x+1][y] = Xnut_pause; } static void Lpush_nut_w(int x, int y) { - switch (Cave[x-1][y]) + cave[x][y] = Ynut_wB; + next[x][y] = Xblank; + + switch (cave[x-1][y]) { case Zborder: - case Znormal: + case Zbug: + case Ztank: + case Zeater: case Zdynamite: + case Zboom: + case Xchain: case Xboom_bug: - case Xboom_bomb: + case Xboom_tank: case Xboom_android: case Xboom_1: - case Zplayer: - Cave[x][y] = Xnut; - Next[x][y] = Xnut; return; - default: - Cave[x][y] = Ynut_wB; - Cave[x-1][y] = Ynut_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xnut_pause; +#ifdef ACID_ROLL + case Xacid_1: + case Xacid_2: + case Xacid_3: + case Xacid_4: + case Xacid_5: + case Xacid_6: + case Xacid_7: + case Xacid_8: + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_e; + if (cave[x-2][y-1] == Xblank) + cave[x-2][y-1] = Xsplash_w; + play_element_sound(x, y, SOUND_acid, Xacid_1); return; +#endif } + + cave[x-1][y] = Ynut_w; + next[x-1][y] = Xnut_pause; } static void Lpush_spring_e(int x, int y) { - switch (Cave[x+1][y]) + cave[x][y] = Yspring_eB; + next[x][y] = Xblank; + + switch (cave[x+1][y]) { case Zborder: - case Znormal: + case Zbug: + case Ztank: + case Zeater: case Zdynamite: + case Zboom: + case Xchain: case Xboom_bug: - case Xboom_bomb: + case Xboom_tank: case Xboom_android: case Xboom_1: - case Zplayer: - Cave[x][y] = Xspring; - Next[x][y] = Xspring; return; - default: - Cave[x][y] = Yspring_eB; - Cave[x+1][y] = Yspring_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xspring_e; +#ifdef ACID_ROLL + case Xacid_1: + case Xacid_2: + case Xacid_3: + case Xacid_4: + case Xacid_5: + case Xacid_6: + case Xacid_7: + case Xacid_8: + if (cave[x+2][y-1] == Xblank) + cave[x+2][y-1] = Xsplash_e; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_w; + play_element_sound(x, y, SOUND_acid, Xacid_1); return; +#endif } + + cave[x+1][y] = Yspring_e; + next[x+1][y] = Xspring_e; } static void Lpush_spring_w(int x, int y) { - switch (Cave[x-1][y]) + cave[x][y] = Yspring_wB; + next[x][y] = Xblank; + + switch (cave[x-1][y]) { case Zborder: - case Znormal: + case Zbug: + case Ztank: + case Zeater: case Zdynamite: + case Zboom: + case Xchain: case Xboom_bug: - case Xboom_bomb: + case Xboom_tank: case Xboom_android: case Xboom_1: - case Zplayer: - Cave[x][y] = Xspring; - Next[x][y] = Xspring; return; - default: - Cave[x][y] = Yspring_wB; - Cave[x-1][y] = Yspring_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xspring_w; +#ifdef ACID_ROLL + case Xacid_1: + case Xacid_2: + case Xacid_3: + case Xacid_4: + case Xacid_5: + case Xacid_6: + case Xacid_7: + case Xacid_8: + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_e; + if (cave[x-2][y-1] == Xblank) + cave[x-2][y-1] = Xsplash_w; + play_element_sound(x, y, SOUND_acid, Xacid_1); return; +#endif } + + cave[x-1][y] = Yspring_w; + next[x-1][y] = Xspring_w; } static void Ldynamite_1(int x, int y) { play_element_sound(x, y, SOUND_tick, Xdynamite_1); - Next[x][y] = Xdynamite_2; + next[x][y] = Xdynamite_2; } static void Ldynamite_2(int x, int y) { play_element_sound(x, y, SOUND_tick, Xdynamite_2); - Next[x][y] = Xdynamite_3; + next[x][y] = Xdynamite_3; } static void Ldynamite_3(int x, int y) { play_element_sound(x, y, SOUND_tick, Xdynamite_3); - Next[x][y] = Xdynamite_4; + next[x][y] = Xdynamite_4; } static void Ldynamite_4(int x, int y) { play_element_sound(x, y, SOUND_tick, Xdynamite_4); - Next[x][y] = Zdynamite; - Boom[x-1][y-1] = Xblank; - Boom[x][y-1] = Xblank; - Boom[x+1][y-1] = Xblank; - Boom[x-1][y] = Xblank; - Boom[x][y] = Xblank; - Boom[x+1][y] = Xblank; - Boom[x-1][y+1] = Xblank; - Boom[x][y+1] = Xblank; - Boom[x+1][y+1] = Xblank; + next[x][y] = Zdynamite; + + Lboom_generic(x, y, Xblank, Xblank); } static void Lfake_door_1(int x, int y) { if (lev.magnify_cnt) - Cave[x][y] = Xdoor_1; + cave[x][y] = Xdoor_1; } static void Lfake_door_2(int x, int y) { if (lev.magnify_cnt) - Cave[x][y] = Xdoor_2; + cave[x][y] = Xdoor_2; } static void Lfake_door_3(int x, int y) { if (lev.magnify_cnt) - Cave[x][y] = Xdoor_3; + cave[x][y] = Xdoor_3; } static void Lfake_door_4(int x, int y) { if (lev.magnify_cnt) - Cave[x][y] = Xdoor_4; + cave[x][y] = Xdoor_4; } static void Lfake_door_5(int x, int y) { if (lev.magnify_cnt) - Cave[x][y] = Xdoor_5; + cave[x][y] = Xdoor_5; } static void Lfake_door_6(int x, int y) { if (lev.magnify_cnt) - Cave[x][y] = Xdoor_6; + cave[x][y] = Xdoor_6; } static void Lfake_door_7(int x, int y) { if (lev.magnify_cnt) - Cave[x][y] = Xdoor_7; + cave[x][y] = Xdoor_7; } static void Lfake_door_8(int x, int y) { if (lev.magnify_cnt) - Cave[x][y] = Xdoor_8; + cave[x][y] = Xdoor_8; } static void Lballoon(int x, int y) @@ -5460,8 +6288,25 @@ static void Lballoon(int x, int y) switch (lev.wind_direction) { case 0: /* north */ - switch (Cave[x][y-1]) + switch (cave[x][y-1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yballoon_nB; + next[x][y] = Xblank; + cave[x][y-1] = Yballoon_n; + next[x][y-1] = Xballoon; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -5470,29 +6315,37 @@ static void Lballoon(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yballoon_nB; - if (Cave[x+1][y-2] == Xblank) - Cave[x+1][y-2] = Xacid_splash_e; - if (Cave[x-1][y-2] == Xblank) - Cave[x-1][y-2] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yballoon_nB; + next[x][y] = Xblank; + if (cave[x+1][y-2] == Xblank) + cave[x+1][y-2] = Xsplash_e; + if (cave[x-1][y-2] == Xblank) + cave[x-1][y-2] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Yballoon_nB; - Cave[x][y-1] = Yballoon_n; - Next[x][y] = Xblank; - Next[x][y-1] = Xballoon; - return; } break; case 1: /* east */ - switch (Cave[x+1][y]) + switch (cave[x+1][y]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yballoon_eB; + next[x][y] = Xblank; + cave[x+1][y] = Yballoon_e; + next[x+1][y] = Xballoon; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -5501,29 +6354,37 @@ static void Lballoon(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yballoon_eB; - if (Cave[x+2][y-1] == Xblank) - Cave[x+2][y-1] = Xacid_splash_e; - if (Cave[x][y-1] == Xblank) - Cave[x][y-1] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yballoon_eB; + next[x][y] = Xblank; + if (cave[x+2][y-1] == Xblank) + cave[x+2][y-1] = Xsplash_e; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Yballoon_eB; - Cave[x+1][y] = Yballoon_e; - Next[x][y] = Xblank; - Next[x+1][y] = Xballoon; - return; } break; case 2: /* south */ - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yballoon_sB; + next[x][y] = Xblank; + cave[x][y+1] = Yballoon_s; + next[x][y+1] = Xballoon; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -5532,29 +6393,37 @@ static void Lballoon(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yballoon_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yballoon_sB; + next[x][y] = Xblank; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Yballoon_sB; - Cave[x][y+1] = Yballoon_s; - Next[x][y] = Xblank; - Next[x][y+1] = Xballoon; - return; } break; case 3: /* west */ - switch (Cave[x-1][y]) + switch (cave[x-1][y]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Yballoon_wB; + next[x][y] = Xblank; + cave[x-1][y] = Yballoon_w; + next[x-1][y] = Xballoon; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -5563,23 +6432,14 @@ static void Lballoon(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Yballoon_wB; - if (Cave[x][y-1] == Xblank) - Cave[x][y-1] = Xacid_splash_e; - if (Cave[x-2][y-1] == Xblank) - Cave[x-2][y-1] = Xacid_splash_w; - Next[x][y] = Xblank; + cave[x][y] = Yballoon_wB; + next[x][y] = Xblank; + if (cave[x][y-1] == Xblank) + cave[x][y-1] = Xsplash_e; + if (cave[x-2][y-1] == Xblank) + cave[x-2][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Yballoon_wB; - Cave[x-1][y] = Yballoon_w; - Next[x][y] = Xblank; - Next[x-1][y] = Xballoon; - return; } break; } @@ -5595,73 +6455,73 @@ static void Lball_common(int x, int y) { case 0: if (lev.ball_array[lev.ball_pos][0] != Xblank && - tab_blank[Cave[x-1][y-1]]) + is_blank[cave[x-1][y-1]]) { - Cave[x-1][y-1] = Yball_blank; - Next[x-1][y-1] = lev.ball_array[lev.ball_pos][0]; + cave[x-1][y-1] = Yball_blank; + next[x-1][y-1] = lev.ball_array[lev.ball_pos][0]; } break; case 1: if (lev.ball_array[lev.ball_pos][1] != Xblank && - tab_blank[Cave[x][y-1]]) + is_blank[cave[x][y-1]]) { - Cave[x][y-1] = Yball_blank; - Next[x][y-1] = lev.ball_array[lev.ball_pos][1]; + cave[x][y-1] = Yball_blank; + next[x][y-1] = lev.ball_array[lev.ball_pos][1]; } break; case 2: if (lev.ball_array[lev.ball_pos][2] != Xblank && - tab_blank[Cave[x+1][y-1]]) + is_blank[cave[x+1][y-1]]) { - Cave[x+1][y-1] = Yball_blank; - Next[x+1][y-1] = lev.ball_array[lev.ball_pos][2]; + cave[x+1][y-1] = Yball_blank; + next[x+1][y-1] = lev.ball_array[lev.ball_pos][2]; } break; case 3: if (lev.ball_array[lev.ball_pos][3] != Xblank && - tab_blank[Cave[x-1][y]]) + is_blank[cave[x-1][y]]) { - Cave[x-1][y] = Yball_blank; - Next[x-1][y] = lev.ball_array[lev.ball_pos][3]; + cave[x-1][y] = Yball_blank; + next[x-1][y] = lev.ball_array[lev.ball_pos][3]; } break; case 4: if (lev.ball_array[lev.ball_pos][4] != Xblank && - tab_blank[Cave[x+1][y]]) + is_blank[cave[x+1][y]]) { - Cave[x+1][y] = Yball_blank; - Next[x+1][y] = lev.ball_array[lev.ball_pos][4]; + cave[x+1][y] = Yball_blank; + next[x+1][y] = lev.ball_array[lev.ball_pos][4]; } break; case 5: if (lev.ball_array[lev.ball_pos][5] != Xblank && - tab_blank[Cave[x-1][y+1]]) + is_blank[cave[x-1][y+1]]) { - Cave[x-1][y+1] = Yball_blank; - Next[x-1][y+1] = lev.ball_array[lev.ball_pos][5]; + cave[x-1][y+1] = Yball_blank; + next[x-1][y+1] = lev.ball_array[lev.ball_pos][5]; } break; case 6: if (lev.ball_array[lev.ball_pos][6] != Xblank && - tab_blank[Cave[x][y+1]]) + is_blank[cave[x][y+1]]) { - Cave[x][y+1] = Yball_blank; - Next[x][y+1] = lev.ball_array[lev.ball_pos][6]; + cave[x][y+1] = Yball_blank; + next[x][y+1] = lev.ball_array[lev.ball_pos][6]; } break; case 7: if (lev.ball_array[lev.ball_pos][7] != Xblank && - tab_blank[Cave[x+1][y+1]]) + is_blank[cave[x+1][y+1]]) { - Cave[x+1][y+1] = Yball_blank; - Next[x+1][y+1] = lev.ball_array[lev.ball_pos][7]; + cave[x+1][y+1] = Yball_blank; + next[x+1][y+1] = lev.ball_array[lev.ball_pos][7]; } break; } @@ -5669,59 +6529,59 @@ static void Lball_common(int x, int y) else { if (lev.ball_array[lev.ball_pos][0] != Xblank && - tab_blank[Cave[x-1][y-1]]) + is_blank[cave[x-1][y-1]]) { - Cave[x-1][y-1] = Yball_blank; - Next[x-1][y-1] = lev.ball_array[lev.ball_pos][0]; + cave[x-1][y-1] = Yball_blank; + next[x-1][y-1] = lev.ball_array[lev.ball_pos][0]; } if (lev.ball_array[lev.ball_pos][1] != Xblank && - tab_blank[Cave[x][y-1]]) + is_blank[cave[x][y-1]]) { - Cave[x][y-1] = Yball_blank; - Next[x][y-1] = lev.ball_array[lev.ball_pos][1]; + cave[x][y-1] = Yball_blank; + next[x][y-1] = lev.ball_array[lev.ball_pos][1]; } if (lev.ball_array[lev.ball_pos][2] != Xblank && - tab_blank[Cave[x+1][y-1]]) + is_blank[cave[x+1][y-1]]) { - Cave[x+1][y-1] = Yball_blank; - Next[x+1][y-1] = lev.ball_array[lev.ball_pos][2]; + cave[x+1][y-1] = Yball_blank; + next[x+1][y-1] = lev.ball_array[lev.ball_pos][2]; } if (lev.ball_array[lev.ball_pos][3] != Xblank && - tab_blank[Cave[x-1][y]]) + is_blank[cave[x-1][y]]) { - Cave[x-1][y] = Yball_blank; - Next[x-1][y] = lev.ball_array[lev.ball_pos][3]; + cave[x-1][y] = Yball_blank; + next[x-1][y] = lev.ball_array[lev.ball_pos][3]; } if (lev.ball_array[lev.ball_pos][4] != Xblank && - tab_blank[Cave[x+1][y]]) + is_blank[cave[x+1][y]]) { - Cave[x+1][y] = Yball_blank; - Next[x+1][y] = lev.ball_array[lev.ball_pos][4]; + cave[x+1][y] = Yball_blank; + next[x+1][y] = lev.ball_array[lev.ball_pos][4]; } if (lev.ball_array[lev.ball_pos][5] != Xblank && - tab_blank[Cave[x-1][y+1]]) + is_blank[cave[x-1][y+1]]) { - Cave[x-1][y+1] = Yball_blank; - Next[x-1][y+1] = lev.ball_array[lev.ball_pos][5]; + cave[x-1][y+1] = Yball_blank; + next[x-1][y+1] = lev.ball_array[lev.ball_pos][5]; } if (lev.ball_array[lev.ball_pos][6] != Xblank && - tab_blank[Cave[x][y+1]]) + is_blank[cave[x][y+1]]) { - Cave[x][y+1] = Yball_blank; - Next[x][y+1] = lev.ball_array[lev.ball_pos][6]; + cave[x][y+1] = Yball_blank; + next[x][y+1] = lev.ball_array[lev.ball_pos][6]; } if (lev.ball_array[lev.ball_pos][7] != Xblank && - tab_blank[Cave[x+1][y+1]]) + is_blank[cave[x+1][y+1]]) { - Cave[x+1][y+1] = Yball_blank; - Next[x+1][y+1] = lev.ball_array[lev.ball_pos][7]; + cave[x+1][y+1] = Yball_blank; + next[x+1][y+1] = lev.ball_array[lev.ball_pos][7]; } } @@ -5730,11 +6590,11 @@ static void Lball_common(int x, int y) static void Lball_1(int x, int y) { - if (lev.ball_state == 0) + if (!lev.ball_active) return; - Cave[x][y] = Yball_1; - Next[x][y] = Xball_2; + cave[x][y] = Yball_1; + next[x][y] = Xball_2; if (lev.ball_cnt) return; @@ -5743,11 +6603,11 @@ static void Lball_1(int x, int y) static void Lball_2(int x, int y) { - if (lev.ball_state == 0) + if (!lev.ball_active) return; - Cave[x][y] = Yball_2; - Next[x][y] = Xball_1; + cave[x][y] = Yball_2; + next[x][y] = Xball_1; if (lev.ball_cnt) return; @@ -5756,15 +6616,35 @@ static void Lball_2(int x, int y) static void Ldrip(int x, int y) { - Next[x][y] = Xdrip_fall; + next[x][y] = Xdrip_fall; } static void Ldrip_fall(int x, int y) { int temp; - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Zplayer: + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: + cave[x][y] = Ydrip_1_sB; + next[x][y] = Xdrip_stretchB; + cave[x][y+1] = Ydrip_1_s; + next[x][y+1] = Xdrip_stretch; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -5773,27 +6653,15 @@ static void Ldrip_fall(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Ydrip_1_sB; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xdrip_stretchB; + cave[x][y] = Ydrip_1_sB; + next[x][y] = Xdrip_stretchB; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_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[x][y] = Ydrip_1_sB; - Cave[x][y+1] = Ydrip_1_s; - Next[x][y] = Xdrip_stretchB; - Next[x][y+1] = Xdrip_stretch; - return; - default: switch (RANDOM(8)) { @@ -5807,8 +6675,8 @@ static void Ldrip_fall(int x, int y) case 7: temp = Xamoeba_8; break; } - Cave[x][y] = temp; - Next[x][y] = temp; + cave[x][y] = temp; + next[x][y] = temp; play_element_sound(x, y, SOUND_drip, Xdrip_fall); return; } @@ -5816,21 +6684,21 @@ static void Ldrip_fall(int x, int y) static void Ldrip_stretch(int x, int y) { - Cave[x][y] = Ydrip_2_s; - Next[x][y] = Xdrip_fall; + cave[x][y] = Ydrip_2_s; + next[x][y] = Xdrip_fall; } static void Ldrip_stretchB(int x, int y) { - Cave[x][y] = Ydrip_2_sB; - Next[x][y] = Xblank; + cave[x][y] = Ydrip_2_sB; + next[x][y] = Xblank; } static void Lwonderwall(int x, int y) { - if (lev.wonderwall_time && lev.wonderwall_state) + if (lev.wonderwall_time > 0 && lev.wonderwall_active) { - Cave[x][y] = XwonderwallB; + cave[x][y] = Ywonderwall; play_element_sound(x, y, SOUND_wonder, Xwonderwall); } } @@ -5838,37 +6706,54 @@ static void Lwonderwall(int x, int y) static void Lwheel(int x, int y) { if (lev.wheel_cnt && x == lev.wheel_x && y == lev.wheel_y) - Cave[x][y] = XwheelB; + cave[x][y] = Ywheel; } static void Lswitch(int x, int y) { - if (lev.ball_state) - Cave[x][y] = XswitchB; + if (lev.ball_active) + cave[x][y] = Yswitch; } static void Lfake_blank(int x, int y) { if (lev.lenses_cnt) - Cave[x][y] = Xfake_blankB; + cave[x][y] = Yfake_blank; } static void Lfake_grass(int x, int y) { if (lev.magnify_cnt) - Cave[x][y] = Xfake_grassB; + cave[x][y] = Yfake_grass; } static void Lfake_amoeba(int x, int y) { if (lev.lenses_cnt) - Cave[x][y] = Xfake_amoebaB; + cave[x][y] = Yfake_amoeba; } static void Lsand_stone(int x, int y) { - switch (Cave[x][y+1]) + switch (cave[x][y+1]) { + case Xblank: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + cave[x][y] = Xsand_stonesand_quickout_1; + next[x][y] = Xsand_stonesand_quickout_2; + cave[x][y+1] = Xsand_stoneout_1; + next[x][y+1] = Xsand_stoneout_2; + return; + case Xacid_1: case Xacid_2: case Xacid_3: @@ -5877,169 +6762,158 @@ static void Lsand_stone(int x, int y) case Xacid_6: case Xacid_7: case Xacid_8: - Cave[x][y] = Xsand_stonesand_quickout_1; - if (Cave[x+1][y] == Xblank) - Cave[x+1][y] = Xacid_splash_e; - if (Cave[x-1][y] == Xblank) - Cave[x-1][y] = Xacid_splash_w; - Next[x][y] = Xsand_stonesand_quickout_2; + cave[x][y] = Xsand_stonesand_quickout_1; + next[x][y] = Xsand_stonesand_quickout_2; + if (cave[x+1][y] == Xblank) + cave[x+1][y] = Xsplash_e; + if (cave[x-1][y] == Xblank) + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: - Cave[x][y] = Xsand_stonesand_quickout_1; - Cave[x][y+1] = Xsand_stoneout_1; - Next[x][y] = Xsand_stonesand_quickout_2; - Next[x][y+1] = Xsand_stoneout_2; - return; - case Xsand: - Cave[x][y] = Xsand_stonesand_1; - Cave[x][y+1] = Xsand_sandstone_1; - Next[x][y] = Xsand_stonesand_2; - Next[x][y+1] = Xsand_sandstone_2; + cave[x][y] = Xsand_stonesand_1; + next[x][y] = Xsand_stonesand_2; + cave[x][y+1] = Xsand_sandstone_1; + next[x][y+1] = Xsand_sandstone_2; return; } } static void Lsand_stonein_1(int x, int y) { - Next[x][y] = Xsand_stonein_2; + next[x][y] = Xsand_stonein_2; } static void Lsand_stonein_2(int x, int y) { - Next[x][y] = Xsand_stonein_3; + next[x][y] = Xsand_stonein_3; } static void Lsand_stonein_3(int x, int y) { - Next[x][y] = Xsand_stonein_4; + next[x][y] = Xsand_stonein_4; } static void Lsand_stonein_4(int x, int y) { - Next[x][y] = Xblank; + next[x][y] = Xblank; } static void Lsand_sandstone_1(int x, int y) { - Next[x][y] = Xsand_sandstone_2; + next[x][y] = Xsand_sandstone_2; } static void Lsand_sandstone_2(int x, int y) { - Next[x][y] = Xsand_sandstone_3; + next[x][y] = Xsand_sandstone_3; } static void Lsand_sandstone_3(int x, int y) { - Next[x][y] = Xsand_sandstone_4; + next[x][y] = Xsand_sandstone_4; } static void Lsand_sandstone_4(int x, int y) { - Next[x][y] = Xsand_stone; + next[x][y] = Xsand_stone; } static void Lsand_stonesand_1(int x, int y) { - Next[x][y] = Xsand_stonesand_2; + next[x][y] = Xsand_stonesand_2; } static void Lsand_stonesand_2(int x, int y) { - Next[x][y] = Xsand_stonesand_3; + next[x][y] = Xsand_stonesand_3; } static void Lsand_stonesand_3(int x, int y) { - Next[x][y] = Xsand_stonesand_4; + next[x][y] = Xsand_stonesand_4; } static void Lsand_stonesand_4(int x, int y) { - Next[x][y] = Xsand; + next[x][y] = Xsand; } static void Lsand_stoneout_1(int x, int y) { - Next[x][y] = Xsand_stoneout_2; + next[x][y] = Xsand_stoneout_2; } static void Lsand_stoneout_2(int x, int y) { - Next[x][y] = Xstone_fall; + next[x][y] = Xstone_fall; } -#ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS static void Lsand_stonesand_quickout_1(int x, int y) { - Next[x][y] = Xsand_stonesand_quickout_2; + next[x][y] = Xsand_stonesand_quickout_2; } static void Lsand_stonesand_quickout_2(int x, int y) { - Next[x][y] = Xsand; + next[x][y] = Xsand; } -#endif -static void Lslidewall_ns(int x, int y) +static void Lslide_ns(int x, int y) { - if (tab_blank[Cave[x][y-1]]) + if (is_blank[cave[x][y-1]]) { - Cave[x][y-1] = Yslidewall_ns_blank; - Next[x][y-1] = Xslidewall_ns; - play_element_sound(x, y, SOUND_slidewall, Xslidewall_ns); + cave[x][y-1] = Yslide_ns_blank; + next[x][y-1] = Xslide_ns; + play_element_sound(x, y, SOUND_slide, Xslide_ns); } - if (tab_blank[Cave[x][y+1]]) + if (is_blank[cave[x][y+1]]) { - Cave[x][y+1] = Yslidewall_ns_blank; - Next[x][y+1] = Xslidewall_ns; - play_element_sound(x, y, SOUND_slidewall, Xslidewall_ns); + cave[x][y+1] = Yslide_ns_blank; + next[x][y+1] = Xslide_ns; + play_element_sound(x, y, SOUND_slide, Xslide_ns); } } -static void Lslidewall_ew(int x, int y) +static void Lslide_ew(int x, int y) { - if (tab_blank[Cave[x+1][y]]) + if (is_blank[cave[x+1][y]]) { - Cave[x+1][y] = Yslidewall_ew_blank; - Next[x+1][y] = Xslidewall_ew; - play_element_sound(x, y, SOUND_slidewall, Xslidewall_ew); + cave[x+1][y] = Yslide_ew_blank; + next[x+1][y] = Xslide_ew; + play_element_sound(x, y, SOUND_slide, Xslide_ew); } - if (tab_blank[Cave[x-1][y]]) + if (is_blank[cave[x-1][y]]) { - Cave[x-1][y] = Yslidewall_ew_blank; - Next[x-1][y] = Xslidewall_ew; - play_element_sound(x, y, SOUND_slidewall, Xslidewall_ew); + cave[x-1][y] = Yslide_ew_blank; + next[x-1][y] = Xslide_ew; + play_element_sound(x, y, SOUND_slide, Xslide_ew); } } static void Lexit(int x, int y) { - if (lev.required > 0) + if (lev.gems_needed > 0) return; switch (RANDOM(64) / 21) { case 0: - Cave[x][y] = Xexit_1; - Next[x][y] = Xexit_2; + cave[x][y] = Xexit_1; + next[x][y] = Xexit_2; break; case 1: - Cave[x][y] = Xexit_2; - Next[x][y] = Xexit_3; + cave[x][y] = Xexit_2; + next[x][y] = Xexit_3; break; default: - Cave[x][y] = Xexit_3; - Next[x][y] = Xexit_1; + cave[x][y] = Xexit_3; + next[x][y] = Xexit_1; break; } @@ -6048,77 +6922,187 @@ static void Lexit(int x, int y) static void Lexit_1(int x, int y) { - Next[x][y] = Xexit_2; + next[x][y] = Xexit_2; } static void Lexit_2(int x, int y) { - Next[x][y] = Xexit_3; + next[x][y] = Xexit_3; } static void Lexit_3(int x, int y) { - Next[x][y] = Xexit_1; + next[x][y] = Xexit_1; } static void Lpause(int x, int y) { - Next[x][y] = Xblank; + next[x][y] = Xblank; } static void Lamoeba(int x, int y) { - switch (Cave[x][y]) + switch (cave[x][y]) { case Xblank: - case Xacid_splash_e: - case Xacid_splash_w: + case Xsplash_e: + case Xsplash_w: + case Xfake_acid_1: + case Xfake_acid_2: + case Xfake_acid_3: + case Xfake_acid_4: + case Xfake_acid_5: + case Xfake_acid_6: + case Xfake_acid_7: + case Xfake_acid_8: + case Xplant: + case Yplant: case Xgrass: case Xdirt: case Xsand: + if (is_amoeba[cave[x][y-1]] || + is_amoeba[cave[x+1][y]] || + is_amoeba[cave[x][y+1]] || + is_amoeba[cave[x-1][y]]) + cave[x][y] = Xdrip; + } +} + +static void Lboom_one(int x, int y, boolean by_dynamite) +{ + switch (cave[x][y]) + { + case Zborder: + case Zbug: + case Ztank: + case Zeater: + case Zdynamite: + case Zboom: + case Xchain: + case Xboom_bug: + case Xboom_tank: + case Xboom_android: + 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 Xplant: case Yplant: - if (tab_amoeba[Cave[x][y-1]] || - tab_amoeba[Cave[x+1][y]] || - tab_amoeba[Cave[x][y+1]] || - tab_amoeba[Cave[x-1][y]]) - Cave[x][y] = Xdrip; + case Xdoor_1: + case Xdoor_2: + case Xdoor_3: + case Xdoor_4: + case Xdoor_5: + case Xdoor_6: + case Xdoor_7: + case Xdoor_8: + case Xfake_door_1: + case Xfake_door_2: + case Xfake_door_3: + case Xfake_door_4: + case Xfake_door_5: + case Xfake_door_6: + case Xfake_door_7: + case Xfake_door_8: + case Xacid_ne: + case Xacid_nw: + case Xacid_s: + case Xacid_se: + case Xacid_sw: + case Xsteel_1: + case Xsteel_2: + case Xsteel_3: + case Xsteel_4: + return; + + 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: + if (by_dynamite) + cave[x][y] = Xboom_android; + return; + + case Xbug_1_n: + case Xbug_1_e: + case Xbug_1_s: + case Xbug_1_w: + case Xbug_2_n: + case Xbug_2_e: + case Xbug_2_s: + case Xbug_2_w: + cave[x][y] = Xboom_bug; + Lboom_bug_new(x, y, TRUE); + return; + + case Xbomb: + case Xbomb_pause: + case Xbomb_fall: + cave[x][y] = Xboom_tank; + Lboom_tank_new(x, y, TRUE); + return; + + default: + cave[x][y] = Xboom_1; + return; } } +static void Lboom_nine(int x, int y, boolean by_dynamite) +{ + Lboom_one(x, y-1, by_dynamite); + Lboom_one(x-1, y, by_dynamite); + Lboom_one(x+1, y, by_dynamite); + Lboom_one(x, y+1, by_dynamite); + Lboom_one(x-1, y-1, by_dynamite); + Lboom_one(x+1, y-1, by_dynamite); + Lboom_one(x-1, y+1, by_dynamite); + Lboom_one(x+1, y+1, by_dynamite); + + cave[x][y] = Xboom_1; +} + static void Lexplode(int x, int y) { - switch (Cave[x][y]) - { - case Znormal: - Cave[x][y] = Xboom_1; - Cave[x][y-1] = tab_explode_normal[Cave[x][y-1]]; - Cave[x-1][y] = tab_explode_normal[Cave[x-1][y]]; - Cave[x+1][y] = tab_explode_normal[Cave[x+1][y]]; - Cave[x][y+1] = tab_explode_normal[Cave[x][y+1]]; - Cave[x-1][y-1] = tab_explode_normal[Cave[x-1][y-1]]; - Cave[x+1][y-1] = tab_explode_normal[Cave[x+1][y-1]]; - Cave[x-1][y+1] = tab_explode_normal[Cave[x-1][y+1]]; - Cave[x+1][y+1] = tab_explode_normal[Cave[x+1][y+1]]; + switch (cave[x][y]) + { + case Zbug: + Lboom_bug_new(x, y, FALSE); + Lboom_nine(x, y, FALSE); + break; + + case Ztank: + Lboom_tank_new(x, y, FALSE); + Lboom_nine(x, y, FALSE); + break; + + case Zeater: + Lboom_eater_new(x, y, FALSE); + Lboom_nine(x, y, FALSE); break; case Zdynamite: - Cave[x][y] = Xboom_1; - Cave[x][y-1] = tab_explode_dynamite[Cave[x][y-1]]; - Cave[x-1][y] = tab_explode_dynamite[Cave[x-1][y]]; - Cave[x+1][y] = tab_explode_dynamite[Cave[x+1][y]]; - Cave[x][y+1] = tab_explode_dynamite[Cave[x][y+1]]; - Cave[x-1][y-1] = tab_explode_dynamite[Cave[x-1][y-1]]; - Cave[x+1][y-1] = tab_explode_dynamite[Cave[x+1][y-1]]; - Cave[x-1][y+1] = tab_explode_dynamite[Cave[x-1][y+1]]; - Cave[x+1][y+1] = tab_explode_dynamite[Cave[x+1][y+1]]; + Lboom_nine(x, y, TRUE); + break; + + case Zboom: + Lboom_nine(x, y, FALSE); break; } } static void Lboom_1(int x, int y) { - Next[x][y] = Xboom_2; + next[x][y] = Xboom_2; #if !PLAY_ELEMENT_SOUND if (x != lev.exit_x && y != lev.exit_y) play_sound(x, y, SOUND_boom); @@ -6129,7 +7113,7 @@ static void Lboom_1(int x, int y) static void Lboom_2(int x, int y) { - Next[x][y] = Boom[x][y]; + next[x][y] = boom[x][y]; } static void Lboom_android(int x, int y) @@ -6141,9 +7125,14 @@ static void Lboom_android(int x, int y) Lboom_1(x, y); } +static void Lchain(int x, int y) +{ + next[x][y] = Zboom; +} + static void handle_tile(int x, int y) { - switch (Cave[x][y]) + switch (cave[x][y]) { case Xacid_1: Lacid_1(x, y); break; case Xacid_2: Lacid_2(x, y); break; @@ -6154,7 +7143,6 @@ static void handle_tile(int x, int y) case Xacid_7: Lacid_7(x, y); break; case Xacid_8: Lacid_8(x, y); break; -#ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS case Xfake_acid_1: Lfake_acid_1(x, y); break; case Xfake_acid_2: Lfake_acid_2(x, y); break; case Xfake_acid_3: Lfake_acid_3(x, y); break; @@ -6163,7 +7151,6 @@ static void handle_tile(int x, int y) case Xfake_acid_6: Lfake_acid_6(x, y); break; case Xfake_acid_7: Lfake_acid_7(x, y); break; case Xfake_acid_8: Lfake_acid_8(x, y); break; -#endif case Xandroid: Landroid(x, y); break; case Xandroid_1_n: Landroid_1_n(x, y); break; @@ -6289,13 +7276,11 @@ static void handle_tile(int x, int y) case Xsand_stonesand_4: Lsand_stonesand_4(x, y); break; case Xsand_stoneout_1: Lsand_stoneout_1(x, y); break; case Xsand_stoneout_2: Lsand_stoneout_2(x, y); break; -#ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS case Xsand_stonesand_quickout_1: Lsand_stonesand_quickout_1(x, y); break; case Xsand_stonesand_quickout_2: Lsand_stonesand_quickout_2(x, y); break; -#endif - case Xslidewall_ns: Lslidewall_ns(x, y); break; - case Xslidewall_ew: Lslidewall_ew(x, y); break; + case Xslide_ns: Lslide_ns(x, y); break; + case Xslide_ew: Lslide_ew(x, y); break; case Xexit: Lexit(x, y); break; case Xexit_1: Lexit_1(x, y); break; @@ -6304,19 +7289,24 @@ static void handle_tile(int x, int y) case Xpause: Lpause(x, y); break; + case Xchain: Lchain(x, y); break; case Xboom_bug: Lboom_bug(x, y); break; - case Xboom_bomb: Lboom_tank(x, y); break; + case Xboom_tank: Lboom_tank(x, y); break; case Xboom_android: Lboom_android(x, y); break; case Xboom_1: Lboom_1(x, y); break; case Xboom_2: Lboom_2(x, y); break; } } -void logic_1(void) +static void logic_players(void) { int start_check_nr; int i; + cave = lev.cave; + next = lev.next; + boom = lev.boom; + game_em.any_player_moving = FALSE; game_em.any_player_snapping = FALSE; @@ -6331,12 +7321,27 @@ void logic_1(void) for (i = 0; i < MAX_PLAYERS; i++) { - ply[i].oldx = ply[i].x; - ply[i].oldy = ply[i].y; + if (!ply[i].alive) + continue; + + /* check for wrap-around movement */ + if (ply[i].x < lev.left || + ply[i].x > lev.right - 1) + { + ply[i].x = (ply[i].x < lev.left ? lev.right - 1 : lev.left); + + game.centered_player_nr_next = i; + game.set_centered_player = TRUE; + game.set_centered_player_wrap = TRUE; + } + + ply[i].prev_x = ply[i].x; + ply[i].prev_y = ply[i].y; ply[i].anim = PLY_still; } - start_check_nr = (RandomEM & 128 ? 0 : 1) * 2 + (RandomEM & 256 ? 0 : 1); + start_check_nr = ((game_em.random & 128 ? 0 : 1) * 2 + + (game_em.random & 256 ? 0 : 1)); for (i = 0; i < MAX_PLAYERS; i++) { @@ -6351,29 +7356,33 @@ void logic_1(void) if (!ply[i].alive) continue; - if (Cave[ply[i].oldx][ply[i].oldy] == Zplayer) + if (cave[ply[i].prev_x][ply[i].prev_y] == Zplayer) { - Cave[ply[i].oldx][ply[i].oldy] = Xblank; - Next[ply[i].oldx][ply[i].oldy] = Xblank; + cave[ply[i].prev_x][ply[i].prev_y] = Xblank; + next[ply[i].prev_x][ply[i].prev_y] = Xblank; } - if (Cave[ply[i].x][ply[i].y] == Xblank) + if (cave[ply[i].x][ply[i].y] == Xblank) { - Cave[ply[i].x][ply[i].y] = Zplayer; - Next[ply[i].x][ply[i].y] = Zplayer; + cave[ply[i].x][ply[i].y] = Zplayer; + next[ply[i].x][ply[i].y] = Zplayer; } } } -void logic_2(void) +static void logic_objects(void) { int x, y; - seed = RandomEM; + cave = lev.cave; + next = lev.next; + boom = lev.boom; + + seed = game_em.random; score = 0; - for (y = 1; y < HEIGHT - 1; y++) - for (x = 0; x < WIDTH; x++) + for (y = lev.top; y < lev.bottom; y++) + for (x = lev.left; x < lev.right; x++) handle_tile(x, y); if (ply[0].alive || ply[1].alive || ply[2].alive || ply[3].alive) @@ -6381,22 +7390,26 @@ void logic_2(void) else game_em.game_over = TRUE; - RandomEM = seed; + game_em.random = seed; /* triple buffering */ - void *temp = Cave; - Cave = Next; - Next = Draw; - Draw = temp; + void *temp = lev.cave; + lev.cave = lev.next; + lev.next = lev.draw; + lev.draw = temp; } -void logic_3(void) +static void logic_globals(void) { int x; int y; int count; unsigned int random; + cave = lev.cave; + next = lev.next; + boom = lev.boom; + /* update variables */ if (lev.score > 9999) @@ -6406,7 +7419,7 @@ void logic_3(void) lev.android_move_cnt = lev.android_move_time; if (lev.android_clone_cnt-- == 0) lev.android_clone_cnt = lev.android_clone_time; - if (lev.ball_state) + if (lev.ball_active) if (lev.ball_cnt-- == 0) lev.ball_cnt = lev.ball_time; if (lev.lenses_cnt) @@ -6417,7 +7430,7 @@ void logic_3(void) lev.wheel_cnt--; if (lev.wind_cnt) lev.wind_cnt--; - if (lev.wonderwall_time && lev.wonderwall_state) + if (lev.wonderwall_time > 0 && lev.wonderwall_active) lev.wonderwall_time--; if (lev.wheel_cnt) @@ -6425,29 +7438,53 @@ void logic_3(void) /* grow amoeba */ - random = RandomEM; + random = game_em.random; for (count = lev.amoeba_time; count--;) { - x = (random >> 10) % (WIDTH - 2); - y = (random >> 20) % (HEIGHT - 2); + x = lev.left - 1 + (random >> 10) % (CAVE_WIDTH + 2); + y = lev.top - 1 + (random >> 20) % (CAVE_HEIGHT + 2); - Lamoeba(x, y); + if (x >= lev.left && x < lev.right && + y >= lev.top && y < lev.bottom) + Lamoeba(x, y); random = random * 129 + 1; } - RandomEM = random; + game_em.random = random; /* handle explosions */ - for (y = 1; y < HEIGHT - 1; y++) - for (x = 1; x < WIDTH - 1; x++) + for (y = lev.top; y < lev.bottom; y++) + for (x = lev.left; x < lev.right; x++) Lexplode(x, y); /* triple buffering */ - for (y = 0; y < HEIGHT; y++) - for (x = 0; x < WIDTH; x++) - Next[x][y] = Cave[x][y]; + for (y = lev.top; y < lev.bottom; y++) + for (x = lev.left; x < lev.right; x++) + next[x][y] = cave[x][y]; +} + +void logic_init(void) +{ + int splash_is_blank = !game_em.use_old_android; + + is_android_blank[Xsplash_e] = splash_is_blank; + is_android_blank[Xsplash_w] = splash_is_blank; +} + +void logic(void) +{ + if (frame == 0) + { + logic_players(); + logic_objects(); + } + + if (frame == 1) + { + logic_globals(); + } }