rnd-20040928-1-src
[rocksndiamonds.git] / src / game_em / synchro_2.c
index 4fbf2d9f182a56ac443bb2bc9310455fd3a0c416..662ad2e53630f521ee873bf3be648d9c682c0419 100644 (file)
 #include "sample.h"
 
 
-#if defined(TARGET_X11)
-
 #define RANDOM (random = random << 31 | random >> 1)
-#define PLAY(sample) { if ((unsigned int)(y - top) <= 12 && (unsigned int)(x - left) <= 20) play[sample] = 1; }
-
-extern unsigned int screen_x;
-extern unsigned int screen_y;
 
 void synchro_2(void)
 {
@@ -31,14 +25,15 @@ void synchro_2(void)
   unsigned long score = 0;
 
   unsigned int temp = 0;       /* initialized to make compilers happy */
-  unsigned int left = screen_x / TILEX; /* only needed for sounds */
-  unsigned int top = screen_y / TILEY;
   unsigned int dx; /* only needed to find closest player */
   unsigned int dy;
+  int element;
 
  loop:
 
-  switch (cave_cache[++x])
+  element = cave_cache[++x];
+
+  switch (element)
   {
     default:
       goto loop;
@@ -353,7 +348,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -484,7 +479,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -521,7 +516,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -539,7 +534,7 @@ void synchro_2(void)
          Cave[y+1][x] = Yemerald_stone;
          Next[y][x] = Xstone;
          Next[y+1][x] = Xemerald;
-         play[SAMPLE_crack] = 1;
+         play_element_sound(x, y, SAMPLE_crack, Xnut);
          score += lev.nut_score;
          goto loop;
 
@@ -563,6 +558,9 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xemerald;
          Boom[y+2][x] = Xemerald;
          Boom[y+2][x+1] = Xemerald;
+#if 0
+         play_element_sound(x, y, SAMPLE_boom, element);
+#endif
          score += lev.bug_score;
          goto loop;
 
@@ -586,6 +584,9 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xblank;
          Boom[y+2][x] = Xblank;
          Boom[y+2][x+1] = Xblank;
+#if 0
+         play_element_sound(x, y, SAMPLE_boom, element);
+#endif
          score += lev.tank_score;
          goto loop;
 
@@ -643,6 +644,9 @@ void synchro_2(void)
          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
+         play_element_sound(x, y, SAMPLE_boom, element);
+#endif
          lev.eater_pos = (lev.eater_pos + 1) & 7;
          score += lev.eater_score;
          goto loop;
@@ -661,6 +665,9 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xblank;
          Boom[y+2][x] = Xblank;
          Boom[y+2][x+1] = Xblank;
+#if 0
+         play_element_sound(x, y, SAMPLE_boom, element);
+#endif
          score += lev.alien_score;
          goto loop;
 
@@ -715,7 +722,7 @@ void synchro_2(void)
            case Xplant:
            case Yplant:
              Next[y][x] = Xstone;
-             PLAY(SAMPLE_stone);
+             play_element_sound(x, y, SAMPLE_stone, Xstone);
              goto loop;
          }
 
@@ -723,7 +730,7 @@ void synchro_2(void)
          Cave[y+1][x] = Ydiamond_stone;
          Next[y][x] = Xblank;
          Next[y+1][x] = Xstone_pause;
-         play[SAMPLE_squash] = 1;
+         play_element_sound(x, y, SAMPLE_squash, Xdiamond);
          goto loop;
 
        case Xbomb:
@@ -739,6 +746,9 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xblank;
          Boom[y+2][x] = Xblank;
          Boom[y+2][x+1] = Xblank;
+#if 0
+         play_element_sound(x, y, SAMPLE_boom, element);
+#endif
          goto loop;
 
        case Xwonderwall:
@@ -754,14 +764,14 @@ void synchro_2(void)
            }
 
            Next[y][x] = Xblank;
-           play[SAMPLE_squash] = 1;
+           play_element_sound(x, y, SAMPLE_wonderfall, Xstone);
            goto loop;
          }
 
        default:
          Cave[y][x] = Xstone;
          Next[y][x] = Xstone;
-         PLAY(SAMPLE_stone);
+         play_element_sound(x, y, SAMPLE_stone, Xstone);
          goto loop;
       }
 
@@ -784,7 +794,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -905,7 +915,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -942,7 +952,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -958,17 +968,17 @@ void synchro_2(void)
        default:
          Cave[y][x] = Xnut;
          Next[y][x] = Xnut;
-         PLAY(SAMPLE_nut);
+         play_element_sound(x, y, SAMPLE_nut, Xnut);
          goto loop;
       }
 
     /* --------------------------------------------------------------------- */
 
     case Xbug_n:
-      if (tab_ameuba[Cave[y-1][x]] ||
-         tab_ameuba[Cave[y][x+1]] ||
-         tab_ameuba[Cave[y+1][x]] ||
-         tab_ameuba[Cave[y][x-1]])
+      if (tab_amoeba[Cave[y-1][x]] ||
+         tab_amoeba[Cave[y][x+1]] ||
+         tab_amoeba[Cave[y+1][x]] ||
+         tab_amoeba[Cave[y][x-1]])
        goto bug_boom;
 
       switch (Cave[y][x+1])
@@ -989,7 +999,7 @@ void synchro_2(void)
        case Zplayer:
          Cave[y][x] = Ybug_n_e;
          Next[y][x] = Xbug_goe;
-         PLAY(SAMPLE_bug);
+         play_sound(x, y, SAMPLE_bug);
          goto loop;
 
        default:
@@ -997,10 +1007,10 @@ void synchro_2(void)
        }
 
     case Xbug_gon:
-      if (tab_ameuba[Cave[y-1][x]] ||
-         tab_ameuba[Cave[y][x+1]] ||
-         tab_ameuba[Cave[y+1][x]] ||
-         tab_ameuba[Cave[y][x-1]])
+      if (tab_amoeba[Cave[y-1][x]] ||
+         tab_amoeba[Cave[y][x+1]] ||
+         tab_amoeba[Cave[y+1][x]] ||
+         tab_amoeba[Cave[y][x-1]])
        goto bug_boom;
 
     bug_gon:
