rnd-20040927-3-src
authorHolger Schemel <info@artsoft.org>
Mon, 27 Sep 2004 18:50:02 +0000 (20:50 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:48:06 +0000 (10:48 +0200)
src/conftime.h
src/files.c
src/game_em/init.c
src/game_em/main_em.h
src/game_em/sample.h
src/game_em/sound.c
src/game_em/synchro_1.c
src/game_em/synchro_2.c

index c06a7d10bb7548198158d0fc29811fb3b3341609..c0d96d9cbb9e77872a3d2a66a63b20eee607629a 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2004-09-27 19:23]"
+#define COMPILE_DATE_STRING "[2004-09-27 20:49]"
index 08785811942da40c2588c76d064d81e930ba685e..20eadecd7b52d3d85d445af79ab7d82994a9234a 100644 (file)
@@ -1820,7 +1820,7 @@ void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
   ply2->x_initial = 0;
   ply2->y_initial = 0;
 
-  /* at last, set the two players at their positions in the playfield */
+  /* at last, set the two players to their positions in the playfield */
   for (y = 0; y < lev->height; y++) for (x = 0; x < lev->width; x++)
   {
     if (level->field[x][y] == EL_PLAYER_1)
index 7f775a05322b586bf40a066a4f88e63bef26a70d..c92ebd3658405cd8778bc2bd5e72dd284aea98fa 100644 (file)
@@ -57,6 +57,7 @@ static const char *sound_names[SAMPLE_MAX] =
   "12.collect.au",
   "13.diamond.au",
   "14.squash.au",
+  "14.squash.au",
   "15.drip.au",
   "16.push.au",
   "17.dirt.au",
@@ -97,6 +98,7 @@ static const int sound_volume[SAMPLE_MAX] =
   100,
   100,
   100,
+  100,
   20,
   100,
   100,
@@ -293,6 +295,11 @@ void play_sound(int x, int y, int sample)
 #endif
 }
 
+void play_element_sound(int x, int y, int sample, int element)
+{
+  play_sound(x, y, sample);
+}
+
 void sound_play(void)
 {
 #if 0
index e1173bcb1ca471ecb5f6f06a16c99c2e1378e99e..38320ef693fc0637e9a89d959767fb41e01d9ebf 100644 (file)
@@ -425,6 +425,44 @@ enum
   TILE_MAX
 };
 
