From 81b24d0c4042cec0b11fff73c5594f386c06418e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 26 Apr 2014 14:34:12 +0300 Subject: FULLPIPE: Proper implementation of FullpipeEngine::startSceneTrack() --- engines/fullpipe/fullpipe.h | 2 ++ engines/fullpipe/sound.cpp | 37 +++++++++++++++++++++++++++++++------ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 989971eaab..27505252ab 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -166,7 +166,9 @@ public: void toggleMute(); void playSound(int id, int flag); void playTrack(GameVar *sceneVar, const char *name, bool delayed); + int getSceneTrack(); void startSceneTrack(); + void startSoundStream1(char *trackName); void stopSoundStream2(); void stopAllSoundStreams(); void stopAllSoundInstances(int id); diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 10d020b494..8071129e5c 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -131,16 +131,41 @@ void FullpipeEngine::setSceneMusicParameters(GameVar *var) { } void FullpipeEngine::startSceneTrack() { - // TODO: Finish this + if (!g_fp->_sceneTrackIsPlaying && g_fp->_numSceneTracks > 0) { + if (g_fp->_trackStartDelay > 0) { + g_fp->_trackStartDelay--; + } else { + int trackNum = getSceneTrack(); + + if (trackNum == -1) { + strcpy(g_fp->_sceneTracksCurrentTrack, "silence"); + + g_fp->_trackStartDelay = 2880; + g_fp->_sceneTrackIsPlaying = 0; + } else { + strcpy(g_fp->_sceneTracksCurrentTrack, g_fp->_sceneTracks[trackNum]); + + startSoundStream1(g_fp->_sceneTracksCurrentTrack); + + g_fp->_sceneTrackIsPlaying = 1; + } + } + } +} + +int FullpipeEngine::getSceneTrack() { + warning("STUB: FullpipeEngine::getSceneTrack()"); + + return -1; +} + +void FullpipeEngine::startSoundStream1(char *trackName) { + stopAllSoundStreams(); + #ifdef USE_VORBIS if (g_fp->_mixer->isSoundHandleActive(_sceneTrackHandle)) return; - GameVar *musicTrackVar = _musicGameVar->getSubVarByName("MUSIC")->getSubVarByName("TRACKS")->_subVars; - if (!musicTrackVar) - return; - - char *trackName = musicTrackVar->_varName; Common::File *track = new Common::File(); if (!track->open(trackName)) { warning("Could not open %s", trackName); -- cgit v1.2.3