diff options
author | Strangerke | 2015-01-15 00:40:43 +0100 |
---|---|---|
committer | Strangerke | 2015-01-15 00:40:43 +0100 |
commit | f1aa191f8c3acd0bfa259c4239bc6aadc9c9b0b0 (patch) | |
tree | 916cd496232686907f016fe7f7f921066549c4f5 | |
parent | 3a57f208165c849bd8f68eacd1eaad818af5f75e (diff) | |
download | scummvm-rg350-f1aa191f8c3acd0bfa259c4239bc6aadc9c9b0b0.tar.gz scummvm-rg350-f1aa191f8c3acd0bfa259c4239bc6aadc9c9b0b0.tar.bz2 scummvm-rg350-f1aa191f8c3acd0bfa259c4239bc6aadc9c9b0b0.zip |
ACCESS: MM - Implement getList
-rw-r--r-- | engines/access/access.cpp | 12 | ||||
-rw-r--r-- | engines/access/access.h | 2 | ||||
-rw-r--r-- | engines/access/bubble_box.cpp | 26 | ||||
-rw-r--r-- | engines/access/bubble_box.h | 6 | ||||
-rw-r--r-- | engines/access/martian/martian_game.cpp | 1 | ||||
-rw-r--r-- | engines/access/martian/martian_resources.cpp | 10 | ||||
-rw-r--r-- | engines/access/martian/martian_resources.h | 3 | ||||
-rw-r--r-- | engines/access/scripts.cpp | 2 |
8 files changed, 43 insertions, 19 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp index fc0137384a..d239d086ae 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 d60a62f683..ec19850992 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -211,9 +211,9 @@ public: // 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 19b9c1fd55..30d33a7fde 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 082f2f7688..ceafe13f6b 100644 --- a/engines/access/bubble_box.h +++ b/engines/access/bubble_box.h @@ -57,7 +57,7 @@ public: 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 @@ public: Common::Array<Common::Rect> _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 @@ public: 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 0b0644c96e..3ad9b65e24 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 c976fe29ad..09e16c156d 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 e758a8944a..fc9150d973 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 0daa1b9899..114e0e7286 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; |