aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2015-01-17 09:42:41 +0100
committerStrangerke2015-01-17 09:42:41 +0100
commit27a9a046153c20d664394079f123f46a7ccde470 (patch)
tree12623aedbc3169b0390e1765b5eec28aa1390abe
parent82027ef3253eb109eac457bc103756acc27a78c6 (diff)
downloadscummvm-rg350-27a9a046153c20d664394079f123f46a7ccde470.tar.gz
scummvm-rg350-27a9a046153c20d664394079f123f46a7ccde470.tar.bz2
scummvm-rg350-27a9a046153c20d664394079f123f46a7ccde470.zip
ACCESS: MM - Fix crash in cmdDoTravel, some renaming
-rw-r--r--engines/access/bubble_box.cpp48
-rw-r--r--engines/access/bubble_box.h5
-rw-r--r--engines/access/scripts.cpp13
-rw-r--r--engines/access/scripts.h1
4 files changed, 39 insertions, 28 deletions
diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp
index 980ffd0b3f..e55f7f8564 100644
--- a/engines/access/bubble_box.cpp
+++ b/engines/access/bubble_box.cpp
@@ -40,8 +40,10 @@ BubbleBox::BubbleBox(AccessEngine *vm, Access::BoxType type, int x, int y, int w
BOXENDX = BOXENDY = 0;
BOXPSTARTX = BOXPSTARTY = 0;
// Unused in AGoE
- for (int i = 0; i < 60; i++)
- _tempListPtr[i] = "";
+ for (int i = 0; i < 60; i++) {
+ _tempList[i] = "";
+ _tempListIdx[i] = 0;
+ }
}
void BubbleBox::load(Common::SeekableReadStream *stream) {
@@ -305,14 +307,14 @@ void BubbleBox::displayBoxData() {
_vm->_fonts._charFor._lo = 15; // 0xFF
_vm->_fonts._charFor._hi = 15;
- if (_tempListPtr[0].size() == 0)
+ if (_tempList[0].size() == 0)
return;
int idx = 0;
if ((_type == TYPE_1) || (_type == TYPE_3)) {
_vm->BCNT = 0;
- if (_tempListPtr[idx].size() == 0) {
+ if (_tempList[idx].size() == 0) {
_vm->BOXDATAEND = true;
return;
}
@@ -336,12 +338,12 @@ void BubbleBox::displayBoxData() {
while (true) {
SETCURSORPOS(BOXPSTARTX, BOXPSTARTY);
- PRINTSTR(_tempListPtr[idx]);
+ PRINTSTR(_tempList[idx]);
++idx;
++BOXPSTARTY;
++_vm->BCNT;
- if (_tempListPtr[idx].size() == 0) {
+ if (_tempList[idx].size() == 0) {
BOXPSTARTY = oldPStartY;
_vm->_events->showCursor();
_vm->BOXDATAEND = true;
@@ -357,7 +359,7 @@ void BubbleBox::displayBoxData() {
}
void BubbleBox::drawSelectBox() {
- if (_tempListPtr[0].size() == 0)
+ if (_tempList[0].size() == 0)
return;
if (((_type != TYPE_1) && (_type != TYPE_3)) || !_vm->BCNT)
@@ -391,11 +393,11 @@ void BubbleBox::drawSelectBox() {
warning("TODO: List filenames");
}
-int BubbleBox::doBox_v1(int item, int box, int &type) {
+int BubbleBox::doBox_v1(int item, int box, int &btnSelected) {
static const int ICONW[] = { 0, 11, 28, 19, 19, 15 };
FontManager &fonts = _vm->_fonts;
- int retval = -1;
+ int retval_ = -1;
_startItem = item;
_startBox = box;
@@ -546,8 +548,9 @@ int BubbleBox::doBox_v1(int item, int box, int &type) {
}
_rowOff = bp;
- BOXPSTARTY = newY;
+ retval_ = BOXPSTARTY = newY;
+
// setcursorpos
_vm->_screen->_printOrg.y = _vm->_screen->_printStart.y = (newY << 3) + _rowOff;
_vm->_screen->_printOrg.x = _vm->_screen->_printStart.x = (newX << 3);
@@ -560,6 +563,7 @@ int BubbleBox::doBox_v1(int item, int box, int &type) {
_vm->_events->showCursor();
warning("TODO: pop values");
_vm->_screen->restoreScreen();
+ return retval_;
}
_vm->_destIn = _vm->_screen;
@@ -658,7 +662,7 @@ int BubbleBox::doBox_v1(int item, int box, int &type) {
if (_type == TYPE_3)
_vm->_boxSelect = val;
else {
- retval = 1;
+ btnSelected = 1;
if (_vm->BOXSELECTY == val)
break;
_vm->BOXSELECTY = val;
@@ -670,17 +674,17 @@ int BubbleBox::doBox_v1(int item, int box, int &type) {
if ((_vm->_events->_mousePos.y >= ICON1Y) && (_vm->_events->_mousePos.y <= ICON1Y + 8)
&& (_vm->_events->_mousePos.x >= ICON1X)) {
- retval = 1;
+ btnSelected = 1;
if (_vm->_events->_mousePos.x < ICON1X + ICONW[ICON1T])
break;
if ((_vm->_events->_mousePos.x >= ICON2X) && (_vm->_events->_mousePos.x < ICON2X + ICONW[ICON2T])) {
- retval = 2;
+ btnSelected = 2;
break;
}
if ((_vm->_events->_mousePos.x >= ICON3X) && (_vm->_events->_mousePos.x < ICON3X + ICONW[ICON3T])) {
- retval = 3;
+ btnSelected = 3;
break;
}
@@ -696,7 +700,16 @@ int BubbleBox::doBox_v1(int item, int box, int &type) {
warning("TODO: sub175B5");
}
}
- return retval;
+
+ _vm->_events->hideCursor();
+ _vm->_screen->restoreBlock();
+ _vm->_events->showCursor();
+ _vm->_events->debounceLeft();
+ if (_vm->BCNT == 0)
+ retval_ = -1;
+ else
+ retval_ = _vm->BOXDATASTART + _vm->BOXSELECTY;
+ return retval_;
}
void BubbleBox::getList(const char *data[], int *flags) {
@@ -704,11 +717,12 @@ void BubbleBox::getList(const char *data[], int *flags) {
int destIdx = 0;
while (data[srcIdx]) {
if (flags[srcIdx]) {
- _tempListPtr[destIdx] = Common::String(data[srcIdx]);
+ _tempList[destIdx] = Common::String(data[srcIdx]);
+ _tempListIdx[destIdx] = srcIdx;
++destIdx;
}
srcIdx++;
}
- _tempListPtr[destIdx] = "";
+ _tempList[destIdx] = "";
}
} // End of namespace Access
diff --git a/engines/access/bubble_box.h b/engines/access/bubble_box.h
index 52ee497106..5697c7397b 100644
--- a/engines/access/bubble_box.h
+++ b/engines/access/bubble_box.h
@@ -57,7 +57,8 @@ public:
Common::StringArray _nameIndex;
Common::String _bubbleTitle;
Common::String _bubbleDisplStr;
- Common::String _tempListPtr[60];
+ Common::String _tempList[60];
+ int _tempListIdx[60];
int _btnId1;
int _btnX1;
int _btnId2;
@@ -94,7 +95,7 @@ public:
void doBox(int item, int box);
- int doBox_v1(int item, int box, int &type);
+ int doBox_v1(int item, int box, int &btnSelected);
void getList(const char *data[], int *flags);
void SETCURSORPOS(int posX, int posY);
void PRINTSTR(Common::String msg);
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 114e0e7286..e823f611b6 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -38,9 +38,6 @@ 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() {
@@ -618,16 +615,16 @@ void Scripts::cmdRemoveLast() {
void Scripts::cmdDoTravel() {
while (true) {
_vm->_travelBox->getList(Martian::TRAVDATA, _vm->TRAVEL);
- int type = 0;
- int boxX = _vm->_travelBox->doBox_v1(_vm->STARTTRAVELITEM, _vm->STARTTRAVELBOX, type);
+ int btnSelected = 0;
+ int boxX = _vm->_travelBox->doBox_v1(_vm->STARTTRAVELITEM, _vm->STARTTRAVELBOX, btnSelected);
_vm->STARTTRAVELITEM = _vm->BOXDATASTART;
_vm->STARTTRAVELBOX = _vm->BOXSELECTY;
if (boxX == -1)
- type = 2;
+ btnSelected = 2;
- if (type != 2) {
- int idx = TMPLPTR[boxX];
+ if (btnSelected != 2) {
+ int idx = _vm->_travelBox->_tempListIdx[boxX];
if (Martian::_byte1EEB5[idx] != _vm->_byte26CB5) {
_vm->_bubbleBox->_bubbleTitle = "TRAVEL";
_vm->_scripts->printString("YOU CAN'T GET THERE FROM HERE.");
diff --git a/engines/access/scripts.h b/engines/access/scripts.h
index d9715afddf..ba052036ca 100644
--- a/engines/access/scripts.h
+++ b/engines/access/scripts.h
@@ -146,7 +146,6 @@ public:
int32 _choiceStart;
Common::Point _charsOrg, _texsOrg;
- int TMPLPTR[60];
public:
Scripts(AccessEngine *vm);