Implemented explosion sound when Mr.Bomb explodes.
authorRicardo Cruz <rick2@aeiou.pt>
Thu, 22 Apr 2004 21:51:19 +0000 (21:51 +0000)
committerRicardo Cruz <rick2@aeiou.pt>
Thu, 22 Apr 2004 21:51:19 +0000 (21:51 +0000)
It uses the current stereo system that is kinda of primitive. We should base it on player's coordinates and calculate it according it.
Instead, it bases the screen, besides it is not even calculated, just use some constants.

SVN-Revision: 663

src/badguy.cpp
src/sound.cpp
src/sound.h

index ac03707..b5012be 100644 (file)
@@ -481,6 +481,15 @@ BadGuy::action_bomb(float frame_ratio)
       set_sprite(img_mrbomb_explosion, img_mrbomb_explosion);
       dying = DYING_NOT; // now the bomb hurts
       timer.start(EXPLODETIME);
+
+      /* play explosion sound */  // FIXME: is the stereo all right? maybe we should use player cordinates...
+      if (base.x < scroll_x + screen->w/2 - 10)
+        play_sound(sounds[SND_EXPLODE], SOUND_LEFT_SPEAKER);
+      else if (base.x > scroll_x + screen->w/2 + 10)
+        play_sound(sounds[SND_EXPLODE], SOUND_RIGHT_SPEAKER);
+      else
+        play_sound(sounds[SND_EXPLODE], SOUND_CENTER_SPEAKER);
+
     } else if(mode == BOMB_EXPLODE) {
       remove_me();
       return;
index 984618a..53a23ca 100644 (file)
@@ -47,7 +47,8 @@ char * soundfilenames[NUM_SOUNDS] = {
                                        "/sounds/shoot.wav",
                                        "/sounds/lifeup.wav",
                                        "/sounds/stomp.wav",
-                                       "/sounds/kick.wav"
+                                       "/sounds/kick.wav",
+                                       "/sounds/explode.wav"
                                     };
 
 
index 095e3c4..b491f90 100644 (file)
@@ -67,6 +67,7 @@ enum {
   SND_LIFEUP,
   SND_STOMP,
   SND_KICK,
+  SND_EXPLODE,
   NUM_SOUNDS
 };