diff options
-rw-r--r-- | engines/fullpipe/motion.cpp | 34 | ||||
-rw-r--r-- | engines/fullpipe/motion.h | 3 |
2 files changed, 36 insertions, 1 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 45ff4ae5f0..8c924e7816 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -47,7 +47,39 @@ void MotionController::enableLinks(const char *linkName, bool enable) { } MovGraphLink *MotionController::getLinkByName(const char *name) { - warning("STUB: MotionController::getLinkByName()"); + if (_objtype == kObjTypeMctlCompound) { + MctlCompound *obj = (MctlCompound *)this; + + for (uint i = 0; i < obj->getMotionControllerCount(); i++) { + MotionController *con = obj->getMotionController(i); + + if (con->_objtype == kObjTypeMovGraph) { + MovGraph *gr = (MovGraph *)con; + + for (ObList::iterator l = gr->_links.begin(); l != gr->_links.end(); ++l) { + assert(((CObject *)*l)->_objtype == kObjTypeMovGraphLink); + + MovGraphLink *lnk = (MovGraphLink *)*l; + + if (!strcmp(lnk->_name, name)) + return lnk; + } + } + } + } + + if (_objtype == kObjTypeMovGraph) { + MovGraph *gr = (MovGraph *)this; + + for (ObList::iterator l = gr->_links.begin(); l != gr->_links.end(); ++l) { + assert(((CObject *)*l)->_objtype == kObjTypeMovGraphLink); + + MovGraphLink *lnk = (MovGraphLink *)*l; + + if (!strcmp(lnk->_name, name)) + return lnk; + } + } return 0; } diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 24f047d76b..1f1e7a733a 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -115,6 +115,9 @@ public: void initMovGraph2(); MctlConnectionPoint *findClosestConnectionPoint(int ox, int oy, int destIndex, int connectionX, int connectionY, int sourceIndex, int *minDistancePtr); void replaceNodeX(int from, int to); + + uint getMotionControllerCount() { return _motionControllers.size(); } + MotionController *getMotionController(int num) { return _motionControllers[num]->_motionControllerObj; } }; struct MGMSubItem { |