diff options
author | Max Horn | 2011-05-11 18:19:05 +0200 |
---|---|---|
committer | Max Horn | 2011-05-13 11:47:11 +0200 |
commit | 82a6f2ee3ce1cd11c7b186b0ec728e48589445ae (patch) | |
tree | b3c7ddee5f87d9b787ce01f8749f602c73fc38d7 /engines/scumm | |
parent | 0342ab3f1b2d67de6fa0112311b973b55d509f1c (diff) | |
download | scummvm-rg350-82a6f2ee3ce1cd11c7b186b0ec728e48589445ae.tar.gz scummvm-rg350-82a6f2ee3ce1cd11c7b186b0ec728e48589445ae.tar.bz2 scummvm-rg350-82a6f2ee3ce1cd11c7b186b0ec728e48589445ae.zip |
SCUMM: Rename ResTypeData::tag to _tag, get rid of ResTypeData::name
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/resource.cpp | 55 | ||||
-rw-r--r-- | engines/scumm/resource.h | 10 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 2 |
3 files changed, 35 insertions, 32 deletions
diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index d0dd077c2c..b9f88b2389 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -526,17 +526,16 @@ int ScummEngine_v70he::readResTypeList(int id) { return num; } -void ResourceManager::allocResTypeData(int id, uint32 tag, int num, const char *name, ResTypeMode mode) { - debug(9, "allocResTypeData(%s/%s,%s,%d,%d)", resTypeFromId(id), name, tag2str(TO_BE_32(tag)), num, mode); +void ResourceManager::allocResTypeData(int id, uint32 tag, int num, ResTypeMode mode) { + debug(2, "allocResTypeData(%s,%s,%d,%d)", resTypeFromId(id), tag2str(TO_BE_32(tag)), num, mode); assert(id >= 0 && id < (int)(ARRAYSIZE(_types))); if (num >= 8000) - error("Too many %ss (%d) in directory", name, num); + error("Too many %s resources (%d) in directory", resTypeFromId(id), num); _types[id]._mode = mode; _types[id]._num = num; - _types[id].tag = tag; - _types[id].name = name; + _types[id]._tag = tag; _types[id]._address = (byte **)calloc(num, sizeof(byte *)); _types[id]._size = (uint32 *)calloc(num, sizeof(uint32)); _types[id].flags = (byte *)calloc(num, sizeof(byte)); @@ -629,7 +628,7 @@ int ScummEngine::loadResource(int type, int idx) { roomNr = getResourceRoomNr(type, idx); if (idx >= _res->_types[type]._num) - error("%s %d undefined %d %d", _res->_types[type].name, idx, _res->_types[type]._num, roomNr); + error("%s %d undefined %d %d", resTypeFromId(type), idx, _res->_types[type]._num, roomNr); if (roomNr == 0) roomNr = _roomResource; @@ -663,11 +662,11 @@ int ScummEngine::loadResource(int type, int idx) { return readSoundResource(idx); } + // Sanity check: Is this the right tag for this resource type? tag = _fileHandle->readUint32BE(); - - if (tag != _res->_types[type].tag && _game.heversion < 70) { + if (tag != _res->_types[type]._tag && _game.heversion < 70) { error("%s %d not in room %d at %d+%d in file %s", - _res->_types[type].name, idx, roomNr, + resTypeFromId(type), idx, roomNr, _fileOffset, fileOffs, _fileHandle->getName()); } @@ -1283,30 +1282,30 @@ void ScummEngine::allocateArrays() { } _res->allocResTypeData(rtCostume, (_game.features & GF_NEW_COSTUMES) ? MKTAG('A','K','O','S') : MKTAG('C','O','S','T'), - _numCostumes, "costume", kStaticResTypeMode); - _res->allocResTypeData(rtRoom, MKTAG('R','O','O','M'), _numRooms, "room", kStaticResTypeMode); - _res->allocResTypeData(rtRoomImage, MKTAG('R','M','I','M'), _numRooms, "room image", kStaticResTypeMode); - _res->allocResTypeData(rtRoomScripts, MKTAG('R','M','S','C'), _numRooms, "room script", kStaticResTypeMode); - _res->allocResTypeData(rtSound, MKTAG('S','O','U','N'), _numSounds, "sound", kSoundResTypeMode); - _res->allocResTypeData(rtScript, MKTAG('S','C','R','P'), _numScripts, "script", kStaticResTypeMode); - _res->allocResTypeData(rtCharset, MKTAG('C','H','A','R'), _numCharsets, "charset", kStaticResTypeMode); - _res->allocResTypeData(rtObjectName, 0, _numNewNames, "new name", kDynamicResTypeMode); - _res->allocResTypeData(rtInventory, 0, _numInventory, "inventory", kDynamicResTypeMode); - _res->allocResTypeData(rtTemp, 0, 10, "temp", kDynamicResTypeMode); - _res->allocResTypeData(rtScaleTable, 0, 5, "scale table", kDynamicResTypeMode); - _res->allocResTypeData(rtActorName, 0, _numActors, "actor name", kDynamicResTypeMode); - _res->allocResTypeData(rtVerb, 0, _numVerbs, "verb", kDynamicResTypeMode); - _res->allocResTypeData(rtString, 0, _numArray, "array", kDynamicResTypeMode); - _res->allocResTypeData(rtFlObject, 0, _numFlObject, "flobject", kDynamicResTypeMode); - _res->allocResTypeData(rtMatrix, 0, 10, "boxes", kDynamicResTypeMode); - _res->allocResTypeData(rtImage, MKTAG('A','W','I','Z'), _numImages, "images", kStaticResTypeMode); - _res->allocResTypeData(rtTalkie, MKTAG('T','L','K','E'), _numTalkies, "talkie", kStaticResTypeMode); + _numCostumes, kStaticResTypeMode); + _res->allocResTypeData(rtRoom, MKTAG('R','O','O','M'), _numRooms, kStaticResTypeMode); + _res->allocResTypeData(rtRoomImage, MKTAG('R','M','I','M'), _numRooms, kStaticResTypeMode); + _res->allocResTypeData(rtRoomScripts, MKTAG('R','M','S','C'), _numRooms, kStaticResTypeMode); + _res->allocResTypeData(rtSound, MKTAG('S','O','U','N'), _numSounds, kSoundResTypeMode); + _res->allocResTypeData(rtScript, MKTAG('S','C','R','P'), _numScripts, kStaticResTypeMode); + _res->allocResTypeData(rtCharset, MKTAG('C','H','A','R'), _numCharsets, kStaticResTypeMode); + _res->allocResTypeData(rtObjectName, 0, _numNewNames, kDynamicResTypeMode); + _res->allocResTypeData(rtInventory, 0, _numInventory, kDynamicResTypeMode); + _res->allocResTypeData(rtTemp, 0, 10, kDynamicResTypeMode); + _res->allocResTypeData(rtScaleTable, 0, 5, kDynamicResTypeMode); + _res->allocResTypeData(rtActorName, 0, _numActors, kDynamicResTypeMode); + _res->allocResTypeData(rtVerb, 0, _numVerbs, kDynamicResTypeMode); + _res->allocResTypeData(rtString, 0, _numArray, kDynamicResTypeMode); + _res->allocResTypeData(rtFlObject, 0, _numFlObject, kDynamicResTypeMode); + _res->allocResTypeData(rtMatrix, 0, 10, kDynamicResTypeMode); + _res->allocResTypeData(rtImage, MKTAG('A','W','I','Z'), _numImages, kStaticResTypeMode); + _res->allocResTypeData(rtTalkie, MKTAG('T','L','K','E'), _numTalkies, kStaticResTypeMode); } void ScummEngine_v70he::allocateArrays() { ScummEngine::allocateArrays(); - _res->allocResTypeData(rtSpoolBuffer, 0, 9, "spool buffer", kStaticResTypeMode); + _res->allocResTypeData(rtSpoolBuffer, 0, 9, kStaticResTypeMode); _heV7RoomIntOffsets = (uint32 *)calloc(_numRooms, sizeof(uint32)); } diff --git a/engines/scumm/resource.h b/engines/scumm/resource.h index 1182dfbc56..7a7d49d31c 100644 --- a/engines/scumm/resource.h +++ b/engines/scumm/resource.h @@ -90,8 +90,12 @@ public: * of various arrays. */ uint16 _num; - uint32 tag; - const char *name; + + /** + * The 4-byte tag or chunk type associated to this resource type, if any. + * Only applies to resources that are loaded from the game data files. + */ + uint32 _tag; /** * Array of size _num containing pointers to each resource of this type. @@ -154,7 +158,7 @@ public: void setHeapThreshold(int min, int max); - void allocResTypeData(int id, uint32 tag, int num, const char *name, ResTypeMode mode); + void allocResTypeData(int id, uint32 tag, int num, ResTypeMode mode); void freeResources(); byte *createResource(int type, int index, uint32 size); diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 22736973f7..21521d0fe6 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1233,7 +1233,7 @@ void ScummEngine::setupScumm() { requestLoad(ConfMan.getInt("save_slot")); } - _res->allocResTypeData(rtBuffer, 0, 10, "buffer", kDynamicResTypeMode); + _res->allocResTypeData(rtBuffer, 0, 10, kDynamicResTypeMode); setupScummVars(); |