aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2014-01-31 15:21:46 +0200
committerEugene Sandulenko2014-01-31 22:17:16 +0200
commit29239aa15d7ced2a7d89ce75298358f5d301fd80 (patch)
tree8a5e8601abc95d160d99b4936c1025df3f28344d
parent2aadd55ae603b2d8470dc7435eaafe41c9658d99 (diff)
downloadscummvm-rg350-29239aa15d7ced2a7d89ce75298358f5d301fd80.tar.gz
scummvm-rg350-29239aa15d7ced2a7d89ce75298358f5d301fd80.tar.bz2
scummvm-rg350-29239aa15d7ced2a7d89ce75298358f5d301fd80.zip
FULLPIPE: Started work on MGM::genMovement()
-rw-r--r--engines/fullpipe/motion.cpp238
1 files changed, 238 insertions, 0 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index f0318581f1..3bdd30561b 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -1814,6 +1814,244 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
warning("STUB: MGM::genMovement()");
return 0;
+
+#if 0
+ v3 = mgminfo->ani;
+
+ if (!mgminfo->ani)
+ return 0;
+
+ mov = v3->_movement;
+
+ if (!mov && !v3->_statics)
+ return 0;
+
+ v5 = mgminfo->flags;
+
+ if (!(mgminfo->flags & 1)) {
+ if (mov)
+ v6 = mov->_staticsObj2->_staticsId;
+ else
+ v6 = v3->_statics->_staticsId;
+ mgminfo->staticsId1 = (unsigned __int16)v6;
+ }
+
+ if (!(v5 & 0x10) || !(v5 & 0x20)) {
+ v7 = v3->go._ox;
+ v8 = v3->go._oy;
+ if (v3->_movement) {
+ v9 = StaticANIObject_calcNextStep(&point2, v3);
+ v7 += v9->x;
+ v8 += v9->y;
+ }
+ v10 = mgminfo->flags;
+ if (!(mgminfo->flags & 0x10))
+ mgminfo->x2 = v7;
+ if (!(v10 & 0x20))
+ mgminfo->y2 = v8;
+ }
+
+ mov = StaticANIObject_getMovementById(mgminfo->ani, LOWORD(mgminfo->movementId));
+
+ if (!mov)
+ return 0;
+
+ v11 = MGM_getItemIndexById(this, mgminfo->ani->go._id);
+ v12 = v11;
+ v13 = MGM_getStaticsIndexById(this, v11, LOWORD(mgminfo->staticsId1));
+ v14 = v13;
+ subIdx = v13;
+ st2idx = MGM_getStaticsIndexById(this, v12, mov->_staticsObj1->_staticsId);
+ st1idx = MGM_getStaticsIndexById(this, v12, mov->_staticsObj2->_staticsId);
+ subOffset = MGM_getStaticsIndexById(this, v12, LOWORD(mgminfo->staticsId2));
+ MGM_clearMovements2(this, v12);
+ MGM_recalcOffsets(this, v12, v14, st2idx, 0, 1);
+ MGM_clearMovements2(this, v12);
+ MGM_recalcOffsets(this, v12, st1idx, subOffset, 0, 1);
+ v15 = this->items;
+ v71 = (Message *)(28 * v12);
+ v16 = (int)&v15[v12].objId;
+ v17 = *(_DWORD *)(v16 + offsetof(MGMItem, staticsListCount));
+ point.x = *(_DWORD *)(v16 + offsetof(MGMItem, subItems));
+ v18 = (MGMSubItem *)(point.x + 24 * (v14 + st2idx * v17));
+ x1 = (int)&v18->movement->go.CObject.vmt;
+ v19 = (MGMSubItem *)(point.x + 24 * (st1idx + subOffset * v17));
+ v69 = (LONG)&v19->movement->go.CObject.vmt;
+
+ if (v14 != st2idx && !x1)
+ return 0;
+
+ if (st1idx != subOffset && !v69)
+ return 0;
+
+ v20 = mgminfo->y2;
+ point2.x = v18->x;
+ point2.y = v18->y;
+ point3.x = v19->x;
+ point3.y = v19->y;
+ point1.x = v19->x;
+ v21 = v18->x;
+ v22 = v19->y;
+ v76 = v18->y;
+ v23 = mgminfo->y1;
+ v75 = v21;
+ v24 = v23 - v20 - v76 - v22;
+ point.x = mgminfo->x1 - mgminfo->x2 - v21 - point1.x;
+ v75 = point.x;
+ v76 = v24;
+ v25 = Movement_calcSomeXY(mov, &point1, 0);
+ v26 = v25->x;
+ v56 = v25->x;
+ v27 = v25->y;
+ v58 = v25->y;
+
+ if (mgminfo->flags & 0x40) {
+ v62 = mgminfo->field_10;
+ v28 = v62;
+ a2 = -1;
+ point1.x = v62 * v26;
+ point1.y = v62 * v27;
+ } else {
+ v29 = MGM_calcLength(this, &point, mov, point.x, v24, &v62, &a2, 1);
+ point1.x = v29->x;
+ v26 = v56;
+ v30 = v29->y;
+ v28 = v62;
+ point1.y = v30;
+ }
+
+ v31 = mgminfo->flags;
+
+ if (!(mgminfo->flags & 2)) {
+ v32 = point3.x + mgminfo->x2;
+ a2 = -1;
+ point1.x = v28 * v26;
+ v75 = v28 * v26;
+ mgminfo->x1 = v28 * v26 + point2.x + v32;
+ }
+
+ if (!(v31 & 4)) {
+ point1.y = v28 * v58;
+ v76 = v28 * v58;
+ v33 = mgminfo->y2;
+ a2 = -1;
+ mgminfo->y1 = v33 + v28 * v58 + point2.y + point3.y;
+ }
+
+ v34 = 0;
+ point.x = 0;
+ v57 = 0;
+
+ if (x1) {
+ v35 = MGM_countPhases(this, v12, subIdx, st2idx, 1);
+ v34 = v35;
+ point.x = v35;
+ v57 = MGM_countPhases(this, v12, subIdx, st2idx, 2);
+ v28 = v62;
+ }
+
+ if (v28 > 1) {
+ v36 = Movement_countPhasesWithFlag(mov, -1, 1);
+ v34 += (v62 - 1) * v36;
+ point.x = v34;
+ v37 = Movement_countPhasesWithFlag(mov, -1, 2);
+ v28 = v62;
+ v57 += (v62 - 1) * v37;
+ }
+
+ if (v28 > 0) {
+ v34 += Movement_countPhasesWithFlag(mov, a2, 1);
+ point.x = v34;
+ v57 += Movement_countPhasesWithFlag(mov, a2, 2);
+ }
+
+ if (v69) {
+ v34 += MGM_countPhases(this, v12, st1idx, subOffset, 1);
+ point.x = v34;
+ v57 += MGM_countPhases(this, v12, st1idx, subOffset, 2);
+ }
+
+ v69 = v75 - point1.x;
+ v38 = v76 - point1.y;
+ v70 = v76 - point1.y;
+
+ if (v34) {
+ x1 = (signed __int64)((double)v69 / (double)*(signed int *)&point);
+ v38 = v70;
+ } else {
+ x1 = 0;
+ }
+
+ if (v57) {
+ y1 = (signed __int64)((double)v70 / (double)v57);
+ v38 = v70;
+ } else {
+ y1 = 0;
+ }
+
+ y2 = v75 - point1.x - v34 * x1;
+ v78 = v38 - v57 * y1;
+
+ if (v75 - point1.x == v34 * x1)
+ x2 = 0;
+ else
+ x2 = (v75 - point1.x - v34 * x1) / abs(v75 - point1.x - v34 * x1);
+
+ if (v38 == v57 * y1)
+ v74 = 0;
+ else
+ v74 = (v38 - v57 * y1) / abs(v38 - v57 * y1);
+ v39 = (MessageQueue *)operator new(0x48u);
+ v69 = (LONG)v39;
+ mq = 0;
+
+ if (v39) {
+ v41 = GlobalMessageQueueList_compact(&g_globalMessageQueueList);
+ mq = MessageQueue_ctor1(v39, v41);
+ }
+
+ for (v42 = subIdx; v42 != st2idx; v42 = v43->staticsIndex) {
+ v43 = &(*(MGMSubItem **)((char *)&this->items->subItems + (unsigned int)v71))[v42 + st2idx * *(int *)((char *)&this->items->staticsListCount + (unsigned int)v71)];
+ v44 = MGM_buildExCommand2(this, v43->movement, mgminfo->ani->go._id, x1, y1, (POINT *)&x2, (POINT *)&y2, -1);
+ v44->ex._parId = mq->_id;
+ v44->ex.msg._keyCode = mgminfo->ani->go._okeyCode;
+ CPtrList::AddTail(&mq->exCommands, v44);
+ }
+ v45 = v62;
+
+ for (i = 0; i < v62; ++i) {
+ if (i == v45 - 1)
+ v47 = a2;
+ else
+ v47 = -1;
+ v48 = MGM_buildExCommand2(this, mov, mgminfo->ani->go._id, x1, y1, (POINT *)&x2, (POINT *)&y2, v47);
+ v48->ex._parId = mq->_id;
+ v48->ex.msg._keyCode = mgminfo->ani->go._okeyCode;
+ CPtrList::AddTail(&mq->exCommands, v48);
+ v45 = v62;
+ }
+
+ for (j = st1idx; j != subOffset; j = v50->staticsIndex) {
+ v50 = &(*(MGMSubItem **)((char *)&this->items->subItems + (unsigned int)v71))[j + subOffset * *(int *)((char *)&this->items->staticsListCount + (unsigned int)v71)];
+ v51 = MGM_buildExCommand2(this, v50->movement, mgminfo->ani->go._id, x1, y1, (POINT *)&x2, (POINT *)&y2, -1);
+ v51->ex._parId = mq->_id;
+ v51->ex.msg._keyCode = mgminfo->ani->go._okeyCode;
+ CPtrList::AddTail(&mq->exCommands, v51);
+ }
+
+ v52 = ExCommand_ctor((ExCommand *)v71, mgminfo->ani->go._id, 5, -1, mgminfo->x1, mgminfo->y1, 0, 1, 0, 0, 0);
+ v52->msg._field_14 = mgminfo->field_1C;
+ v53 = mgminfo->ani;
+
+ v54 = v53->go._okeyCode;
+ v55 = v52->_excFlags;
+ v52->msg._keyCode = (unsigned __int16)v54;
+ v52->msg._field_24 = 0;
+ v52->_excFlags = v55 | 3;
+ CPtrList::AddTail(&mq->exCommands, v52);
+
+ return mq;
+#endif
}
void MGM::updateAnimStatics(StaticANIObject *ani, int staticsId) {