From 2c348071661719e87fc54b0ffc7987969442ac14 Mon Sep 17 00:00:00 2001 From: Ricardo Cruz Date: Thu, 22 Apr 2004 21:51:19 +0000 Subject: [PATCH] Implemented explosion sound when Mr.Bomb explodes. 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 | 9 +++++++++ src/sound.cpp | 3 ++- src/sound.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/badguy.cpp b/src/badguy.cpp index ac037079e..b5012be46 100644 --- a/src/badguy.cpp +++ b/src/badguy.cpp @@ -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; diff --git a/src/sound.cpp b/src/sound.cpp index 984618a0e..53a23ca81 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -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" }; diff --git a/src/sound.h b/src/sound.h index 095e3c4d6..b491f905a 100644 --- a/src/sound.h +++ b/src/sound.h @@ -67,6 +67,7 @@ enum { SND_LIFEUP, SND_STOMP, SND_KICK, + SND_EXPLODE, NUM_SOUNDS }; -- 2.11.0