diff options
author | Eugene Sandulenko | 2013-10-17 22:44:30 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2013-10-17 23:19:28 +0300 |
commit | 2f1387bb26ffdc3bb7dd0066e7023c2818cb77dd (patch) | |
tree | 1df4067931ea86a86785e373de820dcacf06ba9c /engines/fullpipe/motion.cpp | |
parent | c7ca276e101914066e972920229538747fa77298 (diff) | |
download | scummvm-rg350-2f1387bb26ffdc3bb7dd0066e7023c2818cb77dd.tar.gz scummvm-rg350-2f1387bb26ffdc3bb7dd0066e7023c2818cb77dd.tar.bz2 scummvm-rg350-2f1387bb26ffdc3bb7dd0066e7023c2818cb77dd.zip |
FULLPIPE: Implement MovGraph2::findLink1()
Diffstat (limited to 'engines/fullpipe/motion.cpp')
-rw-r--r-- | engines/fullpipe/motion.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 0c0db322f8..da6a82ffeb 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -685,6 +685,7 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int if (!linkInfoDest.node) { linkInfoDest.link = findLink1(xpos, ypos, idxsub, fuzzyMatch); + if (!linkInfoDest.link) { obj->setPicAniInfo(&picAniInfo); @@ -826,9 +827,37 @@ int MovGraph2::findLink(Common::Array<MovGraphLink *> *linkList, MovGraphLink *l } MovGraphLink *MovGraph2::findLink1(int x, int y, int idx, int fuzzyMatch) { - warning("STUB: MovGraphLink *MovGraph2::findLink1()"); + Common::Point point; + MovGraphLink *res = 0; - return 0; + for (ObList::iterator i = _links.begin(); i != _links.end(); ++i) { + assert(((CObject *)*i)->_objtype == kObjTypeMovGraphLink); + + MovGraphLink *lnk = (MovGraphLink *)*i; + + if (fuzzyMatch) { + point.x = x; + point.y = y; + double dst = calcDistance(&point, lnk, 0); + + if (dst >= 0.0 && dst < 2.0) + return lnk; + } else if (!(lnk->_flags & 0x20000000)) { + if (lnk->_movGraphReact->pointInRegion(x, y)) { + if (abs(lnk->_movGraphNode1->_x - lnk->_movGraphNode2->_x) <= abs(lnk->_movGraphNode1->_y - lnk->_movGraphNode2->_y)) { + if (idx == 2 || idx == 3) + return lnk; + res = lnk; + } else { + if (idx == 1 || !idx) + return lnk; + res = lnk; + } + } + } + } + + return res; } MovGraphLink *MovGraph2::findLink2(int x, int y) { @@ -919,6 +948,8 @@ MovGraphLink::MovGraphLink() { _field_38 = 0; _movGraphReact = 0; _name = 0; + + _objtype = kObjTypeMovGraphLink; } bool MovGraphLink::load(MfcArchive &file) { |