@@ -1021,7 +1031,7 @@ void synchro_2(void)
          if (Cave[y-2][x-1] == Xblank)
            Cave[y-2][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -1034,23 +1044,23 @@ void synchro_2(void)
          Cave[y-1][x] = Ybug_n;
          Next[y][x] = Xblank;
          Next[y-1][x] = Xbug_n;
-         PLAY(SAMPLE_bug);
+         play_sound(x, y, SAMPLE_bug);
          goto loop;
 
        default:
          Cave[y][x] = Ybug_n_w;
          Next[y][x] = Xbug_gow;
-         PLAY(SAMPLE_bug);
+         play_sound(x, y, SAMPLE_bug);
          goto loop;
       }
 
     /* --------------------------------------------------------------------- */
 
     case Xbug_e:
-      if (tab_ameuba[Cave[y-1][x]] ||
-         tab_ameuba[Cave[y][x+1]] ||
-         tab_ameuba[Cave[y+1][x]] ||
-         tab_ameuba[Cave[y][x-1]])
+      if (tab_amoeba[Cave[y-1][x]] ||
+         tab_amoeba[Cave[y][x+1]] ||
+         tab_amoeba[Cave[y+1][x]] ||
+         tab_amoeba[Cave[y][x-1]])
        goto bug_boom;
 
       switch (Cave[y+1][x])
@@ -1071,7 +1081,7 @@ void synchro_2(void)
        case Zplayer:
          Cave[y][x] = Ybug_e_s;
          Next[y][x] = Xbug_gos;
-         PLAY(SAMPLE_bug);
+         play_sound(x, y, SAMPLE_bug);
          goto loop;
 
        default:
@@ -1079,10 +1089,10 @@ void synchro_2(void)
       }
 
     case Xbug_goe:
-      if (tab_ameuba[Cave[y-1][x]] ||
-         tab_ameuba[Cave[y][x+1]] ||
-         tab_ameuba[Cave[y+1][x]] ||
-         tab_ameuba[Cave[y][x-1]])
+      if (tab_amoeba[Cave[y-1][x]] ||
+         tab_amoeba[Cave[y][x+1]] ||
+         tab_amoeba[Cave[y+1][x]] ||
+         tab_amoeba[Cave[y][x-1]])
        goto bug_boom;
 
     bug_goe:
@@ -1103,7 +1113,7 @@ void synchro_2(void)
          if (Cave[y-1][x] == Xblank)
            Cave[y-1][x] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -1116,23 +1126,23 @@ void synchro_2(void)
          Cave[y][x+1] = Ybug_e;
          Next[y][x] = Xblank;
          Next[y][x+1] = Xbug_e;
-         PLAY(SAMPLE_bug);
+         play_sound(x, y, SAMPLE_bug);
          goto loop;
 
        default:
          Cave[y][x] = Ybug_e_n;
          Next[y][x] = Xbug_gon;
-         PLAY(SAMPLE_bug);
+         play_sound(x, y, SAMPLE_bug);
          goto loop;
       }
 
     /* --------------------------------------------------------------------- */
 
     case Xbug_s:
-      if (tab_ameuba[Cave[y-1][x]] ||
-         tab_ameuba[Cave[y][x+1]] ||
-         tab_ameuba[Cave[y+1][x]] ||
-         tab_ameuba[Cave[y][x-1]])
+      if (tab_amoeba[Cave[y-1][x]] ||
+         tab_amoeba[Cave[y][x+1]] ||
+         tab_amoeba[Cave[y+1][x]] ||
+         tab_amoeba[Cave[y][x-1]])
        goto bug_boom;
 
       switch (Cave[y][x-1])
@@ -1153,7 +1163,7 @@ void synchro_2(void)
        case Zplayer:
          Cave[y][x] = Ybug_s_w;
          Next[y][x] = Xbug_gow;
-         PLAY(SAMPLE_bug);
+         play_sound(x, y, SAMPLE_bug);
          goto loop;
 
        default:
@@ -1161,10 +1171,10 @@ void synchro_2(void)
       }
 
     case Xbug_gos:
-      if (tab_ameuba[Cave[y-1][x]] ||
-         tab_ameuba[Cave[y][x+1]] ||
-         tab_ameuba[Cave[y+1][x]] ||
-         tab_ameuba[Cave[y][x-1]])
+      if (tab_amoeba[Cave[y-1][x]] ||
+         tab_amoeba[Cave[y][x+1]] ||
+         tab_amoeba[Cave[y+1][x]] ||
+         tab_amoeba[Cave[y][x-1]])
        goto bug_boom;
 
     bug_gos:
@@ -1185,7 +1195,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -1198,23 +1208,23 @@ void synchro_2(void)
          Cave[y+1][x] = Ybug_s;
          Next[y][x] = Xblank;
          Next[y+1][x] = Xbug_s;
-         PLAY(SAMPLE_bug);
+         play_sound(x, y, SAMPLE_bug);
          goto loop;
 
        default:
          Cave[y][x] = Ybug_s_e;
          Next[y][x] = Xbug_goe;
-         PLAY(SAMPLE_bug);
+         play_sound(x, y, SAMPLE_bug);
          goto loop;
       }
 
     /* --------------------------------------------------------------------- */
 
     case Xbug_w:
-      if (tab_ameuba[Cave[y-1][x]] ||
-         tab_ameuba[Cave[y][x+1]] ||
-         tab_ameuba[Cave[y+1][x]] ||
-         tab_ameuba[Cave[y][x-1]])
+      if (tab_amoeba[Cave[y-1][x]] ||
+         tab_amoeba[Cave[y][x+1]] ||
+         tab_amoeba[Cave[y+1][x]] ||
+         tab_amoeba[Cave[y][x-1]])
        goto bug_boom;
 
       switch (Cave[y-1][x])
@@ -1235,7 +1245,7 @@ void synchro_2(void)
        case Zplayer:
          Cave[y][x] = Ybug_w_n;
          Next[y][x] = Xbug_gon;
