diff options
-rw-r--r-- | engines/zvision/music_node.cpp | 14 | ||||
-rw-r--r-- | engines/zvision/music_node.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/engines/zvision/music_node.cpp b/engines/zvision/music_node.cpp index 31d222aead..b716b3ead1 100644 --- a/engines/zvision/music_node.cpp +++ b/engines/zvision/music_node.cpp @@ -46,6 +46,7 @@ MusicNode::MusicNode(ZVision *engine, uint32 key, Common::String &filename, bool _attenuate = 0; _pantrack = false; _pantrack_X = 0; + _sub = NULL; Audio::RewindableAudioStream *audioStream; @@ -69,12 +70,22 @@ MusicNode::MusicNode(ZVision *engine, uint32 key, Common::String &filename, bool if (_key != StateKey_NotSet) _engine->getScriptManager()->setStateValue(_key, 1); + + Common::String subname = filename; + subname.setChar('s', subname.size() - 3); + subname.setChar('u', subname.size() - 2); + subname.setChar('b', subname.size() - 1); + + if (_engine->getSearchManager()->hasFile(subname)) + _sub = new Subtitle(_engine, subname); } MusicNode::~MusicNode() { _engine->_mixer->stopHandle(_handle); if (_key != StateKey_NotSet) _engine->getScriptManager()->setStateValue(_key, 2); + if (_sub) + delete _sub; debug(1, "MusicNode: %d destroyed\n", _key); } @@ -117,6 +128,9 @@ bool MusicNode::process(uint32 deltaTimeInMillis) { if (_pantrack || _volume != _newvol) setVolume(_newvol); + + if (_sub) + _sub->process(_engine->_mixer->getSoundElapsedTime(_handle) / 100); } return false; } diff --git a/engines/zvision/music_node.h b/engines/zvision/music_node.h index 6e3033f6b0..d24496fc02 100644 --- a/engines/zvision/music_node.h +++ b/engines/zvision/music_node.h @@ -25,6 +25,7 @@ #include "audio/mixer.h" #include "zvision/sidefx.h" +#include "zvision/subtitles.h" namespace Common { class String; @@ -64,6 +65,7 @@ private: int32 _crossfade_time; bool _stereo; Audio::SoundHandle _handle; + Subtitle *_sub; }; class PanTrackNode : public SideFX { |