ACCESS: MM - Implement getList

This commit is contained in:
Strangerke 2015-01-15 00:40:43 +01:00
parent 3a57f20816
commit f1aa191f8c
8 changed files with 43 additions and 19 deletions

View File

@ -95,7 +95,7 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
for (int i = 0; i < 60; i++)
TRAVEL[i] = 0;
STARTTRAVELITEM = STARTTRAVELBOX = 0;
for (int i = 0; i < 16; i++)
for (int i = 0; i < 33; i++)
ASK[i];
_startAboutItem = _startAboutBox = 0;
_byte26CB5 = 0;
@ -163,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, "", nullptr);
_bubbleBox = new BubbleBox(this, TYPE_2, 64, 32, 130, 122, 0, 0, 0, 0, "");
if (getGameID() == GType_MartianMemorandum) {
_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);
_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");
} else {
_helpBox = nullptr;
_travelBox = nullptr;

View File

@ -211,9 +211,9 @@ public:
// Fields used by MM
// TODO: Refactor
int TRAVEL[60];
int ASK[33];
int STARTTRAVELITEM;
int STARTTRAVELBOX;
int ASK[16];
int _startAboutItem;
int _startAboutBox;
int BOXDATASTART;

View File

@ -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, byte *tmpList) : 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;
@ -40,7 +40,8 @@ BubbleBox::BubbleBox(AccessEngine *vm, Access::BoxType type, int x, int y, int w
BOXENDX = BOXENDY = 0;
BOXPSTARTX = BOXPSTARTY = 0;
// Unused in AGoE
_tempListPtr = tmpList;
for (int i = 0; i < 60; i++)
_tempListPtr[i] = "";
}
void BubbleBox::load(Common::SeekableReadStream *stream) {
@ -294,14 +295,14 @@ void BubbleBox::displayBoxData() {
_vm->_fonts._charFor._lo = 15; // 0xFF
_vm->_fonts._charFor._hi = 15;
if (!_tempListPtr)
if (_tempListPtr[0].size() == 0)
return;
int idx = 0;
if ((_type == TYPE_1) || (_type == TYPE_3)) {
_vm->BCNT = 0;
if (_tempListPtr[idx] == -1) {
if (_tempListPtr[idx].size() == 0) {
_vm->BOXDATAEND = 1;
return;
}
@ -322,7 +323,7 @@ void BubbleBox::displayBoxData() {
++BOXPSTARTY;
for (int i = 0; i < _vm->BOXDATASTART; i++, idx++) {
while (_tempListPtr[idx] != 0)
while (_tempListPtr[idx].size() != 0)
++idx;
}
@ -332,7 +333,7 @@ void BubbleBox::displayBoxData() {
++idx;
++BOXPSTARTY;
++_vm->BCNT;
if (_tempListPtr[idx] == nullptr) {
if (_tempListPtr[idx].size() == 0) {
BOXPSTARTY = oldPStartY;
_vm->_events->showCursor();
_vm->BOXDATAEND = 1;
@ -565,4 +566,17 @@ int BubbleBox::doBox_v1(int item, int box, int &type) {
warning("TODO: more dobox_v1");
return -1;
}
void BubbleBox::getList(const char *data[], int *flags) {
int srcIdx = 0;
int destIdx = 0;
while (data[srcIdx]) {
if (flags[srcIdx]) {
_tempListPtr[destIdx] = Common::String(data[srcIdx]);
++destIdx;
}
srcIdx++;
}
_tempListPtr[destIdx] = "";
}
} // End of namespace Access

View File

@ -57,7 +57,7 @@ public:
Common::StringArray _nameIndex;
Common::String _bubbleTitle;
Common::String _bubbleDisplStr;
byte *_tempListPtr;
Common::String _tempListPtr[60];
int _btnId1;
int _btnX1;
int _btnId2;
@ -67,7 +67,7 @@ public:
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, byte* tmpList);
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);
void load(Common::SeekableReadStream *stream);
@ -95,7 +95,7 @@ public:
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
void getList(const char *data[], int *flags);
};
} // End of namespace Access

View File

@ -74,6 +74,7 @@ void MartianEngine::initVariables() {
_mouseMode = 0;
_numAnimTimers = 0;
TRAVEL[7] = 1;
ASK[33] = 1;
}
void MartianEngine::setNoteParams() {

View File

@ -807,7 +807,7 @@ const int RMOUSE[10][2] = {
{ 155, 185 }, { 188, 216 }, { 219, 260 }, { 263, 293 }, { 295, 214 }
};
const char *const TRAVDATA[] = {
const char *TRAVDATA[] = {
"GALACTIC PICTURES", "TERRAFORM", "WASHROOM", "MR. BIG", "ALEXIS' HOME",
"JOHNNY FEDORA", "JUNKYARD IN", "TEX'S OFFICE", "MURDER SCENE", "PLAZA HOTEL",
"RESTAURANT", "GIFT SHOP", "LOVE SCENE", "RICK LOGAN", "HUT",
@ -832,6 +832,14 @@ const char *const ASKTBL[] = {
"LARRRY HAMMOND", nullptr
};
byte HELP[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1
};
const byte DEATH_SCREENS[] = {
5, 5, 3, 3, 7, 4, 6, 2, 2, 2, 1, 5, 3, 5, 2, 8, 5, 3, 8, 5
};

View File

@ -55,8 +55,9 @@ extern const byte ICON_DATA[];
extern const int RMOUSE[10][2];
extern const char *const TRAVDATA[];
extern byte HELP[];
extern const char *const ASKTBL[];
extern const char *TRAVDATA[];
extern const byte DEATH_SCREENS[];
extern const char *const DEATHMESSAGE[];

View File

@ -617,7 +617,7 @@ void Scripts::cmdRemoveLast() {
void Scripts::cmdDoTravel() {
while (true) {
_vm->_travelBox->getList();
_vm->_travelBox->getList(Martian::TRAVDATA, _vm->TRAVEL);
int type = 0;
int boxX = _vm->_travelBox->doBox_v1(_vm->STARTTRAVELITEM, _vm->STARTTRAVELBOX, type);
_vm->STARTTRAVELITEM = _vm->BOXDATASTART;