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/amazon | |
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/amazon')
-rw-r--r-- | engines/access/amazon/amazon_game.cpp | 51 | ||||
-rw-r--r-- | engines/access/amazon/amazon_logic.cpp | 2 | ||||
-rw-r--r-- | engines/access/amazon/amazon_resources.cpp | 26 | ||||
-rw-r--r-- | engines/access/amazon/amazon_resources.h | 10 |
4 files changed, 48 insertions, 41 deletions
diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp index 8467d8b623..065952e93b 100644 --- a/engines/access/amazon/amazon_game.cpp +++ b/engines/access/amazon/amazon_game.cpp @@ -162,8 +162,7 @@ void AmazonEngine::setupGame() { _deaths._cells[i] = CellIdent(DEATH_CELLS[i][0], DEATH_CELLS[i][1], DEATH_CELLS[i][2]); // Miscellaneous - _fonts._font1.load(&res.FONT6x6_INDEX[0], &res.FONT6x6_DATA[0]); - _fonts._font2.load(&res.FONT2_INDEX[0], &res.FONT2_DATA[0]); + _fonts.load(res._font6x6, res._font3x5); initVariables(); } @@ -409,21 +408,21 @@ void AmazonEngine::calcIQ() { void AmazonEngine::helpTitle() { AmazonResources &res = *(AmazonResources *)_res; - int width = _fonts._font2.stringWidth(_bubbleBox->_bubbleTitle); + int width = _fonts._font2->stringWidth(_bubbleBox->_bubbleTitle); int posX = 160 - (width / 2); - _fonts._font2._fontColors[0] = 0; - _fonts._font2._fontColors[1] = 33; - _fonts._font2._fontColors[2] = 34; - _fonts._font2._fontColors[3] = 35; - _fonts._font2.drawString(_screen, _bubbleBox->_bubbleTitle, Common::Point(posX, 24)); + _fonts._font2->_fontColors[0] = 0; + _fonts._font2->_fontColors[1] = 33; + _fonts._font2->_fontColors[2] = 34; + _fonts._font2->_fontColors[3] = 35; + _fonts._font2->drawString(_screen, _bubbleBox->_bubbleTitle, Common::Point(posX, 24)); - width = _fonts._font2.stringWidth(res.HELPLVLTXT[_helpLevel]); + width = _fonts._font2->stringWidth(res.HELPLVLTXT[_helpLevel]); posX = 160 - (width / 2); - _fonts._font2._fontColors[0] = 0; - _fonts._font2._fontColors[1] = 10; - _fonts._font2._fontColors[2] = 11; - _fonts._font2._fontColors[3] = 12; - _fonts._font2.drawString(_screen, res.HELPLVLTXT[_helpLevel], Common::Point(posX, 36)); + _fonts._font2->_fontColors[0] = 0; + _fonts._font2->_fontColors[1] = 10; + _fonts._font2->_fontColors[2] = 11; + _fonts._font2->_fontColors[3] = 12; + _fonts._font2->drawString(_screen, res.HELPLVLTXT[_helpLevel], Common::Point(posX, 36)); Common::String iqText = "IQ: "; calcIQ(); @@ -441,13 +440,13 @@ void AmazonEngine::helpTitle() { iqText += " "; iqText += res.IQLABELS[index]; - width = _fonts._font2.stringWidth(iqText); + width = _fonts._font2->stringWidth(iqText); posX = 160 - (width / 2); - _fonts._font2._fontColors[0] = 0; - _fonts._font2._fontColors[1] = 10; - _fonts._font2._fontColors[2] = 11; - _fonts._font2._fontColors[3] = 12; - _fonts._font2.drawString(_screen, iqText, Common::Point(posX, 44)); + _fonts._font2->_fontColors[0] = 0; + _fonts._font2->_fontColors[1] = 10; + _fonts._font2->_fontColors[2] = 11; + _fonts._font2->_fontColors[3] = 12; + _fonts._font2->drawString(_screen, iqText, Common::Point(posX, 44)); } void AmazonEngine::drawHelpText(const Common::String &msg) { @@ -460,15 +459,15 @@ void AmazonEngine::drawHelpText(const Common::String &msg) { int width = 0; bool lastLine = false; do { - lastLine = _fonts._font2.getLine(lines, _screen->_maxChars * 6, line, width); + lastLine = _fonts._font2->getLine(lines, _screen->_maxChars * 6, line, width); // Set font colors - _fonts._font2._fontColors[0] = 0; - _fonts._font2._fontColors[1] = 27; - _fonts._font2._fontColors[2] = 28; - _fonts._font2._fontColors[3] = 29; + _fonts._font2->_fontColors[0] = 0; + _fonts._font2->_fontColors[1] = 27; + _fonts._font2->_fontColors[2] = 28; + _fonts._font2->_fontColors[3] = 29; - _fonts._font2.drawString(_screen, line, _screen->_printOrg); + _fonts._font2->drawString(_screen, line, _screen->_printOrg); _screen->_printOrg = Common::Point(_screen->_printStart.x, _screen->_printOrg.y + 8); } while (!lastLine); diff --git a/engines/access/amazon/amazon_logic.cpp b/engines/access/amazon/amazon_logic.cpp index 5a0f79721e..793545d482 100644 --- a/engines/access/amazon/amazon_logic.cpp +++ b/engines/access/amazon/amazon_logic.cpp @@ -1743,7 +1743,7 @@ void River::plotRiver() { } // Draw the text for skipping the river - Font &font2 = _vm->_fonts._font2; + Font &font2 = *_vm->_fonts._font2; font2.drawString(_vm->_screen, "SKIP", Common::Point(5, 5)); } diff --git a/engines/access/amazon/amazon_resources.cpp b/engines/access/amazon/amazon_resources.cpp index 7dbe1c9f90..fb5e01cce4 100644 --- a/engines/access/amazon/amazon_resources.cpp +++ b/engines/access/amazon/amazon_resources.cpp @@ -27,6 +27,11 @@ namespace Access { namespace Amazon { +AmazonResources::~AmazonResources() { + delete _font3x5; + delete _font6x6; +} + void AmazonResources::load(Common::SeekableReadStream &s) { Resources::load(s); uint count; @@ -60,24 +65,29 @@ void AmazonResources::load(Common::SeekableReadStream &s) { // Load font data count = s.readUint16LE(); - FONT2_INDEX.resize(count); + Common::Array<int> index; + Common::Array<byte> data; + + index.resize(count); for (uint idx = 0; idx < count; ++idx) - FONT2_INDEX[idx] = s.readSint16LE(); + index[idx] = s.readSint16LE(); count = s.readUint16LE(); - FONT2_DATA.resize(count); + data.resize(count); for (uint idx = 0; idx < count; ++idx) - FONT2_DATA[idx] = s.readByte(); + data[idx] = s.readByte(); + _font3x5 = new AmazonFont(&index[0], &data[0]); count = s.readUint16LE(); - FONT6x6_INDEX.resize(count); + index.resize(count); for (uint idx = 0; idx < count; ++idx) - FONT6x6_INDEX[idx] = s.readSint16LE(); + index[idx] = s.readSint16LE(); count = s.readUint16LE(); - FONT6x6_DATA.resize(count); + data.resize(count); for (uint idx = 0; idx < count; ++idx) - FONT6x6_DATA[idx] = s.readByte(); + data[idx] = s.readByte(); + _font6x6 = new AmazonFont(&index[0], &data[0]); } /*------------------------------------------------------------------------*/ diff --git a/engines/access/amazon/amazon_resources.h b/engines/access/amazon/amazon_resources.h index 20d90cc5b6..6ce50f72de 100644 --- a/engines/access/amazon/amazon_resources.h +++ b/engines/access/amazon/amazon_resources.h @@ -26,6 +26,7 @@ #include "common/scummsys.h" #include "common/array.h" #include "access/resources.h" +#include "access/font.h" namespace Access { @@ -128,10 +129,7 @@ protected: */ virtual void load(Common::SeekableReadStream &s); public: - Common::Array<int> FONT2_INDEX; - Common::Array<byte> FONT2_DATA; - Common::Array<int> FONT6x6_INDEX; - Common::Array<byte> FONT6x6_DATA; + AmazonFont *_font3x5, *_font6x6; Common::String NO_HELP_MESSAGE; Common::String NO_HINTS_MESSAGE; Common::String RIVER_HIT1; @@ -140,8 +138,8 @@ public: Common::String HELPLVLTXT[3]; Common::String IQLABELS[9]; public: - AmazonResources(AccessEngine *vm) : Resources(vm) {} - virtual ~AmazonResources() {} + AmazonResources(AccessEngine *vm) : Resources(vm), _font3x5(nullptr), _font6x6(nullptr) {} + virtual ~AmazonResources(); }; #define AMRES (*((Amazon::AmazonResources *)_vm->_res)) |