aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/fullpipe/messages.cpp13
-rw-r--r--engines/fullpipe/messages.h1
-rw-r--r--engines/fullpipe/motion.cpp130
-rw-r--r--engines/fullpipe/motion.h27
4 files changed, 103 insertions, 68 deletions
diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp
index cad1934c5f..4abf2ef56f 100644
--- a/engines/fullpipe/messages.cpp
+++ b/engines/fullpipe/messages.cpp
@@ -201,6 +201,19 @@ MessageQueue::MessageQueue() {
_flag1 = 0;
}
+MessageQueue::MessageQueue(int dataId) {
+ _field_14 = 0;
+ _parId = 0;
+ _dataId = dataId;
+ _id = g_fullpipe->_globalMessageQueueList->compact();
+ _isFinished = 0;
+ _flags = 0;
+ _queueName = 0;
+ _counter = 0;
+ _field_38 = 0;
+ _flag1 = 0;
+}
+
MessageQueue::MessageQueue(MessageQueue *src, int parId, int field_38) {
_counter = 0;
_field_38 = (field_38 == 0);
diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h
index 3e0da292d5..326f05cef3 100644
--- a/engines/fullpipe/messages.h
+++ b/engines/fullpipe/messages.h
@@ -109,6 +109,7 @@ class MessageQueue : public CObject {
public:
MessageQueue();
+ MessageQueue(int dataId);
MessageQueue(MessageQueue *src, int parId, int field_38);
virtual ~MessageQueue();
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;
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index 58c7f9cc73..bab0ffc8ca 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -78,7 +78,7 @@ public:
class MctlCompoundArrayItem : public CObject {
friend class MctlCompound;
- protected:
+protected:
MotionController *_motionControllerObj;
MovGraphReact *_movGraphReactObj;
Common::Array<MctlConnectionPoint *> _connectionPoints;
@@ -86,7 +86,7 @@ class MctlCompoundArrayItem : public CObject {
int _field_24;
int _field_28;
- public:
+public:
MctlCompoundArrayItem() : _movGraphReactObj(0), _motionControllerObj(0), _field_20(0), _field_24(0), _field_28(0) {}
};
@@ -134,6 +134,19 @@ struct MGMItem {
MGMItem();
};
+struct MGMInfo {
+ StaticANIObject *ani;
+ int staticsId1;
+ int staticsId2;
+ int movementId;
+ int field_10;
+ int x1;
+ int y1;
+ int field_1C;
+ int x2;
+ int y2;
+ int flags;
+};
class MGM : public CObject {
public:
@@ -144,6 +157,8 @@ public:
void addItem(int objId);
void rebuildTables(int objId);
int getItemIndexById(int objId);
+
+ MessageQueue *genMovement(MGMInfo *mgminfo);
};
class MovGraphNode : public CObject {
@@ -232,7 +247,7 @@ struct MovGraphItem {
};
class MovGraph : public MotionController {
- public:
+public:
ObList _nodes;
ObList _links;
int _field_44;
@@ -240,7 +255,7 @@ class MovGraph : public MotionController {
int (*_callback1)(int, int, int);
MGM _mgm;
- public:
+public:
MovGraph();
virtual bool load(MfcArchive &file);
@@ -303,7 +318,7 @@ struct MovInfo1 {
int flags;
};
- struct MovGraph2Item { // 744
+struct MovGraph2Item { // 744
int _objectId;
StaticANIObject *_obj;
MovGraph2ItemSub _subItems[4]; // 184
@@ -336,6 +351,8 @@ public:
MovGraphLink *findLink1(int x, int y, int idx, int fuzzyMatch);
MovGraphLink *findLink2(int x, int y);
double findMinPath(LinkInfo *linkInfoSource, LinkInfo *linkInfoDest, Common::Array<MovGraphLink *> *listObj);
+
+ MessageQueue *genMovement(MovInfo1 *movinfo);
};
class MctlConnectionPoint : public CObject {