* compilers suck.
*/
-#include "display.h"
-#include "tile.h"
-#include "level.h"
-#include "sample.h"
+#include "main_em.h"
#define RANDOM (random = random << 31 | random >> 1)
+static void set_nearest_player_xy(int x, int y, int *dx, int *dy)
+{
+ int distance, distance_shortest = EM_MAX_CAVE_WIDTH + EM_MAX_CAVE_HEIGHT;
+ int i;
+
+ /* default values if no players are alive anymore */
+ *dx = 0;
+ *dy = 0;
+
+ for (i = 0; i < MAX_PLAYERS; i++)
+ {
+ if (!ply[i].alive)
+ continue;
+
+ distance = ABS(ply[i].x - x) + ABS(ply[i].y - y);
+
+ if (distance < distance_shortest)
+ {
+ *dx = ply[i].x;
+ *dy = ply[i].y;
+
+ distance_shortest = distance;
+ }
+ }
+}
+
void synchro_2(void)
{
- register unsigned int x = 0;
- register unsigned int y = 1;
- register unsigned long random = Random;
- register unsigned short *cave_cache = Cave[y]; /* might be a win */
- unsigned long score = 0;
-
- unsigned int temp = 0; /* initialized to make compilers happy */
- unsigned int dx; /* only needed to find closest player */
- unsigned int dy;
+ int x = 0;
+ int y = 1;
+ unsigned long random = RandomEM;
+ short *cave_cache = Cave[y]; /* might be a win */
+ int score = 0;
+
+ int temp = 0; /* initialized to make compilers happy */
+ int dx; /* only needed to find closest player */
+ int dy;
int element;
loop:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
case Yacid_splash_wB:
case Xplant:
case Yplant:
+#if 1
+ case Xfake_acid_1:
+ case Xfake_acid_2:
+ case Xfake_acid_3:
+ case Xfake_acid_4:
+ case Xfake_acid_5:
+ case Xfake_acid_6:
+ case Xfake_acid_7:
+ case Xfake_acid_8:
+#endif
Cave[y][x] = Ystone_sB;
Cave[y+1][x] = Ystone_s;
Next[y][x] = Xblank;
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
case Yacid_splash_eB:
case Yacid_splash_wB:
+#if 1
+ case Xfake_acid_1:
+ case Xfake_acid_2:
+ case Xfake_acid_3:
+ case Xfake_acid_4:
+ case Xfake_acid_5:
+ case Xfake_acid_6:
+ case Xfake_acid_7:
+ case Xfake_acid_8:
+#endif
Cave[y][x] = Ystone_sB;
Cave[y+1][x] = Ystone_s;
Next[y][x] = Xblank;
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
case Yacid_splash_eB:
case Yacid_splash_wB:
case Zplayer:
+#if 1
+ case Xfake_acid_1:
+ case Xfake_acid_2:
+ case Xfake_acid_3:
+ case Xfake_acid_4:
+ case Xfake_acid_5:
+ case Xfake_acid_6:
+ case Xfake_acid_7:
+ case Xfake_acid_8:
+#endif
Cave[y][x] = Ystone_sB;
Cave[y+1][x] = Ystone_s;
Next[y][x] = Xblank;
Boom[y+2][x-1] = Xemerald;
Boom[y+2][x] = Xemerald;
Boom[y+2][x+1] = Xemerald;
-#if 0
+#if PLAY_ELEMENT_SOUND
play_element_sound(x, y, SAMPLE_boom, element);
#endif
score += lev.bug_score;
Boom[y+2][x-1] = Xblank;
Boom[y+2][x] = Xblank;
Boom[y+2][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
play_element_sound(x, y, SAMPLE_boom, element);
#endif
score += lev.tank_score;
Boom[y+2][x-1] = lev.eater_array[lev.eater_pos][6];
Boom[y+2][x] = lev.eater_array[lev.eater_pos][7];
Boom[y+2][x+1] = lev.eater_array[lev.eater_pos][8];
-#if 0
+#if PLAY_ELEMENT_SOUND
play_element_sound(x, y, SAMPLE_boom, element);
#endif
lev.eater_pos = (lev.eater_pos + 1) & 7;
Boom[y+2][x-1] = Xblank;
Boom[y+2][x] = Xblank;
Boom[y+2][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
play_element_sound(x, y, SAMPLE_boom, element);
#endif
score += lev.alien_score;
Boom[y+2][x-1] = Xblank;
Boom[y+2][x] = Xblank;
Boom[y+2][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
play_element_sound(x, y, SAMPLE_boom, element);
#endif
goto loop;
}
Next[y][x] = Xblank;
- play_element_sound(x, y, SAMPLE_wonderfall, Xstone);
+ play_element_sound(x, y, SAMPLE_wonderfall, Xwonderwall);
goto loop;
}
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
case Zplayer:
Cave[y][x] = Ybug_n_e;
Next[y][x] = Xbug_goe;
- play_sound(x, y, SAMPLE_bug);
+ play_element_sound(x, y, SAMPLE_bug, element);
goto loop;
default:
if (Cave[y-2][x-1] == Xblank)
Cave[y-2][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Cave[y-1][x] = Ybug_n;
Next[y][x] = Xblank;
Next[y-1][x] = Xbug_n;
- play_sound(x, y, SAMPLE_bug);
+ play_element_sound(x, y, SAMPLE_bug, element);
goto loop;
default:
Cave[y][x] = Ybug_n_w;
Next[y][x] = Xbug_gow;
- play_sound(x, y, SAMPLE_bug);
+ play_element_sound(x, y, SAMPLE_bug, element);
goto loop;
}
case Zplayer:
Cave[y][x] = Ybug_e_s;
Next[y][x] = Xbug_gos;
- play_sound(x, y, SAMPLE_bug);
+ play_element_sound(x, y, SAMPLE_bug, element);
goto loop;
default:
if (Cave[y-1][x] == Xblank)
Cave[y-1][x] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Cave[y][x+1] = Ybug_e;
Next[y][x] = Xblank;
Next[y][x+1] = Xbug_e;
- play_sound(x, y, SAMPLE_bug);
+ play_element_sound(x, y, SAMPLE_bug, element);
goto loop;
default:
Cave[y][x] = Ybug_e_n;
Next[y][x] = Xbug_gon;
- play_sound(x, y, SAMPLE_bug);
+ play_element_sound(x, y, SAMPLE_bug, element);
goto loop;
}
case Zplayer:
Cave[y][x] = Ybug_s_w;
Next[y][x] = Xbug_gow;
- play_sound(x, y, SAMPLE_bug);
+ play_element_sound(x, y, SAMPLE_bug, element);
goto loop;
default:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Cave[y+1][x] = Ybug_s;
Next[y][x] = Xblank;
Next[y+1][x] = Xbug_s;
- play_sound(x, y, SAMPLE_bug);
+ play_element_sound(x, y, SAMPLE_bug, element);
goto loop;
default:
Cave[y][x] = Ybug_s_e;
Next[y][x] = Xbug_goe;
- play_sound(x, y, SAMPLE_bug);
+ play_element_sound(x, y, SAMPLE_bug, element);
goto loop;
}
case Zplayer:
Cave[y][x] = Ybug_w_n;
Next[y][x] = Xbug_gon;
- play_sound(x, y, SAMPLE_bug);
+ play_element_sound(x, y, SAMPLE_bug, element);
goto loop;
default:
if (Cave[y-1][x-2] == Xblank)
Cave[y-1][x-2] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Cave[y][x-1] = Ybug_w;
Next[y][x] = Xblank;
Next[y][x-1] = Xbug_w;
- play_sound(x, y, SAMPLE_bug);
+ play_element_sound(x, y, SAMPLE_bug, element);
goto loop;
default:
Cave[y][x] = Ybug_w_s;
Next[y][x] = Xbug_gos;
- play_sound(x, y, SAMPLE_bug);
+ play_element_sound(x, y, SAMPLE_bug, element);
goto loop;
}
case Zplayer:
Cave[y][x] = Ytank_n_w;
Next[y][x] = Xtank_gow;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_tank, element);
goto loop;
default:
if (Cave[y-2][x-1] == Xblank)
Cave[y-2][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Cave[y-1][x] = Ytank_n;
Next[y][x] = Xblank;
Next[y-1][x] = Xtank_n;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_tank, element);
goto loop;
default:
Cave[y][x] = Ytank_n_e;
Next[y][x] = Xtank_goe;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_tank, element);
goto loop;
}
case Zplayer:
Cave[y][x] = Ytank_e_n;
Next[y][x] = Xtank_gon;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_tank, element);
goto loop;
default:
if (Cave[y-1][x] == Xblank)
Cave[y-1][x] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Cave[y][x+1] = Ytank_e;
Next[y][x] = Xblank;
Next[y][x+1] = Xtank_e;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_tank, element);
goto loop;
default:
Cave[y][x] = Ytank_e_s;
Next[y][x] = Xtank_gos;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_tank, element);
goto loop;
}
case Zplayer:
Cave[y][x] = Ytank_s_e;
Next[y][x] = Xtank_goe;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_tank, element);
goto loop;
default:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Cave[y+1][x] = Ytank_s;
Next[y][x] = Xblank;
Next[y+1][x] = Xtank_s;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_tank, element);
goto loop;
default:
Cave[y][x] = Ytank_s_w;
Next[y][x] = Xtank_gow;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_tank, element);
goto loop;
}
case Zplayer:
Cave[y][x] = Ytank_w_s;
Next[y][x] = Xtank_gos;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_tank, element);
goto loop;
default:
if (Cave[y-1][x-2] == Xblank)
Cave[y-1][x-2] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Cave[y][x-1] = Ytank_w;
Next[y][x] = Xblank;
Next[y][x-1] = Xtank_w;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_tank, element);
goto loop;
default:
Cave[y][x] = Ytank_w_n;
Next[y][x] = Xtank_gon;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_tank, element);
goto loop;
}
goto android_move;
}
- Next[y][x] = temp; /* the item we chose to clone */
- play_element_sound(x, y, SAMPLE_android, temp);
+ Next[y][x] = temp; /* the item we chose to clone */
+ play_element_sound(x, y, SAMPLE_android_clone, temp);
switch (RANDOM & 7)
{
Cave[y+1][x+1] == Zplayer)
goto android_still;
+#if 1
+
+ set_nearest_player_xy(x, y, &dx, &dy);
+
+#else
+
if (ply1.alive && ply2.alive)
{
if ((ply1.x > x ? ply1.x - x : x - ply1.x) +
dy = 0;
}
- Next[y][x] = Xblank; /* assume we will move */
+#endif
+
+ Next[y][x] = Xblank; /* assume we will move */
temp = ((x < dx) + 1 - (x > dx)) + ((y < dy) + 1 - (y > dy)) * 3;
if (RANDOM & 1)
Cave[y][x] = Yandroid_nB;
Cave[y-1][x] = Yandroid_n;
Next[y-1][x] = Xandroid;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_android_move, element);
goto loop;
android_ne:
Cave[y][x] = Yandroid_neB;
Cave[y-1][x+1] = Yandroid_ne;
Next[y-1][x+1] = Xandroid;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_android_move, element);
goto loop;
android_e:
Cave[y][x] = Yandroid_eB;
Cave[y][x+1] = Yandroid_e;
Next[y][x+1] = Xandroid;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_android_move, element);
goto loop;
android_se:
Cave[y][x] = Yandroid_seB;
Cave[y+1][x+1] = Yandroid_se;
Next[y+1][x+1] = Xandroid;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_android_move, element);
goto loop;
android_s:
Cave[y][x] = Yandroid_sB;
Cave[y+1][x] = Yandroid_s;
Next[y+1][x] = Xandroid;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_android_move, element);
goto loop;
android_sw:
Cave[y][x] = Yandroid_swB;
Cave[y+1][x-1] = Yandroid_sw;
Next[y+1][x-1] = Xandroid;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_android_move, element);
goto loop;
android_w:
Cave[y][x] = Yandroid_wB;
Cave[y][x-1] = Yandroid_w;
Next[y][x-1] = Xandroid;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_android_move, element);
goto loop;
android_nw:
Cave[y][x] = Yandroid_nwB;
Cave[y-1][x-1] = Yandroid_nw;
Next[y-1][x-1] = Xandroid;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_android_move, element);
goto loop;
/* --------------------------------------------------------------------- */
if (Cave[y-2][x-1] == Xblank)
Cave[y-2][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Cave[y-1][x] = Yandroid_n;
Next[y][x] = Xblank;
Next[y-1][x] = Xandroid;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_android_move, element);
goto loop;
default:
if (Cave[y-2][x-1] == Xblank)
Cave[y-2][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Cave[y-1][x] = Yandroid_n;
Next[y][x] = Xblank;
Next[y-1][x] = Xandroid_1_n;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_android_move, element);
goto loop;
default:
if (Cave[y-1][x] == Xblank)
Cave[y-1][x] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Cave[y][x+1] = Yandroid_e;
Next[y][x] = Xblank;
Next[y][x+1] = Xandroid;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_android_move, element);
goto loop;
default:
if (Cave[y-1][x] == Xblank)
Cave[y-1][x] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Cave[y][x+1] = Yandroid_e;
Next[y][x] = Xblank;
Next[y][x+1] = Xandroid_1_e;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_android_move, element);
goto loop;
default:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Cave[y+1][x] = Yandroid_s;
Next[y][x] = Xblank;
Next[y+1][x] = Xandroid;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_android_move, element);
goto loop;
default:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Cave[y+1][x] = Yandroid_s;
Next[y][x] = Xblank;
Next[y+1][x] = Xandroid_1_s;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_android_move, element);
goto loop;
default:
if (Cave[y-1][x-2] == Xblank)
Cave[y-1][x-2] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Cave[y][x-1] = Yandroid_w;
Next[y][x] = Xblank;
Next[y][x-1] = Xandroid;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_android_move, element);
goto loop;
default:
if (Cave[y-1][x-2] == Xblank)
Cave[y-1][x-2] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Cave[y][x-1] = Yandroid_w;
Next[y][x] = Xblank;
Next[y][x-1] = Xandroid_1_w;
- play_sound(x, y, SAMPLE_tank);
+ play_element_sound(x, y, SAMPLE_android_move, element);
goto loop;
default:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y-1][x] == Xblank)
Cave[y-1][x] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y-1][x-2] == Xblank)
Cave[y-1][x-2] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Boom[y+2][x-1] = Xblank;
Boom[y+2][x] = Xblank;
Boom[y+2][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
play_element_sound(x, y, SAMPLE_boom, element);
#endif
goto loop;
Boom[y+2][x-1] = Xemerald;
Boom[y+2][x] = Xemerald;
Boom[y+2][x+1] = Xemerald;
-#if 0
+#if PLAY_ELEMENT_SOUND
play_element_sound(x, y, SAMPLE_boom, element);
#endif
score += lev.bug_score;
Boom[y+2][x-1] = Xblank;
Boom[y+2][x] = Xblank;
Boom[y+2][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
play_element_sound(x, y, SAMPLE_boom, element);
#endif
score += lev.tank_score;
Boom[y+2][x-1] = lev.eater_array[lev.eater_pos][6];
Boom[y+2][x] = lev.eater_array[lev.eater_pos][7];
Boom[y+2][x+1] = lev.eater_array[lev.eater_pos][8];
-#if 0
+#if PLAY_ELEMENT_SOUND
play_element_sound(x, y, SAMPLE_boom, element);
#endif
lev.eater_pos = (lev.eater_pos + 1) & 7;
Boom[y+2][x-1] = Xblank;
Boom[y+2][x] = Xblank;
Boom[y+2][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
play_element_sound(x, y, SAMPLE_boom, element);
#endif
score += lev.alien_score;
{
Cave[y][x+1] = Ydiamond_eat;
Next[y][x+1] = Xblank;
- play_element_sound(x, y, SAMPLE_eater, Xdiamond);
+ play_element_sound(x, y, SAMPLE_eater_eat, element);
goto loop;
}
{
Cave[y+1][x] = Ydiamond_eat;
Next[y+1][x] = Xblank;
- play_element_sound(x, y, SAMPLE_eater, Xdiamond);
+ play_element_sound(x, y, SAMPLE_eater_eat, element);
goto loop;
}
{
Cave[y][x-1] = Ydiamond_eat;
Next[y][x-1] = Xblank;
- play_element_sound(x, y, SAMPLE_eater, Xdiamond);
+ play_element_sound(x, y, SAMPLE_eater_eat, element);
goto loop;
}
{
Cave[y-1][x] = Ydiamond_eat;
Next[y-1][x] = Xblank;
- play_element_sound(x, y, SAMPLE_eater, Xdiamond);
+ play_element_sound(x, y, SAMPLE_eater_eat, element);
goto loop;
}
if (Cave[y-2][x-1] == Xblank)
Cave[y-2][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
default:
Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, element);
goto loop;
}
{
Cave[y+1][x] = Ydiamond_eat;
Next[y+1][x] = Xblank;
- play_element_sound(x, y, SAMPLE_eater, Xdiamond);
+ play_element_sound(x, y, SAMPLE_eater_eat, element);
goto loop;
}
{
Cave[y][x-1] = Ydiamond_eat;
Next[y][x-1] = Xblank;
- play_element_sound(x, y, SAMPLE_eater, Xdiamond);
+ play_element_sound(x, y, SAMPLE_eater_eat, element);
goto loop;
}
{
Cave[y-1][x] = Ydiamond_eat;
Next[y-1][x] = Xblank;
- play_element_sound(x, y, SAMPLE_eater, Xdiamond);
+ play_element_sound(x, y, SAMPLE_eater_eat, element);
goto loop;
}
{
Cave[y][x+1] = Ydiamond_eat;
Next[y][x+1] = Xblank;
- play_element_sound(x, y, SAMPLE_eater, Xdiamond);
+ play_element_sound(x, y, SAMPLE_eater_eat, element);
goto loop;
}
if (Cave[y-1][x] == Xblank)
Cave[y-1][x] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
default:
Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, element);
goto loop;
}
{
Cave[y][x-1] = Ydiamond_eat;
Next[y][x-1] = Xblank;
- play_element_sound(x, y, SAMPLE_eater, Xdiamond);
+ play_element_sound(x, y, SAMPLE_eater_eat, element);
goto loop;
}
{
Cave[y-1][x] = Ydiamond_eat;
Next[y-1][x] = Xblank;
- play_element_sound(x, y, SAMPLE_eater, Xdiamond);
+ play_element_sound(x, y, SAMPLE_eater_eat, element);
goto loop;
}
{
Cave[y][x+1] = Ydiamond_eat;
Next[y][x+1] = Xblank;
- play_element_sound(x, y, SAMPLE_eater, Xdiamond);
+ play_element_sound(x, y, SAMPLE_eater_eat, element);
goto loop;
}
{
Cave[y+1][x] = Ydiamond_eat;
Next[y+1][x] = Xblank;
- play_element_sound(x, y, SAMPLE_eater, Xdiamond);
+ play_element_sound(x, y, SAMPLE_eater_eat, element);
goto loop;
}
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
default:
Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, element);
goto loop;
}
{
Cave[y-1][x] = Ydiamond_eat;
Next[y-1][x] = Xblank;
- play_element_sound(x, y, SAMPLE_eater, Xdiamond);
+ play_element_sound(x, y, SAMPLE_eater_eat, element);
goto loop;
}
{
Cave[y][x+1] = Ydiamond_eat;
Next[y][x+1] = Xblank;
- play_element_sound(x, y, SAMPLE_eater, Xdiamond);
+ play_element_sound(x, y, SAMPLE_eater_eat, element);
goto loop;
}
{
Cave[y+1][x] = Ydiamond_eat;
Next[y+1][x] = Xblank;
- play_element_sound(x, y, SAMPLE_eater, Xdiamond);
+ play_element_sound(x, y, SAMPLE_eater_eat, element);
goto loop;
}
{
Cave[y][x-1] = Ydiamond_eat;
Next[y][x-1] = Xblank;
- play_element_sound(x, y, SAMPLE_eater, Xdiamond);
+ play_element_sound(x, y, SAMPLE_eater_eat, element);
goto loop;
}
if (Cave[y-1][x-2] == Xblank)
Cave[y-1][x-2] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
default:
Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s;
- play_sound(x, y, SAMPLE_eater);
+ play_element_sound(x, y, SAMPLE_eater, element);
goto loop;
}
/* --------------------------------------------------------------------- */
case Xalien:
+
+#if 1
+
+ if (lev.wheel_cnt)
+ {
+ dx = lev.wheel_x;
+ dy = lev.wheel_y;
+ }
+ else
+ {
+ set_nearest_player_xy(x, y, &dx, &dy);
+ }
+
+#else
+
if (lev.wheel_cnt)
{
dx = lev.wheel_x;
dy = 0;
}
+#endif
+
if (RANDOM & 1)
{
if (y > dy)
if (Cave[y-2][x-1] == Xblank)
Cave[y-2][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Cave[y][x+1] = Yacid_splash_eB;
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y-1][x] == Xblank)
Cave[y-1][x] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y-1][x-2] == Xblank)
Cave[y-1][x-2] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
}
Next[y][x] = Xblank;
- play_element_sound(x, y, SAMPLE_wonderfall, Xemerald);
+ play_element_sound(x, y, SAMPLE_wonderfall, Xwonderwall);
goto loop;
}
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
}
Next[y][x] = Xblank;
- play_element_sound(x, y, SAMPLE_wonderfall, Xdiamond);
+ play_element_sound(x, y, SAMPLE_wonderfall, Xwonderwall);
goto loop;
}
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xdrip_stretchB;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Boom[y+1][x-1] = Xblank;
Boom[y+1][x] = Xblank;
Boom[y+1][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
play_element_sound(x, y, SAMPLE_boom, element);
#endif
goto loop;
if (Cave[y-2][x-1] == Xblank)
Cave[y-2][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y-1][x] == Xblank)
Cave[y-1][x] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
if (Cave[y-1][x-2] == Xblank)
Cave[y-1][x-2] = Yacid_splash_wB;
Next[y][x] = Xblank;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
case Xblank:
Next[y][x] = Xacid_1;
goto loop;
+ case Xfake_acid_1:
+ Next[y][x] = Xfake_acid_2;
+ goto loop;
+
+ case Xfake_acid_2:
+ Next[y][x] = Xfake_acid_3;
+ goto loop;
+
+ case Xfake_acid_3:
+ Next[y][x] = Xfake_acid_4;
+ goto loop;
+
+ case Xfake_acid_4:
+ Next[y][x] = Xfake_acid_5;
+ goto loop;
+
+ case Xfake_acid_5:
+ Next[y][x] = Xfake_acid_6;
+ goto loop;
+
+ case Xfake_acid_6:
+ Next[y][x] = Xfake_acid_7;
+ goto loop;
+
+ case Xfake_acid_7:
+ Next[y][x] = Xfake_acid_8;
+ goto loop;
+
+ case Xfake_acid_8:
+ Next[y][x] = Xfake_acid_1;
+ goto loop;
+
/* --------------------------------------------------------------------- */
case Xball_1:
}
}
+#if 1
+ lev.ball_pos = (lev.ball_pos + 1) % lev.num_ball_arrays;
+#else
lev.ball_pos = (lev.ball_pos + 1) & 7;
+#endif
goto loop;
/* --------------------------------------------------------------------- */
Next[y][x] = Xexit_1;
}
+ play_element_sound(x, y, SAMPLE_exit_open, Xexit);
+
goto loop;
case Xexit_1:
case Xacid_6:
case Xacid_7:
case Xacid_8:
+#if 1
+ Cave[y][x] = Xsand_stonesand_quickout_1;
+ if (Cave[y][x+1] == Xblank)
+ Cave[y][x+1] = Yacid_splash_eB;
+ if (Cave[y][x-1] == Xblank)
+ Cave[y][x-1] = Yacid_splash_wB;
+ Next[y][x] = Xsand_stonesand_quickout_2;
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
+ goto loop;
+#else
Cave[y][x] = Xsand_stonesand_3;
if (Cave[y][x+1] == Xblank)
Cave[y][x+1] = Yacid_splash_eB;
if (Cave[y][x-1] == Xblank)
Cave[y][x-1] = Yacid_splash_wB;
Next[y][x] = Xsand_stonesand_4;
- play_sound(x, y, SAMPLE_acid);
+ play_element_sound(x, y, SAMPLE_acid, Xacid_1);
goto loop;
+#endif
case Xblank:
case Yacid_splash_eB:
case Yacid_splash_wB:
+#if 1
+ Cave[y][x] = Xsand_stonesand_quickout_1;
+ Cave[y+1][x] = Xsand_stoneout_1;
+ Next[y][x] = Xsand_stonesand_quickout_2;
+ Next[y+1][x] = Xsand_stoneout_2;
+ goto loop;
+#else
Cave[y][x] = Xsand_stonesand_3;
Cave[y+1][x] = Xsand_stoneout_1;
Next[y][x] = Xsand_stonesand_4;
Next[y+1][x] = Xsand_stoneout_2;
goto loop;
+#endif
case Xsand:
Cave[y][x] = Xsand_stonesand_1;
Next[y][x] = Xsand;
goto loop;
+#if 1
+ case Xsand_stonesand_quickout_1:
+ Next[y][x] = Xsand_stonesand_quickout_2;
+ goto loop;
+
+ case Xsand_stonesand_quickout_2:
+ Next[y][x] = Xsand;
+ goto loop;
+#endif
+
case Xsand_stoneout_1:
Next[y][x] = Xsand_stoneout_2;
goto loop;
Boom[y+1][x-1] = Xemerald;
Boom[y+1][x] = Xemerald;
Boom[y+1][x+1] = Xemerald;
-#if 0
+#if PLAY_ELEMENT_SOUND
play_element_sound(x, y, SAMPLE_boom, element);
#endif
goto loop;
Boom[y+1][x-1] = Xblank;
Boom[y+1][x] = Xblank;
Boom[y+1][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
play_element_sound(x, y, SAMPLE_boom, element);
#endif
goto loop;
case Xboom_android:
-#if 0
+#if PLAY_ELEMENT_SOUND
play_element_sound(x, y, SAMPLE_boom, Xandroid);
#endif
case Xboom_1:
Next[y][x] = Xboom_2;
-#if 1
- play_sound(x, y, SAMPLE_boom);
+#if !PLAY_ELEMENT_SOUND
+ if (x != lev.exit_x && y != lev.exit_y)
+ play_sound(x, y, SAMPLE_boom);
+ else
+ lev.exit_x = lev.exit_y = -1;
#endif
goto loop;
done:
- if (ply1.alive || ply2.alive)
- lev.score += score; /* only get a score if someone is alive */
+ if (ply[0].alive || ply[1].alive || ply[2].alive || ply[3].alive)
+ lev.score += score; /* only add a score if someone is alive */
- Random = random;
+ RandomEM = random;
{
void *temp = Cave;