Added sound effects for grow and shrink items.
authorrlk <rlk@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Sun, 8 Apr 2007 17:40:02 +0000 (17:40 +0000)
committerrlk <rlk@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Sun, 8 Apr 2007 17:40:02 +0000 (17:40 +0000)
Added sound effects for large and small ball bounces.

git-svn-id: https://s.snth.net/svn/neverball/trunk@795 78b8d119-cf0a-0410-b17c-f493084dd1d7

ball/game.c
ball/game.h
ball/main.c
ball/st_conf.c
data/snd/bumpbig.ogg [new file with mode: 0644]
data/snd/bumplil.ogg [new file with mode: 0644]
data/snd/grow.ogg [new file with mode: 0644]
data/snd/shrink.ogg [new file with mode: 0644]

index cf86d72..24d66c1 100644 (file)
@@ -92,6 +92,8 @@ static void grow_set(const struct s_file *fp, int type)
 
     if (type == ITEM_SHRINK)
     {
+        audio_play(AUD_SHRINK, 1.f);
+
         if (grow_goal == grow_orig * GROW_SMALL)
             return;
         else if (grow_goal == grow_orig * GROW_BIG)
@@ -107,6 +109,8 @@ static void grow_set(const struct s_file *fp, int type)
     }
     if (type == ITEM_GROW)
     {
+        audio_play(AUD_GROW, 1.f);
+
         if (grow_goal == grow_orig * GROW_BIG)
             return;
         else if (grow_goal == grow_orig * GROW_SMALL)
@@ -919,7 +923,17 @@ int game_step(const float g[3], float dt, int *state_value)
             /* Mix the sound of a ball bounce. */
 
             if (b > 0.5)
-                audio_play(AUD_BUMP, (b - 0.5f) * 2.0f);
+            {
+                float k = (b - 0.5f) * 2.0f;
+                
+                if (got_orig)
+                {
+                    if      (fp->uv->r > grow_orig) audio_play(AUD_BUMPL, k);
+                    else if (fp->uv->r < grow_orig) audio_play(AUD_BUMPS, k);
+                    else                            audio_play(AUD_BUMPM, k);
+                }
+                else audio_play(AUD_BUMPM, k);
+            }
         }
 
         game_step_fade(dt);
index 7a74aed..94b1d66 100644 (file)
 #define AUD_SET    4
 #define AUD_GO     5
 #define AUD_BALL   6
-#define AUD_BUMP   7
-#define AUD_COIN   8
-#define AUD_TICK   9
-#define AUD_TOCK   10
-#define AUD_SWITCH 11
-#define AUD_JUMP   12
-#define AUD_GOAL   13
-#define AUD_SCORE  14
-#define AUD_FALL   15
-#define AUD_TIME   16
-#define AUD_OVER   17
-#define AUD_COUNT  18
+#define AUD_BUMPS  7
+#define AUD_BUMPM  8
+#define AUD_BUMPL  9
+#define AUD_COIN   10
+#define AUD_TICK   11
+#define AUD_TOCK   12
+#define AUD_SWITCH 13
+#define AUD_JUMP   14
+#define AUD_GOAL   15
+#define AUD_SCORE  16
+#define AUD_FALL   17
+#define AUD_TIME   18
+#define AUD_OVER   19
+#define AUD_GROW   20
+#define AUD_SHRINK 21
+#define AUD_COUNT  22
 
 /*---------------------------------------------------------------------------*/
 
index 150bb6a..02155b8 100644 (file)
@@ -364,7 +364,9 @@ int main(int argc, char *argv[])
     audio_bind(AUD_SET,    1, _("snd/set.ogg"));
     audio_bind(AUD_GO,     1, _("snd/go.ogg"));
     audio_bind(AUD_BALL,   2, "snd/ball.ogg");
-    audio_bind(AUD_BUMP,   3, "snd/bump.ogg");
+    audio_bind(AUD_BUMPS,  3, "snd/bumplil.ogg");
+    audio_bind(AUD_BUMPM,  3, "snd/bump.ogg");
+    audio_bind(AUD_BUMPL,  3, "snd/bumpbig.ogg");
     audio_bind(AUD_COIN,   2, "snd/coin.wav");
     audio_bind(AUD_TICK,   4, "snd/tick.ogg");
     audio_bind(AUD_TOCK,   4, "snd/tock.ogg");
@@ -375,6 +377,8 @@ int main(int argc, char *argv[])
     audio_bind(AUD_FALL,   1, _("snd/fall.ogg"));
     audio_bind(AUD_TIME,   1, _("snd/time.ogg"));
     audio_bind(AUD_OVER,   1, _("snd/over.ogg"));
+    audio_bind(AUD_GROW,   5, "snd/grow.ogg");
+    audio_bind(AUD_SHRINK, 5, "snd/shrink.ogg");
 
     audio_init();
 
index 6b0a9b9..0aa123e 100644 (file)
@@ -179,7 +179,7 @@ static int conf_action(int i)
 
             config_set_d(CONFIG_SOUND_VOLUME, n);
             audio_volume(n, m);
-            audio_play(AUD_BUMP, 1.f);
+            audio_play(AUD_BUMPM, 1.f);
 
             gui_toggle(sound_id[n]);
             gui_toggle(sound_id[s]);
@@ -190,7 +190,7 @@ static int conf_action(int i)
 
             config_set_d(CONFIG_MUSIC_VOLUME, n);
             audio_volume(s, n);
-            audio_play(AUD_BUMP, 1.f);
+            audio_play(AUD_BUMPM, 1.f);
 
             gui_toggle(music_id[n]);
             gui_toggle(music_id[m]);
diff --git a/data/snd/bumpbig.ogg b/data/snd/bumpbig.ogg
new file mode 100644 (file)
index 0000000..d3f086c
Binary files /dev/null and b/data/snd/bumpbig.ogg differ
diff --git a/data/snd/bumplil.ogg b/data/snd/bumplil.ogg
new file mode 100644 (file)
index 0000000..e624d08
Binary files /dev/null and b/data/snd/bumplil.ogg differ
diff --git a/data/snd/grow.ogg b/data/snd/grow.ogg
new file mode 100644 (file)
index 0000000..44a2cbd
Binary files /dev/null and b/data/snd/grow.ogg differ
diff --git a/data/snd/shrink.ogg b/data/snd/shrink.ogg
new file mode 100644 (file)
index 0000000..d7f9753
Binary files /dev/null and b/data/snd/shrink.ogg differ