-         PLAY(SAMPLE_bug);
+         play_sound(x, y, SAMPLE_bug);
          goto loop;
 
        default:
@@ -1243,10 +1253,10 @@ void synchro_2(void)
       }
 
     case Xbug_gow:
-      if (tab_ameuba[Cave[y-1][x]] ||
-         tab_ameuba[Cave[y][x+1]] ||
-         tab_ameuba[Cave[y+1][x]] ||
-         tab_ameuba[Cave[y][x-1]])
+      if (tab_amoeba[Cave[y-1][x]] ||
+         tab_amoeba[Cave[y][x+1]] ||
+         tab_amoeba[Cave[y+1][x]] ||
+         tab_amoeba[Cave[y][x-1]])
        goto bug_boom;
 
     bug_gow:
@@ -1267,7 +1277,7 @@ void synchro_2(void)
          if (Cave[y-1][x-2] == Xblank)
            Cave[y-1][x-2] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -1280,23 +1290,23 @@ void synchro_2(void)
          Cave[y][x-1] = Ybug_w;
          Next[y][x] = Xblank;
          Next[y][x-1] = Xbug_w;
-         PLAY(SAMPLE_bug);
+         play_sound(x, y, SAMPLE_bug);
          goto loop;
 
        default:
          Cave[y][x] = Ybug_w_s;
          Next[y][x] = Xbug_gos;
-         PLAY(SAMPLE_bug);
+         play_sound(x, y, SAMPLE_bug);
          goto loop;
       }
 
     /* --------------------------------------------------------------------- */
 
     case Xtank_n:
-      if (tab_ameuba[Cave[y-1][x]] ||
-         tab_ameuba[Cave[y][x+1]] ||
-         tab_ameuba[Cave[y+1][x]] ||
-         tab_ameuba[Cave[y][x-1]])
+      if (tab_amoeba[Cave[y-1][x]] ||
+         tab_amoeba[Cave[y][x+1]] ||
+         tab_amoeba[Cave[y+1][x]] ||
+         tab_amoeba[Cave[y][x-1]])
        goto tank_boom;
 
       switch (Cave[y][x-1])
@@ -1317,7 +1327,7 @@ void synchro_2(void)
        case Zplayer:
          Cave[y][x] = Ytank_n_w;
          Next[y][x] = Xtank_gow;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
 
        default:
@@ -1325,10 +1335,10 @@ void synchro_2(void)
       }
 
     case Xtank_gon:
-      if (tab_ameuba[Cave[y-1][x]] ||
-         tab_ameuba[Cave[y][x+1]] ||
-         tab_ameuba[Cave[y+1][x]] ||
-         tab_ameuba[Cave[y][x-1]])
+      if (tab_amoeba[Cave[y-1][x]] ||
+         tab_amoeba[Cave[y][x+1]] ||
+         tab_amoeba[Cave[y+1][x]] ||
+         tab_amoeba[Cave[y][x-1]])
        goto tank_boom;
 
     tank_gon:
@@ -1349,7 +1359,7 @@ void synchro_2(void)
          if (Cave[y-2][x-1] == Xblank)
            Cave[y-2][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -1362,23 +1372,23 @@ void synchro_2(void)
          Cave[y-1][x] = Ytank_n;
          Next[y][x] = Xblank;
          Next[y-1][x] = Xtank_n;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
 
        default:
          Cave[y][x] = Ytank_n_e;
          Next[y][x] = Xtank_goe;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
       }
 
     /* --------------------------------------------------------------------- */
 
     case Xtank_e:
-      if (tab_ameuba[Cave[y-1][x]] ||
-         tab_ameuba[Cave[y][x+1]] ||
-         tab_ameuba[Cave[y+1][x]] ||
-         tab_ameuba[Cave[y][x-1]])
+      if (tab_amoeba[Cave[y-1][x]] ||
+         tab_amoeba[Cave[y][x+1]] ||
+         tab_amoeba[Cave[y+1][x]] ||
+         tab_amoeba[Cave[y][x-1]])
        goto tank_boom;
 
       switch (Cave[y-1][x])
@@ -1399,7 +1409,7 @@ void synchro_2(void)
        case Zplayer:
          Cave[y][x] = Ytank_e_n;
          Next[y][x] = Xtank_gon;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
 
        default:
@@ -1407,10 +1417,10 @@ void synchro_2(void)
       }
 
     case Xtank_goe:
-      if (tab_ameuba[Cave[y-1][x]] ||
-         tab_ameuba[Cave[y][x+1]] ||
-         tab_ameuba[Cave[y+1][x]] ||
-         tab_ameuba[Cave[y][x-1]])
+      if (tab_amoeba[Cave[y-1][x]] ||
+         tab_amoeba[Cave[y][x+1]] ||
+         tab_amoeba[Cave[y+1][x]] ||
+         tab_amoeba[Cave[y][x-1]])
        goto tank_boom;
 
     tank_goe:
@@ -1431,7 +1441,7 @@ void synchro_2(void)
          if (Cave[y-1][x] == Xblank)
            Cave[y-1][x] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -1444,23 +1454,23 @@ void synchro_2(void)
          Cave[y][x+1] = Ytank_e;
          Next[y][x] = Xblank;
          Next[y][x+1] = Xtank_e;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
 
        default:
          Cave[y][x] = Ytank_e_s;
          Next[y][x] = Xtank_gos;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
       }
 
     /* --------------------------------------------------------------------- */
 
     case Xtank_s:
-      if (tab_ameuba[Cave[y-1][x]] ||
-         tab_ameuba[Cave[y][x+1]] ||
-         tab_ameuba[Cave[y+1][x]] ||
-         tab_ameuba[Cave[y][x-1]])
+      if (tab_amoeba[Cave[y-1][x]] ||
+         tab_amoeba[Cave[y][x+1]] ||
+         tab_amoeba[Cave[y+1][x]] ||
+         tab_amoeba[Cave[y][x-1]])
        goto tank_boom;
 
       switch (Cave[y][x+1])