+enum
+{
+  SAMPLE_blank = 0,    /* player walks on blank */
+  SAMPLE_roll,         /* player pushes stone/bomb/nut/spring */
+  SAMPLE_stone,                /* stone hits ground */
+  SAMPLE_nut,          /* nut hits ground */
+  SAMPLE_crack,                /* stone hits nut */
+  SAMPLE_bug,          /* bug moves */
+  SAMPLE_tank,         /* tank moves */
+  SAMPLE_android,      /* android places something */
+  SAMPLE_spring,       /* spring hits ground/wall/bumper, stone hits spring */
+  SAMPLE_slurp,                /* spring kills alien */
+  SAMPLE_eater,                /* eater sits/eats diamond */
+  SAMPLE_alien,                /* alien moves */
+  SAMPLE_collect,      /* player collects object */
+  SAMPLE_diamond,      /* diamond/emerald hits ground */
+  SAMPLE_squash,       /* stone squashes diamond */
+  SAMPLE_wonderfall,   /* object falls thru wonderwall */
+  SAMPLE_drip,         /* drip hits ground */
+  SAMPLE_push,         /* player pushes balloon/android */
+  SAMPLE_dirt,         /* player walks on dirt */
+  SAMPLE_acid,         /* acid splashes */
+  SAMPLE_ball,         /* ball places something */
+  SAMPLE_grow,         /* growing wall grows */
+  SAMPLE_wonder,       /* wonderwall moves (is active) */
+  SAMPLE_door,         /* player goes thru door */
+  SAMPLE_exit,         /* player goes in exit */
+  SAMPLE_dynamite,     /* player places dynamite */
+  SAMPLE_tick,         /* dynamite ticks */
+  SAMPLE_press,                /* player presses wheel/wind/switch */
+  SAMPLE_wheel,                /* wheel moves */
+  SAMPLE_boom,         /* explosion */
+  SAMPLE_time,         /* time runs out */
+  SAMPLE_die,          /* player dies */
+
+  SAMPLE_MAX
+};
+
 struct LEVEL
 {
   unsigned int home_initial;          /* number of players (initial) */
index e6bfa36940ee5e0d27f8b8f53e82717aa7f1a435..f84531c22445f62f3ed3292b12875a4c8009f315 100644 (file)
@@ -1,51 +1,59 @@
 #ifndef SAMPLE_H
 #define SAMPLE_H
 
+#include "main_em.h"
+
+#if 0
+
 enum
 {
-  SAMPLE_blank = 0, /* player walks on blank */
-  SAMPLE_roll,      /* player pushes stone/bomb/nut */
-  SAMPLE_stone,     /* stone hits ground */
-  SAMPLE_nut,       /* nut hits ground */
-  SAMPLE_crack,     /* stone hits nut */
-  SAMPLE_bug,       /* bug moves */
-  SAMPLE_tank,      /* tank moves */
-  SAMPLE_android,   /* android places something */
-  SAMPLE_spring,    /* spring hits ground/wall/bumper, stone hits spring */
-  SAMPLE_slurp,     /* spring kills alien */
-  SAMPLE_eater,     /* eater sits/eats diamond */
-  SAMPLE_alien,     /* alien moves */
-  SAMPLE_collect,   /* player collects object */
-  SAMPLE_diamond,   /* diamond/emerald hits ground */
-  SAMPLE_squash,    /* stone squashes diamond; object falls thru wonderwall */
-  SAMPLE_drip,      /* drip hits ground */
-  SAMPLE_push,      /* player pushes spring/balloon/android */
-  SAMPLE_dirt,      /* player walks on dirt */
-  SAMPLE_acid,      /* acid splashes */
-  SAMPLE_ball,      /* ball places something */
-  SAMPLE_grow,      /* growing wall grows */
-  SAMPLE_wonder,    /* wonderwall moves */
-  SAMPLE_door,      /* player goes thru door */
-  SAMPLE_exit,      /* player goes in exit */
-  SAMPLE_dynamite,  /* player places dynamite */
-  SAMPLE_tick,      /* dynamite ticks */
-  SAMPLE_press,     /* player presses wheel/wind/switch */
-  SAMPLE_wheel,     /* wheel moves */
-  SAMPLE_boom,      /* explosion */
-  SAMPLE_time,      /* time runs out */
-  SAMPLE_die,       /* player dies */
+  SAMPLE_blank = 0,    /* player walks on blank */
+  SAMPLE_roll,         /* player pushes stone/bomb/nut/spring */
+  SAMPLE_stone,                /* stone hits ground */
+  SAMPLE_nut,          /* nut hits ground */
+  SAMPLE_crack,                /* stone hits nut */
+  SAMPLE_bug,          /* bug moves */
+  SAMPLE_tank,         /* tank moves */
+  SAMPLE_android,      /* android places something */
+  SAMPLE_spring,       /* spring hits ground/wall/bumper, stone hits spring */
+  SAMPLE_slurp,                /* spring kills alien */
+  SAMPLE_eater,                /* eater sits/eats diamond */
+  SAMPLE_alien,                /* alien moves */
+  SAMPLE_collect,      /* player collects object */
+  SAMPLE_diamond,      /* diamond/emerald hits ground */
+  SAMPLE_squash,       /* stone squashes diamond */
+  SAMPLE_wonderfall,   /* object falls thru wonderwall */
+  SAMPLE_drip,         /* drip hits ground */
+  SAMPLE_push,         /* player pushes balloon/android */
+  SAMPLE_dirt,         /* player walks on dirt */
+  SAMPLE_acid,         /* acid splashes */
+  SAMPLE_ball,         /* ball places something */
+  SAMPLE_grow,         /* growing wall grows */
+  SAMPLE_wonder,       /* wonderwall moves (is active) */
+  SAMPLE_door,         /* player goes thru door */
+  SAMPLE_exit,         /* player goes in exit */
+  SAMPLE_dynamite,     /* player places dynamite */
+  SAMPLE_tick,         /* dynamite ticks */
+  SAMPLE_press,                /* player presses wheel/wind/switch */
+  SAMPLE_wheel,                /* wheel moves */
+  SAMPLE_boom,         /* explosion */
+  SAMPLE_time,         /* time runs out */
+  SAMPLE_die,          /* player dies */
 
   SAMPLE_MAX
 };
 
+#endif
+
 extern void play_sound(int, int, int);
+extern void play_element_sound(int, int, int, int);
 
 extern char play[SAMPLE_MAX];
 extern int sound_pipe[2];
 extern short *sound_data[SAMPLE_MAX];
 extern long sound_length[SAMPLE_MAX];
 
-#define MIXER_MAX 4 /* maximum number of samples we can play at once */
+#define MIXER_MAX 4    /* maximum number of samples we can play at once */
 
 #if defined(AUDIO_UNIX_NATIVE)
 
index 7d971f5f992522cc864d6f2b44ad1395e3e5d447..78a293c577a3a52332d51b83c9038b29c5d635dd 100644 (file)
@@ -27,12 +27,37 @@ static char audioname[] = "/dev/audio";
 
 static const int sound_priority[SAMPLE_MAX] =
 {
-  SAMPLE_exit, SAMPLE_die, SAMPLE_time, SAMPLE_boom, SAMPLE_tick,
-  SAMPLE_collect, SAMPLE_roll, SAMPLE_push, SAMPLE_dynamite, SAMPLE_press,
-  SAMPLE_door, SAMPLE_dirt, SAMPLE_blank, SAMPLE_android, SAMPLE_ball,
-  SAMPLE_grow, SAMPLE_squash, SAMPLE_crack, SAMPLE_slurp, SAMPLE_drip,
-  SAMPLE_wonder, SAMPLE_wheel, SAMPLE_stone, SAMPLE_spring, SAMPLE_diamond,
-  SAMPLE_nut, SAMPLE_bug, SAMPLE_tank, SAMPLE_eater, SAMPLE_alien,
+  SAMPLE_exit,
+  SAMPLE_die,
+  SAMPLE_time,
+  SAMPLE_boom,
+  SAMPLE_tick,
+  SAMPLE_collect,
+  SAMPLE_roll,
+  SAMPLE_push,
+  SAMPLE_dynamite,
+  SAMPLE_press,
+  SAMPLE_door,
+  SAMPLE_dirt,
+  SAMPLE_blank,
+  SAMPLE_android,
+  SAMPLE_ball,
+  SAMPLE_grow,
+  SAMPLE_squash,
+  SAMPLE_wonderfall,
+  SAMPLE_crack,
+  SAMPLE_slurp,
+  SAMPLE_drip,
+  SAMPLE_wonder,
+  SAMPLE_wheel,
+  SAMPLE_stone,
+  SAMPLE_spring,
+  SAMPLE_diamond,
+  SAMPLE_nut,
+  SAMPLE_bug,
+  SAMPLE_tank,
+  SAMPLE_eater,
+  SAMPLE_alien,
   SAMPLE_acid
 };
 
index e83a38f7b8200b0846c0a64064f33663f2ed0107..0ff540e35a87640410ca97d52a0531de0271f5d8 100644 (file)
@@ -84,6 +84,9 @@ static int test(struct PLAYER *ply)
   register unsigned int x = ply->x;
   register unsigned int y = ply->y;
 
+  if (!ply->alive)
+    return 0;
+
   if (lev.time == 0)
     return(1);
 
@@ -410,6 +413,8 @@ static void player(struct PLAYER *ply)
 
   if (ply->joy_fire == 0)
   {
+    int element = Cave[y][x];
+
     switch(Cave[y][x])
     {
       /* fire is released */
@@ -459,7 +464,7 @@ static void player(struct PLAYER *ply)
        Cave[y][x] = (dy ? (dy < 0 ? Ygrass_nB : Ygrass_sB) :
                      (dx > 0 ? Ygrass_eB : Ygrass_wB));
        Next[y][x] = Zplayer;
-       play_sound(x, y, SAMPLE_dirt);
+       play_element_sound(x, y, SAMPLE_dirt, Xgrass);
        ply->anim = SPR_walk + anim;
        ply->x = x;
        ply->y = y;
@@ -469,7 +474,7 @@ static void player(struct PLAYER *ply)
        Cave[y][x] = (dy ? (dy < 0 ? Ydirt_nB : Ydirt_sB) :
                      (dx > 0 ? Ydirt_eB : Ydirt_wB));
        Next[y][x] = Zplayer;
-       play_sound(x, y, SAMPLE_dirt);
+       play_element_sound(x, y, SAMPLE_dirt, Xdirt);
        ply->anim = SPR_walk + anim;
        ply->x = x;
        ply->y = y;
@@ -479,7 +484,7 @@ static void player(struct PLAYER *ply)
       case Xdiamond_pause:
        Cave[y][x] = Ydiamond_eat;
        Next[y][x] = Zplayer;
-       play_sound(x, y, SAMPLE_collect);
+       play_element_sound(x, y, SAMPLE_collect, element);
        lev.score += lev.diamond_score;
        lev.required = lev.required < 3 ? 0 : lev.required - 3;
        ply->anim = SPR_walk + anim;
@@ -491,7 +496,7 @@ static void player(struct PLAYER *ply)
       case Xemerald_pause:
        Cave[y][x] = Yemerald_eat;
        Next[y][x] = Zplayer;
-       play_sound(x, y, SAMPLE_collect);
+       play_element_sound(x, y, SAMPLE_collect, element);
        lev.score += lev.emerald_score;
        lev.required = lev.required < 1 ? 0 : lev.required - 1;
        ply->anim = SPR_walk + anim;
@@ -502,7 +507,7 @@ static void player(struct PLAYER *ply)
       case Xdynamite:
        Cave[y][x] = Ydynamite_eat;
        Next[y][x] = Zplayer;
-       play_sound(x, y, SAMPLE_collect);
+       play_element_sound(x, y, SAMPLE_collect, element);
        lev.score += lev.dynamite_score;
        ply->dynamite = ply->dynamite > 9998 ? 9999 : ply->dynamite + 1;
        ply->anim = SPR_walk + anim;
@@ -546,7 +551,7 @@ static void player(struct PLAYER *ply)
 
        Cave[y][x] = Yball_eat;
        Next[y][x] = Zplayer;
-       play_sound(x, y, SAMPLE_collect);
+       play_element_sound(x, y, SAMPLE_collect, element);
        lev.score += lev.key_score;
        ply->anim = SPR_walk + anim;
        ply->x = x;
@@ -556,7 +561,7 @@ static void player(struct PLAYER *ply)
       case Xlenses:
        Cave[y][x] = Yball_eat;
        Next[y][x] = Zplayer;
-       play_sound(x, y, SAMPLE_collect);
+       play_element_sound(x, y, SAMPLE_collect, element);
        lev.score += lev.lenses_score;
        lev.lenses_cnt = lev.lenses_time;
        ply->anim = SPR_walk + anim;
@@ -567,7 +572,7 @@ static void player(struct PLAYER *ply)
       case Xmagnify:
        Cave[y][x] = Yball_eat;
        Next[y][x] = Zplayer;
-       play_sound(x, y, SAMPLE_collect);
+       play_element_sound(x, y, SAMPLE_collect, element);
        lev.score += lev.magnify_score;
        lev.magnify_cnt = lev.magnify_time;
        ply->anim = SPR_walk + anim;
@@ -606,7 +611,7 @@ static void player(struct PLAYER *ply)
 
            Cave[y][x] = dx > 0 ? Ystone_eB : Ystone_wB;
            Next[y][x] = Zplayer;
-           play_sound(x, y, SAMPLE_roll);
+           play_element_sound(x, y, SAMPLE_roll, Xstone);
            ply->x = x;
        }
 
@@ -644,7 +649,7 @@ static void player(struct PLAYER *ply)
 
            Cave[y][x] = dx > 0 ? Ybomb_eB : Ybomb_wB;
            Next[y][x] = Zplayer;
-           play_sound(x, y, SAMPLE_roll);
+           play_element_sound(x, y, SAMPLE_roll, Xbomb);
            ply->x = x;
        }
 
@@ -682,7 +687,7 @@ static void player(struct PLAYER *ply)
 
            Cave[y][x] = dx > 0 ? Ynut_eB : Ynut_wB;
            Next[y][x] = Zplayer;
-           play_sound(x, y, SAMPLE_roll);
+           play_element_sound(x, y, SAMPLE_roll, Xnut);
            ply->x = x;
        }
 
