static unsigned int seed;
static int score;
-static void Lboom_bug(int x, int y)
+static void Lboom_generic(int x, int y, int element, int element_middle)
+{
+ Boom[x-1][y-1] = element;
+ Boom[x][y-1] = element;
+ Boom[x+1][y-1] = element;
+ Boom[x-1][y] = element;
+ Boom[x][y] = element_middle;
+ Boom[x+1][y] = element;
+ Boom[x-1][y+1] = element;
+ Boom[x][y+1] = element;
+ Boom[x+1][y+1] = element;
+}
+
+static void Lboom_bug(int x, int y, int by_element)
+{
+ Next[x][y] = Znormal;
+
+ Lboom_generic(x, y, Xemerald, Xdiamond);
+
+#if PLAY_ELEMENT_SOUND
+ play_element_sound(x, y, SOUND_boom, by_element);
+#endif
+}
+
+static void Lboom_tank(int x, int y, int by_element)
{
Next[x][y] = Znormal;
- Boom[x-1][y-1] = Xemerald;
- Boom[x][y-1] = Xemerald;
- Boom[x+1][y-1] = Xemerald;
- Boom[x-1][y] = Xemerald;
- Boom[x][y] = Xdiamond;
- Boom[x+1][y] = Xemerald;
- Boom[x-1][y+1] = Xemerald;
- Boom[x][y+1] = Xemerald;
- Boom[x+1][y+1] = Xemerald;
+
+ Lboom_generic(x, y, Xblank, Xblank);
#if PLAY_ELEMENT_SOUND
- play_element_sound(x, y, SOUND_boom, element);
+ play_element_sound(x, y, SOUND_boom, by_element);
#endif
}
-static void Lboom_tank(int x, int y)
+static void Lboom_eater(int x, int y, int by_element)
{
Next[x][y] = Znormal;
- Boom[x-1][y-1] = Xblank;
- Boom[x][y-1] = Xblank;
- Boom[x+1][y-1] = Xblank;
- Boom[x-1][y] = Xblank;
- Boom[x][y] = Xblank;
- Boom[x+1][y] = Xblank;
- Boom[x-1][y+1] = Xblank;
- Boom[x][y+1] = Xblank;
- Boom[x+1][y+1] = Xblank;
+
+ Boom[x-1][y-1] = lev.eater_array[lev.eater_pos][0];
+ Boom[x][y-1] = lev.eater_array[lev.eater_pos][1];
+ Boom[x+1][y-1] = lev.eater_array[lev.eater_pos][2];
+ Boom[x-1][y] = lev.eater_array[lev.eater_pos][3];
+ Boom[x][y] = lev.eater_array[lev.eater_pos][4];
+ Boom[x+1][y] = lev.eater_array[lev.eater_pos][5];
+ Boom[x-1][y+1] = lev.eater_array[lev.eater_pos][6];
+ Boom[x][y+1] = lev.eater_array[lev.eater_pos][7];
+ Boom[x+1][y+1] = lev.eater_array[lev.eater_pos][8];
+
+ lev.eater_pos = (lev.eater_pos + 1) & 7;
+
#if PLAY_ELEMENT_SOUND
- play_element_sound(x, y, SOUND_boom, element);
+ play_element_sound(x, y, SOUND_boom, by_element);
#endif
}
tab_amoeba[Cave[x][y+1]] ||
tab_amoeba[Cave[x-1][y]])
{
- Lboom_bug(x, y);
+ Lboom_bug(x, y, Xbug_1_n);
return;
}
tab_amoeba[Cave[x][y+1]] ||
tab_amoeba[Cave[x-1][y]])
{
- Lboom_bug(x, y);
+ Lboom_bug(x, y, Xbug_2_n);
return;
}
tab_amoeba[Cave[x][y+1]] ||
tab_amoeba[Cave[x-1][y]])
{
- Lboom_bug(x, y);
+ Lboom_bug(x, y, Xbug_1_e);
return;
}
tab_amoeba[Cave[x][y+1]] ||
tab_amoeba[Cave[x-1][y]])
{
- Lboom_bug(x, y);
+ Lboom_bug(x, y, Xbug_2_e);
return;
}
tab_amoeba[Cave[x][y+1]] ||
tab_amoeba[Cave[x-1][y]])
{
- Lboom_bug(x, y);
+ Lboom_bug(x, y, Xbug_1_s);
return;
}
tab_amoeba[Cave[x][y+1]] ||
tab_amoeba[Cave[x-1][y]])
{
- Lboom_bug(x, y);
+ Lboom_bug(x, y, Xbug_2_s);
return;
}
tab_amoeba[Cave[x][y+1]] ||
tab_amoeba[Cave[x-1][y]])
{
- Lboom_bug(x, y);
+ Lboom_bug(x, y, Xbug_1_w);
return;
}
tab_amoeba[Cave[x][y+1]] ||
tab_amoeba[Cave[x-1][y]])
{
- Lboom_bug(x, y);
+ Lboom_bug(x, y, Xbug_2_w);
return;
}
tab_amoeba[Cave[x][y+1]] ||
tab_amoeba[Cave[x-1][y]])
{
- Lboom_tank(x, y);
+ Lboom_tank(x, y, Xtank_1_n);
return;
}
tab_amoeba[Cave[x][y+1]] ||
tab_amoeba[Cave[x-1][y]])
{
- Lboom_tank(x, y);
+ Lboom_tank(x, y, Xtank_2_n);
return;
}
tab_amoeba[Cave[x][y+1]] ||
tab_amoeba[Cave[x-1][y]])
{
- Lboom_tank(x, y);
+ Lboom_tank(x, y, Xtank_1_e);
return;
}
tab_amoeba[Cave[x][y+1]] ||
tab_amoeba[Cave[x-1][y]])
{
- Lboom_tank(x, y);
+ Lboom_tank(x, y, Xtank_2_e);
return;
}
tab_amoeba[Cave[x][y+1]] ||
tab_amoeba[Cave[x-1][y]])
{
- Lboom_tank(x, y);
+ Lboom_tank(x, y, Xtank_1_s);
return;
}
tab_amoeba[Cave[x][y+1]] ||
tab_amoeba[Cave[x-1][y]])
{
- Lboom_tank(x, y);
+ Lboom_tank(x, y, Xtank_2_s);
return;
}
tab_amoeba[Cave[x][y+1]] ||
tab_amoeba[Cave[x-1][y]])
{
- Lboom_tank(x, y);
+ Lboom_tank(x, y, Xtank_1_w);
return;
}
tab_amoeba[Cave[x][y+1]] ||
tab_amoeba[Cave[x-1][y]])
{
- Lboom_tank(x, y);
+ Lboom_tank(x, y, Xtank_2_w);
return;
}
case Xbug_2_w:
Cave[x][y] = Ystone_sB;
Cave[x][y+1] = Ybug_stone;
- Next[x][y+1] = Znormal;
- Boom[x-1][y] = Xemerald;
- Boom[x][y] = Xemerald;
- Boom[x+1][y] = Xemerald;
- Boom[x-1][y+1] = Xemerald;
- Boom[x][y+1] = Xdiamond;
- Boom[x+1][y+1] = Xemerald;
- Boom[x-1][y+2] = Xemerald;
- Boom[x][y+2] = Xemerald;
- Boom[x+1][y+2] = Xemerald;
-#if PLAY_ELEMENT_SOUND
- play_element_sound(x, y, SOUND_boom, Xstone_fall);
-#endif
+ Lboom_bug(x, y+1, Xstone_fall);
score += lev.bug_score;
return;
case Xtank_2_w:
Cave[x][y] = Ystone_sB;
Cave[x][y+1] = Ytank_stone;
- Next[x][y+1] = Znormal;
- Boom[x-1][y] = Xblank;
- Boom[x][y] = Xblank;
- Boom[x+1][y] = Xblank;
- Boom[x-1][y+1] = Xblank;
- Boom[x][y+1] = Xblank;
- Boom[x+1][y+1] = Xblank;
- Boom[x-1][y+2] = Xblank;
- Boom[x][y+2] = Xblank;
- Boom[x+1][y+2] = Xblank;
-#if PLAY_ELEMENT_SOUND
- play_element_sound(x, y, SOUND_boom, Xstone_fall);
-#endif
+ Lboom_tank(x, y+1, Xstone_fall);
score += lev.tank_score;
return;
case Xeater_w:
Cave[x][y] = Ystone_sB;
Cave[x][y+1] = Yeater_stone;
- Next[x][y+1] = Znormal;
- Boom[x-1][y] = lev.eater_array[lev.eater_pos][0];
- Boom[x][y] = lev.eater_array[lev.eater_pos][1];
- Boom[x+1][y] = lev.eater_array[lev.eater_pos][2];
- Boom[x-1][y+1] = lev.eater_array[lev.eater_pos][3];
- Boom[x][y+1] = lev.eater_array[lev.eater_pos][4];
- Boom[x+1][y+1] = lev.eater_array[lev.eater_pos][5];
- Boom[x-1][y+2] = lev.eater_array[lev.eater_pos][6];
- Boom[x][y+2] = lev.eater_array[lev.eater_pos][7];
- Boom[x+1][y+2] = lev.eater_array[lev.eater_pos][8];
-#if PLAY_ELEMENT_SOUND
- play_element_sound(x, y, SOUND_boom, Xstone_fall);
-#endif
- lev.eater_pos = (lev.eater_pos + 1) & 7;
+ Lboom_eater(x, y+1, Xstone_fall);
score += lev.eater_score;
return;
case Xalien_pause:
Cave[x][y] = Ystone_sB;
Cave[x][y+1] = Yalien_stone;
- Next[x][y+1] = Znormal;
- Boom[x-1][y] = Xblank;
- Boom[x][y] = Xblank;
- Boom[x+1][y] = Xblank;
- Boom[x-1][y+1] = Xblank;
- Boom[x][y+1] = Xblank;
- Boom[x+1][y+1] = Xblank;
- Boom[x-1][y+2] = Xblank;
- Boom[x][y+2] = Xblank;
- Boom[x+1][y+2] = Xblank;
-#if PLAY_ELEMENT_SOUND
- play_element_sound(x, y, SOUND_boom, Xstone_fall);
-#endif
+ Lboom_tank(x, y+1, Xstone_fall);
score += lev.alien_score;
return;
case Xbomb:
case Xbomb_pause:
Cave[x][y+1] = Ybomb_blank;
- Next[x][y+1] = Znormal;
- Boom[x-1][y] = Xblank;
- Boom[x][y] = Xblank;
- Boom[x+1][y] = Xblank;
- Boom[x-1][y+1] = Xblank;
- Boom[x][y+1] = Xblank;
- Boom[x+1][y+1] = Xblank;
- Boom[x-1][y+2] = Xblank;
- Boom[x][y+2] = Xblank;
- Boom[x+1][y+2] = Xblank;
-#if PLAY_ELEMENT_SOUND
- play_element_sound(x, y, SOUND_boom, Xstone_fall);
-#endif
+ Lboom_tank(x, y+1, Xstone_fall);
return;
case Xwonderwall:
default:
Cave[x][y] = Ybomb_blank;
- Next[x][y] = Znormal;
- Boom[x-1][y-1] = Xblank;
- Boom[x][y-1] = Xblank;
- Boom[x+1][y-1] = Xblank;
- Boom[x-1][y] = Xblank;
- Boom[x][y] = Xblank;
- Boom[x+1][y] = Xblank;
- Boom[x-1][y+1] = Xblank;
- Boom[x][y+1] = Xblank;
- Boom[x+1][y+1] = Xblank;
-#if PLAY_ELEMENT_SOUND
- play_element_sound(x, y, SOUND_boom, Xbomb_fall);
-#endif
+ Lboom_tank(x, y, Xbomb_fall);
return;
}
}
case Xbomb:
case Xbomb_pause:
Cave[x][y+1] = Ybomb_blank;
- Next[x][y+1] = Znormal;
- Boom[x-1][y] = Xblank;
- Boom[x][y] = Xblank;
- Boom[x+1][y] = Xblank;
- Boom[x-1][y+1] = Xblank;
- Boom[x][y+1] = Xblank;
- Boom[x+1][y+1] = Xblank;
- Boom[x-1][y+2] = Xblank;
- Boom[x][y+2] = Xblank;
- Boom[x+1][y+2] = Xblank;
-#if PLAY_ELEMENT_SOUND
- play_element_sound(x, y, SOUND_boom, Xspring_fall);
-#endif
+ Lboom_tank(x, y+1, Xspring_fall);
return;
case Xbug_1_n:
case Xbug_2_w:
Cave[x][y] = Yspring_sB;
Cave[x][y+1] = Ybug_spring;
- Next[x][y+1] = Znormal;
- Boom[x-1][y] = Xemerald;
- Boom[x][y] = Xemerald;
- Boom[x+1][y] = Xemerald;
- Boom[x-1][y+1] = Xemerald;
- Boom[x][y+1] = Xdiamond;
- Boom[x+1][y+1] = Xemerald;
- Boom[x-1][y+2] = Xemerald;
- Boom[x][y+2] = Xemerald;
- Boom[x+1][y+2] = Xemerald;
-#if PLAY_ELEMENT_SOUND
- play_element_sound(x, y, SOUND_boom, Xspring_fall);
-#endif
+ Lboom_bug(x, y+1, Xspring_fall);
score += lev.bug_score;
return;
case Xtank_2_w:
Cave[x][y] = Yspring_sB;
Cave[x][y+1] = Ytank_spring;
- Next[x][y+1] = Znormal;
- Boom[x-1][y] = Xblank;
- Boom[x][y] = Xblank;
- Boom[x+1][y] = Xblank;
- Boom[x-1][y+1] = Xblank;
- Boom[x][y+1] = Xblank;
- Boom[x+1][y+1] = Xblank;
- Boom[x-1][y+2] = Xblank;
- Boom[x][y+2] = Xblank;
- Boom[x+1][y+2] = Xblank;
-#if PLAY_ELEMENT_SOUND
- play_element_sound(x, y, SOUND_boom, Xspring_fall);
-#endif
+ Lboom_tank(x, y+1, Xspring_fall);
score += lev.tank_score;
return;
case Xeater_w:
Cave[x][y] = Yspring_sB;
Cave[x][y+1] = Yeater_spring;
- Next[x][y+1] = Znormal;
- Boom[x-1][y] = lev.eater_array[lev.eater_pos][0];
- Boom[x][y] = lev.eater_array[lev.eater_pos][1];
- Boom[x+1][y] = lev.eater_array[lev.eater_pos][2];
- Boom[x-1][y+1] = lev.eater_array[lev.eater_pos][3];
- Boom[x][y+1] = lev.eater_array[lev.eater_pos][4];
- Boom[x+1][y+1] = lev.eater_array[lev.eater_pos][5];
- Boom[x-1][y+2] = lev.eater_array[lev.eater_pos][6];
- Boom[x][y+2] = lev.eater_array[lev.eater_pos][7];
- Boom[x+1][y+2] = lev.eater_array[lev.eater_pos][8];
-#if PLAY_ELEMENT_SOUND
- play_element_sound(x, y, SOUND_boom, Xspring_fall);
-#endif
- lev.eater_pos = (lev.eater_pos + 1) & 7;
+ Lboom_eater(x, y+1, Xspring_fall);
score += lev.eater_score;
return;
case Xalien_pause:
Cave[x][y] = Yspring_sB;
Cave[x][y+1] = Yalien_spring;
- Next[x][y+1] = Znormal;
- Boom[x-1][y] = Xblank;
- Boom[x][y] = Xblank;
- Boom[x+1][y] = Xblank;
- Boom[x-1][y+1] = Xblank;
- Boom[x][y+1] = Xblank;
- Boom[x+1][y+1] = Xblank;
- Boom[x-1][y+2] = Xblank;
- Boom[x][y+2] = Xblank;
- Boom[x+1][y+2] = Xblank;
-#if PLAY_ELEMENT_SOUND
- play_element_sound(x, y, SOUND_boom, Xspring_fall);
-#endif
+ Lboom_tank(x, y+1, Xspring_fall);
score += lev.alien_score;
return;
{
play_element_sound(x, y, SOUND_tick, Xdynamite_4);
Next[x][y] = Zdynamite;
- Boom[x-1][y-1] = Xblank;
- Boom[x][y-1] = Xblank;
- Boom[x+1][y-1] = Xblank;
- Boom[x-1][y] = Xblank;
- Boom[x][y] = Xblank;
- Boom[x+1][y] = Xblank;
- Boom[x-1][y+1] = Xblank;
- Boom[x][y+1] = Xblank;
- Boom[x+1][y+1] = Xblank;
+
+ Lboom_generic(x, y, Xblank, Xblank);
}
static void Lfake_door_1(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][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]];
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][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]];
case Xpause: Lpause(x, y); break;
- case Xboom_bug: Lboom_bug(x, y); break;
- case Xboom_bomb: Lboom_tank(x, y); break;
+ case Xboom_bug: Lboom_bug(x, y, Xboom_bug); break;
+ case Xboom_bomb: Lboom_tank(x, y, Xboom_bomb); 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;