From 40768ac29dc8c02bb5815e331f2fb72167657ea9 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Mon, 14 Feb 2005 03:12:41 +0000 Subject: Add basic support for DISK index block in later HE games. svn-id: r16784 --- scumm/resource.cpp | 24 ++++++++++++++++++------ scumm/scumm.h | 1 + scumm/sound.cpp | 9 +++++++++ 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/scumm/resource.cpp b/scumm/resource.cpp index f21b0c6cef..ed92ef0056 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -75,16 +75,27 @@ void ScummEngine::openRoom(int room) { if (room_offs == -1) break; - if (room_offs != 0 && room != 0) { + if (room_offs != 0 && room != 0 && _heversion < 98) { _fileOffset = res.roomoffs[rtRoom][room]; - return; } if (!(_features & GF_SMALL_HEADER)) { if (_heversion >= 70) { // Windows titles if (_heversion >= 98) { - sprintf(buf, "%s.%s", _gameName.c_str(), room == 0 ? "he0" : "(a)"); - sprintf(buf2, "%s.(b)", _gameName.c_str()); + int disk = 0; + if (_heV7DiskOffsets) + disk = _heV7DiskOffsets[room]; + + switch(disk) { + case 2: + sprintf(buf, "%s.%s", _gameName.c_str(), "(b)"); + break; + case 1: + sprintf(buf, "%s.%s", _gameName.c_str(), "(a)"); + break; + default: + sprintf(buf, "%s.%s", _gameName.c_str(), "he0"); + } } else sprintf(buf, "%s.he%.1d", _gameName.c_str(), room == 0 ? 0 : 1); } else if (_version >= 7) { @@ -424,8 +435,9 @@ void ScummEngine::readIndexFile() { break; case MKID('DISK'): - _fileHandle.seek(itemsize - 8, SEEK_CUR); - debug(2, "DISK index block not yet handled, skipping"); + i = _fileHandle.readUint16LE(); + _heV7DiskOffsets = (byte *)calloc(i, 1); + _fileHandle.read(_heV7DiskOffsets, i); break; case MKID('INIB'): diff --git a/scumm/scumm.h b/scumm/scumm.h index cbf902aa37..ce17d6e59c 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -634,6 +634,7 @@ protected: byte _resourceMapper[128]; uint32 _allocatedSize; byte _expire_counter; + byte *_heV7DiskOffsets; byte *_heV7RoomOffsets; uint32 *_heV7RoomIntOffsets; const byte *_resourceLastSearchBuf; // FIXME: need to put it to savefile? diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 1d19d4ce5a..6b5167167a 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -261,6 +261,10 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) { memcpy(sound, ptr, size); _vm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID); } + // Support for later Backyard sports games sounds + else if (READ_UINT32(ptr) == MKID('RIFF')) { + // TODO: Play WAV, with set sound ID + } // Support for Putt-Putt sounds - very hackish, too 8-) else if (READ_UINT32(ptr) == MKID('DIGI') || READ_UINT32(ptr) == MKID('TALK') || READ_UINT32(ptr) == MKID('HSHD')) { if (READ_UINT32(ptr) == MKID('HSHD')) { @@ -1303,6 +1307,11 @@ int ScummEngine::readSoundResource(int type, int idx) { total_size = _fileHandle.readUint32BE(); _fileHandle.read(createResource(type, idx, total_size), total_size - 8); return 1; + } else if (basetag == MKID('WSOU')) { + _fileHandle.seek(-12, SEEK_CUR); + total_size = _fileHandle.readUint32BE(); + _fileHandle.read(createResource(type, idx, total_size), total_size - 8); + return 1; } else if (basetag == MKID('HSHD')) { _fileHandle.seek(-12, SEEK_CUR); total_size = _fileHandle.readUint32BE(); -- cgit v1.2.3