Add speech support for Amiga verison of FF

svn-id: r21871
This commit is contained in:
Travis Howell 2006-04-14 05:13:59 +00:00
parent de0dd94c9c
commit 1a6849de91
5 changed files with 48 additions and 3 deletions

View File

@ -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

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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;

View File

@ -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;