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

sev- sev at scummvm.org
Tue Sep 17 22:03:03 CEST 2013


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

Summary:
eeac2c0c4f FULLPIPE: Implement CMovGraph_messageHandler()


Commit: eeac2c0c4ff986071cbe097f7c063b906b926806
    https://github.com/scummvm/scummvm/commit/eeac2c0c4ff986071cbe097f7c063b906b926806
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2013-09-17T13:00:58-07:00

Commit Message:
FULLPIPE: Implement CMovGraph_messageHandler()

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



diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index 514dde5..1d46f79 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -28,6 +28,7 @@
 
 #include "fullpipe/objects.h"
 #include "fullpipe/motion.h"
+#include "fullpipe/messages.h"
 
 namespace Fullpipe {
 
@@ -104,13 +105,17 @@ bool CMctlCompoundArray::load(MfcArchive &file) {
 	return true;
 }
 
+int CMovGraph_messageHandler(ExCommand *cmd);
+
 CMovGraph::CMovGraph() {
 	warning("STUB: CMovGraph::CMovGraph()");
 	_itemsCount = 0;
 	_items = 0;
 	//_callback1 = CMovGraphCallback1;  // TODO
 	_field_44 = 0;
-	// insertMessageHandler(CMovGraph_messageHandler, getMessageHandlersCount() - 1, 129);
+	insertMessageHandler(CMovGraph_messageHandler, getMessageHandlersCount() - 1, 129);
+
+	_objtype = kObjTypeMovGraph;
 }
 
 bool CMovGraph::load(MfcArchive &file) {
@@ -126,6 +131,19 @@ void CMovGraph::addObject(StaticANIObject *obj) {
 	warning("STUB: CMovGraph::addObject()");
 }
 
+double CMovGraph::calcDistance(Common::Point *point, CMovGraphLink *link, int flag) {
+	warning("STUB: CMovGraph::calcDistance()");
+
+	return 0;
+}
+
+CMovGraphNode *CMovGraph::calcOffset(int ox, int oy) {
+	warning("STUB: CMovGraph::calcOffset()");
+
+	return 0;
+}
+
+
 CMovGraphLink::CMovGraphLink() {
 	_distance = 0;
 	_angle = 0;
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index 85a5291..7973984 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -77,6 +77,7 @@ class Unk2 : public CObject {
 };
 
 class CMovGraphNode : public CObject {
+ public:
 	int _x;
 	int _y;
 	int _distance;
@@ -137,6 +138,7 @@ class CReactPolygonal : public CMovGraphReact {
 };
 
 class CMovGraphLink : public CObject {
+ public:
 	CMovGraphNode *_movGraphNode1;
 	CMovGraphNode *_movGraphNode2;
 	CDWordArray _dwordArray1;
@@ -155,6 +157,7 @@ class CMovGraphLink : public CObject {
 };
 
 class CMovGraph : public CMotionController {
+ public:
 	CObList _nodes;
 	CObList _links;
 	int _field_44;
@@ -168,6 +171,9 @@ class CMovGraph : public CMotionController {
 	virtual bool load(MfcArchive &file);
 
 	virtual void addObject(StaticANIObject *obj);
+
+	double calcDistance(Common::Point *point, CMovGraphLink *link, int flag);
+	CMovGraphNode *calcOffset(int ox, int oy);
 };
 
 class CMctlConnectionPoint : public CObject {
diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp
index c9cdc0a..7aec865 100644
--- a/engines/fullpipe/scenes.cpp
+++ b/engines/fullpipe/scenes.cpp
@@ -1313,6 +1313,63 @@ int global_messageHandler4(ExCommand *cmd) {
 	return 1;
 }
 
+int CMovGraph_messageHandler(ExCommand *cmd) {
+	if (cmd->_messageKind != 17)
+		return 0;
+
+	if (cmd->_messageNum != 33)
+		return 0;
+
+	StaticANIObject *ani = g_fullpipe->_currentScene->getStaticANIObject1ById(g_fullpipe->_gameLoader->_field_FA, -1);
+
+	if (!getSc2MctlCompoundBySceneId(g_fullpipe->_currentScene->_sceneId))
+		return 0;
+
+	if (getSc2MctlCompoundBySceneId(g_fullpipe->_currentScene->_sceneId)->_objtype != kObjTypeMovGraph || !ani)
+		return 0;
+
+	CMovGraph *gr = (CMovGraph *)getSc2MctlCompoundBySceneId(g_fullpipe->_currentScene->_sceneId);
+
+	CMovGraphLink *link = 0;
+	double mindistance = 1.0e10;
+	Common::Point point;
+
+	for (CObList::iterator i = gr->_links.begin(); i != gr->_links.end(); ++i) {
+		point.x = ani->_ox;
+		point.y = ani->_oy;
+
+		double dst = gr->calcDistance(&point, (CMovGraphLink *)(*i), 0);
+		if (dst >= 0.0 && dst < mindistance) {
+			mindistance = dst;
+			link = (CMovGraphLink *)(*i);
+		}
+	}
+
+	int top;
+
+	if (link) {
+		CMovGraphNode *node = link->_movGraphNode1;
+
+		double sq = (ani->_oy - node->_y) * (ani->_oy - node->_y) + (ani->_ox - node->_x) * (ani->_ox - node->_x);
+		int off = (node->_field_14 >> 16) & 0xFF;
+		double off2 = (link->_movGraphNode2->_field_14 >> 8) & 0xff - off;
+
+		top = off + (int)(sqrt(sq) * off2 / link->_distance);
+	} else {
+		top = (gr->calcOffset(ani->_ox, ani->_oy)->_field_14 >> 8) & 0xff;
+	}
+
+	if (ani->_movement) {
+		ani->_movement->_currDynamicPhase->_rect->top = 255 - top;
+		return 0;
+	}
+
+	if (ani->_statics)
+		ani->_statics->_rect->top = 255 - top;
+
+	return 0;
+}
+
 int defaultUpdateCursor() {
 	g_fullpipe->updateCursorsCommon();
 
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp
index ee73aea..2ba5a85 100644
--- a/engines/fullpipe/utils.cpp
+++ b/engines/fullpipe/utils.cpp
@@ -396,6 +396,8 @@ CObject *MfcArchive::parseClass(bool *isCopyReturned) {
 		if (_objectMap.size() < obTag) {
 			error("Object index too big: %d  at 0x%08x", obTag, pos() - 2);
 		}
+		debug(7, "parseClass::obTag <%s>", lookupObjectId(_objectIdMap[obTag]));
+
 		res = _objectMap[obTag];
 
 		*isCopyReturned = true;
diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h
index 76a1ae9..2199706 100644
--- a/engines/fullpipe/utils.h
+++ b/engines/fullpipe/utils.h
@@ -68,7 +68,8 @@ enum ObjType {
 	kObjTypeDefault,
 	kObjTypeObjstateCommand,
 	kObjTypeStaticANIObject,
-	kObjTypePictureObject
+	kObjTypePictureObject,
+	kObjTypeMovGraph
 };
 
 class CObject {






More information about the Scummvm-git-logs mailing list