diff options
author | Alexander Tkachev | 2016-07-27 17:51:00 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-07-27 17:51:00 +0600 |
commit | 35883517994efbcef9b5eb429b3888235745dea8 (patch) | |
tree | 4d91db6b3a5cf1cb7775526f39981ffca2554d31 /engines | |
parent | 6b21b1f89365bd77494940ec918212069238cc70 (diff) | |
download | scummvm-rg350-35883517994efbcef9b5eb429b3888235745dea8.tar.gz scummvm-rg350-35883517994efbcef9b5eb429b3888235745dea8.tar.bz2 scummvm-rg350-35883517994efbcef9b5eb429b3888235745dea8.zip |
WAGE: Refine saveGame() once more
_resourceId is added to entities, so saveGame() can access these ids and
save them.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/wage/entities.cpp | 10 | ||||
-rw-r--r-- | engines/wage/entities.h | 6 | ||||
-rw-r--r-- | engines/wage/saveload.cpp | 12 | ||||
-rw-r--r-- | engines/wage/world.cpp | 6 |
4 files changed, 24 insertions, 10 deletions
diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp index 43ac6c8cc7..b2babbab4d 100644 --- a/engines/wage/entities.cpp +++ b/engines/wage/entities.cpp @@ -80,6 +80,8 @@ Context::Context() { } Scene::Scene() { + _resourceId = 0; + _script = NULL; _design = NULL; _textBounds = NULL; @@ -104,6 +106,8 @@ Scene::Scene(Common::String name, Common::SeekableReadStream *data) { _classType = SCENE; _design = new Design(data); + _resourceId = 0; + _script = NULL; _textBounds = NULL; _fontSize = 0; @@ -221,6 +225,7 @@ Designed *Scene::lookUpEntity(int x, int y) { Obj::Obj() : _currentOwner(NULL), _currentScene(NULL) { _index = 0; + _resourceId = 0; _namePlural = false; _value = 0; _attackType = 0; @@ -231,7 +236,9 @@ Obj::Obj() : _currentOwner(NULL), _currentScene(NULL) { _damage = 0; } -Obj::Obj(Common::String name, Common::SeekableReadStream *data) { +Obj::Obj(Common::String name, Common::SeekableReadStream *data, int resourceId) { + _resourceId = resourceId; + _name = name; _classType = OBJ; _currentOwner = NULL; @@ -322,6 +329,7 @@ Chr::Chr(Common::String name, Common::SeekableReadStream *data) { _design = new Design(data); _index = 0; + _resourceId = 0; _currentScene = NULL; setDesignBounds(readRect(data)); diff --git a/engines/wage/entities.h b/engines/wage/entities.h index 9e706f0d58..f327270254 100644 --- a/engines/wage/entities.h +++ b/engines/wage/entities.h @@ -152,6 +152,7 @@ public: Chr(Common::String name, Common::SeekableReadStream *data); int _index; + int _resourceId; Common::String _initialScene; int _gender; bool _nameProperNoun; @@ -229,7 +230,7 @@ public: class Obj : public Designed { public: Obj(); - Obj(Common::String name, Common::SeekableReadStream *data); + Obj(Common::String name, Common::SeekableReadStream *data, int resourceId); ~Obj(); enum ObjectType { @@ -256,6 +257,7 @@ public: public: int _index; + int _resourceId; bool _namePlural; uint _value; int _attackType; @@ -301,6 +303,8 @@ public: RANDOM = 1 }; + int _resourceId; + Script *_script; Common::String _text; Common::Rect *_textBounds; diff --git a/engines/wage/saveload.cpp b/engines/wage/saveload.cpp index 60852551b7..a204757543 100644 --- a/engines/wage/saveload.cpp +++ b/engines/wage/saveload.cpp @@ -212,7 +212,7 @@ int WageEngine::saveGame(const Common::String &fileName, const Common::String &d for (uint32 i = 0; i < orderedScenes.size(); ++i) { Scene *scene = orderedScenes[i]; if (scene != _world->_storageScene) { - out->writeSint16LE(0); //TODO: scene.resourceId + out->writeSint16LE(scene->_resourceId); out->writeSint16LE(scene->_worldY); out->writeSint16LE(scene->_worldX); out->writeByte(scene->_blocked[NORTH] ? 0x01 : 0x00); @@ -232,8 +232,8 @@ int WageEngine::saveGame(const Common::String &fileName, const Common::String &d Common::Array<Chr *> &orderedChrs = _world->_orderedChrs; for (uint32 i = 0; i < orderedChrs.size(); ++i) { Chr *chr = orderedChrs[i]; - out->writeSint16LE(0); //TODO: chr.getResourceID() - out->writeSint16LE(0); //TODO: chr->_currentScene.getResourceID() + out->writeSint16LE(chr->_resourceId); + out->writeSint16LE(chr->_currentScene->_resourceId); Context &chrContext = chr->_context; out->writeByte(chrContext._statVariables[PHYS_STR_CUR]); out->writeByte(chrContext._statVariables[PHYS_HIT_CUR]); @@ -263,9 +263,9 @@ int WageEngine::saveGame(const Common::String &fileName, const Common::String &d Scene *location = obj->_currentScene; Chr *owner = obj->_currentOwner; - out->writeSint16LE(0); //TODO: obj.getResourceID() - out->writeSint16LE(0); //TODO: location == nullptr ? 0 : location.getResourceID()); - out->writeSint16LE(0); //TODO: owner == nullptr ? 0 : owner.getResourceID()); + out->writeSint16LE(obj->_resourceId); + out->writeSint16LE(location == nullptr ? 0 : location->_resourceId); + out->writeSint16LE(owner == nullptr ? 0 : owner->_resourceId); // bytes 7-9 are unknown (always = 0) out->writeByte(0); diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp index 8b89060da3..286ecddf4d 100644 --- a/engines/wage/world.cpp +++ b/engines/wage/world.cpp @@ -217,6 +217,8 @@ bool World::loadWorld(Common::MacResManager *resMan) { delete res; } + + scene->_resourceId = *iter; addScene(scene); } @@ -226,7 +228,7 @@ bool World::loadWorld(Common::MacResManager *resMan) { for (iter = resArray.begin(); iter != resArray.end(); ++iter) { res = resMan->getResource(MKTAG('A','O','B','J'), *iter); - addObj(new Obj(resMan->getResName(MKTAG('A','O','B','J'), *iter), res)); + addObj(new Obj(resMan->getResName(MKTAG('A','O','B','J'), *iter), res, *iter)); } // Load Characters @@ -236,7 +238,7 @@ bool World::loadWorld(Common::MacResManager *resMan) { for (iter = resArray.begin(); iter != resArray.end(); ++iter) { res = resMan->getResource(MKTAG('A','C','H','R'), *iter); Chr *chr = new Chr(resMan->getResName(MKTAG('A','C','H','R'), *iter), res); - + chr->_resourceId = *iter; addChr(chr); // TODO: What if there's more than one player character? if (chr->_playerCharacter) |