@@ -730,7 +735,7 @@ static void player(struct PLAYER *ply)
          spring_walk:
            Cave[y][x] = dx > 0 ? Yspring_eB : Yspring_wB;
            Next[y][x] = Zplayer;
-           play_sound(x, y, SAMPLE_roll);
+           play_element_sound(x, y, SAMPLE_roll, Xspring);
            ply->x = x;
        }
 
@@ -780,7 +785,7 @@ static void player(struct PLAYER *ply)
            Cave[y][x] = (dy ? (dy < 0 ? Yballoon_nB : Yballoon_sB) :
                          (dx > 0 ? Yballoon_eB : Yballoon_wB));
            Next[y][x] = Zplayer;
-           play_sound(x, y, SAMPLE_push);
+           play_element_sound(x, y, SAMPLE_push, Xballoon);
            ply->x = x;
            ply->y = y;
        }
@@ -826,7 +831,7 @@ static void player(struct PLAYER *ply)
            Cave[y][x] = (dy ? (dy < 0 ? Yandroid_nB : Yandroid_sB) :
                          (dx > 0 ? Yandroid_eB : Yandroid_wB));
            Next[y][x] = Zplayer;
-           play_sound(x, y, SAMPLE_push);
+           play_element_sound(x, y, SAMPLE_push, Xandroid);
            ply->x = x;
            ply->y = y;
        }
