mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 09:23:37 +00:00
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
This commit is contained in:
parent
807b573ab2
commit
bed1629642
@ -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) {
|
||||
|
@ -37,8 +37,6 @@ enum {
|
||||
};
|
||||
|
||||
|
||||
const byte *findResourceSmall(uint32 tag, const byte *searchin);
|
||||
|
||||
class ResourceIterator {
|
||||
uint32 _size;
|
||||
uint32 _pos;
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user