GOB: Play Oko's breathing sound

This commit is contained in:
Sven Hesse 2012-01-27 14:45:41 +01:00
parent 9d348f46ad
commit 8414627216
4 changed files with 22 additions and 9 deletions

View File

@ -134,6 +134,11 @@ bool Diving::play(uint16 playerCount, bool hasPearlLocation) {
}
void Diving::init() {
_vm->_sound->sampleLoad(&_soundShoot , SOUND_SND, "tirgim.snd");
_vm->_sound->sampleLoad(&_soundBreathe , SOUND_SND, "respir.snd");
_vm->_sound->sampleLoad(&_soundWhitePearl, SOUND_SND, "virtou.snd");
_vm->_sound->sampleLoad(&_soundBlackPearl, SOUND_SND, "trouve.snd");
_background = new DECFile(_vm, "tperle.dec" , 320, 200);
_objects = new ANIFile(_vm, "tperle.ani" , 320);
_gui = new ANIFile(_vm, "tperlcpt.ani", 320);
@ -201,7 +206,7 @@ void Diving::init() {
_shot[i]->setMode(ANIObject::kModeOnce);
}
_oko = new Oko(*_okoAnim);
_oko = new Oko(*_okoAnim, *_vm->_sound, _soundBreathe);
Surface tmp(320, 103, 1);
@ -226,11 +231,6 @@ void Diving::init() {
_anims.push_back(_oko);
_anims.push_back(_lungs);
_anims.push_back(_heart);
_vm->_sound->sampleLoad(&_soundShoot , SOUND_SND, "tirgim.snd");
_vm->_sound->sampleLoad(&_soundBreathe , SOUND_SND, "respir.snd");
_vm->_sound->sampleLoad(&_soundWhitePearl, SOUND_SND, "virtou.snd");
_vm->_sound->sampleLoad(&_soundBlackPearl, SOUND_SND, "trouve.snd");
}
void Diving::deinit() {

View File

@ -20,6 +20,8 @@
*
*/
#include "gob/sound/sound.h"
#include "gob/minigames/geisha/oko.h"
namespace Gob {
@ -40,7 +42,9 @@ static const uint kLevelCount = 3;
static const int16 kLevelPositionX[kLevelCount] = { 44, 84, 124 };
Oko::Oko(const ANIFile &ani) : ANIObject(ani), _state(kStateEnter), _level(0) {
Oko::Oko(const ANIFile &ani, Sound &sound, SoundDesc &breathe) :
ANIObject(ani), _sound(&sound), _breathe(&breathe), _state(kStateEnter), _level(0) {
setAnimation(kOkoAnimationEnter);
setVisible(true);
}
@ -62,9 +66,11 @@ void Oko::advance() {
}
break;
case kStateBreathe:
if ((getFrame() == 6) || (getFrame() == 23))
_sound->blasterPlay(_breathe, 1, 0);
case kStateSink:
case kStateRaise:
case kStateBreathe:
if (wasLastFrame) {
setAnimation(kOkoAnimationSwim);
setPosition(kOkoPositionX, kLevelPositionX[_level]);

View File

@ -27,6 +27,9 @@
namespace Gob {
class Sound;
class SoundDesc;
namespace Geisha {
/** Oko, the person you control, in Geisha's "Diving" minigame. */
@ -40,7 +43,7 @@ public:
kStateBreathe
};
Oko(const ANIFile &ani);
Oko(const ANIFile &ani, Sound &sound, SoundDesc &breathe);
~Oko();
/** Advance the animation to the next frame. */
@ -54,6 +57,9 @@ public:
State getState() const;
private:
Sound *_sound;
SoundDesc *_breathe;
State _state;
uint8 _level;

View File

@ -24,6 +24,7 @@
#define GOB_SOUND_BGATMOSPHERE_H
#include "audio/mixer.h"
#include "common/array.h"
#include "common/mutex.h"
#include "common/random.h"