diff options
author | Eugene Sandulenko | 2014-01-04 22:16:53 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2014-01-05 00:53:30 +0200 |
commit | 8b78fb5642c3648c34d341edb868525beee040fe (patch) | |
tree | 09bc75005953e63f964b4f55077df078344ceb8d /engines | |
parent | 0cc0c404bf0d8c634f38268c1b022e99ab5d587a (diff) | |
download | scummvm-rg350-8b78fb5642c3648c34d341edb868525beee040fe.tar.gz scummvm-rg350-8b78fb5642c3648c34d341edb868525beee040fe.tar.bz2 scummvm-rg350-8b78fb5642c3648c34d341edb868525beee040fe.zip |
FULLPIPE: Implement MGM::buildExCommand2()
Diffstat (limited to 'engines')
-rw-r--r-- | engines/fullpipe/messages.cpp | 2 | ||||
-rw-r--r-- | engines/fullpipe/messages.h | 2 | ||||
-rw-r--r-- | engines/fullpipe/motion.cpp | 66 | ||||
-rw-r--r-- | engines/fullpipe/motion.h | 2 |
4 files changed, 58 insertions, 14 deletions
diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp index 68ec3dcd04..4665712ca0 100644 --- a/engines/fullpipe/messages.cpp +++ b/engines/fullpipe/messages.cpp @@ -145,7 +145,7 @@ void ExCommand::firef34() { } } -ExCommand2::ExCommand2(int messageKind, int parentId, const Common::Point **points, int pointsSize) : ExCommand(parentId, messageKind, 0, 0, 0, 0, 1, 0, 0, 0) { +ExCommand2::ExCommand2(int messageKind, int parentId, Common::Point **points, int pointsSize) : ExCommand(parentId, messageKind, 0, 0, 0, 0, 1, 0, 0, 0) { _objtype = kObjTypeExCommand2; _pointsSize = pointsSize; diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h index 04355b2f90..7f708383e3 100644 --- a/engines/fullpipe/messages.h +++ b/engines/fullpipe/messages.h @@ -85,7 +85,7 @@ class ExCommand2 : public ExCommand { Common::Point **_points; int _pointsSize; - ExCommand2(int messageKind, int parentId, const Common::Point **points, int pointsSize); + ExCommand2(int messageKind, int parentId, Common::Point **points, int pointsSize); ExCommand2(ExCommand2 *src); virtual ~ExCommand2(); diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 8e5e0c082f..b24790ced5 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -1464,18 +1464,18 @@ MessageQueue *MovGraph2::genMovement(MovInfo1 *info) { int v34 = dx1 - cntX * x1; int v35 = dy1 - cntY * y1; - int v72; - int x2; - int y2 = v34; + Common::Point x2; + Common::Point y2(v34, v35); if (v34) - x2 = v34 / abs(v34); + x2.x = v34 / abs(v34); else - x2 = 0; + x2.x = 0; + if (v35) - v72 = v35 / abs(v35); + x2.y = v35 / abs(v35); else - v72 = 0; + x2.y = 0; MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); ExCommand *ex; @@ -1906,12 +1906,56 @@ Common::Point *MGM::calcLength(Common::Point *point, Movement *mov, int x, int y return point; } -ExCommand2 *MGM::buildExCommand2(Movement *mov, int objId, int x1, int y1, int *x2, int *y2, int len) { - ExCommand2 *ex2 = new ExCommand2(20, objId, 0, 0); +ExCommand2 *MGM::buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len) { + uint cnt; + + if (mov->_currMovement) + cnt = mov->_currMovement->_dynamicPhases.size(); + else + cnt = mov->_dynamicPhases.size(); + + if (len > 0 && cnt > len) + cnt = len; + + Common::Point **points = (Common::Point **)malloc(sizeof(Common::Point *) * cnt); + + for (uint i = 0; i < cnt; i++) { + int flags = mov->getDynamicPhaseByIndex(i)->getDynFlags(); + + points[i] = new Common::Point; + + if (flags & 1) { + points[i]->x = x1 + x2->x; + + y2->x -= x2->x; + + if (!y2->x) + x2->x = 0; + } + + if (flags & 2) { + points[i]->y = y1 + x2->y; + + y2->y -= x2->y; + + if ( !y2->y ) + x2->y = 0; + } + } + + ExCommand2 *ex = new ExCommand2(20, objId, points, cnt); + ex->_excFlags = 2; + ex->_messageNum = mov->_id; + ex->_field_14 = len; + ex->_field_24 = 1; + ex->_keyCode = -1; + + for (int i = 0; i < cnt; i++) + delete points[i]; - warning("STUB: MGM::buildExCommand2()"); + free(points); - return ex2; + return ex; } MovGraphLink::MovGraphLink() { diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 2d39a276df..713cafd139 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -176,7 +176,7 @@ public: void clearMovements2(int idx); int recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop); Common::Point *calcLength(Common::Point *point, Movement *mov, int x, int y, int *x1, int *y1, int flag); - ExCommand2 *buildExCommand2(Movement *mov, int objId, int x1, int y1, int *x2, int *y2, int len); + ExCommand2 *buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len); }; struct MctlLadderMovementVars { |