aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2004-09-27 23:38:19 +0000
committerMax Horn2004-09-27 23:38:19 +0000
commit92c17aecd43405c6a82f69691f730bd7d900f67a (patch)
tree623c4ea452eb3ab3895f4b11dc5ff0aecdc3cbbc
parent1aa01bf1cc3d52307f3058b00c5c641d8e7344a5 (diff)
downloadscummvm-rg350-92c17aecd43405c6a82f69691f730bd7d900f67a.tar.gz
scummvm-rg350-92c17aecd43405c6a82f69691f730bd7d900f67a.tar.bz2
scummvm-rg350-92c17aecd43405c6a82f69691f730bd7d900f67a.zip
Fix endian problems with some HE sound code; also: better code to determine the size of the SDAT chunk
svn-id: r15315
-rw-r--r--scumm/sound.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 735b287cf2..5330d66b56 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -191,7 +191,7 @@ void Sound::playSound(int soundID, int offset) {
skip = 0;
musicFile.seek(+28, SEEK_CUR);
- if (musicFile.readUint32LE() == MKID('SGEN')) {
+ if (musicFile.readUint32LE() == TO_LE_32(MKID('SGEN'))) {
// Skip to correct music header
skip *= 21;
@@ -646,22 +646,22 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, PlayingSoundHandle
}
if (_vm->_features & GF_HUMONGOUS) {
- int extra = 0;;
+ int extra = 0;
_sfxMode |= mode;
- // SKIP TALK (8) HSHD (24)
+ // Skip the TALK (8) and HSHD (24) chunks
_sfxFile->seek(offset + 32, SEEK_SET);
- if (_sfxFile->readUint32LE() == MKID('SBNG')) {
- // SKIP SBNG
+ if (_sfxFile->readUint32LE() == TO_LE_32(MKID('SBNG'))) {
+ // Skip the SBNG, so we end up at the SDAT chunk
extra = _sfxFile->readUint32BE();
- _sfxFile->seek(+extra + 8, SEEK_CUR);
- extra += 8;
+ _sfxFile->seek(extra - 4, SEEK_CUR);
+ size = _sfxFile->readUint32BE() - 8;
} else {
_sfxFile->seek(+4, SEEK_CUR);
+ size = b - 40;
}
- size = b - 40 - extra ;
sound = (byte *)malloc(size);
_sfxFile->read(sound, size);
_vm->_mixer->playRaw(handle, sound, size, 11000, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);