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

sev- sev at scummvm.org
Sat Sep 28 15:05:19 CEST 2013


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:
b22c7d28f7 FULLPIPE: Implement MctlCompound::addObject()
dd7995958d FULLPIPE: Implement MovGraph2::addObject()
ac1be668d9 FULLPIPE: Implement MovGraph2::initDirections()


Commit: b22c7d28f7d757c56d998a2c5d286e3679ae9249
    https://github.com/scummvm/scummvm/commit/b22c7d28f7d757c56d998a2c5d286e3679ae9249
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2013-09-28T03:06:06-07:00

Commit Message:
FULLPIPE: Implement MctlCompound::addObject()

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



diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index 5def3cb..66664b1 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -76,10 +76,9 @@ bool MctlCompound::load(MfcArchive &file) {
 	return true;
 }
 
-int MctlCompound::addObject(StaticANIObject *obj) {
-	warning("STUB: MctlCompound::addObject()");
-
-	return 0;
+void MctlCompound::addObject(StaticANIObject *obj) {
+	for (uint i = 0; i < _motionControllers.size(); i++)
+		_motionControllers[i]->_motionControllerObj->addObject(obj);
 }
 
 int MctlCompound::removeObject(StaticANIObject *obj) {
@@ -167,10 +166,8 @@ bool MovGraph::load(MfcArchive &file) {
 	return true;
 }
 
-int MovGraph::addObject(StaticANIObject *obj) {
+void MovGraph::addObject(StaticANIObject *obj) {
 	warning("STUB: MovGraph::addObject()");
-
-	return 0;
 }
 
 int MovGraph::removeObject(StaticANIObject *obj) {
@@ -237,10 +234,8 @@ double MovGraph::calcDistance(Common::Point *point, MovGraphLink *link, int flag
 	return 0;
 }
 
-int MovGraph2::addObject(StaticANIObject *obj) {
+void MovGraph2::addObject(StaticANIObject *obj) {
 	warning("STUB: MovGraph2::addObject()");
-
-	return 0;
 }
 
 int MovGraph2::removeObject(StaticANIObject *obj) {
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index 3e76f24..0f91a99 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -42,7 +42,7 @@ public:
 	virtual void method10() {}
 	virtual void clearEnabled() { _isEnabled = false; }
 	virtual void setEnabled() { _isEnabled = true; }
-	virtual int addObject(StaticANIObject *obj) { return 0; }
+	virtual void addObject(StaticANIObject *obj) {}
 	virtual int removeObject(StaticANIObject *obj) { return 0; }
 	virtual void freeItems() {}
 	virtual int method28() { return 0; }
@@ -91,7 +91,7 @@ class MctlCompound : public MotionController {
 
 	virtual bool load(MfcArchive &file);
 
-	virtual int addObject(StaticANIObject *obj);
+	virtual void addObject(StaticANIObject *obj);
 	virtual int removeObject(StaticANIObject *obj);
 	virtual void freeItems();
 	virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int flag, int staticsId);
@@ -183,7 +183,7 @@ class MovGraph : public MotionController {
 	MovGraph();
 	virtual bool load(MfcArchive &file);
 
-	virtual int addObject(StaticANIObject *obj);
+	virtual void addObject(StaticANIObject *obj);
 	virtual int removeObject(StaticANIObject *obj);
 	virtual void freeItems();
 	virtual int method28();
@@ -204,7 +204,7 @@ public:
 	ObArray _items;
 
 public:
-	virtual int addObject(StaticANIObject *obj);
+	virtual void addObject(StaticANIObject *obj);
 	virtual int removeObject(StaticANIObject *obj);
 	virtual void freeItems();
 	virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int flag, int staticsId);


Commit: dd7995958dd5d1efd59f86c27384fd1b58dfa098
    https://github.com/scummvm/scummvm/commit/dd7995958dd5d1efd59f86c27384fd1b58dfa098
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2013-09-28T04:15:46-07:00

Commit Message:
FULLPIPE: Implement MovGraph2::addObject()

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



diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index 66664b1..d2ece50 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -27,6 +27,7 @@
 #include "common/list.h"
 
 #include "fullpipe/objects.h"
+#include "fullpipe/statics.h"
 #include "fullpipe/motion.h"
 #include "fullpipe/messages.h"
 #include "fullpipe/gameloader.h"
@@ -234,8 +235,37 @@ double MovGraph::calcDistance(Common::Point *point, MovGraphLink *link, int flag
 	return 0;
 }
 
+int MovGraph2::getItemIndexByGameObjectId(int objectId) {
+	for (uint i = 0; i < _items.size(); i++)
+		if (_items[i]->_objectId == objectId)
+			return i;
+
+	return -1;
+}
+
+bool MovGraph2::initDirections(StaticANIObject *obj, MovGraph2Item *item) {
+	warning("STUB: MovGraph2::initDirections()");
+
+	return false;
+}
+
 void MovGraph2::addObject(StaticANIObject *obj) {
-	warning("STUB: MovGraph2::addObject()");
+	MovGraph::addObject(obj);
+
+	int id = getItemIndexByGameObjectId(obj->_id);
+
+	if (id >= 0) {
+		_items[id]->_obj = obj;
+	} else {
+
+		MovGraph2Item *item = new MovGraph2Item;
+
+		if (initDirections(obj, item)) {
+			_items.push_back(item);
+		} else {
+			delete item;
+		}
+	}
 }
 
 int MovGraph2::removeObject(StaticANIObject *obj) {
@@ -266,7 +296,6 @@ MovGraphNode *MovGraph::calcOffset(int ox, int oy) {
 	return 0;
 }
 
-
 MovGraphLink::MovGraphLink() {
 	_distance = 0;
 	_angle = 0;
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index 0f91a99..7cc20e3 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -101,10 +101,11 @@ class MctlCompound : public MotionController {
 };
 
 class Unk2 : public CObject {
+public:
 	int _items;
 	int _count;
 
- public:
+public:
 	Unk2() : _items(0), _count(0) {}
 };
 
@@ -199,9 +200,32 @@ class MovGraph : public MotionController {
 	MovGraphNode *calcOffset(int ox, int oy);
 };
 
+class Movement;
+
+struct MG2I {
+	int _movementId;
+	Movement *_movement;
+	int _mx;
+	int _my;
+};
+
+struct MovGraph2ItemSub {
+	int _staticsId2;
+	int _staticsId1;
+	MG2I _field_8[3];
+	MG2I _field_38[4];
+	MG2I _field_78[4];
+};
+
+struct MovGraph2Item {
+	int _objectId;
+	StaticANIObject *_obj;
+	MovGraph2ItemSub _subItems[4];
+};
+
 class MovGraph2 : public MovGraph {
 public:
-	ObArray _items;
+	Common::Array<MovGraph2Item *> _items;
 
 public:
 	virtual void addObject(StaticANIObject *obj);
@@ -209,9 +233,13 @@ public:
 	virtual void freeItems();
 	virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int flag, int staticsId);
 	virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int flag, int staticsId);
+
+	int getItemIndexByGameObjectId(int objectId);
+	bool initDirections(StaticANIObject *obj, MovGraph2Item *item);
 };
 
 class MctlConnectionPoint : public CObject {
+public:
 	int _connectionX;
 	int _connectionY;
 	int _field_C;


Commit: ac1be668d93a2cd83d8f20ff3fb7f8541ec878d7
    https://github.com/scummvm/scummvm/commit/ac1be668d93a2cd83d8f20ff3fb7f8541ec878d7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2013-09-28T05:59:46-07:00

Commit Message:
FULLPIPE: Implement MovGraph2::initDirections()

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



diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index d2ece50..a7726f3 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -244,9 +244,132 @@ int MovGraph2::getItemIndexByGameObjectId(int objectId) {
 }
 
 bool MovGraph2::initDirections(StaticANIObject *obj, MovGraph2Item *item) {
-	warning("STUB: MovGraph2::initDirections()");
+	item->_obj = obj;
+	item->_objectId = obj->_id;
+
+	GameVar *var = g_fullpipe->getGameLoaderGameVar()->getSubVarByName(obj->_objectName);
+	if (!var)
+		return false;
+
+	var = var->getSubVarByName("Test_walk");
+
+	if (!var)
+		return false;
+
+	GameVar *varD = 0;
+	Common::Point point;
+
+	for (int dir = 0; dir < 4; dir++) {
+		switch (dir) {
+		case 0:
+			varD = var->getSubVarByName("Right");
+			break;
+		case 1:
+			varD = var->getSubVarByName("Left");
+			break;
+		case 2:
+			varD = var->getSubVarByName("Up");
+			break;
+		case 3:
+			varD = var->getSubVarByName("Down");
+			break;
+		}
+
+		if (!varD)
+			return false;
+
+		for (int act = 0; act < 3; act++) {
+			int idx;
+
+			switch(act) {
+			case 0:
+				idx = varD->getSubVarAsInt("Start");
+				break;
+			case 1:
+				idx = varD->getSubVarAsInt("Go");
+				break;
+			case 2:
+				idx = varD->getSubVarAsInt("Stop");
+				break;
+			}
+
+			item->_subItems[dir]._walk[act]._movementId = idx;
+
+			Movement *mov = obj->getMovementById(idx);
+
+			item->_subItems[dir]._walk[act]._mov = mov;
+			if (mov) {
+				mov->calcSomeXY(point, 0);
+				item->_subItems[dir]._walk[act]._mx = point.x;
+				item->_subItems[dir]._walk[act]._my = point.y;
+			}
+		}
 
-	return false;
+		for (int act = 0; act < 4; act++) {
+			int idx;
+
+			switch(act) {
+			case 0:
+				idx = varD->getSubVarAsInt("TurnR");
+				break;
+			case 1:
+				idx = varD->getSubVarAsInt("TurnL");
+				break;
+			case 2:
+				idx = varD->getSubVarAsInt("TurnU");
+				break;
+			case 3:
+				idx = varD->getSubVarAsInt("TurnD");
+				break;
+			}
+
+			item->_subItems[dir]._turn[act]._movementId = idx;
+
+			Movement *mov = obj->getMovementById(idx);
+
+			item->_subItems[dir]._turn[act]._mov = mov;
+			if (mov) {
+				mov->calcSomeXY(point, 0);
+				item->_subItems[dir]._turn[act]._mx = point.x;
+				item->_subItems[dir]._turn[act]._my = point.y;
+			}
+		}
+
+		for (int act = 0; act < 4; act++) {
+			int idx;
+
+			switch(act) {
+			case 0:
+				idx = varD->getSubVarAsInt("TurnSR");
+				break;
+			case 1:
+				idx = varD->getSubVarAsInt("TurnSL");
+				break;
+			case 2:
+				idx = varD->getSubVarAsInt("TurnSU");
+				break;
+			case 3:
+				idx = varD->getSubVarAsInt("TurnSD");
+				break;
+			}
+
+			item->_subItems[dir]._turnS[act]._movementId = idx;
+
+			Movement *mov = obj->getMovementById(idx);
+
+			item->_subItems[dir]._turnS[act]._mov = mov;
+			if (mov) {
+				mov->calcSomeXY(point, 0);
+				item->_subItems[dir]._turnS[act]._mx = point.x;
+				item->_subItems[dir]._turnS[act]._my = point.y;
+			}
+		}
+
+		item->_subItems[dir]._staticsId1 = item->_subItems[dir]._walk[0]._mov->_staticsObj1->_staticsId;
+		item->_subItems[dir]._staticsId2 = item->_subItems[dir]._walk[0]._mov->_staticsObj2->_staticsId;
+
+	}
+	return true;
 }
 
 void MovGraph2::addObject(StaticANIObject *obj) {
@@ -257,7 +380,6 @@ void MovGraph2::addObject(StaticANIObject *obj) {
 	if (id >= 0) {
 		_items[id]->_obj = obj;
 	} else {
-
 		MovGraph2Item *item = new MovGraph2Item;
 
 		if (initDirections(obj, item)) {
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index 7cc20e3..99d8d3e 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -204,7 +204,7 @@ class Movement;
 
 struct MG2I {
 	int _movementId;
-	Movement *_movement;
+	Movement *_mov;
 	int _mx;
 	int _my;
 };
@@ -212,9 +212,9 @@ struct MG2I {
 struct MovGraph2ItemSub {
 	int _staticsId2;
 	int _staticsId1;
-	MG2I _field_8[3];
-	MG2I _field_38[4];
-	MG2I _field_78[4];
+	MG2I _walk[3];
+	MG2I _turn[4];
+	MG2I _turnS[4];
 };
 
 struct MovGraph2Item {
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index e33eb11..a780539 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -1245,6 +1245,12 @@ Common::Point *Movement::getCurrDynamicPhaseXY(Common::Point &p) {
 	return &p;
 }
 
+Common::Point *Movement::calcSomeXY(Common::Point &p, int idx) {
+	warning("STUB: Movement::calcSomeXY()");
+
+	return &p;
+}
+
 void Movement::setAlpha(int alpha) {
 	if (_currMovement)
 		for (uint i = 0; i < _currMovement->_dynamicPhases.size(); i++) {
diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h
index 1767a57..2879edd 100644
--- a/engines/fullpipe/statics.h
+++ b/engines/fullpipe/statics.h
@@ -140,6 +140,8 @@ class Movement : public GameObject {
 	Common::Point *getCenter(Common::Point *p);
 	Common::Point *getDimensionsOfPhase(Common::Point *p, int phaseIndex);
 
+	Common::Point *calcSomeXY(Common::Point &p, int idx);
+
 	void initStatics(StaticANIObject *ani);
 	void updateCurrDynamicPhase();
 






More information about the Scummvm-git-logs mailing list