Kick and stomp sounds when you hit the laptop. Moved sound defs to sound.h
authorBill Kendrick <nbs@sonic.net>
Sun, 28 Dec 2003 11:05:42 +0000 (11:05 +0000)
committerBill Kendrick <nbs@sonic.net>
Sun, 28 Dec 2003 11:05:42 +0000 (11:05 +0000)
SVN-Revision: 70

CHANGES.txt
src/gameloop.c
src/sound.h

index 1840c33..c9c6537 100644 (file)
@@ -17,6 +17,9 @@ http://www.newbreedsoftware.com/supertux/
     time is running out.
     Bill Kendrick <bill@newbreedsoftware.com>
 
+  * New laptop enemy graphics.  Sounds when you stomp and kick them.
+    Bill Kendrick <bill@newbreedsoftware.com>
+
 
 0.0.5 - December 24th, 2003
 ---------------------------
index a9b374e..67a6ab2 100644 (file)
 #include "world.h"
 #include "player.h"
 
-/* Sound files: */
-
-enum {
-  SND_JUMP,
-  SND_BIGJUMP,
-  SND_SKID,
-  SND_DISTRO,
-  SND_HERRING,
-  SND_BRICK,
-  SND_HURT,
-  SND_SQUISH,
-  SND_FALL,
-  SND_RICOCHET,
-  SND_BUMP_UPGRADE,
-  SND_UPGRADE,
-  SND_EXCELLENT,
-  SND_COFFEE,
-  SND_SHOOT,
-  SND_LIFEUP
-};
-
-
-char * soundfilenames[NUM_SOUNDS] = {
-                                      DATA_PREFIX "/sounds/jump.wav",
-                                      DATA_PREFIX "/sounds/bigjump.wav",
-                                      DATA_PREFIX "/sounds/skid.wav",
-                                      DATA_PREFIX "/sounds/distro.wav",
-                                      DATA_PREFIX "/sounds/herring.wav",
-                                      DATA_PREFIX "/sounds/brick.wav",
-                                      DATA_PREFIX "/sounds/hurt.wav",
-                                      DATA_PREFIX "/sounds/squish.wav",
-                                      DATA_PREFIX "/sounds/fall.wav",
-                                      DATA_PREFIX "/sounds/ricochet.wav",
-                                      DATA_PREFIX "/sounds/bump-upgrade.wav",
-                                      DATA_PREFIX "/sounds/upgrade.wav",
-                                      DATA_PREFIX "/sounds/excellent.wav",
-                                      DATA_PREFIX "/sounds/coffee.wav",
-                                      DATA_PREFIX "/sounds/shoot.wav",
-                                      DATA_PREFIX "/sounds/lifeup.wav"
-                                    };
-
 
 /* Local variables: */
 
@@ -1488,6 +1447,7 @@ int game_action(void)
                         {
                           /* Flatten! */
 
+                          play_sound(sounds[SND_STOMP]);
                           bad_guys[i].mode = FLAT;
 
                           bad_guys[i].timer = 64;
@@ -1499,6 +1459,7 @@ int game_action(void)
                           /* Kick! */
 
                           bad_guys[i].mode = KICK;
+                          play_sound(sounds[SND_KICK]);
 
                           if (tux_x + scroll_x <= bad_guys[i].x)
                             bad_guys[i].dir = RIGHT;
@@ -1559,6 +1520,7 @@ int game_action(void)
                           /* Step on (stop being kicked) */
 
                           bad_guys[i].mode = FLAT;
+                          play_sound(sounds[SND_STOMP]);
                           bad_guys[i].timer = 64;
                         }
                       else
index e47d488..4eb702a 100644 (file)
@@ -18,9 +18,6 @@
 
 #include "defines.h"     /* get YES/NO defines */
 
-/*all the sounds we have*/
-#define NUM_SOUNDS 16
-
 /*global variable*/
 int use_sound;
 int use_music;
@@ -34,6 +31,52 @@ enum Music_Type {
   HERRING_MUSIC
 } current_music;
 
+/* Sound files: */
+
+enum {
+  SND_JUMP,
+  SND_BIGJUMP,
+  SND_SKID,
+  SND_DISTRO,
+  SND_HERRING,
+  SND_BRICK,
+  SND_HURT,
+  SND_SQUISH,
+  SND_FALL,
+  SND_RICOCHET,
+  SND_BUMP_UPGRADE,
+  SND_UPGRADE,
+  SND_EXCELLENT,
+  SND_COFFEE,
+  SND_SHOOT,
+  SND_LIFEUP,
+  SND_STOMP,
+  SND_KICK,
+  NUM_SOUNDS
+};
+
+
+static char * soundfilenames[NUM_SOUNDS] = {
+                                      DATA_PREFIX "/sounds/jump.wav",
+                                      DATA_PREFIX "/sounds/bigjump.wav",
+                                      DATA_PREFIX "/sounds/skid.wav",
+                                      DATA_PREFIX "/sounds/distro.wav",
+                                      DATA_PREFIX "/sounds/herring.wav",
+                                      DATA_PREFIX "/sounds/brick.wav",
+                                      DATA_PREFIX "/sounds/hurt.wav",
+                                      DATA_PREFIX "/sounds/squish.wav",
+                                      DATA_PREFIX "/sounds/fall.wav",
+                                      DATA_PREFIX "/sounds/ricochet.wav",
+                                      DATA_PREFIX "/sounds/bump-upgrade.wav",
+                                      DATA_PREFIX "/sounds/upgrade.wav",
+                                      DATA_PREFIX "/sounds/excellent.wav",
+                                      DATA_PREFIX "/sounds/coffee.wav",
+                                      DATA_PREFIX "/sounds/shoot.wav",
+                                      DATA_PREFIX "/sounds/lifeup.wav",
+                                      DATA_PREFIX "/sounds/stomp.wav",
+                                      DATA_PREFIX "/sounds/kick.wav"
+                                    };
+
 
 #ifndef NOSOUND