[Scummvm-cvs-logs] scummvm master -> 4c039ffe893de9d560c78e6fe14702757a99ec43

sev- sev at scummvm.org
Fri Jan 31 21:18:02 CET 2014


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
29239aa15d FULLPIPE: Started work on MGM::genMovement()
0eb1b312ac FULLPIPE: More work on MGM::genMovement()
4c039ffe89 FULLPIPE: Further work on MGM::genMovement()


Commit: 29239aa15d7ced2a7d89ce75298358f5d301fd80
    https://github.com/scummvm/scummvm/commit/29239aa15d7ced2a7d89ce75298358f5d301fd80
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2014-01-31T12:17:16-08:00

Commit Message:
FULLPIPE: Started work on MGM::genMovement()

Changed paths:
    engines/fullpipe/motion.cpp



diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index f031858..3bdd305 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) {


Commit: 0eb1b312ac654fe1653a039e3e72aedc3304fedf
    https://github.com/scummvm/scummvm/commit/0eb1b312ac654fe1653a039e3e72aedc3304fedf
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2014-01-31T12:17:16-08:00

Commit Message:
FULLPIPE: More work on MGM::genMovement()

Changed paths:
    engines/fullpipe/motion.cpp



diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index 3bdd305..ea75dd9 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -1816,31 +1816,26 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
 	return 0;
 
 #if 0
-	v3 = mgminfo->ani;
-
 	if (!mgminfo->ani)
 		return 0;
 
-	mov = v3->_movement;
+	mov = mgminfo->ani->_movement;
 
-	if (!mov && !v3->_statics)
+	if (!mov && !mgminfo->ani->_statics)
 		return 0;
 
-	v5 = mgminfo->flags;
-
 	if (!(mgminfo->flags & 1)) {
 		if (mov)
-			v6 = mov->_staticsObj2->_staticsId;
+			mgminfo->staticsId1 = mov->_staticsObj2->_staticsId;
 		else
-			v6 = v3->_statics->_staticsId;
-		mgminfo->staticsId1 = (unsigned __int16)v6;
+			mgminfo->staticsId1 = mgminfo->ani->_statics->_staticsId;
 	}
 
-	if (!(v5 & 0x10) || !(v5 & 0x20)) {
-		v7 = v3->go._ox;
-		v8 = v3->go._oy;
-		if (v3->_movement) {
-			v9 = StaticANIObject_calcNextStep(&point2, v3);
+	if (!(mgminfo->flags & 0x10) || !(mgminfo->flags & 0x20)) {
+		v7 = mgminfo->ani->_ox;
+		v8 = mgminfo->ani->_oy;
+		if (mgminfo->ani->_movement) {
+			v9 = StaticANIObject_calcNextStep(&point2, mgminfo->ani);
 			v7 += v9->x;
 			v8 += v9->y;
 		}
@@ -1856,18 +1851,18 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
 	if (!mov)
 		return 0;
 
-	v11 = MGM_getItemIndexById(this, mgminfo->ani->go._id);
+	v11 = getItemIndexById(mgminfo->ani->_id);
 	v12 = v11;
-	v13 = MGM_getStaticsIndexById(this, v11, LOWORD(mgminfo->staticsId1));
+	v13 = getStaticsIndexById(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);
+	st2idx = getStaticsIndexById(v12, mov->_staticsObj1->_staticsId);
+	st1idx = getStaticsIndexById(v12, mov->_staticsObj2->_staticsId);
+	subOffset = getStaticsIndexById(v12, LOWORD(mgminfo->staticsId2));
+	clearMovements2(v12);
+	recalcOffsets(v12, v14, st2idx, 0, 1);
+	clearMovements2(v12);
+	recalcOffsets(v12, st1idx, subOffset, 0, 1);
 	v15 = this->items;
 	v71 = (Message *)(28 * v12);
 	v16 = (int)&v15[v12].objId;
@@ -1912,7 +1907,7 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
 		point1.x = v62 * v26;
 		point1.y = v62 * v27;
 	} else {
-		v29 = MGM_calcLength(this, &point, mov, point.x, v24, &v62, &a2, 1);
+		v29 = calcLength(&point, mov, point.x, v24, &v62, &a2, 1);
 		point1.x = v29->x;
 		v26 = v56;
 		v30 = v29->y;
@@ -1943,10 +1938,10 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
 	v57 = 0;
 
 	if (x1) {
-		v35 = MGM_countPhases(this, v12, subIdx, st2idx, 1);
+		v35 = countPhases(v12, subIdx, st2idx, 1);
 		v34 = v35;
 		point.x = v35;
-		v57 = MGM_countPhases(this, v12, subIdx, st2idx, 2);
+		v57 = countPhases(v12, subIdx, st2idx, 2);
 		v28 = v62;
 	}
 
@@ -1966,9 +1961,9 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
 	}
 
 	if (v69) {
-		v34 += MGM_countPhases(this, v12, st1idx, subOffset, 1);
+		v34 += countPhases(v12, st1idx, subOffset, 1);
 		point.x = v34;
-		v57 += MGM_countPhases(this, v12, st1idx, subOffset, 2);
+		v57 += countPhases(v12, st1idx, subOffset, 2);
 	}
 
 	v69 = v75 - point1.x;
@@ -2001,54 +1996,50 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
 		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);
-	}
+	MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+	ExCommand2 *ex2;
 
 	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);
