From 9af6581daea16b0d235618a2101c074beb5a3294 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Sun, 28 Dec 2003 11:05:42 +0000 Subject: [PATCH] Kick and stomp sounds when you hit the laptop. Moved sound defs to sound.h SVN-Revision: 70 --- CHANGES.txt | 3 +++ src/gameloop.c | 44 +++----------------------------------------- src/sound.h | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 52 insertions(+), 44 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 1840c33ad..c9c65379e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -17,6 +17,9 @@ http://www.newbreedsoftware.com/supertux/ time is running out. Bill Kendrick + * New laptop enemy graphics. Sounds when you stomp and kick them. + Bill Kendrick + 0.0.5 - December 24th, 2003 --------------------------- diff --git a/src/gameloop.c b/src/gameloop.c index a9b374ef8..67a6ab24c 100644 --- a/src/gameloop.c +++ b/src/gameloop.c @@ -35,47 +35,6 @@ #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 diff --git a/src/sound.h b/src/sound.h index e47d4883b..4eb702a8a 100644 --- a/src/sound.h +++ b/src/sound.h @@ -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 -- 2.11.0