diff options
Diffstat (limited to 'engines/scumm/saveload.cpp')
-rw-r--r-- | engines/scumm/saveload.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index be90ba2f39..424e0005f4 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->num[i]; 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->num[rtScaleTable]; i++) { + for (i = 1; i < _res->_types[rtScaleTable].num; i++) { convertScaleTableToScaleSlot(i); } } @@ -1243,11 +1243,11 @@ void ScummEngine::saveOrLoad(Serializer *s) { // number of script resources, savegames won't break. if (s->isSaving()) { for (type = rtFirst; type <= rtLast; type++) { - if (_res->mode[type] != 1 && type != rtTemp && type != rtBuffer) { + if (_res->_types[type].mode != 1 && type != rtTemp && type != rtBuffer) { s->saveUint16(type); // Save the res type... - for (idx = 0; idx < _res->num[type]; idx++) { + for (idx = 0; idx < _res->_types[type].num; idx++) { // Only save resources which actually exist... - if (_res->address[type][idx]) { + if (_res->_types[type].address[idx]) { s->saveUint16(idx); // Save the index of the resource saveResource(s, type, idx); } @@ -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->num[type]); + assert(0 <= idx && idx < _res->_types[type].num); loadResource(s, type, idx); } } @@ -1269,13 +1269,13 @@ void ScummEngine::saveOrLoad(Serializer *s) { // with index 0, and breaks whenever we change the limit on a given // resource type. for (type = rtFirst; type <= rtLast; type++) - if (_res->mode[type] != 1 && type != rtTemp && type != rtBuffer) { + if (_res->_types[type].mode != 1 && type != rtTemp && type != rtBuffer) { // For V1-V5 games, there used to be no object name resources. // At some point this changed. But since old savegames rely on // unchanged resource counts, we have to hard code the following check if (_game.version < 6 && type == rtObjectName) continue; - for (idx = 1; idx < _res->num[type]; idx++) + for (idx = 1; idx < _res->_types[type].num; idx++) saveLoadResource(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->num[i]; j++) { + for (j = 1; j < _res->_types[i].num; j++) { if (_res->isLocked(i, j)) { s->saveByte(i); s->saveUint16(j); @@ -1637,9 +1637,9 @@ void ScummEngine::saveLoadResource(Serializer *ser, int type, int idx) { byte *ptr; uint32 size; - if (!_res->mode[type]) { + if (!_res->_types[type].mode) { if (ser->isSaving()) { - ptr = _res->address[type][idx]; + ptr = _res->_types[type].address[idx]; if (ptr == NULL) { ser->saveUint32(0); return; @@ -1676,10 +1676,10 @@ void ScummEngine::saveLoadResource(Serializer *ser, int type, int idx) { } } } - } else if (_res->mode[type] == 2 && ser->getVersion() >= VER(23)) { + } else if (_res->_types[type].mode == 2 && ser->getVersion() >= VER(23)) { // Save/load only a list of resource numbers that need to be reloaded. if (ser->isSaving()) { - ser->saveUint16(_res->address[type][idx] ? 1 : 0); + ser->saveUint16(_res->_types[type].address[idx] ? 1 : 0); } else { if (ser->loadUint16()) ensureResourceLoaded(type, idx); @@ -1688,10 +1688,10 @@ void ScummEngine::saveLoadResource(Serializer *ser, int type, int idx) { } void ScummEngine::saveResource(Serializer *ser, int type, int idx) { - assert(_res->address[type][idx]); + assert(_res->_types[type].address[idx]); - if (_res->mode[type] == 0) { - byte *ptr = _res->address[type][idx]; + if (_res->_types[type].mode == 0) { + byte *ptr = _res->_types[type].address[idx]; uint32 size = ((MemBlkHeader *)ptr)->size; ser->saveUint32(size); @@ -1713,7 +1713,7 @@ void ScummEngine::loadResource(Serializer *ser, int type, int idx) { assert(size); _res->createResource(type, idx, size); ser->loadBytes(getResourceAddress(type, idx), size); - } else if (_res->mode[type] == 0) { + } else if (_res->_types[type].mode == 0) { uint32 size = ser->loadUint32(); assert(size); _res->createResource(type, idx, size); @@ -1725,7 +1725,7 @@ void ScummEngine::loadResource(Serializer *ser, int type, int idx) { if (type == rtObjectName) { _newNames[idx] = ser->loadUint16(); } - } else if (_res->mode[type] == 2) { + } else if (_res->_types[type].mode == 2) { // HE Games use sound resource 1 for speech if (_game.heversion >= 60 && idx == 1) return; |