diff options
author | Travis Howell | 2006-04-14 05:13:59 +0000 |
---|---|---|
committer | Travis Howell | 2006-04-14 05:13:59 +0000 |
commit | 1a6849de91ce2b36a37482c027268889893515bb (patch) | |
tree | 6aeedcadda568b5c23540dfef1ce1b70be274177 /engines/simon | |
parent | de0dd94c9cbf44f5dae72c69467fb7d24872eca5 (diff) | |
download | scummvm-rg350-1a6849de91ce2b36a37482c027268889893515bb.tar.gz scummvm-rg350-1a6849de91ce2b36a37482c027268889893515bb.tar.bz2 scummvm-rg350-1a6849de91ce2b36a37482c027268889893515bb.zip |
Add speech support for Amiga verison of FF
svn-id: r21871
Diffstat (limited to 'engines/simon')
-rw-r--r-- | engines/simon/res.cpp | 24 | ||||
-rw-r--r-- | engines/simon/simon.cpp | 6 | ||||
-rw-r--r-- | engines/simon/simon.h | 1 | ||||
-rw-r--r-- | engines/simon/sound.cpp | 17 | ||||
-rw-r--r-- | engines/simon/sound.h | 3 |
5 files changed, 48 insertions, 3 deletions
diff --git a/engines/simon/res.cpp b/engines/simon/res.cpp index c9ddd6a27b..a09f6d6b10 100644 --- a/engines/simon/res.cpp +++ b/engines/simon/res.cpp @@ -706,4 +706,28 @@ void SimonEngine::loadSound(uint sound, uint pan, uint vol, bool ambient) { } } +void SimonEngine::loadVoice(uint speechId) { + if (getFeatures() & GF_ZLIBCOMP) { + char filename[15]; + + uint32 file, offset, srcSize, dstSize; + if (getPlatform() == Common::kPlatformAmiga) { + loadOffsets((const char*)"spindex.dat", speechId, file, offset, srcSize, dstSize); + } else { + loadOffsets((const char*)"speech.wav", speechId, file, offset, srcSize, dstSize); + } + + if (getPlatform() == Common::kPlatformAmiga) + sprintf(filename, "sp%d.wav", file); + else + sprintf(filename, "speech.wav"); + + byte *dst = (byte *)malloc(dstSize); + decompressData(filename, dst, offset, srcSize, dstSize); + _sound->playVoiceData(dst, speechId); + } else { + _sound->playVoice(speechId); + } +} + } // End of namespace Simon diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp index d2fbfa94dd..0ce9807910 100644 --- a/engines/simon/simon.cpp +++ b/engines/simon/simon.cpp @@ -3240,7 +3240,7 @@ void SimonEngine::playSpeech(uint speech_id, uint vgaSpriteId) { kill_sprite_simon1(204); } kill_sprite_simon1(vgaSpriteId + 201); - _sound->playVoice(speech_id); + loadVoice(speech_id); loadSprite(4, 2, vgaSpriteId + 201, 0, 0, 0); } } else { @@ -3256,7 +3256,7 @@ void SimonEngine::playSpeech(uint speech_id, uint vgaSpriteId) { _skipVgaWait = true; } else { if (_subtitles && _language != Common::HB_ISR) { - _sound->playVoice(speech_id); + loadVoice(speech_id); return; } else if (_subtitles && _scriptVar2) { loadSprite(4, 2, 5, 0, 0, 0); @@ -3265,7 +3265,7 @@ void SimonEngine::playSpeech(uint speech_id, uint vgaSpriteId) { } kill_sprite_simon2(2, vgaSpriteId + 2); - _sound->playVoice(speech_id); + loadVoice(speech_id); loadSprite(4, 2, vgaSpriteId + 2, 0, 0, 0); } } diff --git a/engines/simon/simon.h b/engines/simon/simon.h index 17025aa856..826f09490b 100644 --- a/engines/simon/simon.h +++ b/engines/simon/simon.h @@ -483,6 +483,7 @@ protected: void decompressData(const char *srcName, byte *dst, uint32 offset, uint32 srcSize, uint32 dstSize); void loadOffsets(const char *filename, int number, uint32 &file, uint32 &offset, uint32 &compressedSize, uint32 &size); void loadSound(uint sound, uint pan, uint vol, bool ambient); + void loadVoice(uint speechId); void palette_fadeout(uint32 *pal_values, uint num); diff --git a/engines/simon/sound.cpp b/engines/simon/sound.cpp index 88cc32b969..73c0f36589 100644 --- a/engines/simon/sound.cpp +++ b/engines/simon/sound.cpp @@ -494,6 +494,23 @@ void Sound::playSoundData(byte *soundData, uint sound, uint pan, uint vol, bool } } +void Sound::playVoiceData(byte *soundData, uint sound) { + byte flags; + int rate; + + int size = READ_LE_UINT32(soundData + 4); + Common::MemoryReadStream stream(soundData, size); + if (!loadWAVFromStream(stream, size, rate, flags)) { + error("playSoundData: Not a valid WAV data"); + } + + byte *buffer = (byte *)malloc(size); + memcpy(buffer, soundData + stream.pos(), size); + + _mixer->stopHandle(_voiceHandle); + _mixer->playRaw(&_voiceHandle, buffer, size, rate, flags); +} + void Sound::playEffects(uint sound) { if (!_effects) return; diff --git a/engines/simon/sound.h b/engines/simon/sound.h index 245c6ffb0c..f2da1a61e2 100644 --- a/engines/simon/sound.h +++ b/engines/simon/sound.h @@ -65,7 +65,10 @@ public: void playVoice(uint sound); void playEffects(uint sound); void playAmbient(uint sound); + + // Feeble Files specific void playSoundData(byte *soundData, uint sound, uint pan, uint vol, bool ambient); + void playVoiceData(byte *soundData, uint sound); bool hasVoice() const; bool isVoiceActive() const; |