diff options
author | Eugene Sandulenko | 2013-11-17 12:19:25 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2013-11-17 16:40:20 -0800 |
commit | fc107e000594bd4fc6a321f9c0bfb927297977e8 (patch) | |
tree | de83ff27c3b3c1b37569fe38dc9cfc8503c74cd0 /engines/fullpipe/motion.cpp | |
parent | 4e4a4bb005dd284d235a54a763727b1a2e061c8e (diff) | |
download | scummvm-rg350-fc107e000594bd4fc6a321f9c0bfb927297977e8.tar.gz scummvm-rg350-fc107e000594bd4fc6a321f9c0bfb927297977e8.tar.bz2 scummvm-rg350-fc107e000594bd4fc6a321f9c0bfb927297977e8.zip |
FULLPIPE: Complete implementation of MovGraph2::buildMovInfo1MessageQueue()
Diffstat (limited to 'engines/fullpipe/motion.cpp')
-rw-r--r-- | engines/fullpipe/motion.cpp | 130 |
1 files changed, 67 insertions, 63 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 02a226d780..c1977c0ac3 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -658,115 +658,112 @@ void MovGraph2::buildMovInfo1SubItems(MovInfo1 *movinfo, Common::Array<MovGraphL } MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) { -#if 0 MovInfo1 movinfo; - memcpy(movinfo, movInfo, sizeof(movinfo)); + memcpy(&movinfo, movInfo, sizeof(movinfo)); - curX = movInfo->pt1.x; - curY = movInfo->pt1.y; - curDistance = movInfo->distance1; + int curX = movInfo->pt1.x; + int curY = movInfo->pt1.y; + int curDistance = movInfo->distance1; - mq = new MessageQueue(g_fullpipe->globalMessageQueueList->compact()); + MessageQueue *mq = new MessageQueue(g_fullpipe->_globalMessageQueueList->compact()); - for (int i = 0; i < movInfo->_itemsCount - 1; i++) { - if (movInfo->items[i + 1].subIndex != 10) { - if (i >= movInfo->itemsCount - 2 || movInfo->items[i + 2].subIndex != 10) { - v12 = (char *)_items[0] + 16 * (movInfo->items[i + 1].subIndex + 8); - movinfo.flags = 0; - subidx = 744 * movInfo->field_0; - v15 = (MG2I *)(&v12[184 * movInfo->items[i].subIndex] + subidx); + for (int i = 0; i < movInfo->itemsCount - 1; i++) { + if (movInfo->items[i + 1]->subIndex != 10) { + MG2I *mg2i; - v15 = &_items[movInfo->field_0]->_subItems[movInfo->items[i].subIndex] + if (i >= movInfo->itemsCount - 2 || movInfo->items[i + 2]->subIndex != 10) { + movinfo.flags = 0; + mg2i = &_items2[movInfo->field_0]->_subItems[movInfo->items[i]->subIndex]._turnS[movInfo->items[i + 1]->subIndex]; } else { - v12 = (char *)_items[0] + 16 * (movInfo->items[i + 1].subIndex + 4); movinfo.flags = 2; - subidx = 744 * movInfo->field_0; - v15 = (MovGraph2Item *)(&v12[184 * movInfo->items[i].subIndex] + subidx); + mg2i = &_items2[movInfo->field_0]->_subItems[movInfo->items[i]->subIndex]._turn[movInfo->items[i + 1]->subIndex]; } if (i < movInfo->itemsCount - 2 - || (movInfo->items[i].x == movInfo->items[i + 1].x - && movInfo->items[i].y == movInfo->items[i + 1].y) - || movInfo->items[i].x == -1 - || movInfo->items[i].y == -1 - || movInfo->items[i + 1].x == -1 - || movInfo->items[i + 1].y == -1) { + || (movInfo->items[i]->x == movInfo->items[i + 1]->x + && movInfo->items[i]->y == movInfo->items[i + 1]->y) + || movInfo->items[i]->x == -1 + || movInfo->items[i]->y == -1 + || movInfo->items[i + 1]->x == -1 + || movInfo->items[i + 1]->y == -1) { - ExCommand *ex = new ExCommand(_items[1][movInfo->field_0].objectId, 1, v15->_movementId, 0, 0, 0, 1, 0, 0, 0); + ExCommand *ex = new ExCommand(_items2[movInfo->field_0]->_objectId, 1, mg2i->_movementId, 0, 0, 0, 1, 0, 0, 0); ex->_excFlags |= 2; - ex->_keyCode = _items[1][movInfo->field_0].obj->GameObject.okeyCode; + ex->_keyCode = _items2[movInfo->field_0]->_obj->_okeyCode; ex->_field_24 = 1; ex->_field_14 = -1; mq->_exCommands.push_back(ex); - curX += v15->_mx; - curY += v15->_my; + curX += mg2i->_mx; + curY += mg2i->_my; } else { - memset(mgminfo, 0, sizeof(mgminfo)); + MGMInfo mgminfo; - mgminfo.ani = *(StaticANIObject **)((char *)&this->items[1]->obj + subidx); - mgminfo.staticsId2 = v15->_mov->staticsObj2->staticsId; - mgminfo.x1 = movInfo->items[i + 1].x; - mgminfo.y1 = movInfo->items[i + 1].y; - mgminfo.field_1C = movInfo->items[i + 1].field_C; - mgminfo.staticsId1 = v15->obj->staticsObj1->staticsId; + memset(&mgminfo, 0, sizeof(mgminfo)); - mgminfo.x2 = movInfo->items[i].x; - mgminfo.y2 = movInfo->items[i].y; + mgminfo.ani = _items2[movInfo->field_0]->_obj; + mgminfo.staticsId2 = mg2i->_mov->_staticsObj2->_staticsId; + mgminfo.x1 = movInfo->items[i + 1]->x; + mgminfo.y1 = movInfo->items[i + 1]->y; + mgminfo.field_1C = movInfo->items[i + 1]->distance; + mgminfo.staticsId1 = mg2i->_mov->_staticsObj1->_staticsId; + + mgminfo.x2 = movInfo->items[i]->x; + mgminfo.y2 = movInfo->items[i]->y; mgminfo.field_10 = 1; mgminfo.flags = 0x7f; - mgminfo.movementId = v15->_movementId; + mgminfo.movementId = mg2i->_movementId; - MessageQueue *mq2 = (MessageQueue *)MGM_sub_445330((MGM *)&this->movGraph.mgm, &mgminfo); + MessageQueue *mq2 = _mgm.genMovement(&mgminfo); mq->transferExCommands(mq2); delete mq2; - curX = movInfo->items[i + 1].x; - curY = movInfo->items[i + 1].y; + curX = movInfo->items[i + 1]->x; + curY = movInfo->items[i + 1]->y; } } else { - movinfo.item1Index = movInfo->items[i].subIndex; + movinfo.item1Index = movInfo->items[i]->subIndex; movinfo.subIndex = movinfo.item1Index; movinfo.pt1.y = curY; movinfo.pt1.x = curX; movinfo.distance1 = curDistance; - movinfo.pt2.x = movInfo->items[i + 2].x; - movinfo.pt2.y = movInfo->items[i + 2].y; - movinfo.distance2 = movInfo->items[i + 2].field_C; + movinfo.pt2.x = movInfo->items[i + 2]->x; + movinfo.pt2.y = movInfo->items[i + 2]->y; + movinfo.distance2 = movInfo->items[i + 2]->distance; if (i >= movInfo->itemsCount - 4 - || movInfo->items[i + 2].subIndex == 10 - || movInfo->items[i + 3].subIndex == 10 - || movInfo->items[i + 2].subIndex == movInfo->items[i + 3].subIndex - || movInfo->items[i + 4].subIndex != 10) { + || movInfo->items[i + 2]->subIndex == 10 + || movInfo->items[i + 3]->subIndex == 10 + || movInfo->items[i + 2]->subIndex == movInfo->items[i + 3]->subIndex + || movInfo->items[i + 4]->subIndex != 10) { if (i >= movInfo->itemsCount - 3 - || movInfo->items[i + 2].subIndex == 10 - || movInfo->items[i + 3].subIndex == 10 - || movInfo->items[i + 2].subIndex == movInfo->items[i + 3].subIndex) { + || movInfo->items[i + 2]->subIndex == 10 + || movInfo->items[i + 3]->subIndex == 10 + || movInfo->items[i + 2]->subIndex == movInfo->items[i + 3]->subIndex) { movinfo.flags &= 3; } else { - v35 = (MovInfo1 *)((char *)&_items[1][movInfo->field_0] + 184 * movInfo->items[i + 2].subIndex + 16 * (movInfo->items[i + 3].subIndex + 8)); - movinfo.pt2.x -= v35->pt1.y; - movinfo.pt2.y -= v35->pt2.x; + MG2I *m = &_items2[movInfo->field_0]->_subItems[movInfo->items[i + 2]->subIndex]._turnS[movInfo->items[i + 3]->subIndex]; + movinfo.pt2.x -= m->_mx; + movinfo.pt2.y -= m->_my; movinfo.flags &= 3; } } else { - v32 = (MovInfo1 *)((char *)&_items[1][movInfo->field_0] + 184 * movInfo->items[i + 2].subIndex + 16 * (movInfo->items[i + 3].subIndex + 4)); + MG2I *m = &_items2[movInfo->field_0]->_subItems[movInfo->items[i + 2]->subIndex]._turn[movInfo->items[i + 3]->subIndex]; if (movinfo.item1Index && movinfo.item1Index != 1) { - movinfo.pt2.y -= v32->pt2.x; + movinfo.pt2.y -= m->_my; movinfo.flags = (movinfo.flags & 2) | 1; } else { - movinfo.pt2.x -= v32->pt1.y; + movinfo.pt2.x -= m->_mx; movinfo.flags = (movinfo.flags & 2) | 1; } } i++; // intentional - MessageQueue *mq2 = sub1(&movinfo); + MessageQueue *mq2 = genMovement(&movinfo); if (mq2) { delete mq; @@ -787,11 +784,6 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) { movInfo->pt2.y = movinfo.pt2.y; return mq; - -#endif - warning("STUB: MovGraph2::buildMovInfo1MessageQueue()"); - - return 0; } int MovGraph2::removeObject(StaticANIObject *obj) { @@ -1163,6 +1155,12 @@ int MovGraph2::findLink(Common::Array<MovGraphLink *> *linkList, int idx, Common return node3->_x >= node2->_x; } +MessageQueue *MovGraph2::genMovement(MovInfo1 *movinfo) { + warning("STUB: MovGraph2::genMovement()"); + + return 0; +} + MovGraphLink *MovGraph2::findLink1(int x, int y, int idx, int fuzzyMatch) { Common::Point point; MovGraphLink *res = 0; @@ -1389,6 +1387,12 @@ int MGM::getItemIndexById(int objId) { return -1; } +MessageQueue *MGM::genMovement(MGMInfo *mgminfo) { + warning("STUB: MGM::genMovement()"); + + return 0; +} + MovGraphLink::MovGraphLink() { _distance = 0; _angle = 0; |