diff --git a/engines/access/access.cpp b/engines/access/access.cpp index af3b2cc0899c..adcb5facd634 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -55,8 +55,6 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc) _currentMan = 0; _currentManOld = -1; _converseMode = 0; - _startAboutBox = 0; - _startTravelBox = 0; _numAnimTimers = 0; _startup = 0; _currentCharFlag = false; @@ -99,7 +97,7 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc) STARTTRAVELITEM = STARTTRAVELBOX = 0; for (int i = 0; i < 16; i++) ASK[i]; - _startAboutItem = 0; + _startAboutItem = _startAboutBox = 0; _vidEnd = false; } diff --git a/engines/access/access.h b/engines/access/access.h index 3d839f64a390..94e27e83c193 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -180,8 +180,6 @@ class AccessEngine : public Engine { int _playerDataCount; int _currentManOld; int _converseMode; - int _startAboutBox; - int _startTravelBox; bool _currentCharFlag; bool _boxSelect; int _scale; @@ -210,11 +208,17 @@ class AccessEngine : public Engine { uint32 _newDate; int _flags[256]; + // Fields used by MM + // TODO: Refactor int TRAVEL[60]; int STARTTRAVELITEM; int STARTTRAVELBOX; int ASK[16]; int _startAboutItem; + int _startAboutBox; + int BOXDATASTART; + int BOXSELECTY; + // bool _vidEnd; bool _clearSummaryFlag; diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp index 7ecba7b027e3..ec6a3b18a367 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) : Manager(vm) { _type = type; _bounds = Common::Rect(x, y, x + w, y + h); _bubbleDisplStr = title; @@ -279,4 +279,9 @@ void BubbleBox::doBox(int item, int box) { delete icons; } +int BubbleBox::doBox_v1(int item, int box, int &type) { + warning("TODO: dobox_v1"); + return -1; +} + } // End of namespace Access diff --git a/engines/access/bubble_box.h b/engines/access/bubble_box.h index 8bfbc40e0c3d..f2ec3a27ac2d 100644 --- a/engines/access/bubble_box.h +++ b/engines/access/bubble_box.h @@ -82,6 +82,9 @@ class BubbleBox : public Manager { void drawBubble(int index); 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 }; } // End of namespace Access diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp index 440ae5e3cc38..a50509dcd64b 100644 --- a/engines/access/scripts.cpp +++ b/engines/access/scripts.cpp @@ -38,6 +38,9 @@ Scripts::Scripts(AccessEngine *vm) : Manager(vm) { _charsOrg = Common::Point(0, 0); _texsOrg = Common::Point(0, 0); setOpcodes(); + + for (int i = 0; i < 60; i++) + TMPLPTR[i] = 0; } Scripts::~Scripts() { @@ -392,8 +395,8 @@ void Scripts::cmdNewRoom() { cmdRetPos(); } -void Scripts::cmdConverse() { - _vm->_conversation = _data->readUint16LE(); +void Scripts::converse1(int val) { + _vm->_conversation = val; _vm->_room->clearRoom(); _vm->freeChar(); _vm->_char->loadChar(_vm->_conversation); @@ -409,6 +412,11 @@ void Scripts::cmdConverse() { } } +void Scripts::cmdConverse() { + int val = _data->readUint16LE(); + converse1(val); +} + void Scripts::cmdCheckFrame() { int id = _data->readUint16LE(); Animation *anim = _vm->_animation->findAnimation(id); @@ -475,8 +483,7 @@ void Scripts::cmdSetAbout() { int idx = _data->readByte(); int val = _data->readByte(); _vm->ASK[idx] = val; - _vm->_startAboutBox = 0; - _vm->_startAboutItem = 0; + _vm->_startAboutBox = _vm->_startAboutItem = 0; } void Scripts::cmdSetTimer() { @@ -609,7 +616,41 @@ void Scripts::cmdRemoveLast() { } void Scripts::cmdDoTravel() { - error("TODO: DEMO - cmdDoTravel"); + while (true) { + _vm->_travelBox->getList(); + int type = 0; + int boxX = _vm->_travelBox->doBox_v1(_vm->STARTTRAVELITEM, _vm->STARTTRAVELBOX, type); + _vm->STARTTRAVELITEM = _vm->BOXDATASTART; + _vm->STARTTRAVELBOX = _vm->BOXSELECTY; + + if (boxX == -1) + type = 2; + + if (type != 2) { + int idx = TMPLPTR[boxX]; + warning("TODO: if (_byte1EEB5[idx] != _byte26CB5) {"); + // _vm->_bubbleBox->_bubbleTitle = "TRAVEL"; + // _vm->_scripts->printString("YOU CAN'T GET THERE FROM HERE."); + // continue; + // } + if (_vm->_player->_roomNumber != idx) { + if (Martian::TRAVEL_POS[idx][0] == -1) { + _vm->_player->_roomNumber = idx; + _vm->_room->_conFlag = true; + _vm->_scripts->converse1(Martian::TRAVEL_POS[idx][1]); + return; + } + _vm->_player->_rawPlayer = Common::Point(Martian::TRAVEL_POS[idx][0], Martian::TRAVEL_POS[idx][1]); + cmdRetPos(); + return; + } + } + + if (_vm->_player->_roomNumber == -1) + continue; + + return; + } } void Scripts::cmdCheckAbout() { diff --git a/engines/access/scripts.h b/engines/access/scripts.h index abb8e5a80c74..d9715afddf5c 100644 --- a/engines/access/scripts.h +++ b/engines/access/scripts.h @@ -44,6 +44,8 @@ class Scripts : public Manager { void charLoop(); void printWatch(); + void converse1(int val); + protected: Common::SeekableReadStream *_data; ScriptMethodPtr COMMAND_LIST[100]; @@ -143,6 +145,8 @@ class Scripts : public Manager { int _choice; int32 _choiceStart; Common::Point _charsOrg, _texsOrg; + + int TMPLPTR[60]; public: Scripts(AccessEngine *vm);