diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tsage/converse.cpp | 9 | ||||
-rw-r--r-- | engines/tsage/converse.h | 1 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_speakers.cpp | 30 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_speakers.h | 6 | ||||
-rw-r--r-- | engines/tsage/sound.cpp | 6 | ||||
-rw-r--r-- | engines/tsage/sound.h | 1 |
6 files changed, 32 insertions, 21 deletions
diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 9e7d84105a..919ba9f69a 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -760,6 +760,15 @@ void StripManager::remove() { Action::remove(); } +void StripManager::dispatch() { + if (g_vm->getGameID() == GType_Ringworld2) { + if (_activeSpeaker) + _activeSpeaker->dispatch(); + } + + Action::dispatch(); +} + void StripManager::signal() { int strIndex = 0; diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h index 5aef0d8a7f..b1cbbeaf2b 100644 --- a/engines/tsage/converse.h +++ b/engines/tsage/converse.h @@ -237,6 +237,7 @@ public: virtual void synchronize(Serializer &s); virtual void remove(); + virtual void dispatch(); virtual void signal(); virtual void process(Event &event); diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index a43938230e..4be3212e77 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -36,6 +36,7 @@ namespace Ringworld2 { VisualSpeaker::VisualSpeaker(): Speaker() { _delayAmount = 0; + _voiceDelayAmount = 0; _frameNumber = R2_GLOBALS._events.getFrameNumber(); _color1 = 8; _color2 = 0; @@ -79,8 +80,7 @@ void VisualSpeaker::signal() { _sceneText.show(); if ((R2_GLOBALS._speechSubtitles & SPEECH_VOICE) && _soundId) { - // TODO: Check global that is passed - setFrame2(/* word_55F90 */ 1); + setVoiceFrame(1); } } else if (_action && _object2) { _action->setDelay(1); @@ -108,14 +108,14 @@ void VisualSpeaker::dispatch() { } // Delay check for voice - if (_delayAmount2) { - if (frameNumber >= _frameNumber2) { - _delayAmount2 = _delayAmount2 - (_frameNumber2 - frameNumber); - _frameNumber2 = frameNumber; - - if (_delayAmount2 <= 0) { - _delayAmount2 = 0; - if (R2_GLOBALS._playStream.play(0, NULL)) { + if (_voiceDelayAmount) { + if (frameNumber >= _voiceFrameNumber) { + _voiceDelayAmount = _voiceDelayAmount - (frameNumber - _voiceFrameNumber); + _voiceFrameNumber = frameNumber; + + if (_voiceDelayAmount <= 0) { + _voiceDelayAmount = 0; + if (R2_GLOBALS._playStream.play(_soundId, NULL)) { _numFrames = 2; _soundId = 0; } else { @@ -149,8 +149,8 @@ void VisualSpeaker::synchronize(Serializer &s) { s.syncAsSint16LE(_numFrames); s.syncAsSint16LE(_delayAmount); s.syncAsUint32LE(_frameNumber); - s.syncAsSint16LE(_delayAmount2); - s.syncAsUint32LE(_frameNumber2); + s.syncAsSint16LE(_voiceDelayAmount); + s.syncAsUint32LE(_voiceFrameNumber); } void VisualSpeaker::setText(const Common::String &msg) { @@ -266,9 +266,9 @@ void VisualSpeaker::setFrame(int numFrames) { _frameNumber = R2_GLOBALS._events.getFrameNumber(); } -void VisualSpeaker::setFrame2(int numFrames) { - _delayAmount2 = numFrames; - _frameNumber2 = R2_GLOBALS._events.getFrameNumber(); +void VisualSpeaker::setVoiceFrame(int numFrames) { + _voiceDelayAmount = numFrames; + _voiceFrameNumber = R2_GLOBALS._events.getFrameNumber(); } void VisualSpeaker::setDelay(int delay) { diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index 1b87606381..a49bb1d3e5 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -49,11 +49,11 @@ public: bool _removeObject; uint32 _frameNumber; int _numFrames; - int _delayAmount2; - uint32 _frameNumber2; + int _voiceDelayAmount; + uint32 _voiceFrameNumber; private: void setFrame(int numFrames); - void setFrame2(int numFrames); + void setVoiceFrame(int numFrames); public: VisualSpeaker(); diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index 02abc58178..90ce66cf03 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -2552,9 +2552,8 @@ bool PlayStream::setFile(const Common::String &filename) { bool PlayStream::play(int voiceNum, EventHandler *endAction) { uint32 offset = getFileOffset(_index, _resData._fileChunkSize, voiceNum); if (offset) { + stop(); _voiceNum = 0; - if (_sound.isPlaying()) - _sound.stop(); // Move to the offset for the start of the voice _file.seek(offset); @@ -2583,6 +2582,9 @@ bool PlayStream::play(int voiceNum, EventHandler *endAction) { while (chunkSize == (_resData._chunkSize - 16)) { // Ensure the next chunk has the 'MORE' header _file.read(&header[0], 4); + if (!strncmp(header, "FEED", 4)) + // Reached start of next voice sample, so stop + break; if (strncmp(header, "MORE", 4)) error("Invalid stream data"); diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h index 83cd4753d5..6778044d03 100644 --- a/engines/tsage/sound.h +++ b/engines/tsage/sound.h @@ -428,7 +428,6 @@ private: Common::File _file; ResFileData _resData; Audio::SoundHandle _soundHandle; - Sound _sound; uint16 *_index; EventHandler *_endAction; int _voiceNum; |