+		ex2 = buildExCommand2(v43->movement, mgminfo->ani->go._id, x1, y1, (POINT *)&x2, (POINT *)&y2, -1);
+		ex2->_parId = mq->_id;
+		ex2->_keyCode = mgminfo->ani->_okeyCode;
+
+		mq->addExCommandToEnd(ex2);
 	}
-	v45 = v62;
 
 	for (i = 0; i < v62; ++i) {
-		if (i == v45 - 1)
+		if (i == v62 - 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;
+
+		ex2 = buildExCommand2(mov, mgminfo->ani->_id, x1, y1, (POINT *)&x2, (POINT *)&y2, v47);
+		ex2->_parId = mq->_id;
+		ex2->_keyCode = mgminfo->ani->_okeyCode;
+
+		mq->addExCommandToEnd(ex2);
 	}
 
 	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);
+
+		ex2 = buildExCommand2(v50->movement, mgminfo->ani->_id, x1, y1, (POINT *)&x2, (POINT *)&y2, -1);
+		ex2->_parId = mq->_id;
+		ex2->_keyCode = mgminfo->ani->_okeyCode;
+
+		mq->addExCommandToEnd(ex2);
+	}
+
+	ExCommand *ex = new ExCommand(mgminfo->ani->_id, 5, -1, mgminfo->x1, mgminfo->y1, 0, 1, 0, 0, 0);
+
+	ex->_field_14 = mgminfo->field_1C;
+	ex->_keyCode = mgminfo->ani->_okeyCode;
+	ex->_field_24 = 0;
+	ex->_excFlags |= 3;
+
+	mq->addExCommandToEnd(ex);
 
 	return mq;
 #endif


Commit: 4c039ffe893de9d560c78e6fe14702757a99ec43
    https://github.com/scummvm/scummvm/commit/4c039ffe893de9d560c78e6fe14702757a99ec43
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2014-01-31T12:17:26-08:00

Commit Message:
FULLPIPE: Further work on MGM::genMovement()

Changed paths:
    engines/fullpipe/motion.cpp



diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index ea75dd9..e2565e8 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -1832,48 +1832,48 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
 	}
 
 	if (!(mgminfo->flags & 0x10) || !(mgminfo->flags & 0x20)) {
-		v7 = mgminfo->ani->_ox;
-		v8 = mgminfo->ani->_oy;
+		int nx = mgminfo->ani->_ox;
+		int ny = mgminfo->ani->_oy;
+
 		if (mgminfo->ani->_movement) {
-			v9 = StaticANIObject_calcNextStep(&point2, mgminfo->ani);
-			v7 += v9->x;
-			v8 += v9->y;
+			mgminfo->ani->calcNextStep(&point2);
+			nx += point2.x;
+			ny += point2.y;
 		}
-		v10 = mgminfo->flags;
+
 		if (!(mgminfo->flags & 0x10))
-			mgminfo->x2 = v7;
-		if (!(v10 & 0x20))
-			mgminfo->y2 = v8;
+			mgminfo->x2 = nx;
+
+		if (!(mgminfo->flags & 0x20))
+			mgminfo->y2 = ny;
 	}
 
-	mov = StaticANIObject_getMovementById(mgminfo->ani, LOWORD(mgminfo->movementId));
+	mov = mgminfo->ani->getMovementById(mgminfo->movementId);
 
 	if (!mov)
 		return 0;
 