@@ -896,14 +901,14 @@ static void player(struct PLAYER *ply)
 
        Cave[y+dy][x+dx] = Zplayer;
        Next[y+dy][x+dx] = Zplayer;
-       play_sound(x, y, SAMPLE_door);
+       play_element_sound(x, y, SAMPLE_door, element);
        ply->anim = SPR_walk + anim;
        ply->x = x + dx;
        ply->y = y + dy;
        break;
 
       case Xwheel:
-       play_sound(x, y, SAMPLE_press);
+       play_element_sound(x, y, SAMPLE_press, element);
        lev.wheel_cnt = lev.wheel_time;
        lev.wheel_x = x;
        lev.wheel_y = y;
@@ -930,17 +935,17 @@ static void player(struct PLAYER *ply)
        goto wind_walk;
 
       wind_walk:
-       play_sound(x, y, SAMPLE_press);
+       play_element_sound(x, y, SAMPLE_press, element);
        lev.wind_cnt = lev.wind_time;
        break;
 
       case Xwind_stop:
-       play_sound(x, y, SAMPLE_press);
+       play_element_sound(x, y, SAMPLE_press, element);
        lev.wind_cnt = 0;
        break;
 
       case Xswitch:
-       play_sound(x, y, SAMPLE_press);
+       play_element_sound(x, y, SAMPLE_press, element);
        lev.ball_cnt = lev.ball_time;
        lev.ball_state = !lev.ball_state;
        break;
