From 870eac39a22ed48ce0e57bf2e5391b3a128bf14e Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Tue, 31 Aug 2004 07:52:47 +0000 Subject: Add eriktorbjorn's patch for separate target for Broken Sword 1 demo. Avoids sound regressions in full game. svn-id: r14846 --- sword1/sound.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'sword1/sound.cpp') diff --git a/sword1/sound.cpp b/sword1/sound.cpp index c5b76a6718..3c752f887e 100644 --- a/sword1/sound.cpp +++ b/sword1/sound.cpp @@ -31,7 +31,7 @@ namespace Sword1 { #define SOUND_SPEECH_ID 1 #define SPEECH_FLAGS (SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_LITTLE_ENDIAN) -Sound::Sound(const char *searchPath, SoundMixer *mixer, ResMan *pResMan) { +Sound::Sound(const char *searchPath, SoundMixer *mixer, ResMan *pResMan, bool isDemo) { strcpy(_filePath, searchPath); _mixer = mixer; _resMan = pResMan; @@ -39,6 +39,7 @@ Sound::Sound(const char *searchPath, SoundMixer *mixer, ResMan *pResMan) { _endOfQueue = 0; _currentCowFile = 0; _speechVolL = _speechVolR = _sfxVolL = _sfxVolR = 192; + _isDemo = isDemo; } int Sound::addToQueue(int32 fxNo) { @@ -185,13 +186,13 @@ int16 *Sound::uncompressSpeech(uint32 index, uint32 cSize, uint32 *size) { while ((READ_BE_UINT32(fBuf + headerPos) != 'data') && (headerPos < 100)) headerPos++; if (headerPos < 100) { - uint32 resSize = READ_LE_UINT32(fBuf + headerPos + 4) >> 1; + int32 resSize; // Demo uses slightly different headers - if (resSize > cSize) { + if (_isDemo) { resSize = READ_LE_UINT32(fBuf + headerPos + 6) >> 1; headerPos += 2; - } - + } else + resSize = READ_LE_UINT32(fBuf + headerPos + 4) >> 1; int16 *srcData = (int16*)(fBuf + headerPos + 8); int16 *dstData = (int16*)malloc(resSize * 2); uint32 srcPos = 0; -- cgit v1.2.3