aboutsummaryrefslogtreecommitdiff
path: root/engines/fullpipe
diff options
context:
space:
mode:
Diffstat (limited to 'engines/fullpipe')
-rw-r--r--engines/fullpipe/motion.cpp228
1 files changed, 226 insertions, 2 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index 8c924e7816..3d515da725 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -1379,8 +1379,232 @@ int MovGraph2::findLink(Common::Array<MovGraphLink *> *linkList, int idx, Common
return node3->_x >= node2->_x;
}
-MessageQueue *MovGraph2::genMovement(MovInfo1 *movinfo) {
- warning("STUB: MovGraph2::genMovement()");
+MessageQueue *MovGraph2::genMovement(MovInfo1 *info) {
+#if 0
+ v69 = 0;
+ v70 = 0;
+
+ if (!(info->_flags & 2)) {
+ v6 = sizeof(MovGraph2Item) * info->field_0 + 184 * info->subIndex;
+ v7 = this->items2.m_pData;
+ v69 = *(int *)((char *)&v7->subItems[0].walk[0].mx + v6);
+ v70 = *(int *)((char *)&v7->subItems[0].walk[0].my + v6);
+ }
+ v59 = 0;
+ v64 = 0;
+ if (!(info->_flags & 4)) {
+ v8 = sizeof(MovGraph2Item) * info->field_0 + 184 * info->subIndex;
+ v9 = this->items2.m_pData;
+ v59 = *(Message **)((char *)&v9->subItems[0].walk[2].mx + v8);
+ v64 = *(int *)((char *)&v9->subItems[0].walk[2].my + v8);
+ }
+ v11 = info->_flags & 1;
+ v12 = info->subIndex;
+ v13 = info->pt2.y - info->pt1.y - v64 - v70;
+ v14 = info->field_0;
+ y = info->pt2.y - info->pt1.y - v64 - v70;
+ x = info->pt2.x - (_DWORD)v59 - v69 - info->pt1.x;
+ v10 = x;
+ v16 = _mgm->calcLength(&point, _items2[v14].subItems[v12].walk[1].mov, x, y, &v65, &a2, v11);
+ v17 = v16->x;
+ x1 = v16->x;
+ v18 = v16->y;
+ v19 = info->flags & 1;
+ y1 = v18;
+ flag = v19;
+ if (!v19) {
+ v20 = info->subIndex;
+ if (v20 == 1 || !v20) {
+ v21 = 23 * v20;
+ v22 = 31 * info->field_0;
+ a2 = -1;
+ v17 = v65 * this->items2.m_pData[24 * v22 / 0x2E8u].subItems[8 * v21 / 0xB8u].walk[1].mx;
+ v10 = v17;
+ x1 = v17;
+ x = v17;
+ info->pt2.x = (int)((char *)&v59->obj.vmt + v17 + v69 + info->pt1.x);
+ }
+ }
+ if (!flag) {
+ v23 = info->subIndex;
+ if (v23 == 2 || v23 == 3) {
+ v24 = 23 * v23;
+ v25 = 31 * info->field_0;
+ a2 = -1;
+ v18 = v65 * this->items2.m_pData[24 * v25 / 0x2E8u].subItems[8 * v24 / 0xB8u].walk[1].my;
+ v26 = v18 + info->pt1.y;
+ y1 = v18;
+ v13 = v18;
+ info->pt2.y = v70 + v64 + v26;
+ }
+ }
+ cnt = 0;
+ v60 = 0;
+ if (!(info->flags & 2)) {
+ cnt = Movement_countPhasesWithFlag(this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[offsetof(MovGraph2Item, objectId)].mov, -1, 1);
+ v27 = Movement_countPhasesWithFlag(this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[offsetof(MovGraph2Item, objectId)].mov, -1, 2);
+ v18 = y1;
+ v17 = x1;
+ v10 = x;
+ v60 = (Message *)v27;
+ }
+ if (v65 > 1) {
+ v28 = Movement_countPhasesWithFlag(this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[1].mov, -1, 1);
+ cnt += (v65 - 1) * v28;
+ v29 = Movement_countPhasesWithFlag(this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[1].mov, -1, 2);
+ v17 = x1;
+ v10 = x;
+ v60 = (Message *)((char *)v60 + (v65 - 1) * v29);
+ v18 = y1;
+ }
+ if (v65 > 0) {
+ cnt += Movement_countPhasesWithFlag(this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[1].mov, a2, 1);
+ v30 = Movement_countPhasesWithFlag(this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[1].mov, a2, 2);
+ v17 = x1;
+ v10 = x;
+ v60 = (Message *)((char *)v60 + v30);
+ v18 = y1;
+ }
+ if (!(info->flags & 4)) {
+ cnt += Movement_countPhasesWithFlag(this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[2].mov, -1, 1);
+ v31 = Movement_countPhasesWithFlag(this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[2].mov, -1, 2);
+ v17 = x1;
+ v10 = x;
+ v60 = (Message *)((char *)v60 + v31);
+ v18 = y1;
+ }
+ v32 = v10 - v17;
+ v33 = v13 - v18;
+ x = v32;
+ v74 = v33;
+ if (cnt)
+ x1 = (signed __int64)((double)x / (double)cnt);
+ else
+ x1 = 0;
+ if (v60)
+ y1 = (signed __int64)((double)v74 / (double)(signed int)v60);
+ else
+ y1 = 0;
+ v34 = v32 - cnt * x1;
+ v35 = v33 - (_DWORD)v60 * y1;
+ y2 = v34;
+ v76 = v35;
+ if (v34)
+ x2 = v34 / abs(v34);
+ else
+ x2 = 0;
+ if (v35)
+ v72 = v35 / abs(v35);
+ else
+ v72 = 0;
+ v38 = GlobalMessageQueueList_compact(&g_globalMessageQueueList);
+ res = MessageQueue_ctor1(v36, v38);
+ mq = res;
+ v39 = info->flags & 2;
+ if ((_BYTE)v39) {
+ v45 = new ExCommand(
+ LOWORD(this->items2.m_pData[info->field_0].objectId),
+ 5,
+ this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[1].movementId,
+ info->pt1.x,
+ info->pt1.y,
+ 0,
+ 1,
+ 0,
+ 0,
+ 0);
+ v46 = info->distance1;
+ v45->msg._field_14 = v46;
+ v41 = (int)&res->exCommands.obj.vmt;
+ v47 = v45->_excFlags | 2;
+ v45->msg._keyCode = this->items2.m_pData[info->field_0].obj->go._okeyCode;
+ v45->msg._field_24 = 1;
+ v45->_excFlags = v47;
+ } else {
+ v40 = ExCommand_ctor(
+ (ExCommand *)v61,
+ LOWORD(this->items2.m_pData[info->field_0].objectId),
+ 5,
+ this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[offsetof(MovGraph2Item, objectId)].movementId,
+ info->pt1.x,
+ info->pt1.y,
+ 0,
+ 1,
+ 0,
+ 0,
+ 0);
+ v41 = (int)&res->exCommands.obj.vmt;
+ v40->msg._field_14 = info->distance1;
+ v42 = info->field_0;
+ v43 = info->field_0;
+
+ LOWORD(v43) = *(_WORD *)(*((_DWORD *)&this->items2.m_pData->obj + 6 * (32 * v43 - v42)) + 4);
+ v44 = v40->_excFlags;
+ v40->msg._keyCode = (unsigned __int16)v43;
+ v40->msg._field_24 = 1;
+ v40->_excFlags = v44 | 2;
+ CPtrList::AddTail(&res->exCommands, v40);
+ v45 = MGM_buildExCommand2(
+ (MGM *)&this->movGraph.mgm,
+ this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[offsetof(MovGraph2Item, objectId)].mov,
+ LOWORD(this->items2.m_pData[info->field_0].objectId),
+ x1,
+ y1,
+ &x2,
+ &y2,
+ -1);
+ v45->_parId = res->_id;
+ v45->msg._keyCode = this->items2.m_pData[info->field_0].obj->go._okeyCode;
+ }
+ CPtrList::AddTail(v41, v45);
+ v48 = v65;
+ v49 = 0;
+ for (i = 0; i < v65; ++i) {
+ if (v49 == v48 - 1)
+ v50 = a2;
+ else
+ v50 = -1;
+ v51 = MGM_buildExCommand2(
+ (MGM *)&this->movGraph.mgm,
+ this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[1].mov,
+ LOWORD(this->items2.m_pData[info->field_0].objectId),
+ x1,
+ y1,
+ &x2,
+ &y2,
+ v50);
+ res = mq;
+ v51->_parId = mq->_id;
+ v51->msg._keyCode = this->items2.m_pData[info->field_0].obj->go._okeyCode;
+ CPtrList::AddTail(v41, v51);
+ v48 = v65;
+ v49 = i + 1;
+ }
+ if (!(info->flags & 4)) {
+ v52 = MGM_buildExCommand2(
+ (MGM *)&this->movGraph.mgm,
+ this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[2].mov,
+ LOWORD(this->items2.m_pData[info->field_0].objectId),
+ x1,
+ y1,
+ &x2,
+ &y2,
+ -1);
+ v52->_parId = res->_id;
+ v52->msg._keyCode = this->items2.m_pData[info->field_0].obj->go._okeyCode;
+ CPtrList::AddTail(v41, v52);
+ }
+ v54 = ExCommand_ctor(v53, LOWORD(this->items2.m_pData[info->field_0].objectId), 5, -1, info->pt2.x, info->pt2.y, 0, 1, 0, 0, 0);
+ v54->msg._field_14 = info->distance2;
+ v55 = info->field_0;
+ v56 = this->items2.m_pData;
+ v54->msg._keyCode = v56[v55].obj->go._okeyCode;
+ v57 = v54->_excFlags | 2;
+ v54->msg._field_24 = 0;
+ v54->_excFlags = v57;
+ CPtrList::AddTail(v41, v54);
+ return res;
+#endif
return 0;
}