diff options
author | Paul Gilbert | 2018-07-20 19:05:56 -0700 |
---|---|---|
committer | Paul Gilbert | 2018-07-20 19:05:56 -0700 |
commit | af6034efcdf9ff12e037f03626caf2c89c11a6ed (patch) | |
tree | d08635577aca00bcbc6475276e2836de63b17e89 /engines/access/martian | |
parent | b6dc832346ef1a70390970430f604d6b4625d268 (diff) | |
download | scummvm-rg350-af6034efcdf9ff12e037f03626caf2c89c11a6ed.tar.gz scummvm-rg350-af6034efcdf9ff12e037f03626caf2c89c11a6ed.tar.bz2 scummvm-rg350-af6034efcdf9ff12e037f03626caf2c89c11a6ed.zip |
ACCESS: MM: Implement proper game data and fonts in access.dat
Diffstat (limited to 'engines/access/martian')
-rw-r--r-- | engines/access/martian/martian_game.cpp | 9 | ||||
-rw-r--r-- | engines/access/martian/martian_resources.cpp | 29 | ||||
-rw-r--r-- | engines/access/martian/martian_resources.h | 13 |
3 files changed, 43 insertions, 8 deletions
diff --git a/engines/access/martian/martian_game.cpp b/engines/access/martian/martian_game.cpp index 5382cd9880..41c84198cb 100644 --- a/engines/access/martian/martian_game.cpp +++ b/engines/access/martian/martian_game.cpp @@ -115,7 +115,7 @@ void MartianEngine::displayNote(const Common::String &msg) { int width = 0; bool lastLine = false; do { - lastLine = _fonts._font1.getLine(lines, _screen->_maxChars * 6, line, width); + lastLine = _fonts._font1->getLine(lines, _screen->_maxChars * 6, line, width); _bubbleBox->printString(line); _screen->_printOrg = Common::Point(_screen->_printStart.x, _screen->_printOrg.y + 6); @@ -299,9 +299,8 @@ void MartianEngine::setupGame() { } // Miscellaneous - Amazon::AmazonResources &res = *((Amazon::AmazonResources *)_res); - _fonts._font1.load(&res.FONT6x6_INDEX[0], &res.FONT6x6_DATA[0]); - _fonts._font2.load(&res.FONT2_INDEX[0], &res.FONT2_DATA[0]); + Martian::MartianResources &res = *((Martian::MartianResources *)_res); + _fonts.load(res._font6x6, res._font3x5); // Set player room and position _player->_roomNumber = 7; @@ -314,7 +313,7 @@ void MartianEngine::showDeathText(Common::String msg) { int width = 0; bool lastLine; do { - lastLine = _fonts._font2.getLine(msg, _screen->_maxChars * 6, line, width); + lastLine = _fonts._font2->getLine(msg, _screen->_maxChars * 6, line, width); // Draw the text _bubbleBox->printString(line); diff --git a/engines/access/martian/martian_resources.cpp b/engines/access/martian/martian_resources.cpp index 2b0479a005..ee1f1c3cba 100644 --- a/engines/access/martian/martian_resources.cpp +++ b/engines/access/martian/martian_resources.cpp @@ -27,6 +27,35 @@ namespace Access { namespace Martian { +MartianResources::~MartianResources() { + delete _font6x6; + delete _font3x5; +} + +void MartianResources::load(Common::SeekableReadStream &s) { + Resources::load(s); + uint count; + + // Get the offset of the general shared data for the game + uint entryOffset = findEntry(_vm->getGameID(), 2, 0, (Common::Language)0); + s.seek(entryOffset); + + // Read in the cursor list + count = s.readUint16LE(); + CURSORS.resize(count); + for (uint idx = 0; idx < count; ++idx) { + uint count2 = s.readUint16LE(); + CURSORS[idx].resize(count2); + s.read(&CURSORS[idx][0], count2); + } + + // Load font data + _font6x6 = new MartianFont(6, s); + _font3x5 = new MartianFont(5, s); +} + +/*------------------------------------------------------------------------*/ + const int SIDEOFFR[] = { 4, 0, 7, 10, 3, 1, 2, 13, 0, 0, 0, 0 }; const int SIDEOFFL[] = { 11, 6, 1, 4, 10, 6, 1, 4, 0, 0, 0, 0 }; const int SIDEOFFU[] = { 1, 2, 0, 2, 2, 1, 1, 0, 0, 0, 0, 0 }; diff --git a/engines/access/martian/martian_resources.h b/engines/access/martian/martian_resources.h index 76765aad5a..6b01ee3754 100644 --- a/engines/access/martian/martian_resources.h +++ b/engines/access/martian/martian_resources.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "access/resources.h" +#include "access/font.h" namespace Access { @@ -55,11 +56,17 @@ extern const byte _byte1EEB5[]; extern const int PICTURERANGE[][2]; class MartianResources : public Resources { +protected: + /** + * Load data from the access.dat file + */ + virtual void load(Common::SeekableReadStream &s); public: - + MartianFont *_font6x6; + MartianFont *_font3x5; public: - MartianResources(AccessEngine *vm) : Resources(vm) {} - virtual ~MartianResources() {} + MartianResources(AccessEngine *vm) : Resources(vm), _font6x6(nullptr), _font3x5(nullptr) {} + virtual ~MartianResources(); }; #define MMRES (*((Martian::MartianResources *)_vm->_res)) |