aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/resource_v2.cpp
diff options
context:
space:
mode:
authorMax Horn2011-05-11 16:23:26 +0200
committerMax Horn2011-05-13 11:47:08 +0200
commit45e65d7ea04b10cf7bb5282bd66b8df609700a63 (patch)
tree9600fbf0670d552e5b68b7f55c446c0fb5c9596d /engines/scumm/resource_v2.cpp
parentb37463fe5921420a9081aa6c5cf7588d52b41e78 (diff)
downloadscummvm-rg350-45e65d7ea04b10cf7bb5282bd66b8df609700a63.tar.gz
scummvm-rg350-45e65d7ea04b10cf7bb5282bd66b8df609700a63.tar.bz2
scummvm-rg350-45e65d7ea04b10cf7bb5282bd66b8df609700a63.zip
SCUMM: Refactor how resource (types) are srepresented
Previously, we had a couple of arrays of size N (where N = number of resource types), one for each attribute of a resource type (such as as the number of resources of that type. Now, we have one array of size N, whose elements are a record aggregating all the attributes of each resource type.
Diffstat (limited to 'engines/scumm/resource_v2.cpp')
-rw-r--r--engines/scumm/resource_v2.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/engines/scumm/resource_v2.cpp b/engines/scumm/resource_v2.cpp
index c183a0e83b..f86924821d 100644
--- a/engines/scumm/resource_v2.cpp
+++ b/engines/scumm/resource_v2.cpp
@@ -84,40 +84,40 @@ void ScummEngine_v2::readClassicIndexFile() {
}
for (i = 0; i < _numRooms; i++) {
- _res->roomno[rtRoom][i] = i;
+ _res->_types[rtRoom].roomno[i] = i;
}
_fileHandle->seek(_numRooms, SEEK_CUR);
for (i = 0; i < _numRooms; i++) {
- _res->roomoffs[rtRoom][i] = _fileHandle->readUint16LE();
- if (_res->roomoffs[rtRoom][i] == 0xFFFF)
- _res->roomoffs[rtRoom][i] = (uint32)RES_INVALID_OFFSET;
+ _res->_types[rtRoom].roomoffs[i] = _fileHandle->readUint16LE();
+ if (_res->_types[rtRoom].roomoffs[i] == 0xFFFF)
+ _res->_types[rtRoom].roomoffs[i] = (uint32)RES_INVALID_OFFSET;
}
for (i = 0; i < _numCostumes; i++) {
- _res->roomno[rtCostume][i] = _fileHandle->readByte();
+ _res->_types[rtCostume].roomno[i] = _fileHandle->readByte();
}
for (i = 0; i < _numCostumes; i++) {
- _res->roomoffs[rtCostume][i] = _fileHandle->readUint16LE();
- if (_res->roomoffs[rtCostume][i] == 0xFFFF)
- _res->roomoffs[rtCostume][i] = (uint32)RES_INVALID_OFFSET;
+ _res->_types[rtCostume].roomoffs[i] = _fileHandle->readUint16LE();
+ if (_res->_types[rtCostume].roomoffs[i] == 0xFFFF)
+ _res->_types[rtCostume].roomoffs[i] = (uint32)RES_INVALID_OFFSET;
}
for (i = 0; i < _numScripts; i++) {
- _res->roomno[rtScript][i] = _fileHandle->readByte();
+ _res->_types[rtScript].roomno[i] = _fileHandle->readByte();
}
for (i = 0; i < _numScripts; i++) {
- _res->roomoffs[rtScript][i] = _fileHandle->readUint16LE();
- if (_res->roomoffs[rtScript][i] == 0xFFFF)
- _res->roomoffs[rtScript][i] = (uint32)RES_INVALID_OFFSET;
+ _res->_types[rtScript].roomoffs[i] = _fileHandle->readUint16LE();
+ if (_res->_types[rtScript].roomoffs[i] == 0xFFFF)
+ _res->_types[rtScript].roomoffs[i] = (uint32)RES_INVALID_OFFSET;
}
for (i = 0; i < _numSounds; i++) {
- _res->roomno[rtSound][i] = _fileHandle->readByte();
+ _res->_types[rtSound].roomno[i] = _fileHandle->readByte();
}
for (i = 0; i < _numSounds; i++) {
- _res->roomoffs[rtSound][i] = _fileHandle->readUint16LE();
- if (_res->roomoffs[rtSound][i] == 0xFFFF)
- _res->roomoffs[rtSound][i] = (uint32)RES_INVALID_OFFSET;
+ _res->_types[rtSound].roomoffs[i] = _fileHandle->readUint16LE();
+ if (_res->_types[rtSound].roomoffs[i] == 0xFFFF)
+ _res->_types[rtSound].roomoffs[i] = (uint32)RES_INVALID_OFFSET;
}
}