diff options
author | Max Horn | 2011-05-11 18:11:37 +0200 |
---|---|---|
committer | Max Horn | 2011-05-13 11:47:11 +0200 |
commit | 0342ab3f1b2d67de6fa0112311b973b55d509f1c (patch) | |
tree | 67549fd86477bc6ee1fa7d1c26cca38664f41153 | |
parent | 75b9deb1856bae8355403faa5f55857f3929adb6 (diff) | |
download | scummvm-rg350-0342ab3f1b2d67de6fa0112311b973b55d509f1c.tar.gz scummvm-rg350-0342ab3f1b2d67de6fa0112311b973b55d509f1c.tar.bz2 scummvm-rg350-0342ab3f1b2d67de6fa0112311b973b55d509f1c.zip |
SCUMM: Rename ResTypeData::num to _num
-rw-r--r-- | engines/scumm/debugger.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/resource.cpp | 22 | ||||
-rw-r--r-- | engines/scumm/resource.h | 20 | ||||
-rw-r--r-- | engines/scumm/resource_v4.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/room.cpp | 8 | ||||
-rw-r--r-- | engines/scumm/saveload.cpp | 12 | ||||
-rw-r--r-- | engines/scumm/script.cpp | 4 |
7 files changed, 38 insertions, 34 deletions
diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp index d404802c3c..f7293b563b 100644 --- a/engines/scumm/debugger.cpp +++ b/engines/scumm/debugger.cpp @@ -374,8 +374,8 @@ bool ScummDebugger::Cmd_Actor(int argc, const char **argv) { DebugPrintf("Actor[%d]._elevation = %d\n", actnum, a->getElevation()); _vm->_fullRedraw = true; } else if (!strcmp(argv[2], "costume")) { - if (value >= _vm->_res->_types[rtCostume].num) - DebugPrintf("Costume not changed as %d exceeds max of %d\n", value, _vm->_res->_types[rtCostume].num); + if (value >= _vm->_res->_types[rtCostume]._num) + DebugPrintf("Costume not changed as %d exceeds max of %d\n", value, _vm->_res->_types[rtCostume]._num); else { a->setActorCostume(value); _vm->_fullRedraw = true; diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index 009fd5c11d..d0dd077c2c 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -491,7 +491,7 @@ int ScummEngine::readResTypeList(int id) { else num = _fileHandle->readUint16LE(); - if (num != _res->_types[id].num) { + if (num != _res->_types[id]._num) { error("Invalid number of %ss (%d) in directory", resTypeFromId(id), num); } @@ -534,7 +534,7 @@ void ResourceManager::allocResTypeData(int id, uint32 tag, int num, const char * error("Too many %ss (%d) in directory", name, num); _types[id]._mode = mode; - _types[id].num = num; + _types[id]._num = num; _types[id].tag = tag; _types[id].name = name; _types[id]._address = (byte **)calloc(num, sizeof(byte *)); @@ -605,7 +605,7 @@ void ScummEngine::ensureResourceLoaded(int type, int i) { if (type != rtCharset && i == 0) return; - if (i <= _res->_types[type].num && _res->_types[type]._address[i]) + if (i <= _res->_types[type]._num && _res->_types[type]._address[i]) return; loadResource(type, i); @@ -628,8 +628,8 @@ 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); + if (idx >= _res->_types[type]._num) + error("%s %d undefined %d %d", _res->_types[type].name, idx, _res->_types[type]._num, roomNr); if (roomNr == 0) roomNr = _roomResource; @@ -773,7 +773,7 @@ void ResourceManager::increaseResourceCounter() { byte counter; for (i = rtFirst; i <= rtLast; i++) { - for (j = _types[i].num; --j >= 0;) { + for (j = _types[i]._num; --j >= 0;) { counter = _types[i].flags[j] & RF_USAGE; if (counter && counter < RF_USAGE_MAX) { setResourceCounter(i, j, counter + 1); @@ -848,7 +848,7 @@ void ResourceManager::setHeapThreshold(int min, int max) { } bool ResourceManager::validateResource(const char *str, int type, int idx) const { - if (type < rtFirst || type > rtLast || (uint) idx >= (uint)_types[type].num) { + if (type < rtFirst || type > rtLast || (uint) idx >= (uint)_types[type]._num) { error("%s Illegal Glob type %s (%d) num %d", str, resTypeFromId(type), type, idx); return false; } @@ -861,7 +861,7 @@ void ResourceManager::nukeResource(int type, int idx) { if (!_types[type]._address) return; - assert(idx >= 0 && idx < _types[type].num); + assert(idx >= 0 && idx < _types[type]._num); ptr = _types[type]._address[idx]; if (ptr != NULL) { @@ -986,7 +986,7 @@ void ResourceManager::expireResources(uint32 size) { if (_types[i]._mode != kDynamicResTypeMode) { // Resources of this type can be reloaded from the data files, // so we can potentially unload them to free memory. - for (j = _types[i].num; --j >= 0;) { + for (j = _types[i]._num; --j >= 0;) { flag = _types[i].flags[j]; if (!(flag & RF_LOCK) && flag >= best_counter && _types[i]._address[j] && !_vm->isResourceInUse(i, j)) { best_counter = flag; @@ -1009,7 +1009,7 @@ void ResourceManager::expireResources(uint32 size) { void ResourceManager::freeResources() { int i, j; for (i = rtFirst; i <= rtLast; i++) { - for (j = _types[i].num; --j >= 0;) { + for (j = _types[i]._num; --j >= 0;) { if (isResourceLoaded(i, j)) nukeResource(i, j); } @@ -1060,7 +1060,7 @@ void ResourceManager::resourceStats() { byte flag; for (i = rtFirst; i <= rtLast; i++) - for (j = _types[i].num; --j >= 0;) { + for (j = _types[i]._num; --j >= 0;) { flag = _types[i].flags[j]; if (flag & RF_LOCK && _types[i]._address[j]) { lockedSize += _types[i]._size[j]; diff --git a/engines/scumm/resource.h b/engines/scumm/resource.h index dd314cb0c8..1182dfbc56 100644 --- a/engines/scumm/resource.h +++ b/engines/scumm/resource.h @@ -85,40 +85,44 @@ public: friend class ResourceManager; public: ResTypeMode _mode; - uint16 num; + /** + * The maximal number of resource of this type. Determines the size + * of various arrays. + */ + uint16 _num; uint32 tag; const char *name; /** - * Array of size num containing pointers to each resource of this type. + * Array of size _num containing pointers to each resource of this type. */ byte **_address; /** - * Array of size num containing the sizes of each resource of this type. + * Array of size _num containing the sizes of each resource of this type. */ uint32 *_size; protected: /** - * Array of size num containing TODO of each resource of this type. + * Array of size _num containing TODO of each resource of this type. */ byte *flags; /** - * Array of size num containing the status of each resource of this type. + * Array of size _num containing the status of each resource of this type. * This is a bitfield of which currently only one bit is used, which indicates * whether the resource is modified. */ byte *_status; public: /** - * Array of size num containing for each resource of this type the + * Array of size _num containing for each resource of this type the * id of the room (resp. the disk) the resource is contained in. */ byte *roomno; /** - * Array of size num containing room offsets of each resource of this type. + * Array of size _num containing room offsets of each resource of this type. * That is the offset (in bytes) where the data for this resources * can be found in the game data file(s), relative to the start * of the room the resource is contained in. @@ -129,7 +133,7 @@ public: uint32 *roomoffs; /** - * Array of size num. Occurs in HE 70+, but we don't use it for anything. + * Array of size _num. Occurs in HE 70+, but we don't use it for anything. */ uint32 *globsize; diff --git a/engines/scumm/resource_v4.cpp b/engines/scumm/resource_v4.cpp index 8fc27627b2..95eb8d4292 100644 --- a/engines/scumm/resource_v4.cpp +++ b/engines/scumm/resource_v4.cpp @@ -38,7 +38,7 @@ int ScummEngine_v4::readResTypeList(int id) { num = _fileHandle->readUint16LE(); - if (num != _res->_types[id].num) { + if (num != _res->_types[id]._num) { error("Invalid number of %ss (%d) in directory", resTypeFromId(id), num); } diff --git a/engines/scumm/room.cpp b/engines/scumm/room.cpp index 7e0f70e2cd..6ff55e26fd 100644 --- a/engines/scumm/room.cpp +++ b/engines/scumm/room.cpp @@ -525,14 +525,14 @@ void ScummEngine::resetRoomSubBlocks() { // // Load scale data // - for (i = 1; i < _res->_types[rtScaleTable].num; i++) + for (i = 1; i < _res->_types[rtScaleTable]._num; i++) _res->nukeResource(rtScaleTable, i); ptr = findResourceData(MKTAG('S','C','A','L'), roomptr); if (ptr) { int s1, s2, y1, y2; if (_game.version == 8) { - for (i = 1; i < _res->_types[rtScaleTable].num; i++, ptr += 16) { + for (i = 1; i < _res->_types[rtScaleTable]._num; i++, ptr += 16) { s1 = READ_LE_UINT32(ptr); y1 = READ_LE_UINT32(ptr + 4); s2 = READ_LE_UINT32(ptr + 8); @@ -540,7 +540,7 @@ void ScummEngine::resetRoomSubBlocks() { setScaleSlot(i, 0, y1, s1, 0, y2, s2); } } else { - for (i = 1; i < _res->_types[rtScaleTable].num; i++, ptr += 8) { + for (i = 1; i < _res->_types[rtScaleTable]._num; i++, ptr += 8) { s1 = READ_LE_UINT16(ptr); y1 = READ_LE_UINT16(ptr + 2); s2 = READ_LE_UINT16(ptr + 4); @@ -794,7 +794,7 @@ void ScummEngine_v3old::resetRoomSubBlocks() { // // No scale data in old bundle games // - for (i = 1; i < _res->_types[rtScaleTable].num; i++) + for (i = 1; i < _res->_types[rtScaleTable]._num; i++) _res->nukeResource(rtScaleTable, i); } diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 0ca16482ce..376351c19a 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -428,7 +428,7 @@ bool ScummEngine::loadState(int slot, bool compat) { // Nuke all resources for (i = rtFirst; i <= rtLast; i++) if (i != rtTemp && i != rtBuffer && (i != rtSound || _saveSound || !compat)) - for (j = 0; j < _res->_types[i].num; j++) { + for (j = 0; j < _res->_types[i]._num; j++) { _res->nukeResource(i, j); } @@ -517,7 +517,7 @@ bool ScummEngine::loadState(int slot, bool compat) { // loading such an old save game, try to upgrade the old to new format. if (hdr.ver < VER(22)) { // Convert all rtScaleTable resources to matching scale items - for (i = 1; i < _res->_types[rtScaleTable].num; i++) { + for (i = 1; i < _res->_types[rtScaleTable]._num; i++) { convertScaleTableToScaleSlot(i); } } @@ -1245,7 +1245,7 @@ void ScummEngine::saveOrLoad(Serializer *s) { for (type = rtFirst; type <= rtLast; type++) { if (_res->_types[type]._mode != kStaticResTypeMode && type != rtTemp && type != rtBuffer) { s->saveUint16(type); // Save the res type... - for (idx = 0; idx < _res->_types[type].num; idx++) { + for (idx = 0; idx < _res->_types[type]._num; idx++) { // Only save resources which actually exist... if (_res->_types[type]._address[idx]) { s->saveUint16(idx); // Save the index of the resource @@ -1259,7 +1259,7 @@ void ScummEngine::saveOrLoad(Serializer *s) { } else { while ((type = s->loadUint16()) != 0xFFFF) { while ((idx = s->loadUint16()) != 0xFFFF) { - assert(0 <= idx && idx < _res->_types[type].num); + assert(0 <= idx && idx < _res->_types[type]._num); loadResource(s, type, idx); } } @@ -1275,7 +1275,7 @@ void ScummEngine::saveOrLoad(Serializer *s) { // unchanged resource counts, we have to hard code the following check if (_game.version < 6 && type == rtObjectName) continue; - for (idx = 1; idx < _res->_types[type].num; idx++) + for (idx = 1; idx < _res->_types[type]._num; idx++) loadResourceOLD(s, type, idx); } } @@ -1388,7 +1388,7 @@ void ScummEngine::saveOrLoad(Serializer *s) { // if (s->isSaving()) { for (i = rtFirst; i <= rtLast; i++) - for (j = 1; j < _res->_types[i].num; j++) { + for (j = 1; j < _res->_types[i]._num; j++) { if (_res->isLocked(i, j)) { s->saveByte(i); s->saveUint16(j); diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp index 7f279a3f0c..e418fcd290 100644 --- a/engines/scumm/script.cpp +++ b/engines/scumm/script.cpp @@ -397,7 +397,7 @@ void ScummEngine::getScriptBaseAddress() { case WIO_ROOM: /* room script */ if (_game.version == 8) { _scriptOrgPointer = getResourceAddress(rtRoomScripts, _roomResource); - assert(_roomResource < _res->_types[rtRoomScripts].num); + assert(_roomResource < _res->_types[rtRoomScripts]._num); _lastCodePtr = &_res->_types[rtRoomScripts]._address[_roomResource]; } else { _scriptOrgPointer = getResourceAddress(rtRoom, _roomResource); @@ -1099,7 +1099,7 @@ void ScummEngine::checkAndRunSentenceScript() { // For now we assume that if there are more than 460 scripts, then // the pair 29/104 is used, else the pair 28/103. - if (_res->_types[rtScript].num > 460) { + if (_res->_types[rtScript]._num > 460) { if (sentenceScript == 104) sentenceScript = 29; } else { |