From 3a57f208165c849bd8f68eacd1eaad818af5f75e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 14 Jan 2015 23:44:24 +0100 Subject: [PATCH] ACCESS: MM - Implement displayBoxData --- engines/access/access.cpp | 11 +++--- engines/access/access.h | 1 + engines/access/bubble_box.cpp | 67 ++++++++++++++++++++++++++++++++--- engines/access/bubble_box.h | 5 +-- 4 files changed, 72 insertions(+), 12 deletions(-) diff --git a/engines/access/access.cpp b/engines/access/access.cpp index acef37588465..fc0137384ae4 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -106,6 +106,7 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc) NUMBLINES = 0; _word234F3 = _word234F7 = _word234F5 = _word234F9 = 0; _word234FB = _word234FF = _word234FD = _word23501 = 0; + TEMPLIST = nullptr; _vidEnd = false; } @@ -162,12 +163,12 @@ void AccessEngine::initialize() { // Create sub-objects of the engine _animation = new AnimationManager(this); - _bubbleBox = new BubbleBox(this, TYPE_2, 64, 32, 130, 122, 0, 0, 0, 0, ""); + _bubbleBox = new BubbleBox(this, TYPE_2, 64, 32, 130, 122, 0, 0, 0, 0, "", nullptr); if (getGameID() == GType_MartianMemorandum) { - _helpBox = new BubbleBox(this, TYPE_1, 64, 24, 146, 122, 1, 32, 2, 76, "HELP"); - _travelBox = new BubbleBox(this, TYPE_1, 64, 32, 194, 122, 1, 24, 2, 74, "TRAVEL"); - _invBox = new BubbleBox(this, TYPE_1, 64, 32, 146, 122, 1, 32, 2, 76, "INVENTORY"); - _aboutBox = new BubbleBox(this, TYPE_1, 64, 32, 194, 122, 1, 32, 2, 76, "ASK ABOUT"); + _helpBox = new BubbleBox(this, TYPE_1, 64, 24, 146, 122, 1, 32, 2, 76, "HELP", TEMPLIST); + _travelBox = new BubbleBox(this, TYPE_1, 64, 32, 194, 122, 1, 24, 2, 74, "TRAVEL", TEMPLIST); + _invBox = new BubbleBox(this, TYPE_1, 64, 32, 146, 122, 1, 32, 2, 76, "INVENTORY", TEMPLIST); + _aboutBox = new BubbleBox(this, TYPE_1, 64, 32, 194, 122, 1, 32, 2, 76, "ASK ABOUT", TEMPLIST); } else { _helpBox = nullptr; _travelBox = nullptr; diff --git a/engines/access/access.h b/engines/access/access.h index 5db2aea639c7..d60a62f68341 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -225,6 +225,7 @@ class AccessEngine : public Engine { int BCNT; int _word234F3, _word234F7, _word234F5, _word234F9; int _word234FB, _word234FF, _word234FD, _word23501; + byte *TEMPLIST; // bool _vidEnd; diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp index 6b95d0eb4eae..19b9c1fd5561 100644 --- a/engines/access/bubble_box.cpp +++ b/engines/access/bubble_box.cpp @@ -26,7 +26,7 @@ namespace Access { -BubbleBox::BubbleBox(AccessEngine *vm, Access::BoxType type, int x, int y, int w, int h, int val1, int val2, int val3, int val4, Common::String title) : Manager(vm) { +BubbleBox::BubbleBox(AccessEngine *vm, Access::BoxType type, int x, int y, int w, int h, int val1, int val2, int val3, int val4, Common::String title, byte *tmpList) : Manager(vm) { _type = type; _bounds = Common::Rect(x, y, x + w, y + h); _bubbleDisplStr = title; @@ -37,8 +37,10 @@ BubbleBox::BubbleBox(AccessEngine *vm, Access::BoxType type, int x, int y, int w _btnId3 = _btnX3 = 0; // Unused in MM and Amazon? BOXSTARTX = BOXSTARTY = 0; BICONSTARTX = BICONSTARTY = 0; - BOXENDY = 0; + BOXENDX = BOXENDY = 0; BOXPSTARTX = BOXPSTARTY = 0; + // Unused in AGoE + _tempListPtr = tmpList; } void BubbleBox::load(Common::SeekableReadStream *stream) { @@ -285,7 +287,64 @@ void BubbleBox::doBox(int item, int box) { } void BubbleBox::displayBoxData() { - warning("TODO displayBoxData"); + _vm->BOXDATAEND = 0; + _rowOff = 2; + _vm->_fonts._charSet._lo = 7; // 0xF7 + _vm->_fonts._charSet._hi = 15; + _vm->_fonts._charFor._lo = 15; // 0xFF + _vm->_fonts._charFor._hi = 15; + + if (!_tempListPtr) + return; + + int idx = 0; + if ((_type == TYPE_1) || (_type == TYPE_3)) { + _vm->BCNT = 0; + + if (_tempListPtr[idx] == -1) { + _vm->BOXDATAEND = 1; + return; + } + + _vm->_events->hideCursor(); + + _vm->_screen->_orgX1 = BOXSTARTX; + _vm->_screen->_orgX2 = BOXENDX; + _vm->_screen->_orgY1 = BOXSTARTY; + _vm->_screen->_orgY2 = BOXENDY; + _vm->_screen->_lColor = 0xFA; + _vm->_screen->drawRect(); + _vm->_events->showCursor(); + } + + _vm->_events->hideCursor(); + int oldPStartY = BOXPSTARTY; + ++BOXPSTARTY; + + for (int i = 0; i < _vm->BOXDATASTART; i++, idx++) { + while (_tempListPtr[idx] != 0) + ++idx; + } + + while (true) { + warning("TODO: SETCURSOR"); + warning("TODO: PRINTSTR"); + ++idx; + ++BOXPSTARTY; + ++_vm->BCNT; + if (_tempListPtr[idx] == nullptr) { + BOXPSTARTY = oldPStartY; + _vm->_events->showCursor(); + _vm->BOXDATAEND = 1; + return; + } + + if (_vm->BCNT == _vm->NUMBLINES) { + BOXPSTARTY = oldPStartY; + _vm->_events->showCursor(); + return; + } + } } void BubbleBox::drawSelectBox() { @@ -503,9 +562,7 @@ int BubbleBox::doBox_v1(int item, int box, int &type) { drawSelectBox(); } - warning("TODO: more dobox_v1"); return -1; } - } // End of namespace Access diff --git a/engines/access/bubble_box.h b/engines/access/bubble_box.h index 4aa9e261e636..082f2f7688d9 100644 --- a/engines/access/bubble_box.h +++ b/engines/access/bubble_box.h @@ -44,7 +44,7 @@ class BubbleBox : public Manager { int _charCol, _rowOff; Common::Point _fileStart; int BOXSTARTX, BOXSTARTY; - int BOXENDY; + int BOXENDX, BOXENDY; int BICONSTARTX, BICONSTARTY; int BOXPSTARTX, BOXPSTARTY; @@ -57,6 +57,7 @@ class BubbleBox : public Manager { Common::StringArray _nameIndex; Common::String _bubbleTitle; Common::String _bubbleDisplStr; + byte *_tempListPtr; int _btnId1; int _btnX1; int _btnId2; @@ -66,7 +67,7 @@ class BubbleBox : public Manager { Common::Array _bubbles; public: - BubbleBox(AccessEngine *vm, Access::BoxType type, int x, int y, int w, int h, int val1, int val2, int val3, int val4, Common::String title); + BubbleBox(AccessEngine *vm, Access::BoxType type, int x, int y, int w, int h, int val1, int val2, int val3, int val4, Common::String title, byte* tmpList); void load(Common::SeekableReadStream *stream);