diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 6c98ae20f48..f6a8e002193 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -185,6 +185,7 @@ public: void updateTrackDelay(); void startSceneTrack(); void startSoundStream1(const char *trackName); + void playOggSound(const char *trackName, Audio::SoundHandle *stream); void stopSoundStream2(); void stopAllSoundStreams(); void stopAllSoundInstances(int id); diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index b364908dbec..4b50763e8c1 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -68,6 +68,7 @@ Vars::Vars() { scene04_mamasha = 0; scene04_boot = 0; scene04_speaker = 0; + scene04_musicStage = 0; scene04_ladder = 0; scene04_coinPut = false; diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h index 462eddeea89..2d30f54d52a 100644 --- a/engines/fullpipe/scenes.h +++ b/engines/fullpipe/scenes.h @@ -288,6 +288,8 @@ public: int scene04_springOffset; StaticANIObject *scene04_lastKozyawka; int scene04_springDelay; + int scene04_musicStage; + StaticANIObject *scene05_handle; StaticANIObject *scene05_wacko; diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp index 05bb01154f9..b8f80e8d505 100644 --- a/engines/fullpipe/scenes/scene04.cpp +++ b/engines/fullpipe/scenes/scene04.cpp @@ -35,6 +35,8 @@ #include "fullpipe/gameloader.h" #include "fullpipe/behavior.h" +#include "audio/mixer.h" + namespace Fullpipe { static const int scene04_speakerPhases[] = { @@ -214,6 +216,8 @@ void scene04_initScene(Scene *sc) { g_vars->scene04_speakerVariant = 0; g_vars->scene04_speakerPhase = 0; + g_vars->scene04_musicStage = 0; + g_fp->initArcadeKeys("SC_4"); } @@ -1071,13 +1075,36 @@ void sceneHandler04_liftBottle() { } void sceneHandler04_startSounds(const char *snd1, const char *snd2, const char *snd3) { - warning("STUB: sceneHandler04_startSounds()"); - - // playFile(snd1); - // playFile(snd2); - // playFile(snd3); + g_fp->playOggSound(snd1, g_fp->_soundStream2); g_fp->_stream2playing = true; + + g_vars->scene04_musicStage = 1; +} + +void updateSound() { + switch (g_vars->scene04_musicStage) { + case 0: + return; + + case 1: + if (!g_fp->_mixer->isSoundHandleActive(*g_fp->_soundStream2)) { + g_fp->playOggSound("sc4_loop.ogg", g_fp->_soundStream3); + g_vars->scene04_musicStage = 2; + } + break; + case 2: + if (!g_fp->_mixer->isSoundHandleActive(*g_fp->_soundStream3)) { + g_fp->playOggSound("sc4_stop2.ogg", g_fp->_soundStream4); + g_vars->scene04_musicStage = 3; + } + break; + case 3: + if (!g_fp->_mixer->isSoundHandleActive(*g_fp->_soundStream4)) { + g_vars->scene04_musicStage = 0; + } + break; + } } void sceneHandler04_goClock() { @@ -1606,6 +1633,8 @@ int sceneHandler04(ExCommand *ex) { break; } + updateSound(); + return 0; } diff --git a/engines/fullpipe/scenes/sceneFinal.cpp b/engines/fullpipe/scenes/sceneFinal.cpp index f569306cbe9..30ca31b7b09 100644 --- a/engines/fullpipe/scenes/sceneFinal.cpp +++ b/engines/fullpipe/scenes/sceneFinal.cpp @@ -123,7 +123,7 @@ void sceneHandlerFinal_fallCoin() { } } -void checkMusic() { +void updateMusic() { if (g_vars->sceneFinal_trackHasStarted && !g_fp->_mixer->isSoundHandleActive(*g_fp->_soundStream1)) { // loop music sceneHandlerFinal_startMusic("track16.ogg"); } @@ -177,7 +177,7 @@ int sceneHandlerFinal(ExCommand *cmd) { break; } - checkMusic(); + updateMusic(); return 0; } diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index d52d8dc4ec9..fd248f56996 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -367,8 +367,12 @@ int FullpipeEngine::getSceneTrack() { void FullpipeEngine::startSoundStream1(const char *trackName) { stopAllSoundStreams(); + playOggSound(trackName, _soundStream1); +} + +void FullpipeEngine::playOggSound(const char *trackName, Audio::SoundHandle *stream) { #ifdef USE_VORBIS - if (_mixer->isSoundHandleActive(*_soundStream1)) + if (_mixer->isSoundHandleActive(*stream)) return; Common::File *track = new Common::File(); @@ -378,7 +382,7 @@ void FullpipeEngine::startSoundStream1(const char *trackName) { return; } Audio::RewindableAudioStream *ogg = Audio::makeVorbisStream(track, DisposeAfterUse::YES); - _mixer->playStream(Audio::Mixer::kMusicSoundType, _soundStream1, ogg); + _mixer->playStream(Audio::Mixer::kMusicSoundType, stream, ogg); #endif }