[Scummvm-cvs-logs] scummvm master -> fc107e000594bd4fc6a321f9c0bfb927297977e8

sev- sev at scummvm.org
Mon Nov 18 01:40:47 CET 2013


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

Summary:
4e4a4bb005 FULLPIPE: Get rid of ambiguity in MovGraph2 class
fc107e0005 FULLPIPE: Complete implementation of MovGraph2::buildMovInfo1MessageQueue()


Commit: 4e4a4bb005dd284d235a54a763727b1a2e061c8e
    https://github.com/scummvm/scummvm/commit/4e4a4bb005dd284d235a54a763727b1a2e061c8e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2013-11-17T16:40:20-08:00

Commit Message:
FULLPIPE: Get rid of ambiguity in MovGraph2 class

Changed paths:
    engines/fullpipe/motion.cpp
    engines/fullpipe/motion.h



diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index 2d23470..02a226d 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -371,8 +371,8 @@ void MovGraph::calcNodeDistancesAndAngles() {
 }
 
 int MovGraph2::getItemIndexByGameObjectId(int objectId) {
-	for (uint i = 0; i < _items.size(); i++)
-		if (_items[i]->_objectId == objectId)
+	for (uint i = 0; i < _items2.size(); i++)
+		if (_items2[i]->_objectId == objectId)
 			return i;
 
 	return -1;
@@ -380,7 +380,7 @@ int MovGraph2::getItemIndexByGameObjectId(int objectId) {
 
 int MovGraph2::getItemSubIndexByStaticsId(int idx, int staticsId) {
 	for (int i = 0; i < 4; i++)
-		if (_items[idx]->_subItems[i]._staticsId1 == staticsId || _items[idx]->_subItems[i]._staticsId2 == staticsId)
+		if (_items2[idx]->_subItems[i]._staticsId1 == staticsId || _items2[idx]->_subItems[i]._staticsId2 == staticsId)
 			return i;
 
 	return -1;
@@ -388,8 +388,8 @@ int MovGraph2::getItemSubIndexByStaticsId(int idx, int staticsId) {
 
 int MovGraph2::getItemSubIndexByMovementId(int idx, int movId) {
 	for (int i = 0; i < 4; i++)
-		if (_items[idx]->_subItems[i]._walk[0]._movementId == movId || _items[idx]->_subItems[i]._turn[0]._movementId == movId ||
-			_items[idx]->_subItems[i]._turnS[0]._movementId == movId)
+		if (_items2[idx]->_subItems[i]._walk[0]._movementId == movId || _items2[idx]->_subItems[i]._turn[0]._movementId == movId ||
+			_items2[idx]->_subItems[i]._turnS[0]._movementId == movId)
 			return i;
 
 	return -1;
@@ -536,12 +536,12 @@ void MovGraph2::addObject(StaticANIObject *obj) {
 	int id = getItemIndexByGameObjectId(obj->_id);
 
 	if (id >= 0) {
-		_items[id]->_obj = obj;
+		_items2[id]->_obj = obj;
 	} else {
 		MovGraph2Item *item = new MovGraph2Item;
 
 		if (initDirections(obj, item)) {
-			_items.push_back(item);
+			_items2.push_back(item);
 		} else {
 			delete item;
 		}
@@ -672,14 +672,14 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) {
 	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[1] + 16 * (movInfo->items[i + 1].subIndex + 8);
+				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);
 
 				v15 = &_items[movInfo->field_0]->_subItems[movInfo->items[i].subIndex]
 			} else {
-				v12 = (char *)_items[1] + 16 * (movInfo->items[i + 1].subIndex + 4);
+				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);
@@ -889,7 +889,7 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int
 
 		if (subMgm) {
 			obj->_messageQueueId = 0;
-			obj->changeStatics2(_items[idx]->_subItems[idxsub]._staticsId1);
+			obj->changeStatics2(_items2[idx]->_subItems[idxsub]._staticsId1);
 			newx = obj->_ox;
 			newy = obj->_oy;
 		} else {
@@ -924,7 +924,7 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int
 				return 0;
 			}
 
-			ExCommand *ex = new ExCommand(picAniInfo.objectId, 1, _items[idx]->_subItems[idxsub]._walk[idxwalk]._movementId, 0, 0, 0, 1, 0, 0, 0);
+			ExCommand *ex = new ExCommand(picAniInfo.objectId, 1, _items2[idx]->_subItems[idxsub]._walk[idxwalk]._movementId, 0, 0, 0, 1, 0, 0, 0);
 
 			ex->_field_24 = 1;
 			ex->_keyCode = picAniInfo.field_8;
@@ -1039,7 +1039,7 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int
 
 	movInfo1.flags = fuzzyMatch != 0;
 
-	if (_items[idx]->_subItems[idxsub]._staticsId1 != obj->_statics->_staticsId)
+	if (_items2[idx]->_subItems[idxsub]._staticsId1 != obj->_statics->_staticsId)
 		movInfo1.flags |= 2;
 
 	buildMovInfo1SubItems(&movInfo1, &tempLinkList, &linkInfoSource, &linkInfoDest);
@@ -1066,7 +1066,7 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int
 				ex->_excFlags |= 2;
 				mq->addExCommand(ex);
 
-				ex = new ExCommand(picAniInfo.objectId, 22, _items[idx]->_subItems[idxsub]._staticsId1, 0, 0, 0, 1, 0, 0, 0);
+				ex = new ExCommand(picAniInfo.objectId, 22, _items2[idx]->_subItems[idxsub]._staticsId1, 0, 0, 0, 1, 0, 0, 0);
 
 				ex->_keyCode = picAniInfo.field_8;
 				ex->_excFlags |= 3;
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index 746c5c6..58c7f9c 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -311,7 +311,7 @@ struct MovInfo1 {
 
 class MovGraph2 : public MovGraph {
 public:
-	Common::Array<MovGraph2Item *> _items;
+	Common::Array<MovGraph2Item *> _items2;
 
 public:
 	virtual void addObject(StaticANIObject *obj);


Commit: fc107e000594bd4fc6a321f9c0bfb927297977e8
    https://github.com/scummvm/scummvm/commit/fc107e000594bd4fc6a321f9c0bfb927297977e8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2013-11-17T16:40:20-08:00

Commit Message:
FULLPIPE: Complete implementation of MovGraph2::buildMovInfo1MessageQueue()

Changed paths:
    engines/fullpipe/messages.cpp
    engines/fullpipe/messages.h
    engines/fullpipe/motion.cpp
    engines/fullpipe/motion.h



diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp
index cad1934..4abf2ef 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 3e0da29..326f05c 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 02a226d..c1977c0 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 58c7f9c..bab0ffc 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 {






More information about the Scummvm-git-logs mailing list