mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-24 19:45:07 +00:00
TSAGE: Bugfixes for voice playback to work in conversations
This commit is contained in:
parent
a9aaca4608
commit
33e75a8718
@ -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;
|
||||
|
||||
|
@ -237,6 +237,7 @@ public:
|
||||
|
||||
virtual void synchronize(Serializer &s);
|
||||
virtual void remove();
|
||||
virtual void dispatch();
|
||||
virtual void signal();
|
||||
virtual void process(Event &event);
|
||||
|
||||
|
@ -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 (_voiceDelayAmount) {
|
||||
if (frameNumber >= _voiceFrameNumber) {
|
||||
_voiceDelayAmount = _voiceDelayAmount - (frameNumber - _voiceFrameNumber);
|
||||
_voiceFrameNumber = frameNumber;
|
||||
|
||||
if (_delayAmount2 <= 0) {
|
||||
_delayAmount2 = 0;
|
||||
if (R2_GLOBALS._playStream.play(0, NULL)) {
|
||||
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) {
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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");
|
||||
|
||||
|
@ -428,7 +428,6 @@ private:
|
||||
Common::File _file;
|
||||
ResFileData _resData;
|
||||
Audio::SoundHandle _soundHandle;
|
||||
Sound _sound;
|
||||
uint16 *_index;
|
||||
EventHandler *_endAction;
|
||||
int _voiceNum;
|
||||
|
Loading…
x
Reference in New Issue
Block a user