aboutsummaryrefslogtreecommitdiff
path: root/sword1/sound.cpp
diff options
context:
space:
mode:
authorTravis Howell2004-07-27 03:47:56 +0000
committerTravis Howell2004-07-27 03:47:56 +0000
commitf734014fd2ce201f1fbec340d09d5695305a649e (patch)
tree2e56b2bbfde189e8093c14a791c517f826aebe52 /sword1/sound.cpp
parentbd88e98c9cb4c1b8d853cb0603254eee30a3b8e3 (diff)
downloadscummvm-rg350-f734014fd2ce201f1fbec340d09d5695305a649e.tar.gz
scummvm-rg350-f734014fd2ce201f1fbec340d09d5695305a649e.tar.bz2
scummvm-rg350-f734014fd2ce201f1fbec340d09d5695305a649e.zip
Add support for speech in demo.
svn-id: r14350
Diffstat (limited to 'sword1/sound.cpp')
-rw-r--r--sword1/sound.cpp11
1 files changed, 9 insertions, 2 deletions
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);