X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fgame_em%2Flogic.c;h=4b489d8a507dee65da5f9b7c35f79bb48ec62cc2;hp=2c5f74b347b2878fb7294b656a50f91ec5815f2c;hb=2a4f4ada000ade47a2a04e7f7b4d1d67878a2381;hpb=c734235e0757e54dfdf6645d07a76c2a0bc591ba diff --git a/src/game_em/logic.c b/src/game_em/logic.c index 2c5f74b3..4b489d8a 100644 --- a/src/game_em/logic.c +++ b/src/game_em/logic.c @@ -9,15 +9,153 @@ #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_BUG /* handle problem with old tapes using 64-bit random */ + +#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_player[GAME_TILE_MAX] = +{ + [Zplayer] = 1, + [Xfake_acid_1_player] = 1, + [Xfake_acid_2_player] = 1, + [Xfake_acid_3_player] = 1, + [Xfake_acid_4_player] = 1, + [Xfake_acid_5_player] = 1, + [Xfake_acid_6_player] = 1, + [Xfake_acid_7_player] = 1, + [Xfake_acid_8_player] = 1 +}; + +static const byte add_player[GAME_TILE_MAX] = +{ + [Xblank] = Zplayer, + [Xsplash_e] = Zplayer, + [Xsplash_w] = Zplayer, + [Xfake_acid_1] = Xfake_acid_1_player, + [Xfake_acid_2] = Xfake_acid_2_player, + [Xfake_acid_3] = Xfake_acid_3_player, + [Xfake_acid_4] = Xfake_acid_4_player, + [Xfake_acid_5] = Xfake_acid_5_player, + [Xfake_acid_6] = Xfake_acid_6_player, + [Xfake_acid_7] = Xfake_acid_7_player, + [Xfake_acid_8] = Xfake_acid_8_player +}; + +static const byte remove_player[GAME_TILE_MAX] = +{ + [Zplayer] = Xblank, + [Xfake_acid_1_player] = Xfake_acid_1, + [Xfake_acid_2_player] = Xfake_acid_2, + [Xfake_acid_3_player] = Xfake_acid_3, + [Xfake_acid_4_player] = Xfake_acid_4, + [Xfake_acid_5_player] = Xfake_acid_5, + [Xfake_acid_6_player] = Xfake_acid_6, + [Xfake_acid_7_player] = Xfake_acid_7, + [Xfake_acid_8_player] = Xfake_acid_8 +}; + +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; @@ -31,31 +169,34 @@ static void Lboom_generic(int x, int y, int element, int element_middle) boom[x+1][y+1] = element; } -static void Lboom_bug(int x, int y, int by_element) +static void Lboom_bug(int x, int y) { - next[x][y] = Znormal; + 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, by_element); + play_element_sound(x, y, SOUND_boom, Xbug_1_n); #endif } -static void Lboom_tank(int x, int y, int by_element) +static void Lboom_tank(int x, int y) { - next[x][y] = Znormal; + 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, by_element); + play_element_sound(x, y, SOUND_boom, Xtank_1_n); #endif } -static void Lboom_eater(int x, int y, int by_element) +static void Lboom_eater(int x, int y) { - next[x][y] = Znormal; + 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]; @@ -67,13 +208,95 @@ static void Lboom_eater(int x, int y, int by_element) 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) & 7; + lev.eater_pos = (lev.eater_pos + 1) % lev.num_eater_arrays; #if PLAY_ELEMENT_SOUND - play_element_sound(x, y, SOUND_boom, by_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 void Lpush_element_old(int x, int y, int element) +{ + if (!game_em.use_old_push_elements) + return; + + cave[x][y] = element; + next[x][y] = element; +} + static boolean player_killed(struct PLAYER *ply) { int x = ply->x; @@ -171,10 +394,10 @@ static boolean player_killed(struct PLAYER *ply) switch (cave[x][y]) { + 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: @@ -183,8 +406,14 @@ static boolean player_killed(struct PLAYER *ply) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif - case Zplayer: + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xdynamite_1: case Xdynamite_2: case Xdynamite_3: @@ -200,7 +429,7 @@ 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]) { @@ -213,6 +442,7 @@ static void kill_player(struct PLAYER *ply) case Xbug_2_s: case Xbug_2_w: cave[x][y-1] = Xboom_bug; + Lboom_bug_new(x, y-1, TRUE); break; case Xtank_1_n: @@ -223,7 +453,8 @@ 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; } @@ -238,6 +469,7 @@ static void kill_player(struct PLAYER *ply) case Xbug_2_s: case Xbug_2_w: cave[x+1][y] = Xboom_bug; + Lboom_bug_new(x+1, y, TRUE); break; case Xtank_1_n: @@ -248,7 +480,8 @@ 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; } @@ -263,6 +496,7 @@ static void kill_player(struct PLAYER *ply) case Xbug_2_s: case Xbug_2_w: cave[x][y+1] = Xboom_bug; + Lboom_bug_new(x, y+1, TRUE); break; case Xtank_1_n: @@ -273,7 +507,8 @@ 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; } @@ -288,6 +523,7 @@ static void kill_player(struct PLAYER *ply) case Xbug_2_s: case Xbug_2_w: cave[x-1][y] = Xboom_bug; + Lboom_bug_new(x-1, y, TRUE); break; case Xtank_1_n: @@ -298,7 +534,8 @@ 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; } @@ -319,7 +556,7 @@ static void kill_player(struct PLAYER *ply) switch (cave[x][y]) { -#ifdef USE_CHANGED_ACID_STUFF +#ifdef ACID_PLAYER case Xacid_1: case Xacid_2: case Xacid_3: @@ -353,7 +590,7 @@ 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]; @@ -361,11 +598,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) { /* 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: case Xfake_acid_1: case Xfake_acid_2: case Xfake_acid_3: @@ -374,14 +608,15 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + cave[x][y] = add_player[element]; + next[x][y] = add_player[element]; + 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: @@ -390,13 +625,14 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xacid_6: case Xacid_7: case Xacid_8: +#ifdef ACID_PLAYER if (cave[x+1][y-1] == Xblank) - cave[x+1][y-1] = Xacid_splash_e; + cave[x+1][y-1] = Xsplash_e; if (cave[x-1][y-1] == Xblank) - cave[x-1][y-1] = Xacid_splash_w; + 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: @@ -415,17 +651,6 @@ 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; @@ -457,7 +682,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) 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; @@ -470,7 +695,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) 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; @@ -567,9 +792,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) switch (cave[x+dx][y]) { 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: @@ -578,7 +802,6 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x+dx][y] = dx > 0 ? Ystone_e : Ystone_w; next[x+dx][y] = Xstone_pause; goto stone_walk; @@ -592,9 +815,9 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xacid_7: case Xacid_8: if (cave[x+dx+1][y-1] == Xblank) - cave[x+dx+1][y-1] = Xacid_splash_e; + cave[x+dx+1][y-1] = Xsplash_e; if (cave[x+dx-1][y-1] == Xblank) - cave[x+dx-1][y-1] = Xacid_splash_w; + cave[x+dx-1][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); stone_walk: @@ -616,9 +839,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) switch (cave[x+dx][y]) { 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: @@ -627,7 +849,6 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x+dx][y] = dx > 0 ? Ybomb_e : Ybomb_w; next[x+dx][y] = Xbomb_pause; goto bomb_walk; @@ -641,9 +862,9 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xacid_7: case Xacid_8: if (cave[x+dx+1][y-1] == Xblank) - cave[x+dx+1][y-1] = Xacid_splash_e; + cave[x+dx+1][y-1] = Xsplash_e; if (cave[x+dx-1][y-1] == Xblank) - cave[x+dx-1][y-1] = Xacid_splash_w; + cave[x+dx-1][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); bomb_walk: @@ -665,9 +886,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) switch (cave[x+dx][y]) { 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: @@ -676,7 +896,6 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x+dx][y] = dx > 0 ? Ynut_e : Ynut_w; next[x+dx][y] = Xnut_pause; goto nut_walk; @@ -690,9 +909,9 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xacid_7: case Xacid_8: if (cave[x+dx+1][y-1] == Xblank) - cave[x+dx+1][y-1] = Xacid_splash_e; + cave[x+dx+1][y-1] = Xsplash_e; if (cave[x+dx-1][y-1] == Xblank) - cave[x+dx-1][y-1] = Xacid_splash_w; + cave[x+dx-1][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); nut_walk: @@ -714,9 +933,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) switch (cave[x+dx][y]) { 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: @@ -725,7 +943,6 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x+dx][y] = dx > 0 ? Yspring_e : Yspring_w; next[x+dx][y] = dx > 0 ? Xspring_e : Xspring_w; goto spring_walk; @@ -739,9 +956,9 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xacid_7: case Xacid_8: if (cave[x+dx+1][y-1] == Xblank) - cave[x+dx+1][y-1] = Xacid_splash_e; + cave[x+dx+1][y-1] = Xsplash_e; if (cave[x+dx-1][y-1] == Xblank) - cave[x+dx-1][y-1] = Xacid_splash_w; + cave[x+dx-1][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); spring_walk: @@ -785,9 +1002,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) switch (cave[x+dx][y+dy]) { 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: @@ -796,7 +1012,6 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x+dx][y+dy] = (dy ? (dy < 0 ? Yballoon_n : Yballoon_s) : (dx > 0 ? Yballoon_e : Yballoon_w)); next[x+dx][y+dy] = Xballoon; @@ -811,9 +1026,9 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) 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; + 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] = Xacid_splash_w; + cave[x+dx-1][y+dy-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); balloon_walk: @@ -842,9 +1057,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) switch (cave[x+dx][y+dy]) { 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: @@ -853,7 +1067,6 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif 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) : @@ -869,9 +1082,9 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) 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; + 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] = Xacid_splash_w; + cave[x+dx-1][y+dy-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); android_walk: @@ -946,14 +1159,13 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) door_walk: - if (!tab_blank[cave[x+dx][y+dy]]) + if (!is_blank[cave[x+dx][y+dy]]) break; - if (!tab_fake_acid[cave[x+dx][y+dy]]) - { - cave[x+dx][y+dy] = Zplayer; - next[x+dx][y+dy] = Zplayer; - } + int element_next = cave[x+dx][y+dy]; + + cave[x+dx][y+dy] = add_player[element_next]; + next[x+dx][y+dy] = add_player[element_next]; play_element_sound(x, y, SOUND_door, element); ply->anim = PLY_walk_n + anim; @@ -1002,7 +1214,7 @@ 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: @@ -1060,7 +1272,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) 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; @@ -1071,7 +1283,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) 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; @@ -1156,6 +1368,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; } @@ -1223,7 +1440,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; } @@ -1231,7 +1451,7 @@ static void check_player(struct PLAYER *ply) if (dx == 0 && dy == 0) { - ply->joy_stick = 0; + ply->joy_stick = FALSE; if (ply->joy_drop) { @@ -1247,17 +1467,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; @@ -1356,7 +1580,6 @@ static void Lacid_8(int x, int y) 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; @@ -1396,7 +1619,6 @@ static void Lfake_acid_8(int x, int y) { next[x][y] = Xfake_acid_1; } -#endif static void Landroid(int x, int y) { @@ -1404,14 +1626,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)) @@ -1515,91 +1737,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; } } @@ -1607,14 +1829,14 @@ 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 (is_player[cave[x-1][y-1]] || + is_player[cave[x][y-1]] || + is_player[cave[x+1][y-1]] || + is_player[cave[x-1][y]] || + is_player[cave[x+1][y]] || + is_player[cave[x-1][y+1]] || + is_player[cave[x][y+1]] || + is_player[cave[x+1][y+1]]) goto android_still; set_nearest_player_xy(x, y, &dx, &dy); @@ -1629,54 +1851,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; } } @@ -1687,54 +1909,54 @@ 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; } } @@ -1806,9 +2028,8 @@ static void Landroid_1_n(int x, int y) switch (cave[x][y-1]) { 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: @@ -1817,7 +2038,6 @@ static void Landroid_1_n(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Yandroid_nB; next[x][y] = Xblank; cave[x][y-1] = Yandroid_n; @@ -1836,9 +2056,9 @@ static void Landroid_1_n(int x, int y) cave[x][y] = Yandroid_nB; next[x][y] = Xblank; if (cave[x+1][y-2] == Xblank) - cave[x+1][y-2] = Xacid_splash_e; + cave[x+1][y-2] = Xsplash_e; if (cave[x-1][y-2] == Xblank) - cave[x-1][y-2] = Xacid_splash_w; + cave[x-1][y-2] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -1853,9 +2073,8 @@ static void Landroid_2_n(int x, int y) switch (cave[x][y-1]) { 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: @@ -1864,7 +2083,6 @@ static void Landroid_2_n(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Yandroid_nB; next[x][y] = Xblank; cave[x][y-1] = Yandroid_n; @@ -1883,9 +2101,9 @@ static void Landroid_2_n(int x, int y) cave[x][y] = Yandroid_nB; next[x][y] = Xblank; if (cave[x+1][y-2] == Xblank) - cave[x+1][y-2] = Xacid_splash_e; + cave[x+1][y-2] = Xsplash_e; if (cave[x-1][y-2] == Xblank) - cave[x-1][y-2] = Xacid_splash_w; + cave[x-1][y-2] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -1900,9 +2118,8 @@ static void Landroid_1_e(int x, int y) switch (cave[x+1][y]) { 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: @@ -1911,7 +2128,6 @@ static void Landroid_1_e(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Yandroid_eB; next[x][y] = Xblank; cave[x+1][y] = Yandroid_e; @@ -1930,9 +2146,9 @@ static void Landroid_1_e(int x, int y) cave[x][y] = Yandroid_eB; next[x][y] = Xblank; if (cave[x+2][y-1] == Xblank) - cave[x+2][y-1] = Xacid_splash_e; + cave[x+2][y-1] = Xsplash_e; if (cave[x][y-1] == Xblank) - cave[x][y-1] = Xacid_splash_w; + cave[x][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -1947,9 +2163,8 @@ static void Landroid_2_e(int x, int y) switch (cave[x+1][y]) { 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: @@ -1958,7 +2173,6 @@ static void Landroid_2_e(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Yandroid_eB; next[x][y] = Xblank; cave[x+1][y] = Yandroid_e; @@ -1977,9 +2191,9 @@ static void Landroid_2_e(int x, int y) cave[x][y] = Yandroid_eB; next[x][y] = Xblank; if (cave[x+2][y-1] == Xblank) - cave[x+2][y-1] = Xacid_splash_e; + cave[x+2][y-1] = Xsplash_e; if (cave[x][y-1] == Xblank) - cave[x][y-1] = Xacid_splash_w; + cave[x][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -1994,9 +2208,8 @@ static void Landroid_1_s(int x, int y) switch (cave[x][y+1]) { 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: @@ -2005,7 +2218,6 @@ static void Landroid_1_s(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Yandroid_sB; next[x][y] = Xblank; cave[x][y+1] = Yandroid_s; @@ -2024,9 +2236,9 @@ static void Landroid_1_s(int x, int y) cave[x][y] = Yandroid_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -2041,9 +2253,8 @@ static void Landroid_2_s(int x, int y) switch (cave[x][y+1]) { 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: @@ -2052,7 +2263,6 @@ static void Landroid_2_s(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Yandroid_sB; next[x][y] = Xblank; cave[x][y+1] = Yandroid_s; @@ -2071,9 +2281,9 @@ static void Landroid_2_s(int x, int y) cave[x][y] = Yandroid_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -2088,9 +2298,8 @@ static void Landroid_1_w(int x, int y) switch (cave[x-1][y]) { 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: @@ -2099,7 +2308,6 @@ static void Landroid_1_w(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Yandroid_wB; next[x][y] = Xblank; cave[x-1][y] = Yandroid_w; @@ -2118,9 +2326,9 @@ static void Landroid_1_w(int x, int y) cave[x][y] = Yandroid_wB; next[x][y] = Xblank; if (cave[x][y-1] == Xblank) - cave[x][y-1] = Xacid_splash_e; + cave[x][y-1] = Xsplash_e; if (cave[x-2][y-1] == Xblank) - cave[x-2][y-1] = Xacid_splash_w; + cave[x-2][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -2135,9 +2343,8 @@ static void Landroid_2_w(int x, int y) switch (cave[x-1][y]) { 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: @@ -2146,7 +2353,6 @@ static void Landroid_2_w(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Yandroid_wB; next[x][y] = Xblank; cave[x-1][y] = Yandroid_w; @@ -2165,9 +2371,9 @@ static void Landroid_2_w(int x, int y) cave[x][y] = Yandroid_wB; next[x][y] = Xblank; if (cave[x][y-1] == Xblank) - cave[x][y-1] = Xacid_splash_e; + cave[x][y-1] = Xsplash_e; if (cave[x-2][y-1] == Xblank) - cave[x-2][y-1] = Xacid_splash_w; + cave[x-2][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -2213,10 +2419,10 @@ static void Leater_n(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: @@ -2225,10 +2431,16 @@ static void Leater_n(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: - case Zplayer: cave[x][y] = Yeater_nB; next[x][y] = Xblank; cave[x][y-1] = Yeater_n; @@ -2246,9 +2458,9 @@ static void Leater_n(int x, int y) cave[x][y] = Yeater_nB; next[x][y] = Xblank; if (cave[x+1][y-2] == Xblank) - cave[x+1][y-2] = Xacid_splash_e; + cave[x+1][y-2] = Xsplash_e; if (cave[x-1][y-2] == Xblank) - cave[x-1][y-2] = Xacid_splash_w; + cave[x-1][y-2] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -2295,10 +2507,10 @@ static void Leater_e(int x, int y) switch (cave[x+1][y]) { + 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: @@ -2307,10 +2519,16 @@ static void Leater_e(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: - case Zplayer: cave[x][y] = Yeater_eB; next[x][y] = Xblank; cave[x+1][y] = Yeater_e; @@ -2328,9 +2546,9 @@ static void Leater_e(int x, int y) cave[x][y] = Yeater_eB; next[x][y] = Xblank; if (cave[x+2][y-1] == Xblank) - cave[x+2][y-1] = Xacid_splash_e; + cave[x+2][y-1] = Xsplash_e; if (cave[x][y-1] == Xblank) - cave[x][y-1] = Xacid_splash_w; + cave[x][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -2377,10 +2595,10 @@ static void Leater_s(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: @@ -2389,10 +2607,16 @@ static void Leater_s(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: - case Zplayer: cave[x][y] = Yeater_sB; next[x][y] = Xblank; cave[x][y+1] = Yeater_s; @@ -2410,9 +2634,9 @@ static void Leater_s(int x, int y) cave[x][y] = Yeater_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -2459,10 +2683,10 @@ static void Leater_w(int x, int y) switch (cave[x-1][y]) { + 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: @@ -2471,10 +2695,16 @@ static void Leater_w(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: - case Zplayer: cave[x][y] = Yeater_wB; next[x][y] = Xblank; cave[x-1][y] = Yeater_w; @@ -2492,9 +2722,9 @@ static void Leater_w(int x, int y) cave[x][y] = Yeater_wB; next[x][y] = Xblank; if (cave[x][y-1] == Xblank) - cave[x][y-1] = Xacid_splash_e; + cave[x][y-1] = Xsplash_e; if (cave[x-2][y-1] == Xblank) - cave[x-2][y-1] = Xacid_splash_w; + cave[x-2][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -2525,10 +2755,10 @@ static void Lalien(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: @@ -2537,10 +2767,16 @@ static void Lalien(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: - case Zplayer: cave[x][y] = Yalien_nB; next[x][y] = Xblank; cave[x][y-1] = Yalien_n; @@ -2559,9 +2795,9 @@ static void Lalien(int x, int y) cave[x][y] = Yalien_nB; next[x][y] = Xblank; if (cave[x+1][y-2] == Xblank) - cave[x+1][y-2] = Xacid_splash_e; + cave[x+1][y-2] = Xsplash_e; if (cave[x-1][y-2] == Xblank) - cave[x-1][y-2] = Xacid_splash_w; + cave[x-1][y-2] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; } @@ -2570,10 +2806,10 @@ static void Lalien(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: @@ -2582,10 +2818,16 @@ static void Lalien(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: - case Zplayer: cave[x][y] = Yalien_sB; next[x][y] = Xblank; cave[x][y+1] = Yalien_s; @@ -2604,9 +2846,9 @@ static void Lalien(int x, int y) cave[x][y] = Yalien_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; } @@ -2618,10 +2860,10 @@ static void Lalien(int x, int y) { switch (cave[x+1][y]) { + 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: @@ -2630,10 +2872,16 @@ static void Lalien(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: - case Zplayer: cave[x][y] = Yalien_eB; next[x][y] = Xblank; cave[x+1][y] = Yalien_e; @@ -2652,9 +2900,9 @@ static void Lalien(int x, int y) cave[x][y] = Yalien_eB; next[x][y] = Xblank; if (cave[x+2][y-1] == Xblank) - cave[x+2][y-1] = Xacid_splash_e; + cave[x+2][y-1] = Xsplash_e; if (cave[x][y-1] == Xblank) - cave[x][y-1] = Xacid_splash_w; + cave[x][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; } @@ -2663,10 +2911,10 @@ static void Lalien(int x, int y) { switch (cave[x-1][y]) { + 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: @@ -2675,10 +2923,16 @@ static void Lalien(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: - case Zplayer: cave[x][y] = Yalien_wB; next[x][y] = Xblank; cave[x-1][y] = Yalien_w; @@ -2697,9 +2951,9 @@ static void Lalien(int x, int y) cave[x][y] = Yalien_wB; next[x][y] = Xblank; if (cave[x][y-1] == Xblank) - cave[x][y-1] = Xacid_splash_e; + cave[x][y-1] = Xsplash_e; if (cave[x-2][y-1] == Xblank) - cave[x-2][y-1] = Xacid_splash_w; + cave[x-2][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; } @@ -2716,10 +2970,10 @@ static void Lbug_n(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: @@ -2728,10 +2982,16 @@ static void Lbug_n(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: - case Zplayer: cave[x][y] = Ybug_nB; next[x][y] = Xblank; cave[x][y-1] = Ybug_n; @@ -2750,9 +3010,9 @@ static void Lbug_n(int x, int y) cave[x][y] = Ybug_nB; next[x][y] = Xblank; if (cave[x+1][y-2] == Xblank) - cave[x+1][y-2] = Xacid_splash_e; + cave[x+1][y-2] = Xsplash_e; if (cave[x-1][y-2] == Xblank) - cave[x-1][y-2] = Xacid_splash_w; + cave[x-1][y-2] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -2766,22 +3026,23 @@ 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]]) { - Lboom_bug(x, y, Xbug_1_n); + next[x][y] = Zboom; + Lboom_bug(x, y); return; } switch (cave[x+1][y]) { + 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: @@ -2790,7 +3051,14 @@ static void Lbug_1_n(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: case Xacid_1: @@ -2801,7 +3069,6 @@ 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; play_element_sound(x, y, SOUND_bug, Xbug_1_n); @@ -2815,12 +3082,13 @@ 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]]) { - Lboom_bug(x, y, Xbug_2_n); + next[x][y] = Zboom; + Lboom_bug(x, y); return; } @@ -2832,10 +3100,10 @@ static void Lbug_e(int x, int y) { switch (cave[x+1][y]) { + 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: @@ -2844,10 +3112,16 @@ static void Lbug_e(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: - case Zplayer: cave[x][y] = Ybug_eB; next[x][y] = Xblank; cave[x+1][y] = Ybug_e; @@ -2866,9 +3140,9 @@ static void Lbug_e(int x, int y) cave[x][y] = Ybug_eB; next[x][y] = Xblank; if (cave[x+2][y-1] == Xblank) - cave[x+2][y-1] = Xacid_splash_e; + cave[x+2][y-1] = Xsplash_e; if (cave[x][y-1] == Xblank) - cave[x][y-1] = Xacid_splash_w; + cave[x][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -2882,22 +3156,23 @@ 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]]) { - Lboom_bug(x, y, Xbug_1_e); + next[x][y] = Zboom; + Lboom_bug(x, y); return; } 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: @@ -2906,7 +3181,14 @@ static void Lbug_1_e(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: case Xacid_1: @@ -2917,7 +3199,6 @@ 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; play_element_sound(x, y, SOUND_bug, Xbug_1_e); @@ -2931,12 +3212,13 @@ 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]]) { - Lboom_bug(x, y, Xbug_2_e); + next[x][y] = Zboom; + Lboom_bug(x, y); return; } @@ -2948,10 +3230,10 @@ static void Lbug_s(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: @@ -2960,10 +3242,16 @@ static void Lbug_s(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: - case Zplayer: cave[x][y] = Ybug_sB; next[x][y] = Xblank; cave[x][y+1] = Ybug_s; @@ -2982,9 +3270,9 @@ static void Lbug_s(int x, int y) cave[x][y] = Ybug_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -2998,22 +3286,23 @@ 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]]) { - Lboom_bug(x, y, Xbug_1_s); + next[x][y] = Zboom; + Lboom_bug(x, y); return; } switch (cave[x-1][y]) { + 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: @@ -3022,7 +3311,14 @@ static void Lbug_1_s(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: case Xacid_1: @@ -3033,7 +3329,6 @@ 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; play_element_sound(x, y, SOUND_bug, Xbug_1_s); @@ -3047,12 +3342,13 @@ 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]]) { - Lboom_bug(x, y, Xbug_2_s); + next[x][y] = Zboom; + Lboom_bug(x, y); return; } @@ -3064,10 +3360,10 @@ static void Lbug_w(int x, int y) { switch (cave[x-1][y]) { + 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: @@ -3076,10 +3372,16 @@ static void Lbug_w(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: - case Zplayer: cave[x][y] = Ybug_wB; next[x][y] = Xblank; cave[x-1][y] = Ybug_w; @@ -3098,9 +3400,9 @@ static void Lbug_w(int x, int y) cave[x][y] = Ybug_wB; next[x][y] = Xblank; if (cave[x][y-1] == Xblank) - cave[x][y-1] = Xacid_splash_e; + cave[x][y-1] = Xsplash_e; if (cave[x-2][y-1] == Xblank) - cave[x-2][y-1] = Xacid_splash_w; + cave[x-2][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -3114,22 +3416,23 @@ 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]]) { - Lboom_bug(x, y, Xbug_1_w); + next[x][y] = Zboom; + Lboom_bug(x, y); return; } 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: @@ -3138,7 +3441,14 @@ static void Lbug_1_w(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: case Xacid_1: @@ -3149,7 +3459,6 @@ 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; play_element_sound(x, y, SOUND_bug, Xbug_1_w); @@ -3163,12 +3472,13 @@ 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]]) { - Lboom_bug(x, y, Xbug_2_w); + next[x][y] = Zboom; + Lboom_bug(x, y); return; } @@ -3180,10 +3490,10 @@ static void Ltank_n(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: @@ -3192,10 +3502,16 @@ static void Ltank_n(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: - case Zplayer: cave[x][y] = Ytank_nB; next[x][y] = Xblank; cave[x][y-1] = Ytank_n; @@ -3214,9 +3530,9 @@ static void Ltank_n(int x, int y) cave[x][y] = Ytank_nB; next[x][y] = Xblank; if (cave[x+1][y-2] == Xblank) - cave[x+1][y-2] = Xacid_splash_e; + cave[x+1][y-2] = Xsplash_e; if (cave[x-1][y-2] == Xblank) - cave[x-1][y-2] = Xacid_splash_w; + cave[x-1][y-2] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -3230,22 +3546,23 @@ 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]]) { - Lboom_tank(x, y, Xtank_1_n); + next[x][y] = Zboom; + Lboom_tank(x, y); return; } switch (cave[x-1][y]) { + 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: @@ -3254,7 +3571,14 @@ static void Ltank_1_n(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: case Xacid_1: @@ -3265,7 +3589,6 @@ 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; play_element_sound(x, y, SOUND_tank, Xtank_1_n); @@ -3279,12 +3602,13 @@ 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]]) { - Lboom_tank(x, y, Xtank_2_n); + next[x][y] = Zboom; + Lboom_tank(x, y); return; } @@ -3296,10 +3620,10 @@ static void Ltank_e(int x, int y) { switch (cave[x+1][y]) { + 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: @@ -3308,10 +3632,16 @@ static void Ltank_e(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: - case Zplayer: cave[x][y] = Ytank_eB; next[x][y] = Xblank; cave[x+1][y] = Ytank_e; @@ -3330,9 +3660,9 @@ static void Ltank_e(int x, int y) cave[x][y] = Ytank_eB; next[x][y] = Xblank; if (cave[x+2][y-1] == Xblank) - cave[x+2][y-1] = Xacid_splash_e; + cave[x+2][y-1] = Xsplash_e; if (cave[x][y-1] == Xblank) - cave[x][y-1] = Xacid_splash_w; + cave[x][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -3346,22 +3676,23 @@ 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]]) { - Lboom_tank(x, y, Xtank_1_e); + next[x][y] = Zboom; + Lboom_tank(x, y); return; } 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: @@ -3370,7 +3701,14 @@ static void Ltank_1_e(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: case Xacid_1: @@ -3381,7 +3719,6 @@ 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; play_element_sound(x, y, SOUND_tank, Xtank_1_e); @@ -3395,12 +3732,13 @@ 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]]) { - Lboom_tank(x, y, Xtank_2_e); + next[x][y] = Zboom; + Lboom_tank(x, y); return; } @@ -3412,10 +3750,10 @@ static void Ltank_s(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: @@ -3424,10 +3762,16 @@ static void Ltank_s(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: - case Zplayer: cave[x][y] = Ytank_sB; next[x][y] = Xblank; cave[x][y+1] = Ytank_s; @@ -3446,9 +3790,9 @@ static void Ltank_s(int x, int y) cave[x][y] = Ytank_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -3462,22 +3806,23 @@ 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]]) { - Lboom_tank(x, y, Xtank_1_s); + next[x][y] = Zboom; + Lboom_tank(x, y); return; } switch (cave[x+1][y]) { + 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: @@ -3486,7 +3831,14 @@ static void Ltank_1_s(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: case Xacid_1: @@ -3497,7 +3849,6 @@ 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; play_element_sound(x, y, SOUND_tank, Xtank_1_s); @@ -3511,12 +3862,13 @@ 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]]) { - Lboom_tank(x, y, Xtank_2_s); + next[x][y] = Zboom; + Lboom_tank(x, y); return; } @@ -3528,10 +3880,10 @@ static void Ltank_w(int x, int y) { switch (cave[x-1][y]) { + 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: @@ -3540,10 +3892,16 @@ static void Ltank_w(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: - case Zplayer: cave[x][y] = Ytank_wB; next[x][y] = Xblank; cave[x-1][y] = Ytank_w; @@ -3562,9 +3920,9 @@ static void Ltank_w(int x, int y) cave[x][y] = Ytank_wB; next[x][y] = Xblank; if (cave[x][y-1] == Xblank) - cave[x][y-1] = Xacid_splash_e; + cave[x][y-1] = Xsplash_e; if (cave[x-2][y-1] == Xblank) - cave[x-2][y-1] = Xacid_splash_w; + cave[x-2][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -3578,22 +3936,23 @@ 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]]) { - Lboom_tank(x, y, Xtank_1_w); + next[x][y] = Zboom; + Lboom_tank(x, y); return; } 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: @@ -3602,7 +3961,14 @@ static void Ltank_1_w(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: case Xacid_1: @@ -3613,7 +3979,6 @@ 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; play_element_sound(x, y, SOUND_tank, Xtank_1_w); @@ -3627,12 +3992,13 @@ 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]]) { - Lboom_tank(x, y, Xtank_2_w); + next[x][y] = Zboom; + Lboom_tank(x, y); return; } @@ -3645,9 +4011,8 @@ static void Lemerald(int x, int y) switch (cave[x][y+1]) { 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: @@ -3656,7 +4021,6 @@ static void Lemerald(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Yemerald_sB; next[x][y] = Xblank; cave[x][y+1] = Yemerald_s; @@ -3674,16 +4038,12 @@ static void Lemerald(int x, int y) cave[x][y] = Yemerald_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xspring: - case Xspring_pause: - case Xspring_e: - case Xspring_w: case Xandroid: case Xandroid_1_n: case Xandroid_2_n: @@ -3693,24 +4053,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: @@ -3719,12 +4075,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: @@ -3733,43 +4094,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; 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; 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; 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; 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; } } @@ -3790,9 +4163,8 @@ static void Lemerald_pause(int x, int y) switch (cave[x][y+1]) { 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: @@ -3801,7 +4173,6 @@ static void Lemerald_pause(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Yemerald_sB; next[x][y] = Xblank; cave[x][y+1] = Yemerald_s; @@ -3819,9 +4190,9 @@ static void Lemerald_pause(int x, int y) cave[x][y] = Yemerald_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -3836,10 +4207,10 @@ static void Lemerald_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: @@ -3848,8 +4219,14 @@ static void Lemerald_fall(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif - case Zplayer: + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: cave[x][y] = Yemerald_sB; next[x][y] = Xblank; cave[x][y+1] = Yemerald_s; @@ -3867,24 +4244,23 @@ static void Lemerald_fall(int x, int y) cave[x][y] = Yemerald_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; case Xwonderwall: - if (lev.wonderwall_time) + if (lev.wonderwall_time > 0) { - lev.wonderwall_state = 1; + lev.wonderwall_active = TRUE; cave[x][y] = Yemerald_sB; - if (tab_blank[cave[x][y+2]]) + next[x][y] = Xblank; + if (is_blank[cave[x][y+2]]) { 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; } @@ -3902,9 +4278,8 @@ static void Ldiamond(int x, int y) switch (cave[x][y+1]) { 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: @@ -3913,7 +4288,6 @@ static void Ldiamond(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Ydiamond_sB; next[x][y] = Xblank; cave[x][y+1] = Ydiamond_s; @@ -3931,16 +4305,12 @@ static void Ldiamond(int x, int y) cave[x][y] = Ydiamond_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xspring: - case Xspring_pause: - case Xspring_e: - case Xspring_w: case Xandroid: case Xandroid_1_n: case Xandroid_2_n: @@ -3950,24 +4320,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: @@ -3976,12 +4342,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: @@ -3990,43 +4361,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; 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; 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; 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; 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; } } @@ -4047,9 +4430,8 @@ static void Ldiamond_pause(int x, int y) switch (cave[x][y+1]) { 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: @@ -4058,7 +4440,6 @@ static void Ldiamond_pause(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Ydiamond_sB; next[x][y] = Xblank; cave[x][y+1] = Ydiamond_s; @@ -4076,9 +4457,9 @@ static void Ldiamond_pause(int x, int y) cave[x][y] = Ydiamond_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -4093,10 +4474,10 @@ static void Ldiamond_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: @@ -4105,8 +4486,14 @@ static void Ldiamond_fall(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif - case Zplayer: + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: cave[x][y] = Ydiamond_sB; next[x][y] = Xblank; cave[x][y+1] = Ydiamond_s; @@ -4124,24 +4511,23 @@ static void Ldiamond_fall(int x, int y) cave[x][y] = Ydiamond_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; case Xwonderwall: - if (lev.wonderwall_time) + if (lev.wonderwall_time > 0) { - lev.wonderwall_state = 1; + lev.wonderwall_active = TRUE; cave[x][y] = Ydiamond_sB; - if (tab_blank[cave[x][y+2]]) + next[x][y] = Xblank; + if (is_blank[cave[x][y+2]]) { 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; } @@ -4159,9 +4545,8 @@ static void Lstone(int x, int y) switch (cave[x][y+1]) { 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: @@ -4170,7 +4555,6 @@ static void Lstone(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif case Xplant: case Yplant: cave[x][y] = Ystone_sB; @@ -4190,9 +4574,9 @@ static void Lstone(int x, int y) cave[x][y] = Ystone_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -4203,10 +4587,6 @@ static void Lstone(int x, int y) 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: @@ -4216,23 +4596,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: @@ -4241,51 +4618,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; 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; 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; 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; 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; } } @@ -4297,9 +4690,8 @@ static void Lstone_pause(int x, int y) switch (cave[x][y+1]) { 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: @@ -4308,7 +4700,6 @@ 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; next[x][y] = Xblank; cave[x][y+1] = Ystone_s; @@ -4326,9 +4717,9 @@ static void Lstone_pause(int x, int y) cave[x][y] = Ystone_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -4343,10 +4734,10 @@ 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: @@ -4355,8 +4746,14 @@ static void Lstone_fall(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif - case Zplayer: + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: cave[x][y] = Ystone_sB; next[x][y] = Xblank; cave[x][y+1] = Ystone_s; @@ -4374,19 +4771,32 @@ static void Lstone_fall(int x, int y) cave[x][y] = Ystone_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - 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; + 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 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: @@ -4398,8 +4808,10 @@ static void Lstone_fall(int x, int y) case Xbug_2_s: case Xbug_2_w: cave[x][y] = Ystone_sB; + Lboom_next_new(x, y, Xblank); cave[x][y+1] = Ybug_stone; - Lboom_bug(x, y+1, Xstone_fall); + next[x][y+1] = Zbug; + Lboom_bug_old(x, y+1); score += lev.bug_score; return; @@ -4412,95 +4824,21 @@ static void Lstone_fall(int x, int y) case Xtank_2_s: case Xtank_2_w: cave[x][y] = Ystone_sB; + Lboom_next_new(x, y, Xblank); cave[x][y+1] = Ytank_stone; - Lboom_tank(x, y+1, Xstone_fall); + 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: -#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 - 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: -#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 - 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; - Lboom_eater(x, y+1, Xstone_fall); - score += lev.eater_score; - return; - - case Xalien: - case Xalien_pause: - cave[x][y] = Ystone_sB; - cave[x][y+1] = Yalien_stone; - Lboom_tank(x, y+1, Xstone_fall); - score += lev.alien_score; - return; - case Xdiamond: case Xdiamond_pause: switch (cave[x][y+2]) { + 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: @@ -4509,8 +4847,33 @@ static void Lstone_fall(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif - case Zplayer: + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: + 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: @@ -4527,32 +4890,13 @@ 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: + case Xspring_fall: + case Xacid_s: next[x][y] = Xstone; play_element_sound(x, y, SOUND_stone, Xstone); return; @@ -4567,23 +4911,87 @@ static void Lstone_fall(int x, int y) case Xbomb: case Xbomb_pause: + Lboom_cave_new(x, y, Xstone); + Lboom_next_new(x, y, Xstone); cave[x][y+1] = Ybomb_blank; - Lboom_tank(x, y+1, Xstone_fall); + next[x][y+1] = Ztank; + Lboom_tank_old(x, y+1); + return; + + 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)) + { + 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; + + default: + cave[x][y+1] = Xspring_w; + break; + } + } + else + { + 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_w; + break; + default: + cave[x][y+1] = Xspring_e; + break; + } + } + + next[x][y] = Xstone; return; case Xwonderwall: - if (lev.wonderwall_time) + if (lev.wonderwall_time > 0) { - lev.wonderwall_state = 1; + lev.wonderwall_active = TRUE; cave[x][y] = Ystone_sB; - - if (tab_blank[cave[x][y+2]]) + next[x][y] = Xblank; + if (is_blank[cave[x][y+2]]) { cave[x][y+2] = Yemerald_s; next[x][y+2] = Xemerald_fall; } - - next[x][y] = Xblank; play_element_sound(x, y, SOUND_wonderfall, Xwonderwall); return; } @@ -4601,9 +5009,8 @@ static void Lbomb(int x, int y) switch (cave[x][y+1]) { 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: @@ -4612,7 +5019,6 @@ static void Lbomb(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Ybomb_sB; next[x][y] = Xblank; cave[x][y+1] = Ybomb_s; @@ -4630,16 +5036,12 @@ static void Lbomb(int x, int y) cave[x][y] = Ybomb_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xspring: - case Xspring_pause: - case Xspring_e: - case Xspring_w: case Xandroid: case Xandroid_1_n: case Xandroid_2_n: @@ -4649,23 +5051,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: @@ -4674,49 +5073,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; 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; 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; 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; 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; } } @@ -4728,9 +5143,8 @@ static void Lbomb_pause(int x, int y) switch (cave[x][y+1]) { 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: @@ -4739,7 +5153,6 @@ static void Lbomb_pause(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Ybomb_sB; next[x][y] = Xblank; cave[x][y+1] = Ybomb_s; @@ -4757,9 +5170,9 @@ static void Lbomb_pause(int x, int y) cave[x][y] = Ybomb_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -4775,9 +5188,8 @@ static void Lbomb_fall(int x, int y) switch (cave[x][y+1]) { 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: @@ -4786,7 +5198,6 @@ static void Lbomb_fall(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Ybomb_sB; next[x][y] = Xblank; cave[x][y+1] = Ybomb_s; @@ -4804,15 +5215,16 @@ static void Lbomb_fall(int x, int y) cave[x][y] = Ybomb_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; default: cave[x][y] = Ybomb_blank; - Lboom_tank(x, y, Xbomb_fall); + next[x][y] = Ztank; + Lboom_tank_old(x, y); return; } } @@ -4822,9 +5234,8 @@ static void Lnut(int x, int y) switch (cave[x][y+1]) { 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: @@ -4833,7 +5244,6 @@ static void Lnut(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Ynut_sB; next[x][y] = Xblank; cave[x][y+1] = Ynut_s; @@ -4851,16 +5261,12 @@ static void Lnut(int x, int y) cave[x][y] = Ynut_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xspring: - case Xspring_pause: - case Xspring_e: - case Xspring_w: case Xandroid: case Xandroid_1_n: case Xandroid_2_n: @@ -4870,23 +5276,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: @@ -4895,49 +5298,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; 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; 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; 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; 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; } } @@ -4949,9 +5368,8 @@ static void Lnut_pause(int x, int y) switch (cave[x][y+1]) { 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: @@ -4960,7 +5378,6 @@ static void Lnut_pause(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Ynut_sB; next[x][y] = Xblank; cave[x][y+1] = Ynut_s; @@ -4978,9 +5395,9 @@ static void Lnut_pause(int x, int y) cave[x][y] = Ynut_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -4995,10 +5412,10 @@ static void Lnut_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: @@ -5007,8 +5424,14 @@ static void Lnut_fall(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif - case Zplayer: + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: cave[x][y] = Ynut_sB; next[x][y] = Xblank; cave[x][y+1] = Ynut_s; @@ -5026,9 +5449,9 @@ static void Lnut_fall(int x, int y) cave[x][y] = Ynut_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -5045,9 +5468,8 @@ static void Lspring(int x, int y) switch (cave[x][y+1]) { 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: @@ -5056,7 +5478,6 @@ static void Lspring(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif case Xplant: case Yplant: cave[x][y] = Yspring_sB; @@ -5076,16 +5497,12 @@ static void Lspring(int x, int y) cave[x][y] = Yspring_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xspring: - case Xspring_pause: - case Xspring_e: - case Xspring_w: case Xandroid: case Xandroid_1_n: case Xandroid_2_n: @@ -5095,23 +5512,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: @@ -5120,77 +5534,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; next[x][y] = Xblank; cave[x+1][y] = Yspring_e; - if (cave[x][y+1] == Xbumper) - cave[x][y+1] = XbumperB; - #ifdef SPRING_ROLL next[x+1][y] = Xspring_e; #else 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; next[x][y] = Xblank; cave[x-1][y] = Yspring_w; - if (cave[x][y+1] == Xbumper) - cave[x][y+1] = XbumperB; - #ifdef SPRING_ROLL next[x-1][y] = Xspring_w; #else 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; next[x][y] = Xblank; cave[x-1][y] = Yspring_w; - if (cave[x][y+1] == Xbumper) - cave[x][y+1] = XbumperB; - #ifdef SPRING_ROLL next[x-1][y] = Xspring_w; #else 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; next[x][y] = Xblank; cave[x+1][y] = Yspring_e; - if (cave[x][y+1] == Xbumper) - cave[x][y+1] = XbumperB; - #ifdef SPRING_ROLL next[x+1][y] = Xspring_e; #else next[x+1][y] = Xspring_pause; #endif + if (cave[x][y+1] == Xbumper) + cave[x][y+1] = Ybumper; return; } } @@ -5202,9 +5620,8 @@ static void Lspring_pause(int x, int y) switch (cave[x][y+1]) { 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: @@ -5213,7 +5630,6 @@ static void Lspring_pause(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Yspring_sB; next[x][y] = Xblank; cave[x][y+1] = Yspring_s; @@ -5231,9 +5647,9 @@ static void Lspring_pause(int x, int y) cave[x][y] = Yspring_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -5249,9 +5665,8 @@ static void Lspring_e(int x, int y) switch (cave[x][y+1]) { 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: @@ -5260,7 +5675,6 @@ static void Lspring_e(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Yspring_sB; next[x][y] = Xblank; cave[x][y+1] = Yspring_s; @@ -5278,22 +5692,21 @@ static void Lspring_e(int x, int y) cave[x][y] = Yspring_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; case Xbumper: - cave[x][y+1] = XbumperB; + cave[x][y+1] = Ybumper; } switch (cave[x+1][y]) { 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: @@ -5302,7 +5715,6 @@ static void Lspring_e(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif case Yalien_nB: case Yalien_eB: case Yalien_sB: @@ -5324,9 +5736,9 @@ static void Lspring_e(int x, int y) cave[x][y] = Yspring_eB; next[x][y] = Xblank; if (cave[x+2][y-1] == Xblank) - cave[x+2][y-1] = Xacid_splash_e; + cave[x+2][y-1] = Xsplash_e; if (cave[x][y-1] == Xblank) - cave[x][y-1] = Xacid_splash_w; + cave[x][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -5345,8 +5757,8 @@ static void Lspring_e(int x, int y) return; case Xbumper: - case XbumperB: - cave[x+1][y] = XbumperB; + case Ybumper: + cave[x+1][y] = Ybumper; next[x][y] = Xspring_w; play_element_sound(x, y, SOUND_spring, Xspring); return; @@ -5364,9 +5776,8 @@ static void Lspring_w(int x, int y) switch (cave[x][y+1]) { 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: @@ -5375,7 +5786,6 @@ static void Lspring_w(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Yspring_sB; next[x][y] = Xblank; cave[x][y+1] = Yspring_s; @@ -5393,22 +5803,21 @@ static void Lspring_w(int x, int y) cave[x][y] = Yspring_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; case Xbumper: - cave[x][y+1] = XbumperB; + cave[x][y+1] = Ybumper; } switch (cave[x-1][y]) { 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: @@ -5417,7 +5826,6 @@ static void Lspring_w(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif case Yalien_nB: case Yalien_eB: case Yalien_sB: @@ -5439,9 +5847,9 @@ static void Lspring_w(int x, int y) cave[x][y] = Yspring_wB; next[x][y] = Xblank; if (cave[x][y-1] == Xblank) - cave[x][y-1] = Xacid_splash_e; + cave[x][y-1] = Xsplash_e; if (cave[x-2][y-1] == Xblank) - cave[x-2][y-1] = Xacid_splash_w; + cave[x-2][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -5460,8 +5868,8 @@ static void Lspring_w(int x, int y) return; case Xbumper: - case XbumperB: - cave[x-1][y] = XbumperB; + case Ybumper: + cave[x-1][y] = Ybumper; next[x][y] = Xspring_e; play_element_sound(x, y, SOUND_spring, Xspring); return; @@ -5478,10 +5886,10 @@ static void Lspring_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: @@ -5490,8 +5898,14 @@ static void Lspring_fall(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif - case Zplayer: + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: cave[x][y] = Yspring_sB; next[x][y] = Xblank; cave[x][y+1] = Yspring_s; @@ -5509,16 +5923,32 @@ static void Lspring_fall(int x, int y) cave[x][y] = Yspring_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; - case Xbomb: - case Xbomb_pause: - cave[x][y+1] = Ybomb_blank; - Lboom_tank(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 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: @@ -5530,8 +5960,10 @@ static void Lspring_fall(int x, int y) case Xbug_2_s: case Xbug_2_w: cave[x][y] = Yspring_sB; + next[x][y] = Xblank; cave[x][y+1] = Ybug_spring; - Lboom_bug(x, y+1, Xspring_fall); + next[x][y+1] = Zbug; + Lboom_bug_old(x, y+1); score += lev.bug_score; return; @@ -5544,27 +5976,20 @@ static void Lspring_fall(int x, int y) case Xtank_2_s: case Xtank_2_w: cave[x][y] = Yspring_sB; + next[x][y] = Xblank; cave[x][y+1] = Ytank_spring; - Lboom_tank(x, y+1, Xspring_fall); + 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; - Lboom_eater(x, y+1, Xspring_fall); - score += lev.eater_score; - return; - - case Xalien: - case Xalien_pause: - cave[x][y] = Yspring_sB; - cave[x][y+1] = Yalien_spring; - Lboom_tank(x, y+1, Xspring_fall); - 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: @@ -5577,302 +6002,578 @@ static void Lspring_fall(int x, int y) static void Lpush_emerald_e(int x, int y) { + cave[x][y] = Yemerald_eB; + next[x][y] = Xblank; + switch (cave[x+1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; 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; + Lpush_element_old(x, y, Xemerald); return; - default: - cave[x][y] = Yemerald_eB; - next[x][y] = Xblank; - cave[x+1][y] = Yemerald_e; - 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 (game_em.use_old_push_into_acid) + break; + 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) { + cave[x][y] = Yemerald_wB; + next[x][y] = Xblank; + switch (cave[x-1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; 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; + Lpush_element_old(x, y, Xemerald); return; - default: - cave[x][y] = Yemerald_wB; - next[x][y] = Xblank; - cave[x-1][y] = Yemerald_w; - 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 (game_em.use_old_push_into_acid) + break; + 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) { + cave[x][y] = Ydiamond_eB; + next[x][y] = Xblank; + switch (cave[x+1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; 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; + Lpush_element_old(x, y, Xdiamond); return; - default: - cave[x][y] = Ydiamond_eB; - next[x][y] = Xblank; - cave[x+1][y] = Ydiamond_e; - 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 (game_em.use_old_push_into_acid) + break; + 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) { + cave[x][y] = Ydiamond_wB; + next[x][y] = Xblank; + switch (cave[x-1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; 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; + Lpush_element_old(x, y, Xdiamond); return; - default: - cave[x][y] = Ydiamond_wB; - next[x][y] = Xblank; - cave[x-1][y] = Ydiamond_w; - 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 (game_em.use_old_push_into_acid) + break; + 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) { + cave[x][y] = Ystone_eB; + next[x][y] = Xblank; + switch (cave[x+1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; 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; + Lpush_element_old(x, y, Xstone); return; - default: - cave[x][y] = Ystone_eB; - next[x][y] = Xblank; - cave[x+1][y] = Ystone_e; - 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 (game_em.use_old_push_into_acid) + break; + 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) { + cave[x][y] = Ystone_wB; + next[x][y] = Xblank; + switch (cave[x-1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; 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; + Lpush_element_old(x, y, Xstone); return; - default: - cave[x][y] = Ystone_wB; - next[x][y] = Xblank; - cave[x-1][y] = Ystone_w; - 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 (game_em.use_old_push_into_acid) + break; + 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) { + cave[x][y] = Ybomb_eB; + next[x][y] = Xblank; + switch (cave[x+1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; 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; + Lpush_element_old(x, y, Xbomb); return; - default: - cave[x][y] = Ybomb_eB; - next[x][y] = Xblank; - cave[x+1][y] = Ybomb_e; - 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 (game_em.use_old_push_into_acid) + break; + 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) { + cave[x][y] = Ybomb_wB; + next[x][y] = Xblank; + switch (cave[x-1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; 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; + Lpush_element_old(x, y, Xbomb); return; - default: - cave[x][y] = Ybomb_wB; - next[x][y] = Xblank; - cave[x-1][y] = Ybomb_w; - 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 (game_em.use_old_push_into_acid) + break; + 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) { + cave[x][y] = Ynut_eB; + next[x][y] = Xblank; + switch (cave[x+1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; 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; + Lpush_element_old(x, y, Xnut); return; - default: - cave[x][y] = Ynut_eB; - next[x][y] = Xblank; - cave[x+1][y] = Ynut_e; - 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 (game_em.use_old_push_into_acid) + break; + 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) { + cave[x][y] = Ynut_wB; + next[x][y] = Xblank; + switch (cave[x-1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; 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; + Lpush_element_old(x, y, Xnut); return; - default: - cave[x][y] = Ynut_wB; - next[x][y] = Xblank; - cave[x-1][y] = Ynut_w; - 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 (game_em.use_old_push_into_acid) + break; + 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) { + cave[x][y] = Yspring_eB; + next[x][y] = Xblank; + switch (cave[x+1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; 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; + Lpush_element_old(x, y, Xspring); return; - default: - cave[x][y] = Yspring_eB; - next[x][y] = Xblank; - cave[x+1][y] = Yspring_e; - 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 (game_em.use_old_push_into_acid) + break; + 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) { + cave[x][y] = Yspring_wB; + next[x][y] = Xblank; + switch (cave[x-1][y]) { + case Zplayer: + if (!game_em.use_old_push_elements) + break; 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; + Lpush_element_old(x, y, Xspring); return; - default: - cave[x][y] = Yspring_wB; - next[x][y] = Xblank; - cave[x-1][y] = Yspring_w; - 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 (game_em.use_old_push_into_acid) + break; + 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) @@ -5960,9 +6661,8 @@ static void Lballoon(int x, int y) switch (cave[x][y-1]) { 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: @@ -5971,7 +6671,6 @@ static void Lballoon(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Yballoon_nB; next[x][y] = Xblank; cave[x][y-1] = Yballoon_n; @@ -5989,9 +6688,9 @@ static void Lballoon(int x, int y) cave[x][y] = Yballoon_nB; next[x][y] = Xblank; if (cave[x+1][y-2] == Xblank) - cave[x+1][y-2] = Xacid_splash_e; + cave[x+1][y-2] = Xsplash_e; if (cave[x-1][y-2] == Xblank) - cave[x-1][y-2] = Xacid_splash_w; + cave[x-1][y-2] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; } @@ -6001,9 +6700,8 @@ static void Lballoon(int x, int y) switch (cave[x+1][y]) { 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: @@ -6012,7 +6710,6 @@ static void Lballoon(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Yballoon_eB; next[x][y] = Xblank; cave[x+1][y] = Yballoon_e; @@ -6030,9 +6727,9 @@ static void Lballoon(int x, int y) cave[x][y] = Yballoon_eB; next[x][y] = Xblank; if (cave[x+2][y-1] == Xblank) - cave[x+2][y-1] = Xacid_splash_e; + cave[x+2][y-1] = Xsplash_e; if (cave[x][y-1] == Xblank) - cave[x][y-1] = Xacid_splash_w; + cave[x][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; } @@ -6042,9 +6739,8 @@ static void Lballoon(int x, int y) switch (cave[x][y+1]) { 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: @@ -6053,7 +6749,6 @@ static void Lballoon(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Yballoon_sB; next[x][y] = Xblank; cave[x][y+1] = Yballoon_s; @@ -6071,9 +6766,9 @@ static void Lballoon(int x, int y) cave[x][y] = Yballoon_sB; next[x][y] = Xblank; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; } @@ -6083,9 +6778,8 @@ static void Lballoon(int x, int y) switch (cave[x-1][y]) { 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: @@ -6094,7 +6788,6 @@ static void Lballoon(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Yballoon_wB; next[x][y] = Xblank; cave[x-1][y] = Yballoon_w; @@ -6112,9 +6805,9 @@ static void Lballoon(int x, int y) cave[x][y] = Yballoon_wB; next[x][y] = Xblank; if (cave[x][y-1] == Xblank) - cave[x][y-1] = Xacid_splash_e; + cave[x][y-1] = Xsplash_e; if (cave[x-2][y-1] == Xblank) - cave[x-2][y-1] = Xacid_splash_w; + cave[x-2][y-1] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; } @@ -6132,7 +6825,7 @@ 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]; @@ -6141,7 +6834,7 @@ static void Lball_common(int x, int y) 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]; @@ -6150,7 +6843,7 @@ static void Lball_common(int x, int y) 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]; @@ -6159,7 +6852,7 @@ static void Lball_common(int x, int y) 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]; @@ -6168,7 +6861,7 @@ static void Lball_common(int x, int y) 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]; @@ -6177,7 +6870,7 @@ static void Lball_common(int x, int y) 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]; @@ -6186,7 +6879,7 @@ static void Lball_common(int x, int y) 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]; @@ -6195,7 +6888,7 @@ static void Lball_common(int x, int y) 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]; @@ -6206,56 +6899,56 @@ 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]; } 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]; } 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]; } 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]; } 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]; } 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]; } 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]; } 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]; @@ -6267,7 +6960,7 @@ 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; @@ -6280,7 +6973,7 @@ 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; @@ -6302,10 +6995,10 @@ static void Ldrip_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: @@ -6314,10 +7007,16 @@ static void Ldrip_fall(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + case Xfake_acid_1_player: + case Xfake_acid_2_player: + case Xfake_acid_3_player: + case Xfake_acid_4_player: + case Xfake_acid_5_player: + case Xfake_acid_6_player: + case Xfake_acid_7_player: + case Xfake_acid_8_player: case Xplant: case Yplant: - case Zplayer: cave[x][y] = Ydrip_1_sB; next[x][y] = Xdrip_stretchB; cave[x][y+1] = Ydrip_1_s; @@ -6335,9 +7034,9 @@ static void Ldrip_fall(int x, int y) cave[x][y] = Ydrip_1_sB; next[x][y] = Xdrip_stretchB; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -6375,9 +7074,9 @@ static void Ldrip_stretchB(int x, int y) 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); } } @@ -6385,31 +7084,31 @@ 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) @@ -6417,9 +7116,8 @@ static void Lsand_stone(int x, int y) switch (cave[x][y+1]) { 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: @@ -6428,7 +7126,6 @@ static void Lsand_stone(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif cave[x][y] = Xsand_stonesand_quickout_1; next[x][y] = Xsand_stonesand_quickout_2; cave[x][y+1] = Xsand_stoneout_1; @@ -6446,9 +7143,9 @@ static void Lsand_stone(int x, int y) cave[x][y] = Xsand_stonesand_quickout_1; next[x][y] = Xsand_stonesand_quickout_2; if (cave[x+1][y] == Xblank) - cave[x+1][y] = Xacid_splash_e; + cave[x+1][y] = Xsplash_e; if (cave[x-1][y] == Xblank) - cave[x-1][y] = Xacid_splash_w; + cave[x-1][y] = Xsplash_w; play_element_sound(x, y, SOUND_acid, Xacid_1); return; @@ -6531,7 +7228,6 @@ static void Lsand_stoneout_2(int x, int y) 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; @@ -6541,45 +7237,44 @@ static void Lsand_stonesand_quickout_2(int x, int y) { 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) @@ -6628,9 +7323,8 @@ static void Lamoeba(int x, int y) switch (cave[x][y]) { 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: @@ -6639,46 +7333,147 @@ static void Lamoeba(int x, int y) case Xfake_acid_6: case Xfake_acid_7: case Xfake_acid_8: -#endif + 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]]; + 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; } } @@ -6708,6 +7503,11 @@ 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]) @@ -6721,7 +7521,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; @@ -6730,7 +7529,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; @@ -6856,13 +7654,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; @@ -6871,54 +7667,87 @@ static void handle_tile(int x, int y) case Xpause: Lpause(x, y); break; - case Xboom_bug: Lboom_bug(x, y, Xboom_bug); break; - case Xboom_bomb: Lboom_tank(x, y, Xboom_bomb); break; + case Xchain: Lchain(x, y); break; + case Xboom_bug: Lboom_bug(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) +boolean logic_check_wrap(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; - - /* must test for death and actually kill separately */ for (i = 0; i < MAX_PLAYERS; i++) { - boolean ply_kill = player_killed(&ply[i]); + if (!ply[i].alive) + continue; - if (ply[i].alive && ply_kill) - kill_player(&ply[i]); + /* check for wrap-around movement */ + if (ply[i].x < lev.left || + ply[i].x > lev.right - 1) + return TRUE; } + return FALSE; +} + +void logic_move(void) +{ + int i; + for (i = 0; i < MAX_PLAYERS; i++) { + 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); + if (!lev.infinite_true) + ply[i].y += (ply[i].x == lev.left ? 1 : -1); + game.centered_player_nr_next = i; game.set_centered_player = TRUE; - game.set_centered_player_fast = TRUE; + game.set_centered_player_wrap = TRUE; } - ply[i].oldx = ply[i].x; - ply[i].oldy = ply[i].y; + ply[i].prev_x = ply[i].x; + ply[i].prev_y = ply[i].y; ply[i].anim = PLY_still; } +} + +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; + + /* must test for death and actually kill separately */ + for (i = 0; i < MAX_PLAYERS; i++) + { + boolean ply_kill = player_killed(&ply[i]); + + if (ply[i].alive && ply_kill) + kill_player(&ply[i]); + } + + logic_move(); - 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++) { @@ -6933,21 +7762,25 @@ void logic_1(void) if (!ply[i].alive) continue; - if (cave[ply[i].oldx][ply[i].oldy] == Zplayer) + if (is_player[cave[ply[i].prev_x][ply[i].prev_y]]) { - cave[ply[i].oldx][ply[i].oldy] = Xblank; - next[ply[i].oldx][ply[i].oldy] = Xblank; + int element = cave[ply[i].prev_x][ply[i].prev_y]; + + cave[ply[i].prev_x][ply[i].prev_y] = remove_player[element]; + next[ply[i].prev_x][ply[i].prev_y] = remove_player[element]; } - if (cave[ply[i].x][ply[i].y] == Xblank) + if (is_blank[cave[ply[i].x][ply[i].y]]) { - cave[ply[i].x][ply[i].y] = Zplayer; - next[ply[i].x][ply[i].y] = Zplayer; + int element = cave[ply[i].x][ply[i].y]; + + cave[ply[i].x][ply[i].y] = add_player[element]; + next[ply[i].x][ply[i].y] = add_player[element]; } } } -void logic_2(void) +static void logic_objects(void) { int x, y; @@ -6955,7 +7788,7 @@ void logic_2(void) next = lev.next; boom = lev.boom; - seed = RandomEM; + seed = game_em.random; score = 0; for (y = lev.top; y < lev.bottom; y++) @@ -6967,7 +7800,7 @@ void logic_2(void) else game_em.game_over = TRUE; - RandomEM = seed; + game_em.random = seed; /* triple buffering */ void *temp = lev.cave; @@ -6976,12 +7809,16 @@ void logic_2(void) lev.draw = temp; } -void logic_3(void) +static void logic_globals(void) { int x; int y; int count; - unsigned int random; +#ifdef RANDOM_BUG + uint64_t random; +#else + uint32_t random; +#endif cave = lev.cave; next = lev.next; @@ -6996,7 +7833,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) @@ -7007,7 +7844,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) @@ -7015,7 +7852,7 @@ void logic_3(void) /* grow amoeba */ - random = RandomEM; + random = game_em.random; for (count = lev.amoeba_time; count--;) { @@ -7027,9 +7864,14 @@ void logic_3(void) Lamoeba(x, y); random = random * 129 + 1; + +#ifdef RANDOM_BUG + if (!game_em.use_random_bug) + random = (uint32_t)random; +#endif } - RandomEM = random; + game_em.random = random; /* handle explosions */ @@ -7043,3 +7885,25 @@ void logic_3(void) 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(); + } +}