diff options
author | Borja Lorente | 2016-08-13 17:45:49 +0200 |
---|---|---|
committer | Borja Lorente | 2016-08-19 16:29:17 +0200 |
commit | 019f3d4b626f290fa7e2bc6c6be0ab5c43ecd468 (patch) | |
tree | 203e78a0e8491b18e1c0b72c2c58b6e5e3dd5f3b /engines/macventure/world.cpp | |
parent | 44a6f8a1dbdfa271aaa9ccf4b1ecc48e275ca11a (diff) | |
download | scummvm-rg350-019f3d4b626f290fa7e2bc6c6be0ab5c43ecd468.tar.gz scummvm-rg350-019f3d4b626f290fa7e2bc6c6be0ab5c43ecd468.tar.bz2 scummvm-rg350-019f3d4b626f290fa7e2bc6c6be0ab5c43ecd468.zip |
MACVENTURE: Add wrapper class for global settings
Diffstat (limited to 'engines/macventure/world.cpp')
-rw-r--r-- | engines/macventure/world.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/engines/macventure/world.cpp b/engines/macventure/world.cpp index 708ccfec33..20695dbff6 100644 --- a/engines/macventure/world.cpp +++ b/engines/macventure/world.cpp @@ -56,7 +56,7 @@ void World::startNewGame() { uint32 World::getObjAttr(ObjID objID, uint32 attrID) { uint res; - uint32 index = _engine->getGlobalSettings().attrIndices[attrID]; + uint32 index = _engine->getGlobalSettings()._attrIndices[attrID]; // HACK, but if I try to initialize it in the else clause, it goes out of scope and segfaults Common::SeekableReadStream *objStream = _objectConstants->getItem(objID); if (!(index & 0x80)) { // It's not a constant @@ -69,8 +69,8 @@ uint32 World::getObjAttr(ObjID objID, uint32 attrID) { res = objStream->readByte() << 8; res |= objStream->readByte(); } - res &= _engine->getGlobalSettings().attrMasks[attrID]; - res >>= _engine->getGlobalSettings().attrShifts[attrID]; + res &= _engine->getGlobalSettings()._attrMasks[attrID]; + res >>= _engine->getGlobalSettings()._attrShifts[attrID]; if (res & 0x8000) res = -((res ^ 0xffff) + 1); debugC(5, kMVDebugMain, "Attribute %x from object %x is %x", attrID, objID, res); @@ -88,11 +88,11 @@ void World::setObjAttr(ObjID objID, uint32 attrID, Attribute value) { if (attrID < kAttrOtherDoor) _engine->enqueueObject(kUpdateObject, objID); - uint32 idx = _engine->getGlobalSettings().attrIndices[attrID]; - value <<= _engine->getGlobalSettings().attrShifts[attrID]; - value &= _engine->getGlobalSettings().attrMasks[attrID]; + uint32 idx = _engine->getGlobalSettings()._attrIndices[attrID]; + value <<= _engine->getGlobalSettings()._attrShifts[attrID]; + value &= _engine->getGlobalSettings()._attrMasks[attrID]; Attribute oldVal = _saveGame->getAttr(objID, idx); - oldVal &= ~_engine->getGlobalSettings().attrMasks[attrID]; + oldVal &= ~_engine->getGlobalSettings()._attrMasks[attrID]; _saveGame->setAttr(idx, objID, (value | oldVal)); _engine->gameChanged(); } @@ -195,7 +195,7 @@ bool World::intersects(ObjID objID, Common::Rect rect) { void World::calculateObjectRelations() { _relations.clear(); ObjID val, next; - uint32 numObjs = _engine->getGlobalSettings().numObjects; + uint32 numObjs = _engine->getGlobalSettings()._numObjects; const AttributeGroup &parents = *_saveGame->getGroup(0); for (uint i = 0; i < numObjs * 2; i++) { _relations.push_back(0); @@ -305,9 +305,9 @@ void SaveGame::saveInto(Common::OutSaveFile *file) { void SaveGame::loadGroups(MacVentureEngine *engine, Common::SeekableReadStream * res) { GlobalSettings settings = engine->getGlobalSettings(); - for (int i = 0; i < settings.numGroups; ++i) { + for (int i = 0; i < settings._numGroups; ++i) { AttributeGroup g; - for (int j = 0; j < settings.numObjects; ++j) + for (int j = 0; j < settings._numObjects; ++j) g.push_back(res->readUint16BE()); _groups.push_back(g); @@ -316,7 +316,7 @@ void SaveGame::loadGroups(MacVentureEngine *engine, Common::SeekableReadStream * void SaveGame::loadGlobals(MacVentureEngine *engine, Common::SeekableReadStream * res) { GlobalSettings settings = engine->getGlobalSettings(); - for (int i = 0; i < settings.numGlobals; ++i) { + for (int i = 0; i < settings._numGlobals; ++i) { _globals.push_back(res->readUint16BE()); } } |