diff options
author | Sven Hesse | 2012-07-08 00:47:03 +0200 |
---|---|---|
committer | Sven Hesse | 2012-07-30 01:44:46 +0200 |
commit | 943c6af82af9e14062c1aa1940aea2f625121368 (patch) | |
tree | 130f6b554f3f3cc3e8c898e37f7432dda7140638 /engines | |
parent | 9c32fd2360d9fa18ceac6fefc571c6610965d361 (diff) | |
download | scummvm-rg350-943c6af82af9e14062c1aa1940aea2f625121368.tar.gz scummvm-rg350-943c6af82af9e14062c1aa1940aea2f625121368.tar.bz2 scummvm-rg350-943c6af82af9e14062c1aa1940aea2f625121368.zip |
GOB: Add the sounds in the Once Upon A Time character generator
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gob/pregob/onceupon/chargenchild.cpp | 13 | ||||
-rw-r--r-- | engines/gob/pregob/onceupon/chargenchild.h | 9 | ||||
-rw-r--r-- | engines/gob/pregob/onceupon/onceupon.cpp | 24 | ||||
-rw-r--r-- | engines/gob/pregob/onceupon/onceupon.h | 1 |
4 files changed, 43 insertions, 4 deletions
diff --git a/engines/gob/pregob/onceupon/chargenchild.cpp b/engines/gob/pregob/onceupon/chargenchild.cpp index 7150c69b5f..ba099e4937 100644 --- a/engines/gob/pregob/onceupon/chargenchild.cpp +++ b/engines/gob/pregob/onceupon/chargenchild.cpp @@ -99,6 +99,19 @@ void CharGenChild::advance() { } } +CharGenChild::Sound CharGenChild::shouldPlaySound() const { + const uint16 anim = getAnimation(); + const uint16 frame = getFrame(); + + if (((anim == kAnimWalkLeft) || (anim == kAnimWalkRight)) && ((frame == 1) || (frame == 6))) + return kSoundWalk; + + if (((anim == kAnimJumpLeft) || (anim == kAnimJumpRight)) && (frame == 0)) + return kSoundJump; + + return kSoundNone; +} + } // End of namespace OnceUpon } // End of namespace Gob diff --git a/engines/gob/pregob/onceupon/chargenchild.h b/engines/gob/pregob/onceupon/chargenchild.h index afbe3fd2fe..3b09ef112a 100644 --- a/engines/gob/pregob/onceupon/chargenchild.h +++ b/engines/gob/pregob/onceupon/chargenchild.h @@ -37,11 +37,20 @@ namespace OnceUpon { /** The child running around on the character generator screen. */ class CharGenChild : public ANIObject { public: + enum Sound { + kSoundNone = 0, + kSoundWalk , + kSoundJump + }; + CharGenChild(const ANIFile &ani); ~CharGenChild(); /** Advance the animation to the next frame. */ void advance(); + + /** Should we play a sound right now? */ + Sound shouldPlaySound() const; }; } // End of namespace OnceUpon diff --git a/engines/gob/pregob/onceupon/onceupon.cpp b/engines/gob/pregob/onceupon/onceupon.cpp index 7eef740139..f9e093374b 100644 --- a/engines/gob/pregob/onceupon/onceupon.cpp +++ b/engines/gob/pregob/onceupon/onceupon.cpp @@ -136,7 +136,8 @@ const OnceUpon::MenuButton OnceUpon::kLanguageButtons[] = { const char *OnceUpon::kSound[kSoundMAX] = { "diamant.snd", // kSoundClick - "cigogne.snd" // kSoundStork + "cigogne.snd", // kSoundStork + "saute.snd" // kSoundJump }; const OnceUpon::SectionFunc OnceUpon::kSectionFuncs[kSectionCount] = { @@ -1648,14 +1649,16 @@ OnceUpon::CharGenAction OnceUpon::characterGenerator() { charGenSetup(state); ANIFile ani(_vm, "ba.ani", 320); - ANIList anims; - - anims.push_back(new CharGenChild(ani)); ani.recolor(0x0F, 0x0C); ani.recolor(0x0E, 0x0A); ani.recolor(0x08, 0x09); + CharGenChild *child = new CharGenChild(ani); + + ANIList anims; + anims.push_back(child); + fadeOut(); _vm->_draw->forceBlit(); @@ -1733,6 +1736,9 @@ OnceUpon::CharGenAction OnceUpon::characterGenerator() { } if (mouseButtons == kMouseButtonsLeft) { + stopSound(); + playSound(kSoundClick); + int trousers = checkButton(kCharGenTrousersButtons, ARRAYSIZE(kCharGenTrousersButtons), mouseX, mouseY); if ((state == kCharGenStateTrousers) && (trousers >= 0)) { _colorTrousers = trousers; @@ -1777,6 +1783,16 @@ OnceUpon::CharGenAction OnceUpon::characterGenerator() { } drawAnim(anims); + + // Play the child sounds + CharGenChild::Sound childSound = child->shouldPlaySound(); + if (childSound == CharGenChild::kSoundWalk) { + beep(50, 10); + } else if (childSound == CharGenChild::kSoundJump) { + stopSound(); + playSound(kSoundJump); + } + showCursor(); fadeIn(); diff --git a/engines/gob/pregob/onceupon/onceupon.h b/engines/gob/pregob/onceupon/onceupon.h index 80fcba35bd..d2e1feb604 100644 --- a/engines/gob/pregob/onceupon/onceupon.h +++ b/engines/gob/pregob/onceupon/onceupon.h @@ -136,6 +136,7 @@ private: enum Sound { kSoundClick = 0, kSoundStork , + kSoundJump , kSoundMAX }; |