-	v11 = getItemIndexById(mgminfo->ani->_id);
-	v12 = v11;
-	v13 = getStaticsIndexById(v11, LOWORD(mgminfo->staticsId1));
-	v14 = v13;
-	subIdx = v13;
-	st2idx = getStaticsIndexById(v12, mov->_staticsObj1->_staticsId);
-	st1idx = getStaticsIndexById(v12, mov->_staticsObj2->_staticsId);
-	subOffset = getStaticsIndexById(v12, LOWORD(mgminfo->staticsId2));
-	clearMovements2(v12);
-	recalcOffsets(v12, v14, st2idx, 0, 1);
-	clearMovements2(v12);
-	recalcOffsets(v12, st1idx, subOffset, 0, 1);
-	v15 = this->items;
-	v71 = (Message *)(28 * v12);
-	v16 = (int)&v15[v12].objId;
+	itemIdx = getItemIndexById(mgminfo->ani->_id);
+	subIdx = getStaticsIndexById(itemIdx, mgminfo->staticsId1);
+	st2idx = getStaticsIndexById(itemIdx, mov->_staticsObj1->_staticsId);
+	st1idx = getStaticsIndexById(itemIdx, mov->_staticsObj2->_staticsId);
+	subOffset = getStaticsIndexById(itemIdx, mgminfo->staticsId2);
+
+	clearMovements2(itemIdx);
+	recalcOffsets(itemIdx, subIdx, st2idx, 0, 1);
+	clearMovements2(itemIdx);
+	recalcOffsets(itemIdx, st1idx, subOffset, 0, 1);
+
+	v71 = (Message *)(28 * itemIdx);
+	v16 = items[itemIdx].objId;
 	v17 = *(_DWORD *)(v16 + offsetof(MGMItem, staticsListCount));
 	point.x = *(_DWORD *)(v16 + offsetof(MGMItem, subItems));
-	v18 = (MGMSubItem *)(point.x + 24 * (v14 + st2idx * v17));
+	v18 = (MGMSubItem *)(point.x + 24 * (subIdx + 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)
+	if (subIdx != st2idx && !x1)
 		return 0;
 
 	if (st1idx != subOffset && !v69)
@@ -1894,11 +1894,12 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
 	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;
+
+	mov->calcSomeXY(&point1, 0);
+	v26 = point1.x;
+	v56 = point1.x;
+	v27 = point1.y;
+	v58 = point1.y;
 
 	if (mgminfo->flags & 0x40) {
 		v62 = mgminfo->field_10;
@@ -1915,8 +1916,6 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
 		point1.y = v30;
 	}
 
-	v31 = mgminfo->flags;
-
 	if (!(mgminfo->flags & 2)) {
 		v32 = point3.x + mgminfo->x2;
 		a2 = -1;
@@ -1925,7 +1924,7 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
 		mgminfo->x1 = v28 * v26 + point2.x + v32;
 	}
 
-	if (!(v31 & 4)) {
+	if (!(mgminfo->flags & 4)) {
 		point1.y = v28 * v58;
 		v76 = v28 * v58;
 		v33 = mgminfo->y2;
@@ -1938,10 +1937,10 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
 	v57 = 0;
 
 	if (x1) {
-		v35 = countPhases(v12, subIdx, st2idx, 1);
+		v35 = countPhases(itemIdx, subIdx, st2idx, 1);
 		v34 = v35;
 		point.x = v35;
-		v57 = countPhases(v12, subIdx, st2idx, 2);
+		v57 = countPhases(itemIdx, subIdx, st2idx, 2);
 		v28 = v62;
 	}
 
@@ -1961,9 +1960,9 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
 	}
 
 	if (v69) {
-		v34 += countPhases(v12, st1idx, subOffset, 1);
+		v34 += countPhases(itemIdx, st1idx, subOffset, 1);
 		point.x = v34;
-		v57 += countPhases(v12, st1idx, subOffset, 2);
+		v57 += countPhases(itemIdx, st1idx, subOffset, 2);
 	}
 
 	v69 = v75 - point1.x;
@@ -1971,7 +1970,7 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
 	v70 = v76 - point1.y;
 
 	if (v34) {
-		x1 = (signed __int64)((double)v69 / (double)*(signed int *)&point);
+		x1 = (signed __int64)((double)v69 / (double)point.x);
 		v38 = v70;
 	} else {
 		x1 = 0;






More information about the Scummvm-git-logs mailing list