aboutsummaryrefslogtreecommitdiff
path: root/engines/macventure/world.cpp
diff options
context:
space:
mode:
authorBorja Lorente2016-06-16 20:33:02 +0200
committerBorja Lorente2016-08-14 18:25:35 +0200
commita112cdcb9dd8349390a54b8c5cd2c0c8bc3ad66a (patch)
tree1517e97ce4428a6febb66c1be333e01ba07a14e7 /engines/macventure/world.cpp
parentbc435b398e0c6ad0afb48f1d30721d3d4588d6c6 (diff)
downloadscummvm-rg350-a112cdcb9dd8349390a54b8c5cd2c0c8bc3ad66a.tar.gz
scummvm-rg350-a112cdcb9dd8349390a54b8c5cd2c0c8bc3ad66a.tar.bz2
scummvm-rg350-a112cdcb9dd8349390a54b8c5cd2c0c8bc3ad66a.zip
MACVENTURE: Add object attribute retrieval
Diffstat (limited to 'engines/macventure/world.cpp')
-rw-r--r--engines/macventure/world.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/engines/macventure/world.cpp b/engines/macventure/world.cpp
index cdc0e1682e..209b3c1096 100644
--- a/engines/macventure/world.cpp
+++ b/engines/macventure/world.cpp
@@ -19,6 +19,9 @@ World::World(MacVentureEngine *engine, Common::MacResManager *resMan) {
_saveGame = new SaveGame(_engine, saveGameRes);
+ debug("%x", _saveGame->getGroups()[0][1]);
+ debug(11, "Parent of player is %d", getObjAttr(1, 0));
+
_objectConstants = new Container(_engine->getFilePath(kObjectPathID).c_str());
delete saveGameRes;
@@ -35,6 +38,24 @@ World::~World() {
delete _objectConstants;
}
+
+uint32 World::getObjAttr(uint32 objID, uint32 attrID) {
+ uint32 res;
+ uint32 index = _engine->getGlobalSettings().attrIndices[attrID];
+ if (!(index & 0x80)) { // It's not a constant
+ res = _saveGame->getGroups()[attrID][objID];
+ } else {
+ Common::SeekableReadStream *objStream = _objectConstants->getItem(objID);
+ index &= 0x7F;
+ objStream->skip((index * 2) - 1);
+ res = objStream->readUint16BE();
+ }
+ res &= _engine->getGlobalSettings().attrMasks[attrID];
+ res >>= _engine->getGlobalSettings().attrShifts[attrID];
+ debug(11, "Attribute %x from object %x is %x", attrID, objID, res);
+ return res;
+}
+
bool World::loadStartGameFileName() {
Common::SeekableReadStream *res;