rnd-20100521-1-src
[rocksndiamonds.git] / src / game_em / sound.c
index 7d971f5f992522cc864d6f2b44ad1395e3e5d447..c1334cc7bb05381cada4ab00d9b26452cb13964d 100644 (file)
@@ -3,7 +3,7 @@
  * handle sounds in emerald mine
  */
 
-#include "game_em.h"
+#include "main_em.h"
 
 
 #if defined(AUDIO_UNIX_NATIVE)
 #include <soundcard.h>
 #endif
 
-#include "global.h"
-#include "sample.h"
-
 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_open,
+  SAMPLE_exit_leave,
+  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_clone,
+  SAMPLE_android_move,
+  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_eater_eat,
+  SAMPLE_alien,
   SAMPLE_acid
 };
 
@@ -61,7 +86,7 @@ int sound_thread(void)
   mix_buffer = 0;
   mix_count = 0;
 
-  memset(sound_play, 0, sizeof(sound_play)); /* not playing any sounds */
+  clear_mem(sound_play, sizeof(sound_play)); /* not playing any sounds */
 
   for (;;)
   {
@@ -69,7 +94,9 @@ int sound_thread(void)
     {
 
       /* pick sounds to play, if any */
-      if (sound_play[SAMPLE_exit] || sound_play[SAMPLE_die])
+      if (sound_play[SAMPLE_exit_open] ||
+         sound_play[SAMPLE_exit_leave] ||
+         sound_play[SAMPLE_die])
        sound_play[SAMPLE_boom] = 0; /* no explosions if player goes home */
 
       mix_count = 0;
@@ -267,7 +294,7 @@ int sound_thread(void)
     if (mix_count && audio_fd != -1)
     {
       /* prepare mix buffer */
-      memset(mix_buffer, 0, fragment_size * sizeof(*mix_buffer));
+      clear_mem(mix_buffer, fragment_size * sizeof(*mix_buffer));
 
       for (i = 0; i < mix_count; i++)
       {