@@ -1481,7 +1491,7 @@ void synchro_2(void)
        case Zplayer:
          Cave[y][x] = Ytank_s_e;
          Next[y][x] = Xtank_goe;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
 
        default:
@@ -1489,10 +1499,10 @@ void synchro_2(void)
       }
 
     case Xtank_gos:
-      if (tab_ameuba[Cave[y-1][x]] ||
-         tab_ameuba[Cave[y][x+1]] ||
-         tab_ameuba[Cave[y+1][x]] ||
-         tab_ameuba[Cave[y][x-1]])
+      if (tab_amoeba[Cave[y-1][x]] ||
+         tab_amoeba[Cave[y][x+1]] ||
+         tab_amoeba[Cave[y+1][x]] ||
+         tab_amoeba[Cave[y][x-1]])
        goto tank_boom;
 
     tank_gos:
@@ -1513,7 +1523,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -1526,23 +1536,23 @@ void synchro_2(void)
          Cave[y+1][x] = Ytank_s;
          Next[y][x] = Xblank;
          Next[y+1][x] = Xtank_s;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
 
        default:
          Cave[y][x] = Ytank_s_w;
          Next[y][x] = Xtank_gow;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
       }
 
     /* --------------------------------------------------------------------- */
 
     case Xtank_w:
-      if (tab_ameuba[Cave[y-1][x]] ||
-         tab_ameuba[Cave[y][x+1]] ||
-         tab_ameuba[Cave[y+1][x]] ||
-         tab_ameuba[Cave[y][x-1]])
+      if (tab_amoeba[Cave[y-1][x]] ||
+         tab_amoeba[Cave[y][x+1]] ||
+         tab_amoeba[Cave[y+1][x]] ||
+         tab_amoeba[Cave[y][x-1]])
        goto tank_boom;
 
       switch (Cave[y+1][x])
@@ -1563,7 +1573,7 @@ void synchro_2(void)
        case Zplayer:
          Cave[y][x] = Ytank_w_s;
          Next[y][x] = Xtank_gos;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
 
        default:
@@ -1571,10 +1581,10 @@ void synchro_2(void)
       }
 
     case Xtank_gow:
-      if (tab_ameuba[Cave[y-1][x]] ||
-         tab_ameuba[Cave[y][x+1]] ||
-         tab_ameuba[Cave[y+1][x]] ||
-         tab_ameuba[Cave[y][x-1]])
+      if (tab_amoeba[Cave[y-1][x]] ||
+         tab_amoeba[Cave[y][x+1]] ||
+         tab_amoeba[Cave[y+1][x]] ||
+         tab_amoeba[Cave[y][x-1]])
        goto tank_boom;
 
     tank_gow:
@@ -1595,7 +1605,7 @@ void synchro_2(void)
          if (Cave[y-1][x-2] == Xblank)
            Cave[y-1][x-2] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -1608,13 +1618,13 @@ void synchro_2(void)
          Cave[y][x-1] = Ytank_w;
          Next[y][x] = Xblank;
          Next[y][x-1] = Xtank_w;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
 
        default:
          Cave[y][x] = Ytank_w_n;
          Next[y][x] = Xtank_gon;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
       }
 
@@ -1730,7 +1740,7 @@ void synchro_2(void)
        }
 
        Next[y][x] = temp; /* the item we chose to clone */
