diff --git a/engines/access/access.cpp b/engines/access/access.cpp index fc0137384ae4..d239d086aed6 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -95,7 +95,7 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc) for (int i = 0; i < 60; i++) TRAVEL[i] = 0; STARTTRAVELITEM = STARTTRAVELBOX = 0; - for (int i = 0; i < 16; i++) + for (int i = 0; i < 33; i++) ASK[i]; _startAboutItem = _startAboutBox = 0; _byte26CB5 = 0; @@ -163,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, "", nullptr); + _bubbleBox = new BubbleBox(this, TYPE_2, 64, 32, 130, 122, 0, 0, 0, 0, ""); if (getGameID() == GType_MartianMemorandum) { - _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); + _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"); } else { _helpBox = nullptr; _travelBox = nullptr; diff --git a/engines/access/access.h b/engines/access/access.h index d60a62f68341..ec1985099298 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -211,9 +211,9 @@ class AccessEngine : public Engine { // Fields used by MM // TODO: Refactor int TRAVEL[60]; + int ASK[33]; int STARTTRAVELITEM; int STARTTRAVELBOX; - int ASK[16]; int _startAboutItem; int _startAboutBox; int BOXDATASTART; diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp index 19b9c1fd5561..30d33a7fdefe 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, byte *tmpList) : 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) : Manager(vm) { _type = type; _bounds = Common::Rect(x, y, x + w, y + h); _bubbleDisplStr = title; @@ -40,7 +40,8 @@ BubbleBox::BubbleBox(AccessEngine *vm, Access::BoxType type, int x, int y, int w BOXENDX = BOXENDY = 0; BOXPSTARTX = BOXPSTARTY = 0; // Unused in AGoE - _tempListPtr = tmpList; + for (int i = 0; i < 60; i++) + _tempListPtr[i] = ""; } void BubbleBox::load(Common::SeekableReadStream *stream) { @@ -294,14 +295,14 @@ void BubbleBox::displayBoxData() { _vm->_fonts._charFor._lo = 15; // 0xFF _vm->_fonts._charFor._hi = 15; - if (!_tempListPtr) + if (_tempListPtr[0].size() == 0) return; int idx = 0; if ((_type == TYPE_1) || (_type == TYPE_3)) { _vm->BCNT = 0; - if (_tempListPtr[idx] == -1) { + if (_tempListPtr[idx].size() == 0) { _vm->BOXDATAEND = 1; return; } @@ -322,7 +323,7 @@ void BubbleBox::displayBoxData() { ++BOXPSTARTY; for (int i = 0; i < _vm->BOXDATASTART; i++, idx++) { - while (_tempListPtr[idx] != 0) + while (_tempListPtr[idx].size() != 0) ++idx; } @@ -332,7 +333,7 @@ void BubbleBox::displayBoxData() { ++idx; ++BOXPSTARTY; ++_vm->BCNT; - if (_tempListPtr[idx] == nullptr) { + if (_tempListPtr[idx].size() == 0) { BOXPSTARTY = oldPStartY; _vm->_events->showCursor(); _vm->BOXDATAEND = 1; @@ -565,4 +566,17 @@ int BubbleBox::doBox_v1(int item, int box, int &type) { warning("TODO: more dobox_v1"); return -1; } + +void BubbleBox::getList(const char *data[], int *flags) { + int srcIdx = 0; + int destIdx = 0; + while (data[srcIdx]) { + if (flags[srcIdx]) { + _tempListPtr[destIdx] = Common::String(data[srcIdx]); + ++destIdx; + } + srcIdx++; + } + _tempListPtr[destIdx] = ""; +} } // End of namespace Access diff --git a/engines/access/bubble_box.h b/engines/access/bubble_box.h index 082f2f7688d9..ceafe13f6b17 100644 --- a/engines/access/bubble_box.h +++ b/engines/access/bubble_box.h @@ -57,7 +57,7 @@ class BubbleBox : public Manager { Common::StringArray _nameIndex; Common::String _bubbleTitle; Common::String _bubbleDisplStr; - byte *_tempListPtr; + Common::String _tempListPtr[60]; int _btnId1; int _btnX1; int _btnId2; @@ -67,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, byte* tmpList); + 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); void load(Common::SeekableReadStream *stream); @@ -95,7 +95,7 @@ class BubbleBox : public Manager { void doBox(int item, int box); int doBox_v1(int item, int box, int &type); - void getList() { warning("TODO: getList"); } // TODO: Check if implementation is useful + void getList(const char *data[], int *flags); }; } // End of namespace Access diff --git a/engines/access/martian/martian_game.cpp b/engines/access/martian/martian_game.cpp index 0b0644c96e67..3ad9b65e24c4 100644 --- a/engines/access/martian/martian_game.cpp +++ b/engines/access/martian/martian_game.cpp @@ -74,6 +74,7 @@ void MartianEngine::initVariables() { _mouseMode = 0; _numAnimTimers = 0; TRAVEL[7] = 1; + ASK[33] = 1; } void MartianEngine::setNoteParams() { diff --git a/engines/access/martian/martian_resources.cpp b/engines/access/martian/martian_resources.cpp index c976fe29ad01..09e16c156d8d 100644 --- a/engines/access/martian/martian_resources.cpp +++ b/engines/access/martian/martian_resources.cpp @@ -807,7 +807,7 @@ const int RMOUSE[10][2] = { { 155, 185 }, { 188, 216 }, { 219, 260 }, { 263, 293 }, { 295, 214 } }; -const char *const TRAVDATA[] = { +const char *TRAVDATA[] = { "GALACTIC PICTURES", "TERRAFORM", "WASHROOM", "MR. BIG", "ALEXIS' HOME", "JOHNNY FEDORA", "JUNKYARD IN", "TEX'S OFFICE", "MURDER SCENE", "PLAZA HOTEL", "RESTAURANT", "GIFT SHOP", "LOVE SCENE", "RICK LOGAN", "HUT", @@ -832,6 +832,14 @@ const char *const ASKTBL[] = { "LARRRY HAMMOND", nullptr }; + +byte HELP[] = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 +}; + const byte DEATH_SCREENS[] = { 5, 5, 3, 3, 7, 4, 6, 2, 2, 2, 1, 5, 3, 5, 2, 8, 5, 3, 8, 5 }; diff --git a/engines/access/martian/martian_resources.h b/engines/access/martian/martian_resources.h index e758a8944afd..fc9150d9733b 100644 --- a/engines/access/martian/martian_resources.h +++ b/engines/access/martian/martian_resources.h @@ -55,8 +55,9 @@ extern const byte ICON_DATA[]; extern const int RMOUSE[10][2]; -extern const char *const TRAVDATA[]; +extern byte HELP[]; extern const char *const ASKTBL[]; +extern const char *TRAVDATA[]; extern const byte DEATH_SCREENS[]; extern const char *const DEATHMESSAGE[]; diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp index 0daa1b98990b..114e0e7286b5 100644 --- a/engines/access/scripts.cpp +++ b/engines/access/scripts.cpp @@ -617,7 +617,7 @@ void Scripts::cmdRemoveLast() { void Scripts::cmdDoTravel() { while (true) { - _vm->_travelBox->getList(); + _vm->_travelBox->getList(Martian::TRAVDATA, _vm->TRAVEL); int type = 0; int boxX = _vm->_travelBox->doBox_v1(_vm->STARTTRAVELITEM, _vm->STARTTRAVELBOX, type); _vm->STARTTRAVELITEM = _vm->BOXDATASTART;