@@ -948,7 +953,7 @@ static void player(struct PLAYER *ply)
       case Xplant:
        Cave[y][x] = Yplant;
        Next[y][x] = Xplant;
-       play_sound(x, y, SAMPLE_blank);
+       play_element_sound(x, y, SAMPLE_blank, Xplant);
        ply->anim = SPR_walk + anim;
        ply->x = x;
        ply->y = y;
@@ -968,6 +973,8 @@ static void player(struct PLAYER *ply)
   }
   else
   {
+    int element = Cave[y][x];
+
     switch(Cave[y][x])
     {
       /* fire is pressed */
@@ -976,7 +983,7 @@ static void player(struct PLAYER *ply)
       case Xdirt:
        Cave[y][x] = Yball_eat;
        Next[y][x] = Xblank;
-       play_sound(x, y, SAMPLE_dirt);
+       play_element_sound(x, y, SAMPLE_dirt, element);
        ply->anim = SPR_spray + anim;
        break;
 
@@ -984,7 +991,7 @@ static void player(struct PLAYER *ply)
       case Xdiamond_pause:
        Cave[y][x] = Ydiamond_eat;
        Next[y][x] = Xblank;
-       play_sound(x, y, SAMPLE_collect);
+       play_element_sound(x, y, SAMPLE_collect, element);
        lev.score += lev.diamond_score;
        lev.required = lev.required < 3 ? 0 : lev.required - 3;
        ply->anim = SPR_walk + anim;
@@ -994,7 +1001,7 @@ static void player(struct PLAYER *ply)
       case Xemerald_pause:
        Cave[y][x] = Yemerald_eat;
        Next[y][x] = Xblank;
-       play_sound(x, y, SAMPLE_collect);
+       play_element_sound(x, y, SAMPLE_collect, element);
        lev.score += lev.emerald_score;
        lev.required = lev.required < 1 ? 0 : lev.required - 1;
        ply->anim = SPR_walk + anim;
@@ -1003,7 +1010,7 @@ static void player(struct PLAYER *ply)
       case Xdynamite:
        Cave[y][x] = Ydynamite_eat;
        Next[y][x] = Xblank;
-       play_sound(x, y, SAMPLE_collect);
+       play_element_sound(x, y, SAMPLE_collect, element);
        lev.score += lev.dynamite_score;
        ply->dynamite = ply->dynamite > 9998 ? 9999 : ply->dynamite + 1;
        ply->anim = SPR_walk + anim;
@@ -1044,7 +1051,7 @@ static void player(struct PLAYER *ply)
       key_shoot:
        Cave[y][x] = Yball_eat;
        Next[y][x] = Xblank;
-       play_sound(x, y, SAMPLE_collect);
+       play_element_sound(x, y, SAMPLE_collect, element);
        lev.score += lev.key_score;
        ply->anim = SPR_walk + anim;
        break;
@@ -1052,7 +1059,7 @@ static void player(struct PLAYER *ply)
       case Xlenses:
        Cave[y][x] = Yball_eat;
        Next[y][x] = Xblank;
-       play_sound(x, y, SAMPLE_collect);
+       play_element_sound(x, y, SAMPLE_collect, element);
        lev.score += lev.lenses_score;
        lev.lenses_cnt = lev.lenses_time;
        ply->anim = SPR_walk + anim;
@@ -1061,7 +1068,7 @@ static void player(struct PLAYER *ply)
       case Xmagnify:
        Cave[y][x] = Yball_eat;
        Next[y][x] = Xblank;
-       play_sound(x, y, SAMPLE_collect);
+       play_element_sound(x, y, SAMPLE_collect, element);
        lev.score += lev.magnify_score;
        lev.magnify_cnt = lev.magnify_time;
        ply->anim = SPR_walk + anim;
index c8a50916fac0e25fa3848bab0a02397d4478d503..d8f7913ce534e5efba868acf402f11338ea0ba8e 100644 (file)
@@ -27,10 +27,13 @@ void synchro_2(void)
   unsigned int temp = 0;       /* initialized to make compilers happy */
   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;
@@ -746,7 +749,7 @@ void synchro_2(void)
            }
 
            Next[y][x] = Xblank;
-           play_sound(x, y, SAMPLE_squash);
+           play_element_sound(x, y, SAMPLE_wonderfall, Xstone);
            goto loop;
          }
 
