From f734014fd2ce201f1fbec340d09d5695305a649e Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Tue, 27 Jul 2004 03:47:56 +0000 Subject: Add support for speech in demo. svn-id: r14350 --- sword1/sound.cpp | 11 +++++++++-- sword1/sword1.cpp | 4 ---- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'sword1') diff --git a/sword1/sound.cpp b/sword1/sound.cpp index c81362addb..c5b76a6718 100644 --- a/sword1/sound.cpp +++ b/sword1/sound.cpp @@ -186,6 +186,12 @@ int16 *Sound::uncompressSpeech(uint32 index, uint32 cSize, uint32 *size) { headerPos++; if (headerPos < 100) { uint32 resSize = READ_LE_UINT32(fBuf + headerPos + 4) >> 1; + // Demo uses slightly different headers + if (resSize > cSize) { + resSize = READ_LE_UINT32(fBuf + headerPos + 6) >> 1; + headerPos += 2; + } + int16 *srcData = (int16*)(fBuf + headerPos + 8); int16 *dstData = (int16*)malloc(resSize * 2); uint32 srcPos = 0; @@ -254,9 +260,10 @@ void Sound::initCowSystem(void) { */ sprintf(cowName, "SPEECH%d.CLU", SwordEngine::_systemVars.currentCD); _cowFile.open(cowName); - if (!_cowFile.isOpen()) { + if (!_cowFile.isOpen()) _cowFile.open("speech.clu"); - } + if (!_cowFile.isOpen()) + _cowFile.open("cows.mad"); if (_cowFile.isOpen()) { _cowHeaderSize = _cowFile.readUint32LE(); _cowHeader = (uint32*)malloc(_cowHeaderSize); diff --git a/sword1/sword1.cpp b/sword1/sword1.cpp index 0981dbce21..1d4113dbd9 100644 --- a/sword1/sword1.cpp +++ b/sword1/sword1.cpp @@ -1066,10 +1066,6 @@ void SwordEngine::checkCdFiles(void) { // check if we're running from cd, hdd or _systemVars.playSpeech = true; return ; } else { - const char msg[] = "SPEECH2.CLU not found.\nPlease copy the SPEECH.CLU from CD2 and rename it to SPEECH2.CLU"; - GUI::MessageDialog dialog(msg); - dialog.runModal(); - error(msg); } } else { // speech1.clu & speech2.clu not present. are we running from cd? if (test.open("cd1.id")) { -- cgit v1.2.3