diff options
Diffstat (limited to 'engines/access/char.cpp')
-rw-r--r-- | engines/access/char.cpp | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/engines/access/char.cpp b/engines/access/char.cpp index b359bcf13a..f6d3033b1b 100644 --- a/engines/access/char.cpp +++ b/engines/access/char.cpp @@ -27,15 +27,25 @@ namespace Access { -CharEntry::CharEntry(const byte *data) { +CharEntry::CharEntry(const byte *data, AccessEngine *vm) { Common::MemoryReadStream s(data, 999); _charFlag = s.readByte(); - _estabIndex = s.readSint16LE(); - _screenFile.load(s); + if (vm->getGameID() != GType_Amazon || !vm->isCD()) { + _screenFile.load(s); + _estabIndex = s.readSint16LE(); + } else { + _estabIndex = s.readSint16LE(); + _screenFile.load(s); + } + _paletteFile.load(s); _startColor = s.readUint16LE(); - _numColors = s.readUint16LE(); + if (vm->getGameID() == GType_MartianMemorandum) { + int lastColor = s.readUint16LE(); + _numColors = lastColor - _startColor; + } else + _numColors = s.readUint16LE(); // Load cells for (byte cell = s.readByte(); cell != 0xff; cell = s.readByte()) { @@ -68,19 +78,12 @@ CharEntry::CharEntry() { /*------------------------------------------------------------------------*/ CharManager::CharManager(AccessEngine *vm) : Manager(vm) { - switch (vm->getGameID()) { - case GType_Amazon: - // Setup character list - if (_vm->isDemo()) { - for (int i = 0; i < 27; ++i) - _charTable.push_back(CharEntry(Amazon::CHARTBL_DEMO[i])); - } else { - for (int i = 0; i < 37; ++i) - _charTable.push_back(CharEntry(Amazon::CHARTBL[i])); - } - break; - default: - error("Unknown game"); + // Setup character list + for (uint idx = 0; idx < _vm->_res->CHARTBL.size(); ++idx) { + if (_vm->_res->CHARTBL[idx].size() == 0) + _charTable.push_back(CharEntry()); + else + _charTable.push_back(CharEntry(&_vm->_res->CHARTBL[idx][0], _vm)); } _charFlag = 0; @@ -128,6 +131,7 @@ void CharManager::loadChar(int charId) { if (ce._animFile._fileNum != -1) { Resource *data = _vm->_files->loadFile(ce._animFile); _vm->_animation->loadAnimations(data); + delete data; } // Load script data @@ -152,8 +156,18 @@ void CharManager::charMenu() { screen.saveScreen(); screen.setDisplayScan(); - screen.plotImage(spr, 17, Common::Point(0, 176)); - screen.plotImage(spr, 18, Common::Point(155, 176)); + if (_vm->getGameID() == GType_MartianMemorandum) { + screen.plotImage(spr, 17, Common::Point(0, 184)); + screen.plotImage(spr, 18, Common::Point(193, 184)); + } else if (_vm->getGameID() == GType_Amazon) { + screen.plotImage(spr, 17, Common::Point(0, 176)); + screen.plotImage(spr, 18, Common::Point(155, 176)); + } else + error("Game not supported"); + + // Make a backup copy of the screen including the character buttons, + // for restoring when erasing conversation boxes + screen.copyTo(&_vm->_buffer1); screen.restoreScreen(); delete spr; |