-       play[SAMPLE_android] = 1;
+       play_element_sound(x, y, SAMPLE_android, temp);
 
        switch (RANDOM & 7)
        {
@@ -2002,7 +2012,7 @@ void synchro_2(void)
       Cave[y][x] = Yandroid_nB;
       Cave[y-1][x] = Yandroid_n;
       Next[y-1][x] = Xandroid;
-      PLAY(SAMPLE_tank);
+      play_sound(x, y, SAMPLE_tank);
       goto loop;
 
     android_ne:
@@ -2010,7 +2020,7 @@ void synchro_2(void)
       Cave[y][x] = Yandroid_neB;
       Cave[y-1][x+1] = Yandroid_ne;
       Next[y-1][x+1] = Xandroid;
-      PLAY(SAMPLE_tank);
+      play_sound(x, y, SAMPLE_tank);
       goto loop;
 
     android_e:
@@ -2018,7 +2028,7 @@ void synchro_2(void)
       Cave[y][x] = Yandroid_eB;
       Cave[y][x+1] = Yandroid_e;
       Next[y][x+1] = Xandroid;
-      PLAY(SAMPLE_tank);
+      play_sound(x, y, SAMPLE_tank);
       goto loop;
 
     android_se:
@@ -2026,7 +2036,7 @@ void synchro_2(void)
       Cave[y][x] = Yandroid_seB;
       Cave[y+1][x+1] = Yandroid_se;
       Next[y+1][x+1] = Xandroid;
-      PLAY(SAMPLE_tank);
+      play_sound(x, y, SAMPLE_tank);
       goto loop;
 
     android_s:
@@ -2034,7 +2044,7 @@ void synchro_2(void)
       Cave[y][x] = Yandroid_sB;
       Cave[y+1][x] = Yandroid_s;
       Next[y+1][x] = Xandroid;
-      PLAY(SAMPLE_tank);
+      play_sound(x, y, SAMPLE_tank);
       goto loop;
 
     android_sw:
@@ -2042,7 +2052,7 @@ void synchro_2(void)
       Cave[y][x] = Yandroid_swB;
       Cave[y+1][x-1] = Yandroid_sw;
       Next[y+1][x-1] = Xandroid;
-      PLAY(SAMPLE_tank);
+      play_sound(x, y, SAMPLE_tank);
       goto loop;
 
     android_w:
@@ -2050,7 +2060,7 @@ void synchro_2(void)
       Cave[y][x] = Yandroid_wB;
       Cave[y][x-1] = Yandroid_w;
       Next[y][x-1] = Xandroid;
-      PLAY(SAMPLE_tank);
+      play_sound(x, y, SAMPLE_tank);
       goto loop;
 
     android_nw:
@@ -2058,7 +2068,7 @@ void synchro_2(void)
       Cave[y][x] = Yandroid_nwB;
       Cave[y-1][x-1] = Yandroid_nw;
       Next[y-1][x-1] = Xandroid;
-      PLAY(SAMPLE_tank);
+      play_sound(x, y, SAMPLE_tank);
       goto loop;
 
     /* --------------------------------------------------------------------- */
@@ -2080,7 +2090,7 @@ void synchro_2(void)
          if (Cave[y-2][x-1] == Xblank)
            Cave[y-2][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -2090,7 +2100,7 @@ void synchro_2(void)
          Cave[y-1][x] = Yandroid_n;
          Next[y][x] = Xblank;
          Next[y-1][x] = Xandroid;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
 
        default:
@@ -2114,7 +2124,7 @@ void synchro_2(void)
          if (Cave[y-2][x-1] == Xblank)
            Cave[y-2][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -2124,7 +2134,7 @@ void synchro_2(void)
          Cave[y-1][x] = Yandroid_n;
          Next[y][x] = Xblank;
          Next[y-1][x] = Xandroid_1_n;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
 
        default:
@@ -2150,7 +2160,7 @@ void synchro_2(void)
          if (Cave[y-1][x] == Xblank)
            Cave[y-1][x] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -2160,7 +2170,7 @@ void synchro_2(void)
          Cave[y][x+1] = Yandroid_e;
          Next[y][x] = Xblank;
          Next[y][x+1] = Xandroid;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
 
        default:
@@ -2184,7 +2194,7 @@ void synchro_2(void)
          if (Cave[y-1][x] == Xblank)
            Cave[y-1][x] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -2194,7 +2204,7 @@ void synchro_2(void)
          Cave[y][x+1] = Yandroid_e;
          Next[y][x] = Xblank;
          Next[y][x+1] = Xandroid_1_e;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
 
        default:
@@ -2220,7 +2230,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -2230,7 +2240,7 @@ void synchro_2(void)
          Cave[y+1][x] = Yandroid_s;
          Next[y][x] = Xblank;
          Next[y+1][x] = Xandroid;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
 
        default:
@@ -2254,7 +2264,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -2264,7 +2274,7 @@ void synchro_2(void)
          Cave[y+1][x] = Yandroid_s;
          Next[y][x] = Xblank;
          Next[y+1][x] = Xandroid_1_s;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
 
        default:
@@ -2290,7 +2300,7 @@ void synchro_2(void)
          if (Cave[y-1][x-2] == Xblank)
            Cave[y-1][x-2] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -2300,7 +2310,7 @@ void synchro_2(void)
          Cave[y][x-1] = Yandroid_w;
          Next[y][x] = Xblank;
          Next[y][x-1] = Xandroid;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
 
        default:
@@ -2324,7 +2334,7 @@ void synchro_2(void)
          if (Cave[y-1][x-2] == Xblank)
            Cave[y-1][x-2] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -2334,7 +2344,7 @@ void synchro_2(void)
          Cave[y][x-1] = Yandroid_w;
          Next[y][x] = Xblank;
          Next[y][x-1] = Xandroid_1_w;
-         PLAY(SAMPLE_tank);
+         play_sound(x, y, SAMPLE_tank);
          goto loop;
 
        default:
@@ -2360,7 +2370,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -2514,7 +2524,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -2551,7 +2561,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -2583,7 +2593,7 @@ void synchro_2(void)
          if (Cave[y-1][x] == Xblank)
            Cave[y-1][x] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -2609,7 +2619,7 @@ void synchro_2(void)
          Cave[y][x+1] = Yspring_kill_e;
          Next[y][x] = Xblank;
          Next[y][x+1] = Xspring_e;
-         play[SAMPLE_slurp] = 1;
+         play_element_sound(x, y, SAMPLE_slurp, Xalien);
          score += lev.slurp_score;
          goto loop;
 
@@ -2617,13 +2627,13 @@ void synchro_2(void)
        case XbumperB:
          Cave[y][x+1] = XbumperB;
          Next[y][x] = Xspring_w;
-         PLAY(SAMPLE_spring);
+         play_element_sound(x, y, SAMPLE_spring, Xspring);
          goto loop;
 
        default:
          Cave[y][x] = Xspring;
          Next[y][x] = Xspring;
-         PLAY(SAMPLE_spring);
+         play_element_sound(x, y, SAMPLE_spring, Xspring);
          goto loop;
       }
 
@@ -2646,7 +2656,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -2678,7 +2688,7 @@ void synchro_2(void)
          if (Cave[y-1][x-2] == Xblank)
            Cave[y-1][x-2] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -2704,7 +2714,7 @@ void synchro_2(void)
          Cave[y][x-1] = Yspring_kill_w;
          Next[y][x] = Xblank;
          Next[y][x-1] = Xspring_w;
-         play[SAMPLE_slurp] = 1;
+         play_element_sound(x, y, SAMPLE_slurp, Xalien);
          score += lev.slurp_score;
          goto loop;
 
@@ -2712,13 +2722,13 @@ void synchro_2(void)
        case XbumperB:
          Cave[y][x-1] = XbumperB;
          Next[y][x] = Xspring_e;
-         PLAY(SAMPLE_spring);
+         play_element_sound(x, y, SAMPLE_spring, Xspring);
          goto loop;
 
        default:
          Cave[y][x] = Xspring;
          Next[y][x] = Xspring;
-         PLAY(SAMPLE_spring);
+         play_element_sound(x, y, SAMPLE_spring, Xspring);
          goto loop;
       }
 
@@ -2741,7 +2751,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -2767,6 +2777,9 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xblank;
          Boom[y+2][x] = Xblank;
          Boom[y+2][x+1] = Xblank;
+#if 0
+         play_element_sound(x, y, SAMPLE_boom, element);
+#endif
          goto loop;
 
        case Xbug_n:
@@ -2789,6 +2802,9 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xemerald;
          Boom[y+2][x] = Xemerald;
          Boom[y+2][x+1] = Xemerald;
+#if 0
+         play_element_sound(x, y, SAMPLE_boom, element);
+#endif
          score += lev.bug_score;
          goto loop;
 
@@ -2812,6 +2828,9 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xblank;
          Boom[y+2][x] = Xblank;
          Boom[y+2][x+1] = Xblank;
+#if 0
+         play_element_sound(x, y, SAMPLE_boom, element);
+#endif
          score += lev.tank_score;
          goto loop;
 
@@ -2831,6 +2850,9 @@ void synchro_2(void)
          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
+         play_element_sound(x, y, SAMPLE_boom, element);
+#endif
          lev.eater_pos = (lev.eater_pos + 1) & 7;
          score += lev.eater_score;
          goto loop;
@@ -2849,13 +2871,16 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xblank;
          Boom[y+2][x] = Xblank;
          Boom[y+2][x+1] = Xblank;
+#if 0
+         play_element_sound(x, y, SAMPLE_boom, element);
+#endif
          score += lev.alien_score;
          goto loop;
 
        default:
          Cave[y][x] = Xspring;
          Next[y][x] = Xspring;
-         PLAY(SAMPLE_spring);
+         play_element_sound(x, y, SAMPLE_spring, Xspring);
          goto loop;
       }
 
