ACCESS: MM - Some more work on BubbleBox class

This commit is contained in:
Strangerke 2015-01-13 21:52:40 +01:00
parent 6a288bc476
commit 93e8b47e13
4 changed files with 135 additions and 18 deletions

View File

@ -100,6 +100,12 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
_startAboutItem = _startAboutBox = 0;
_byte26CB5 = 0;
BCNT = 0;
BOXDATASTART = BOXDATAEND = 0;
BOXSELECTY = 0;
BOXSELECTYOLD = -1;
NUMBLINES = 0;
_word234F3 = _word234F7 = _word234F5 = _word234F9 = 0;
_word234FB = _word234FF = _word234FD = _word23501 = 0;
_vidEnd = false;
}

View File

@ -217,9 +217,14 @@ public:
int _startAboutItem;
int _startAboutBox;
int BOXDATASTART;
int BOXDATAEND;
int BOXSELECTY;
int BOXSELECTYOLD;
int NUMBLINES;
byte _byte26CB5;
int BCNT;
int _word234F3, _word234F7, _word234F5, _word234F9;
int _word234FB, _word234FF, _word234FD, _word23501;
//
bool _vidEnd;

View File

@ -30,12 +30,13 @@ BubbleBox::BubbleBox(AccessEngine *vm, Access::BoxType type, int x, int y, int w
_type = type;
_bounds = Common::Rect(x, y, x + w, y + h);
_bubbleDisplStr = title;
_fieldD = val1;
_fieldE = val2;
_fieldF = val3;
_field10 = val4;
_btnId1 = val1;
_btnX1 = val2;
_btnId2 = val3;
_btnX2 = val4;
_btnId3 = _btnX3 = 0; // Unused in MM and Amazon?
BOXSTARTX = BOXSTARTY = 0;
BICONSTARTX = 0;
BICONSTARTX = BICONSTARTY = 0;
BOXENDY = 0;
BOXPSTARTX = BOXPSTARTY = 0;
}
@ -283,6 +284,14 @@ void BubbleBox::doBox(int item, int box) {
delete icons;
}
void BubbleBox::displayBoxData() {
warning("TODO displayBoxData");
}
void BubbleBox::drawSelectBox() {
warning("TODO drawSelectBox");
}
int BubbleBox::doBox_v1(int item, int box, int &type) {
FontManager &fonts = _vm->_fonts;
@ -349,9 +358,9 @@ int BubbleBox::doBox_v1(int item, int box, int &type) {
if (_type != TYPE_2) {
oldY = _vm->_screen->_orgY1;
--_vm->_screen->_orgY2;
_vm->_screen->_orgY2 -= 8;
_vm->_screen->_orgY1 = _vm->_screen->_orgY2 - 8;
if (_type == TYPE_3)
_vm->_screen->_orgY2 -= 8;
_vm->_screen->_orgY1 -= 8;
_vm->_screen->drawRect();
int tmpX = BICONSTARTX = _vm->_screen->_orgX1;
@ -359,9 +368,9 @@ int BubbleBox::doBox_v1(int item, int box, int &type) {
int tmpY = BOXENDY = _vm->_screen->_orgY1;
if (_type == TYPE_3)
BOXSTARTY = tmpY - 7;
BICONSTARTY = tmpY - 7;
else
BOXSTARTY = tmpY + 1;
BICONSTARTY = tmpY + 1;
if (_type == TYPE_3)
warning("TODO: Implement more of TYPE_3");
@ -402,6 +411,99 @@ int BubbleBox::doBox_v1(int item, int box, int &type) {
_vm->_screen->restoreScreen();
}
_vm->_destIn = _vm->_screen;
// Draw buttons
int ICON1T = 0;
int ICON1X = 0;
int ICON1Y = 0;
if (_btnId1) {
ICON1T = _btnId1;
ICON1X = BICONSTARTX + _btnX1;
ICON1Y = BICONSTARTY;
_vm->_screen->plotImage(icons, ICON1T + 10, Common::Point(ICON1X, ICON1Y));
int ICON2T = 0;
int ICON2X = 0;
int ICON2Y = 0;
if (_btnId2) {
ICON2T = _btnId2;
ICON2X = BICONSTARTX + _btnX2;
ICON2Y = BICONSTARTY;
_vm->_screen->plotImage(icons, ICON2T + 10, Common::Point(ICON2X, ICON2Y));
int ICON3T = 0;
int ICON3X = 0;
int ICON3Y = 0;
if (_btnId3) {
ICON3T = _btnId3;
ICON3X = BICONSTARTX + _btnX3;
ICON3Y = BICONSTARTY;
_vm->_screen->plotImage(icons, ICON3T + 10, Common::Point(ICON3X, ICON3Y));
}
}
}
_vm->_screen->restoreScreen();
_vm->BOXDATASTART = _startItem;
_vm->BOXSELECTYOLD = -1;
_vm->BOXSELECTY = _startBox;
_vm->NUMBLINES = (_bounds.bottom >> 3) - 2;
if (_type == TYPE_3)
--_vm->NUMBLINES;
_vm->_events->showCursor();
displayBoxData();
drawSelectBox();
while (true) {
_vm->_events->pollEvents();
if (_vm->_events->_leftButton)
continue;
if ((_type != TYPE_1) && (_vm->_timers[2]._flag == 0)) {
++_vm->_timers[2]._flag;
if ((_vm->_events->_mousePos.x >= _vm->_word234F3) && (_vm->_events->_mousePos.x <= _vm->_word234F7)
&& (_vm->_events->_mousePos.y >= _vm->_word234F5) && (_vm->_events->_mousePos.y < _vm->_word234F9)) {
if (_vm->BCNT) {
if (_vm->BOXSELECTY != 0) {
--_vm->BOXSELECTY;
drawSelectBox();
} else if (_vm->BOXDATASTART != 0) {
--_vm->BOXDATASTART;
displayBoxData();
drawSelectBox();
}
}
continue;
} else if ((_vm->_events->_mousePos.x >= _vm->_word234FB) && (_vm->_events->_mousePos.x <= _vm->_word234FF)
&& (_vm->_events->_mousePos.y >= _vm->_word234FD) && (_vm->_events->_mousePos.y < _vm->_word23501)) {
if (_vm->BCNT) {
if (_vm->BCNT == _vm->NUMBLINES) {
if (_vm->BCNT != _vm->BOXSELECTY + 1) {
++_vm->BOXSELECTY;
drawSelectBox();
} else if (_vm->BOXDATAEND == 0) {
++_vm->BOXDATASTART;
displayBoxData();
drawSelectBox();
}
} else if (_vm->BCNT != _vm->BOXSELECTY + 1) {
++_vm->BOXSELECTY;
drawSelectBox();
}
}
continue;
}
}
warning("TODO Case 1");
displayBoxData();
drawSelectBox();
}
warning("TODO: more dobox_v1");
return -1;
}

View File

@ -43,22 +43,26 @@ private:
int _startItem, _startBox;
int _charCol, _rowOff;
Common::Point _fileStart;
int BOXSTARTX;
int BOXSTARTY;
int BOXSTARTX, BOXSTARTY;
int BOXENDY;
int BICONSTARTX;
int BOXPSTARTX;
int BOXPSTARTY;
int BICONSTARTX, BICONSTARTY;
int BOXPSTARTX, BOXPSTARTY;
void displayBoxData();
void drawSelectBox();
public:
BoxType _type;
Common::Rect _bounds;
Common::StringArray _nameIndex;
Common::String _bubbleTitle;
Common::String _bubbleDisplStr;
int _fieldD;
int _fieldE;
int _fieldF;
int _field10;
int _btnId1;
int _btnX1;
int _btnId2;
int _btnX2;
int _btnId3;
int _btnX3;
Common::Array<Common::Rect> _bubbles;
public: