static unsigned int seed;
static int score;
+static const byte is_blank[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[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[TILE_MAX] =
+{
+ [Xfake_acid_1] = 1,
+ [Xfake_acid_2] = 1,
+ [Xfake_acid_3] = 1,
+ [Xfake_acid_4] = 1,
+ [Xfake_acid_5] = 1,
+ [Xfake_acid_6] = 1,
+ [Xfake_acid_7] = 1,
+ [Xfake_acid_8] = 1
+};
+
+static const byte is_amoeba[TILE_MAX] =
+{
+ [Xfake_amoeba] = 1,
+ [Xfake_amoebaB] = 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 const byte is_android_walkable[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;
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]])
+ if (!is_fake_acid[cave[x+dx][y+dy]])
{
cave[x+dx][y+dy] = Zplayer;
next[x+dx][y+dy] = Zplayer;
/* 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;
}
}
/* 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;
}
}
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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] = Yemerald_eB;
next[x][y] = Xblank;
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;
}
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;
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;
{
lev.wonderwall_state = 1;
cave[x][y] = Yemerald_sB;
- if (tab_blank[cave[x][y+2]])
+ if (is_blank[cave[x][y+2]])
{
cave[x][y+2] = Ydiamond_s;
next[x][y+2] = Xdiamond_fall;
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] = Ydiamond_eB;
next[x][y] = Xblank;
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;
}
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;
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;
{
lev.wonderwall_state = 1;
cave[x][y] = Ydiamond_sB;
- if (tab_blank[cave[x][y+2]])
+ if (is_blank[cave[x][y+2]])
{
cave[x][y+2] = Ystone_s;
next[x][y+2] = Xstone_fall;
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;
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;
}
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;
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;
lev.wonderwall_state = 1;
cave[x][y] = Ystone_sB;
- if (tab_blank[cave[x][y+2]])
+ if (is_blank[cave[x][y+2]])
{
cave[x][y+2] = Yemerald_s;
next[x][y+2] = Xemerald_fall;
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;
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;
}
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;
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;
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;
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;
}
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;
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;
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;
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;
}
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;
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;
{
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];
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];
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];
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];
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];
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];
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];
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];
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];
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] = 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] = Yslide_ns_blank;
next[x][y+1] = Xslide_ns;
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] = 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] = Yslide_ew_blank;
next[x-1][y] = Xslide_ew;
case Xsand:
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]])
+ 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 Znormal:
+ case Zdynamite:
+ case Xboom_bug:
+ case Xboom_bomb:
+ 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 Xacid_ne:
+ case Xacid_nw:
+ case Xacid_s:
+ case Xacid_se:
+ case Xacid_sw:
+ case Xplant:
+ case Yplant:
+ 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 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;
+ return;
+
+ case Xbomb:
+ case Xbomb_pause:
+ case Xbomb_fall:
+ cave[x][y] = Xboom_bomb;
+ 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]];
+ 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;
}
}