@@ -2866,7 +2891,7 @@ void synchro_2(void)
       {
        Cave[y][x+1] = Ydiamond_eat;
        Next[y][x+1] = Xblank;
-       play[SAMPLE_eater] = 1;
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -2874,7 +2899,7 @@ void synchro_2(void)
       {
        Cave[y+1][x] = Ydiamond_eat;
        Next[y+1][x] = Xblank;
-       play[SAMPLE_eater] = 1;
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -2882,7 +2907,7 @@ void synchro_2(void)
       {
        Cave[y][x-1] = Ydiamond_eat;
        Next[y][x-1] = Xblank;
-       play[SAMPLE_eater] = 1;
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -2890,7 +2915,7 @@ void synchro_2(void)
       {
        Cave[y-1][x] = Ydiamond_eat;
        Next[y-1][x] = Xblank;
-       play[SAMPLE_eater] = 1;
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -2910,7 +2935,7 @@ void synchro_2(void)
          if (Cave[y-2][x-1] == Xblank)
            Cave[y-2][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -2927,7 +2952,7 @@ void synchro_2(void)
 
        default:
          Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w;
-         PLAY(SAMPLE_eater);
+         play_sound(x, y, SAMPLE_eater);
          goto loop;
       }
 
@@ -2938,7 +2963,7 @@ void synchro_2(void)
       {
        Cave[y+1][x] = Ydiamond_eat;
        Next[y+1][x] = Xblank;
-       play[SAMPLE_eater] = 1;
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -2946,7 +2971,7 @@ void synchro_2(void)
       {
        Cave[y][x-1] = Ydiamond_eat;
        Next[y][x-1] = Xblank;
-       play[SAMPLE_eater] = 1;
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -2954,7 +2979,7 @@ void synchro_2(void)
       {
        Cave[y-1][x] = Ydiamond_eat;
        Next[y-1][x] = Xblank;
-       play[SAMPLE_eater] = 1;
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -2962,7 +2987,7 @@ void synchro_2(void)
       {
        Cave[y][x+1] = Ydiamond_eat;
        Next[y][x+1] = Xblank;
-       play[SAMPLE_eater] = 1;
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -2982,7 +3007,7 @@ void synchro_2(void)
          if (Cave[y-1][x] == Xblank)
            Cave[y-1][x] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -2999,7 +3024,7 @@ void synchro_2(void)
 
        default:
          Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s;
-         PLAY(SAMPLE_eater);
+         play_sound(x, y, SAMPLE_eater);
          goto loop;
       }
 
@@ -3010,7 +3035,7 @@ void synchro_2(void)
       {
        Cave[y][x-1] = Ydiamond_eat;
        Next[y][x-1] = Xblank;
-       play[SAMPLE_eater] = 1;
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -3018,7 +3043,7 @@ void synchro_2(void)
       {
        Cave[y-1][x] = Ydiamond_eat;
        Next[y-1][x] = Xblank;
-       play[SAMPLE_eater] = 1;
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -3026,7 +3051,7 @@ void synchro_2(void)
       {
        Cave[y][x+1] = Ydiamond_eat;
        Next[y][x+1] = Xblank;
-       play[SAMPLE_eater] = 1;
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -3034,7 +3059,7 @@ void synchro_2(void)
       {
        Cave[y+1][x] = Ydiamond_eat;
        Next[y+1][x] = Xblank;
-       play[SAMPLE_eater] = 1;
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -3054,7 +3079,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -3071,7 +3096,7 @@ void synchro_2(void)
 
        default:
          Next[y][x] = RANDOM & 1 ? Xeater_e : Xeater_w;
-         PLAY(SAMPLE_eater);
+         play_sound(x, y, SAMPLE_eater);
          goto loop;
       }
 
@@ -3082,7 +3107,7 @@ void synchro_2(void)
       {
        Cave[y-1][x] = Ydiamond_eat;
        Next[y-1][x] = Xblank;
-       play[SAMPLE_eater] = 1;
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -3090,7 +3115,7 @@ void synchro_2(void)
       {
        Cave[y][x+1] = Ydiamond_eat;
        Next[y][x+1] = Xblank;
-       play[SAMPLE_eater] = 1;
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -3098,7 +3123,7 @@ void synchro_2(void)
       {
        Cave[y+1][x] = Ydiamond_eat;
        Next[y+1][x] = Xblank;
-       play[SAMPLE_eater] = 1;
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -3106,7 +3131,7 @@ void synchro_2(void)
       {
        Cave[y][x-1] = Ydiamond_eat;
        Next[y][x-1] = Xblank;
-       play[SAMPLE_eater] = 1;
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -3126,7 +3151,7 @@ void synchro_2(void)
          if (Cave[y-1][x-2] == Xblank)
            Cave[y-1][x-2] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -3143,7 +3168,7 @@ void synchro_2(void)
 
        default:
          Next[y][x] = RANDOM & 1 ? Xeater_n : Xeater_s;
-         PLAY(SAMPLE_eater);
+         play_sound(x, y, SAMPLE_eater);
          goto loop;
       }
 
@@ -3207,7 +3232,7 @@ void synchro_2(void)
              if (Cave[y-2][x-1] == Xblank)
                Cave[y-2][x-1] = Yacid_splash_wB;
              Next[y][x] = Xblank;
-             PLAY(SAMPLE_acid);
+             play_sound(x, y, SAMPLE_acid);
              goto loop;
 
            case Xblank:
@@ -3220,7 +3245,7 @@ void synchro_2(void)
              Cave[y-1][x] = Yalien_n;
              Next[y][x] = Xblank;
              Next[y-1][x] = Xalien_pause;
-             PLAY(SAMPLE_alien);
+             play_element_sound(x, y, SAMPLE_alien, Xalien);
              goto loop;
          }
        }
@@ -3242,7 +3267,7 @@ void synchro_2(void)
                Cave[y][x+1] = Yacid_splash_eB;
              if (Cave[y][x-1] == Xblank)
                Cave[y][x-1] = Yacid_splash_wB;
-             PLAY(SAMPLE_acid);
+             play_sound(x, y, SAMPLE_acid);
              goto loop;
 
            case Xblank:
@@ -3255,7 +3280,7 @@ void synchro_2(void)
              Cave[y+1][x] = Yalien_s;
              Next[y][x] = Xblank;
              Next[y+1][x] = Xalien_pause;
-             PLAY(SAMPLE_alien);
+             play_element_sound(x, y, SAMPLE_alien, Xalien);
              goto loop;
          }
        }
@@ -3280,7 +3305,7 @@ void synchro_2(void)
              if (Cave[y-1][x] == Xblank)
                Cave[y-1][x] = Yacid_splash_wB;
              Next[y][x] = Xblank;
-             PLAY(SAMPLE_acid);
+             play_sound(x, y, SAMPLE_acid);
              goto loop;
 
            case Xblank:
@@ -3293,7 +3318,7 @@ void synchro_2(void)
              Cave[y][x+1] = Yalien_e;
              Next[y][x] = Xblank;
              Next[y][x+1] = Xalien_pause;
-             PLAY(SAMPLE_alien);
+             play_element_sound(x, y, SAMPLE_alien, Xalien);
              goto loop;
          }
        }
@@ -3315,7 +3340,7 @@ void synchro_2(void)
              if (Cave[y-1][x-2] == Xblank)
                Cave[y-1][x-2] = Yacid_splash_wB;
              Next[y][x] = Xblank;
-             PLAY(SAMPLE_acid);
+             play_sound(x, y, SAMPLE_acid);
              goto loop;
 
            case Xblank:
@@ -3328,7 +3353,7 @@ void synchro_2(void)
              Cave[y][x-1] = Yalien_w;
              Next[y][x] = Xblank;
              Next[y][x-1] = Xalien_pause;
-             PLAY(SAMPLE_alien);
+             play_element_sound(x, y, SAMPLE_alien, Xalien);
              goto loop;
          }
        }
@@ -3359,7 +3384,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -3494,7 +3519,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -3531,7 +3556,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -3556,14 +3581,14 @@ void synchro_2(void)
            }
 
            Next[y][x] = Xblank;
-           play[SAMPLE_squash] = 1;
+           play_element_sound(x, y, SAMPLE_wonderfall, Xemerald);
            goto loop;
          }
 
        default:
          Cave[y][x] = Xemerald;
          Next[y][x] = Xemerald;
-         PLAY(SAMPLE_diamond);
+         play_element_sound(x, y, SAMPLE_diamond, Xemerald);
          goto loop;
       }
 
@@ -3586,7 +3611,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -3721,7 +3746,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -3758,7 +3783,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -3783,14 +3808,14 @@ void synchro_2(void)
            }
 
            Next[y][x] = Xblank;
-           play[SAMPLE_squash] = 1;
+           play_element_sound(x, y, SAMPLE_wonderfall, Xdiamond);
            goto loop;
          }
 
        default:
          Cave[y][x] = Xdiamond;
          Next[y][x] = Xdiamond;
