diff options
author | Max Horn | 2005-03-31 23:11:39 +0000 |
---|---|---|
committer | Max Horn | 2005-03-31 23:11:39 +0000 |
commit | bed16296425df6def9b59ebe7df6f5ee45dcf035 (patch) | |
tree | 44f11cf4b59d70632a241aeb4439c60e7aff057f | |
parent | 807b573ab253a2ab9eb2e667e346f42cb2a04064 (diff) | |
download | scummvm-rg350-bed16296425df6def9b59ebe7df6f5ee45dcf035.tar.gz scummvm-rg350-bed16296425df6def9b59ebe7df6f5ee45dcf035.tar.bz2 scummvm-rg350-bed16296425df6def9b59ebe7df6f5ee45dcf035.zip |
Made findResourceSmall local to resource.cpp; simplified _EPAL_offs (since we don't use it nor save it at this time, this is harmless); added a comment about _CLUT_offs ugliness
svn-id: r17314
-rw-r--r-- | scumm/resource.cpp | 7 | ||||
-rw-r--r-- | scumm/resource.h | 2 | ||||
-rw-r--r-- | scumm/scumm.cpp | 18 |
3 files changed, 17 insertions, 10 deletions
diff --git a/scumm/resource.cpp b/scumm/resource.cpp index 0899ffcd68..3c54c6b95b 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -36,6 +36,7 @@ namespace Scumm { static uint16 newTag2Old(uint32 newTag); static const char *resTypeFromId(int id); +static const byte *findResourceSmall(uint32 tag, const byte *searchin); /* Open a room */ @@ -909,11 +910,11 @@ int ScummEngine::getResourceDataSize(const byte *ptr) const { return 0; if (_features & GF_OLD_BUNDLE) - return READ_LE_UINT16(ptr) - 4; + return READ_LE_UINT16(ptr) - _resourceHeaderSize; else if (_features & GF_SMALL_HEADER) - return READ_LE_UINT32(ptr) - 6; + return READ_LE_UINT32(ptr) - _resourceHeaderSize; else - return READ_BE_UINT32(ptr - 4) - 8; + return READ_BE_UINT32(ptr - 4) - _resourceHeaderSize; } void ResourceManager::lock(int type, int i) { diff --git a/scumm/resource.h b/scumm/resource.h index 7e1901f817..58498ca816 100644 --- a/scumm/resource.h +++ b/scumm/resource.h @@ -37,8 +37,6 @@ enum { }; -const byte *findResourceSmall(uint32 tag, const byte *searchin); - class ResourceIterator { uint32 _size; uint32 _pos; diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index ec6e621cac..510f38e743 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -2421,7 +2421,7 @@ void ScummEngine::initRoomSubBlocks() { // FIXME. This is an evil HACK!!! size = (READ_LE_UINT16(roomptr + 0x0A) - READ_LE_UINT16(roomptr + 0x15)) - size; else - size = getResourceDataSize(ptr - size - 6) - size; + size = getResourceDataSize(ptr - size - _resourceHeaderSize) - size; if (size > 0) { // do this :) createResource(rtMatrix, 1, size); @@ -2611,10 +2611,9 @@ void ScummEngine::initRoomSubBlocks() { } } + // Locate the EGA palette (currently unused). if (_features & GF_OLD_BUNDLE) ptr = 0; - else if (_features & GF_SMALL_HEADER) - ptr = findResourceSmall(MKID('EPAL'), roomptr); else ptr = findResourceData(MKID('EPAL'), roomptr); @@ -2622,17 +2621,26 @@ void ScummEngine::initRoomSubBlocks() { _EPAL_offs = ptr - roomptr; } + // Locate the standard room palette (for V3-V5 games). + // Note: We used to use findResourceSmall instead of findResourceData; + // in the small header case. That means we have to do some ugly trickery + // in order to emulate the old behaviour. It would be very nice to get + // rid of that. That would require some changes to the palette code. + // + // And of course this would break savegame compatibility unless extra code + // were added to the save/load system to cope with this. if (_features & GF_OLD_BUNDLE) ptr = 0; - else if (_features & GF_SMALL_HEADER) - ptr = findResourceSmall(MKID('CLUT'), roomptr); else ptr = findResourceData(MKID('CLUT'), roomptr); if (ptr) { + if ((_features & GF_SMALL_HEADER) && ptr) + ptr -= _resourceHeaderSize; _CLUT_offs = ptr - roomptr; } + // Locate the standard room palettes (for V6+ games). if (_version >= 6) { ptr = findResource(MKID('PALS'), roomptr); if (ptr) { |