aboutsummaryrefslogtreecommitdiff
path: root/sword1/sound.cpp
diff options
context:
space:
mode:
authorTravis Howell2004-08-31 07:52:47 +0000
committerTravis Howell2004-08-31 07:52:47 +0000
commit870eac39a22ed48ce0e57bf2e5391b3a128bf14e (patch)
tree5d1e276259b0c7fedff1dd37fffbbbea251b2880 /sword1/sound.cpp
parent3f1aee9ff4c71c069f5ba22dbd9effd013b5de34 (diff)
downloadscummvm-rg350-870eac39a22ed48ce0e57bf2e5391b3a128bf14e.tar.gz
scummvm-rg350-870eac39a22ed48ce0e57bf2e5391b3a128bf14e.tar.bz2
scummvm-rg350-870eac39a22ed48ce0e57bf2e5391b3a128bf14e.zip
Add eriktorbjorn's patch for separate target for Broken Sword 1 demo. Avoids sound regressions in full game.
svn-id: r14846
Diffstat (limited to 'sword1/sound.cpp')
-rw-r--r--sword1/sound.cpp11
1 files changed, 6 insertions, 5 deletions
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;