diff options
author | Borja Lorente | 2016-07-27 21:08:33 +0200 |
---|---|---|
committer | Borja Lorente | 2016-08-14 19:00:35 +0200 |
commit | f58435a2bcf41153b5a0c0e61548dd350e24cad9 (patch) | |
tree | cbf32824cde250e0ef3c7da769cb062790234cb2 /engines/macventure | |
parent | 518d336e5a5e266c2b443a9cacfa88abd541fe28 (diff) | |
download | scummvm-rg350-f58435a2bcf41153b5a0c0e61548dd350e24cad9.tar.gz scummvm-rg350-f58435a2bcf41153b5a0c0e61548dd350e24cad9.tar.bz2 scummvm-rg350-f58435a2bcf41153b5a0c0e61548dd350e24cad9.zip |
MACVENTURE: Add dejavu
Diffstat (limited to 'engines/macventure')
-rw-r--r-- | engines/macventure/container.h | 52 | ||||
-rw-r--r-- | engines/macventure/detection.cpp | 1 | ||||
-rw-r--r-- | engines/macventure/detection_tables.h | 1 | ||||
-rw-r--r-- | engines/macventure/gui.cpp | 2 | ||||
-rw-r--r-- | engines/macventure/script.cpp | 2 | ||||
-rw-r--r-- | engines/macventure/world.cpp | 4 |
6 files changed, 34 insertions, 28 deletions
diff --git a/engines/macventure/container.h b/engines/macventure/container.h index f0094a786b..a909122874 100644 --- a/engines/macventure/container.h +++ b/engines/macventure/container.h @@ -26,6 +26,7 @@ #include "macventure/macventure.h" #include "common/file.h" +#include "common/fs.h" #include "common/bitstream.h" namespace MacVenture { @@ -38,20 +39,23 @@ struct ItemGroup { typedef uint32 ContainerHeader; -class Container { +class Container { public: - Container(const char *filename) { - _filename = Common::String(filename); + Container(Common::String filename) { + _filename = filename; - if (!_file.open(filename)) - error("Could not open %s", filename); + FSNode node = FSDirectory("."); + debug(node.getDisplayName().c_str()); + + if (!_file.open(_filename)) + error("Could not open %s", _filename.c_str()); _res = _file.readStream(_file.size()); _header = _res->readUint32BE(); _simplified = false; - - if (!(_header & 0x80000000)) { + + if (!(_header & 0x80000000)) { // Is simplified container _simplified = true; int dataLen = _res->size() - sizeof(_header); @@ -75,7 +79,7 @@ public: for (uint i = 0; i < numGroups; ++i) { ItemGroup group; - + // Place myself in the correct position to read group _res->seek(_header + (i * 6) + 0x30, SEEK_SET); byte b1, b2, b3; @@ -91,10 +95,10 @@ public: // Place the bit reader in the correct position // group.bitOffset indicates the offset from the start of the subHeader - _res->seek(_header + (group.bitOffset >> 3), SEEK_SET); + _res->seek(_header + (group.bitOffset >> 3), SEEK_SET); uint32 bits = group.bitOffset & 7; - for (uint j = 0; j < 64; ++j) { + for (uint j = 0; j < 64; ++j) { uint32 length = 0; //debug("reading mask from address %x", _res->pos()); uint32 mask = _res->readUint32BE(); @@ -107,8 +111,8 @@ public: for (x = 0; x < 16; x++) { if (_huff[x] > mask) break; } - - // I will opt to copy the code from webventure, + + // I will opt to copy the code from webventure, // But according to the docs, this call should suffice: // length = bitStream.getBits(_lens[x]); // The problem is that _lens[] usually contains values larger @@ -131,19 +135,19 @@ public: else length >>= (32 - bitSize) - bits; length &= (1 << bitSize) - 1; length |= 1 << bitSize; - bits += bitSize; + bits += bitSize; if (bits & 0x10) { bits &= 0xF; _res->seek(2, SEEK_CUR); } - } + } group.lengths[j] = length; debug(11, "Load legth of object %d:%d is %d", i, j, length); } - - _groups.push_back(group); - } + + _groups.push_back(group); + } } } @@ -173,12 +177,12 @@ public: /** * getItemByteSize should be called before this one */ - Common::SeekableReadStream *getItem(uint32 id) { + Common::SeekableReadStream *getItem(uint32 id) { if (_simplified) { _res->seek((id * _lenObjs) + sizeof(_header), SEEK_SET); } else { uint32 groupID = (id >> 6); - uint32 objectIndex = id & 0x3f; // Index within the group + uint32 objectIndex = id & 0x3f; // Index within the group uint32 offset = 0; for (uint i = 0; i < objectIndex; i++) { @@ -192,24 +196,24 @@ public: Common::SeekableReadStream *res = _res->readStream(getItemByteSize(id) * 2); return res; } - + protected: bool _simplified; - + uint _lenObjs; // In the case of simple container, lenght of an object uint _numObjs; ContainerHeader _header; - + uint16 _huff[15]; // huffman masks uint8 _lens[16]; // huffman lengths Common::Array<ItemGroup> _groups; - + Common::String _filename; Common::File _file; Common::SeekableReadStream *_res; - + }; diff --git a/engines/macventure/detection.cpp b/engines/macventure/detection.cpp index 88fb85d650..597f859cee 100644 --- a/engines/macventure/detection.cpp +++ b/engines/macventure/detection.cpp @@ -41,6 +41,7 @@ namespace MacVenture { static const PlainGameDescriptor macventureGames[] = { { "shadowgate", "Shadowgate" }, + { "deja_vu", "Deja Vu"}, { 0, 0 } }; diff --git a/engines/macventure/detection_tables.h b/engines/macventure/detection_tables.h index e2e94261bb..ebcf35f8b6 100644 --- a/engines/macventure/detection_tables.h +++ b/engines/macventure/detection_tables.h @@ -28,6 +28,7 @@ namespace MacVenture { static const ADGameDescription gameDescriptions[] = { BASEGAME("shadowgate", "Zojoi Rerelease", "Shadowgate.bin", "ebbfbcbf93938bd2900cb0c0213b19ad", 68974), // Zojoi Rerelease + BASEGAME("deja_vu", "Zojoi Rerelease", "Déjà Vu.bin", "5e9f5a8e3c8eb29ed02b34ae5937354f", 69034), // Zojoi Rerelease AD_TABLE_END_MARKER }; } // End of namespace MacVenture diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp index 738ea900af..7691b56697 100644 --- a/engines/macventure/gui.cpp +++ b/engines/macventure/gui.cpp @@ -368,7 +368,7 @@ void Gui::loadBorder(Graphics::MacWindow *target, Common::String filename, bool } void Gui::loadGraphics() { - _graphics = new Container(_engine->getFilePath(kGraphicPathID).c_str()); + _graphics = new Container(_engine->getFilePath(kGraphicPathID)); } bool Gui::loadMenus() { diff --git a/engines/macventure/script.cpp b/engines/macventure/script.cpp index 36aabae3ed..51bfa3382b 100644 --- a/engines/macventure/script.cpp +++ b/engines/macventure/script.cpp @@ -33,7 +33,7 @@ ScriptEngine::ScriptEngine(MacVentureEngine * engine, World * world) { _engine = engine; _world = world; // HACK - _scripts = new Container("Shadowgate II/Shadow Filter"); + _scripts = new Container(_engine->getFilePath(kFilterPathID)); } ScriptEngine::~ScriptEngine() { diff --git a/engines/macventure/world.cpp b/engines/macventure/world.cpp index e6efeb5598..f5af029f8f 100644 --- a/engines/macventure/world.cpp +++ b/engines/macventure/world.cpp @@ -20,10 +20,10 @@ World::World(MacVentureEngine *engine, Common::MacResManager *resMan) { Common::SeekableReadStream *saveGameRes = saveGameFile.readStream(saveGameFile.size()); _saveGame = new SaveGame(_engine, saveGameRes); - _objectConstants = new Container(_engine->getFilePath(kObjectPathID).c_str()); + _objectConstants = new Container(_engine->getFilePath(kObjectPathID)); calculateObjectRelations(); - _gameText = new Container(_engine->getFilePath(kTextPathID).c_str()); + _gameText = new Container(_engine->getFilePath(kTextPathID)); delete saveGameRes; saveGameFile.close(); |