From 7a27be396350309b9a23b587d0a566603370e27a Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 6 May 2014 07:10:50 +0300 Subject: FULLPIPE: Implement MovGraph::shuffleTree() --- engines/fullpipe/motion.cpp | 29 +++++++++++++++++++++++++++++ engines/fullpipe/motion.h | 1 + 2 files changed, 30 insertions(+) (limited to 'engines') diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index a4c5b0ba64..91950baa4a 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -818,6 +818,35 @@ Common::Array *MovGraph::genMovArr(int x, int y, int *arrSize, int fla return arr; } +void MovGraph::shuffleTree(MovGraphLink *lnk, MovGraphLink *lnk2, Common::Array &tempObList1, Common::Array &tempObList2) { + if (lnk == lnk2) { + for (uint i = 0; i < tempObList1.size(); i++) + tempObList2.push_back(tempObList1[i]); + + tempObList2.push_back(lnk); + } else { + lnk->_flags |= 0x80000000; + + tempObList1.push_back(lnk); + + for (ObList::iterator i = _links.begin(); i != _links.end(); ++i) { + MovGraphLink *l = (MovGraphLink *)*i; + + if (l->_movGraphNode1 != lnk->_movGraphNode1) { + if (l->_movGraphNode2 != lnk->_movGraphNode1) { + if (l->_movGraphNode1 != lnk->_movGraphNode2 && l->_movGraphNode2 != lnk->_movGraphNode2) + continue; + } + } + + if (!(l->_flags & 0xA0000000)) + shuffleTree(l, lnk2, tempObList1, tempObList2); + } + + lnk->_flags &= 0x7FFFFFFF; + } +} + int MovGraph2::getItemIndexByGameObjectId(int objectId) { for (uint i = 0; i < _items2.size(); i++) if (_items2[i]->_objectId == objectId) diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 13d96ae551..e00447b335 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -363,6 +363,7 @@ public: MovGraphNode *calcOffset(int ox, int oy); int getItemIndexByStaticAni(StaticANIObject *ani); Common::Array *genMovArr(int x, int y, int *arrSize, int flag1, int flag2); + void shuffleTree(MovGraphLink *lnk, MovGraphLink *lnk2, Common::Array &tempObList1, Common::Array &tempObList2); }; class Movement; -- cgit v1.2.3