-         PLAY(SAMPLE_diamond);
+         play_element_sound(x, y, SAMPLE_diamond, Xdiamond);
          goto loop;
       }
 
@@ -3813,7 +3838,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xdrip_stretchB;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -3832,41 +3857,41 @@ void synchro_2(void)
          switch (RANDOM & 7)
          {
            case 0:
-             temp = Xameuba_1;
+             temp = Xamoeba_1;
              break;
 
            case 1:
-             temp = Xameuba_2;
+             temp = Xamoeba_2;
              break;
 
            case 2:
-             temp = Xameuba_3;
+             temp = Xamoeba_3;
              break;
 
            case 3:
-             temp = Xameuba_4;
+             temp = Xamoeba_4;
              break;
 
            case 4:
-             temp = Xameuba_5;
+             temp = Xamoeba_5;
              break;
 
            case 5:
-             temp = Xameuba_6;
+             temp = Xamoeba_6;
              break;
 
            case 6:
-             temp = Xameuba_7;
+             temp = Xamoeba_7;
              break;
 
            case 7:
-             temp = Xameuba_8;
+             temp = Xamoeba_8;
              break;
          }
 
          Cave[y][x] = temp;
          Next[y][x] = temp;
-         play[SAMPLE_drip] = 1;
+         play_element_sound(x, y, SAMPLE_drip, Xdrip_fall);
          goto loop;
       }
 
@@ -3905,7 +3930,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -4025,7 +4050,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -4062,7 +4087,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xblank;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -4086,6 +4111,9 @@ void synchro_2(void)
          Boom[y+1][x-1] = Xblank;
          Boom[y+1][x] = Xblank;
          Boom[y+1][x+1] = Xblank;
+#if 0
+         play_element_sound(x, y, SAMPLE_boom, element);
+#endif
          goto loop;
       }
 
