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];
lev.eater_pos = (lev.eater_pos + 1) & 7;
#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 boolean player_killed(struct PLAYER *ply)
{
int x = ply->x;
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:
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;
}
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:
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;
}
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:
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;
}
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:
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
case Xeater_s:
case Xeater_w:
cave[x][y] = Ystone_sB;
+ next[x][y] = Xblank;
cave[x][y+1] = Yeater_stone;
- Lboom_eater(x, y+1, Xstone_fall);
+ 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;
+ next[x][y] = Xblank;
cave[x][y+1] = Yalien_stone;
- Lboom_tank(x, y+1, Xstone_fall);
+ next[x][y+1] = Ztank;
+ Lboom_tank_old(x, y+1);
score += lev.alien_score;
return;
case Xbug_2_s:
case Xbug_2_w:
cave[x][y] = Ystone_sB;
+ next[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;
case Xtank_2_s:
case Xtank_2_w:
cave[x][y] = Ystone_sB;
+ next[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 Xbomb:
case Xbomb_pause:
+ cave[x][y] = Xstone;
+ next[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:
default:
cave[x][y] = Ybomb_blank;
- Lboom_tank(x, y, Xbomb_fall);
+ next[x][y] = Ztank;
+ Lboom_tank_old(x, y);
return;
}
}
case Xeater_s:
case Xeater_w:
cave[x][y] = Yspring_sB;
+ next[x][y] = Xblank;
cave[x][y+1] = Yeater_spring;
- Lboom_eater(x, y+1, Xspring_fall);
+ 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;
- Lboom_tank(x, y+1, Xspring_fall);
+ next[x][y+1] = Ztank;
+ Lboom_tank_old(x, y+1);
score += lev.alien_score;
return;
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;
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 Xbomb:
case Xbomb_pause:
+ cave[x][y] = Xspring;
+ next[x][y] = Xspring;
cave[x][y+1] = Ybomb_blank;
- Lboom_tank(x, y+1, Xspring_fall);
+ next[x][y+1] = Ztank;
+ Lboom_tank_old(x, y+1);
return;
default:
switch (cave[x+1][y])
{
case Zborder:
- case Znormal:
+ case Zbug:
+ case Ztank:
+ case Zeater:
case Zdynamite:
+ case Zboom:
+ case Xchain:
case Xboom_bug:
- case Xboom_bomb:
+ case Xboom_tank:
case Xboom_android:
case Xboom_1:
return;
switch (cave[x-1][y])
{
case Zborder:
- case Znormal:
+ case Zbug:
+ case Ztank:
+ case Zeater:
case Zdynamite:
+ case Zboom:
+ case Xchain:
case Xboom_bug:
- case Xboom_bomb:
+ case Xboom_tank:
case Xboom_android:
case Xboom_1:
return;
switch (cave[x+1][y])
{
case Zborder:
- case Znormal:
+ case Zbug:
+ case Ztank:
+ case Zeater:
case Zdynamite:
+ case Zboom:
+ case Xchain:
case Xboom_bug:
- case Xboom_bomb:
+ case Xboom_tank:
case Xboom_android:
case Xboom_1:
return;
switch (cave[x-1][y])
{
case Zborder:
- case Znormal:
+ case Zbug:
+ case Ztank:
+ case Zeater:
case Zdynamite:
+ case Zboom:
+ case Xchain:
case Xboom_bug:
- case Xboom_bomb:
+ case Xboom_tank:
case Xboom_android:
case Xboom_1:
return;
switch (cave[x+1][y])
{
case Zborder:
- case Znormal:
+ case Zbug:
+ case Ztank:
+ case Zeater:
case Zdynamite:
+ case Zboom:
+ case Xchain:
case Xboom_bug:
- case Xboom_bomb:
+ case Xboom_tank:
case Xboom_android:
case Xboom_1:
return;
switch (cave[x-1][y])
{
case Zborder:
- case Znormal:
+ case Zbug:
+ case Ztank:
+ case Zeater:
case Zdynamite:
+ case Zboom:
+ case Xchain:
case Xboom_bug:
- case Xboom_bomb:
+ case Xboom_tank:
case Xboom_android:
case Xboom_1:
return;
switch (cave[x+1][y])
{
case Zborder:
- case Znormal:
+ case Zbug:
+ case Ztank:
+ case Zeater:
case Zdynamite:
+ case Zboom:
+ case Xchain:
case Xboom_bug:
- case Xboom_bomb:
+ case Xboom_tank:
case Xboom_android:
case Xboom_1:
return;
switch (cave[x-1][y])
{
case Zborder:
- case Znormal:
+ case Zbug:
+ case Ztank:
+ case Zeater:
case Zdynamite:
+ case Zboom:
+ case Xchain:
case Xboom_bug:
- case Xboom_bomb:
+ case Xboom_tank:
case Xboom_android:
case Xboom_1:
return;
switch (cave[x+1][y])
{
case Zborder:
- case Znormal:
+ case Zbug:
+ case Ztank:
+ case Zeater:
case Zdynamite:
+ case Zboom:
+ case Xchain:
case Xboom_bug:
- case Xboom_bomb:
+ case Xboom_tank:
case Xboom_android:
case Xboom_1:
return;
switch (cave[x-1][y])
{
case Zborder:
- case Znormal:
+ case Zbug:
+ case Ztank:
+ case Zeater:
case Zdynamite:
+ case Zboom:
+ case Xchain:
case Xboom_bug:
- case Xboom_bomb:
+ case Xboom_tank:
case Xboom_android:
case Xboom_1:
return;
switch (cave[x+1][y])
{
case Zborder:
- case Znormal:
+ case Zbug:
+ case Ztank:
+ case Zeater:
case Zdynamite:
+ case Zboom:
+ case Xchain:
case Xboom_bug:
- case Xboom_bomb:
+ case Xboom_tank:
case Xboom_android:
case Xboom_1:
return;
switch (cave[x-1][y])
{
case Zborder:
- case Znormal:
+ case Zbug:
+ case Ztank:
+ case Zeater:
case Zdynamite:
+ case Zboom:
+ case Xchain:
case Xboom_bug:
- case Xboom_bomb:
+ case Xboom_tank:
case Xboom_android:
case Xboom_1:
return;
switch (cave[x][y])
{
case Zborder:
- case Znormal:
+ case Zbug:
+ case Ztank:
+ case Zeater:
case Zdynamite:
+ case Zboom:
+ case Xchain:
case Xboom_bug:
- case Xboom_bomb:
+ case Xboom_tank:
case Xboom_android:
case Xacid_1:
case Xacid_2:
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_bomb;
+ cave[x][y] = Xboom_tank;
+ Lboom_tank_new(x, y, TRUE);
return;
default:
{
switch (cave[x][y])
{
- case Znormal:
+ 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:
Lboom_nine(x, y, TRUE);
break;
+
+ case Zboom:
+ Lboom_nine(x, y, FALSE);
+ break;
}
}
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])
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_players(void)
+static void logic_players(void)
{
int start_check_nr;
int i;
ply[i].anim = PLY_still;
}
- start_check_nr = (RandomEM & 128 ? 0 : 1) * 2 + (RandomEM & 256 ? 0 : 1);
+ start_check_nr = ((game_em.random & 128 ? 0 : 1) * 2 +
+ (game_em.random & 256 ? 0 : 1));
for (i = 0; i < MAX_PLAYERS; i++)
{
}
}
-void logic_objects(void)
+static void logic_objects(void)
{
int x, y;
next = lev.next;
boom = lev.boom;
- seed = RandomEM;
+ seed = game_em.random;
score = 0;
for (y = lev.top; y < lev.bottom; y++)
else
game_em.game_over = TRUE;
- RandomEM = seed;
+ game_em.random = seed;
/* triple buffering */
void *temp = lev.cave;
lev.draw = temp;
}
-void logic_globals(void)
+static void logic_globals(void)
{
int x;
int y;
/* grow amoeba */
- random = RandomEM;
+ random = game_em.random;
for (count = lev.amoeba_time; count--;)
{
random = random * 129 + 1;
}
- RandomEM = random;
+ game_em.random = random;
/* handle explosions */
for (x = lev.left; x < lev.right; x++)
next[x][y] = cave[x][y];
}
+
+void logic(void)
+{
+ if (frame == 0)
+ {
+ logic_players();
+ logic_objects();
+ }
+
+ if (frame == 1)
+ {
+ logic_globals();
+ }
+}