Skip to content

Commit

Permalink
ACCESS: MM - Start implementing MM dialog box, split cmdConverse in t…
Browse files Browse the repository at this point in the history
…wo (WIP)
  • Loading branch information
Strangerke committed Jan 11, 2015
1 parent 8249de3 commit ec381ae
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 11 deletions.
4 changes: 1 addition & 3 deletions engines/access/access.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
8 changes: 6 additions & 2 deletions engines/access/access.h
Expand Up @@ -180,8 +180,6 @@ class AccessEngine : public Engine {
int _playerDataCount;
int _currentManOld;
int _converseMode;
int _startAboutBox;
int _startTravelBox;
bool _currentCharFlag;
bool _boxSelect;
int _scale;
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 6 additions & 1 deletion engines/access/bubble_box.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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
3 changes: 3 additions & 0 deletions engines/access/bubble_box.h
Expand Up @@ -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
Expand Down
51 changes: 46 additions & 5 deletions engines/access/scripts.cpp
Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 4 additions & 0 deletions engines/access/scripts.h
Expand Up @@ -44,6 +44,8 @@ class Scripts : public Manager {

void charLoop();
void printWatch();
void converse1(int val);

protected:
Common::SeekableReadStream *_data;
ScriptMethodPtr COMMAND_LIST[100];
Expand Down Expand Up @@ -143,6 +145,8 @@ class Scripts : public Manager {
int _choice;
int32 _choiceStart;
Common::Point _charsOrg, _texsOrg;

int TMPLPTR[60];
public:
Scripts(AccessEngine *vm);

Expand Down

0 comments on commit ec381ae

Please sign in to comment.