@@ -4114,7 +4142,7 @@ void synchro_2(void)
              if (Cave[y-2][x-1] == Xblank)
                Cave[y-2][x-1] = Yacid_splash_wB;
              Next[y][x] = Xblank;
-             PLAY(SAMPLE_acid);
+             play_sound(x, y, SAMPLE_acid);
              goto loop;
 
            case Xblank:
@@ -4147,7 +4175,7 @@ void synchro_2(void)
              if (Cave[y-1][x] == Xblank)
                Cave[y-1][x] = Yacid_splash_wB;
              Next[y][x] = Xblank;
-             PLAY(SAMPLE_acid);
+             play_sound(x, y, SAMPLE_acid);
              goto loop;
 
            case Xblank:
@@ -4180,7 +4208,7 @@ void synchro_2(void)
              if (Cave[y][x-1] == Xblank)
                Cave[y][x-1] = Yacid_splash_wB;
              Next[y][x] = Xblank;
-             PLAY(SAMPLE_acid);
+             play_sound(x, y, SAMPLE_acid);
              goto loop;
 
            case Xblank:
@@ -4213,7 +4241,7 @@ void synchro_2(void)
              if (Cave[y-1][x-2] == Xblank)
                Cave[y-1][x-2] = Yacid_splash_wB;
              Next[y][x] = Xblank;
-             PLAY(SAMPLE_acid);
+             play_sound(x, y, SAMPLE_acid);
              goto loop;
 
            case Xblank:
@@ -4290,7 +4318,7 @@ void synchro_2(void)
 
     ball_common:
 
-      play[SAMPLE_ball] = 1;
+      play_element_sound(x, y, SAMPLE_ball, element);
       if (lev.ball_random)
       {
        switch (RANDOM & 7)
@@ -4437,14 +4465,14 @@ void synchro_2(void)
       {
        Cave[y-1][x] = Ygrow_ns_eat;
        Next[y-1][x] = Xgrow_ns;
-       play[SAMPLE_grow] = 1;
+       play_element_sound(x, y, SAMPLE_grow, Xgrow_ns);
       }
 
       if (tab_blank[Cave[y+1][x]])
       {
        Cave[y+1][x] = Ygrow_ns_eat;
        Next[y+1][x] = Xgrow_ns;
-       play[SAMPLE_grow] = 1;
+       play_element_sound(x, y, SAMPLE_grow, Xgrow_ns);
       }
 
       goto loop;
@@ -4454,14 +4482,14 @@ void synchro_2(void)
       {
        Cave[y][x+1] = Ygrow_ew_eat;
        Next[y][x+1] = Xgrow_ew;
-       play[SAMPLE_grow] = 1;
+       play_element_sound(x, y, SAMPLE_grow, Xgrow_ew);
       }
 
       if (tab_blank[Cave[y][x-1]])
       {
        Cave[y][x-1] = Ygrow_ew_eat;
        Next[y][x-1] = Xgrow_ew;
-       play[SAMPLE_grow] = 1;
+       play_element_sound(x, y, SAMPLE_grow, Xgrow_ew);
       }
 
       goto loop;
@@ -4472,7 +4500,7 @@ void synchro_2(void)
       if (lev.wonderwall_time && lev.wonderwall_state)
       {
        Cave[y][x] = XwonderwallB;
-       play[SAMPLE_wonder] = 1;
+       play_element_sound(x, y, SAMPLE_wonder, Xwonderwall);
       }
 
       goto loop;
@@ -4517,22 +4545,22 @@ void synchro_2(void)
     /* --------------------------------------------------------------------- */
 
     case Xdynamite_1:
-      play[SAMPLE_tick] = 1;
+      play_element_sound(x, y, SAMPLE_tick, Xdynamite_1);
       Next[y][x] = Xdynamite_2;
       goto loop;
 
     case Xdynamite_2:
-      play[SAMPLE_tick] = 1;
+      play_element_sound(x, y, SAMPLE_tick, Xdynamite_2);
       Next[y][x] = Xdynamite_3;
       goto loop;
 
     case Xdynamite_3:
-      play[SAMPLE_tick] = 1;
+      play_element_sound(x, y, SAMPLE_tick, Xdynamite_3);
       Next[y][x] = Xdynamite_4;
       goto loop;
 
     case Xdynamite_4:
-      play[SAMPLE_tick] = 1;
+      play_element_sound(x, y, SAMPLE_tick, Xdynamite_4);
       Next[y][x] = Zdynamite;
       Boom[y-1][x-1] = Xblank;
       Boom[y-1][x] = Xblank;
@@ -4578,7 +4606,7 @@ void synchro_2(void)
          if (Cave[y][x-1] == Xblank)
            Cave[y][x-1] = Yacid_splash_wB;
          Next[y][x] = Xsand_stonesand_4;
-         PLAY(SAMPLE_acid);
+         play_sound(x, y, SAMPLE_acid);
          goto loop;
 
        case Xblank:
@@ -4734,6 +4762,9 @@ void synchro_2(void)
       Boom[y+1][x-1] = Xemerald;
       Boom[y+1][x] = Xemerald;
       Boom[y+1][x+1] = Xemerald;
+#if 0
+      play_element_sound(x, y, SAMPLE_boom, element);
+#endif
       goto loop;
 
     case Xboom_bomb:
@@ -4750,12 +4781,20 @@ void synchro_2(void)
       Boom[y+1][x-1] = Xblank;
       Boom[y+1][x] = Xblank;
       Boom[y+1][x+1] = Xblank;
+#if 0
+      play_element_sound(x, y, SAMPLE_boom, element);
+#endif
       goto loop;
 
     case Xboom_android:
+#if 0
+      play_element_sound(x, y, SAMPLE_boom, Xandroid);
+#endif
     case Xboom_1:
       Next[y][x] = Xboom_2;
-      play[SAMPLE_boom] = 1;
+#if 1
+      play_sound(x, y, SAMPLE_boom);
+#endif
       goto loop;
 
     case Xboom_2:
@@ -4795,5 +4834,3 @@ void synchro_2(void)
     Draw = temp;
   }
 }
-
-#endif