Skip to content

Commit

Permalink
ACCESS: MM - Implement displayBoxData
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Jan 14, 2015
1 parent 93e8b47 commit 3a57f20
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 12 deletions.
11 changes: 6 additions & 5 deletions engines/access/access.cpp
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions engines/access/access.h
Expand Up @@ -225,6 +225,7 @@ class AccessEngine : public Engine {
int BCNT;
int _word234F3, _word234F7, _word234F5, _word234F9;
int _word234FB, _word234FF, _word234FD, _word23501;
byte *TEMPLIST;
//

bool _vidEnd;
Expand Down
67 changes: 62 additions & 5 deletions 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, byte *tmpList) : Manager(vm) {
_type = type;
_bounds = Common::Rect(x, y, x + w, y + h);
_bubbleDisplStr = title;
Expand All @@ -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) {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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
5 changes: 3 additions & 2 deletions engines/access/bubble_box.h
Expand Up @@ -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;

Expand All @@ -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;
Expand All @@ -66,7 +67,7 @@ class BubbleBox : public Manager {

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);
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);

Expand Down

0 comments on commit 3a57f20

Please sign in to comment.