@@ -2858,7 +2861,7 @@ void synchro_2(void)
       {
        Cave[y][x+1] = Ydiamond_eat;
        Next[y][x+1] = Xblank;
-       play_sound(x, y, SAMPLE_eater);
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -2866,7 +2869,7 @@ void synchro_2(void)
       {
        Cave[y+1][x] = Ydiamond_eat;
        Next[y+1][x] = Xblank;
-       play_sound(x, y, SAMPLE_eater);
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -2874,7 +2877,7 @@ void synchro_2(void)
       {
        Cave[y][x-1] = Ydiamond_eat;
        Next[y][x-1] = Xblank;
-       play_sound(x, y, SAMPLE_eater);
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -2882,7 +2885,7 @@ void synchro_2(void)
       {
        Cave[y-1][x] = Ydiamond_eat;
        Next[y-1][x] = Xblank;
-       play_sound(x, y, SAMPLE_eater);
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -2930,7 +2933,7 @@ void synchro_2(void)
       {
        Cave[y+1][x] = Ydiamond_eat;
        Next[y+1][x] = Xblank;
-       play_sound(x, y, SAMPLE_eater);
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -2938,7 +2941,7 @@ void synchro_2(void)
       {
        Cave[y][x-1] = Ydiamond_eat;
        Next[y][x-1] = Xblank;
-       play_sound(x, y, SAMPLE_eater);
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -2946,7 +2949,7 @@ void synchro_2(void)
       {
        Cave[y-1][x] = Ydiamond_eat;
        Next[y-1][x] = Xblank;
-       play_sound(x, y, SAMPLE_eater);
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -2954,7 +2957,7 @@ void synchro_2(void)
       {
        Cave[y][x+1] = Ydiamond_eat;
        Next[y][x+1] = Xblank;
-       play_sound(x, y, SAMPLE_eater);
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -3002,7 +3005,7 @@ void synchro_2(void)
       {
        Cave[y][x-1] = Ydiamond_eat;
        Next[y][x-1] = Xblank;
-       play_sound(x, y, SAMPLE_eater);
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -3010,7 +3013,7 @@ void synchro_2(void)
       {
        Cave[y-1][x] = Ydiamond_eat;
        Next[y-1][x] = Xblank;
-       play_sound(x, y, SAMPLE_eater);
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -3018,7 +3021,7 @@ void synchro_2(void)
       {
        Cave[y][x+1] = Ydiamond_eat;
        Next[y][x+1] = Xblank;
-       play_sound(x, y, SAMPLE_eater);
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -3026,7 +3029,7 @@ void synchro_2(void)
       {
        Cave[y+1][x] = Ydiamond_eat;
        Next[y+1][x] = Xblank;
-       play_sound(x, y, SAMPLE_eater);
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -3074,7 +3077,7 @@ void synchro_2(void)
       {
        Cave[y-1][x] = Ydiamond_eat;
        Next[y-1][x] = Xblank;
-       play_sound(x, y, SAMPLE_eater);
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -3082,7 +3085,7 @@ void synchro_2(void)
       {
        Cave[y][x+1] = Ydiamond_eat;
        Next[y][x+1] = Xblank;
-       play_sound(x, y, SAMPLE_eater);
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -3090,7 +3093,7 @@ void synchro_2(void)
       {
        Cave[y+1][x] = Ydiamond_eat;
        Next[y+1][x] = Xblank;
-       play_sound(x, y, SAMPLE_eater);
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -3098,7 +3101,7 @@ void synchro_2(void)
       {
        Cave[y][x-1] = Ydiamond_eat;
        Next[y][x-1] = Xblank;
-       play_sound(x, y, SAMPLE_eater);
+       play_element_sound(x, y, SAMPLE_eater, Xdiamond);
        goto loop;
       }
 
@@ -3548,14 +3551,14 @@ void synchro_2(void)
            }
 
            Next[y][x] = Xblank;
-           play_sound(x, y, SAMPLE_squash);
+           play_element_sound(x, y, SAMPLE_wonderfall, Xemerald);
            goto loop;
          }
 
        default:
          Cave[y][x] = Xemerald;
          Next[y][x] = Xemerald;
-         play_sound(x, y, SAMPLE_diamond);
+         play_element_sound(x, y, SAMPLE_diamond, Xemerald);
          goto loop;
       }
 
@@ -3775,14 +3778,14 @@ void synchro_2(void)
            }
 
            Next[y][x] = Xblank;
-           play_sound(x, y, SAMPLE_squash);
+           play_element_sound(x, y, SAMPLE_wonderfall, Xdiamond);
            goto loop;
          }
 
        default:
          Cave[y][x] = Xdiamond;
          Next[y][x] = Xdiamond;
-         play_sound(x, y, SAMPLE_diamond);
+         play_element_sound(x, y, SAMPLE_diamond, Xdiamond);
          goto loop;
       }
 
@@ -4282,7 +4285,7 @@ void synchro_2(void)
 
     ball_common:
 
-      play_sound(x, y, SAMPLE_ball);
+      play_element_sound(x, y, SAMPLE_ball, element);
       if (lev.ball_random)
       {
        switch (RANDOM & 7)