From 7c017cfdb924ade0faa8b01faf9580a7c444d4df Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 7 Jun 2014 10:13:13 +0300 Subject: FULLPIPE: Implement MovGraph2::getItemSubIndexByMGM() --- engines/fullpipe/motion.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'engines/fullpipe/motion.cpp') diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index adfc2f7326..85069262f8 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -816,6 +816,7 @@ void MovGraph::freeItems() { _items.clear(); } + Common::Array *MovGraph::method28(StaticANIObject *ani, int x, int y, int flag1, int *rescount) { *rescount = 0; @@ -1629,8 +1630,22 @@ int MovGraph2::getItemSubIndexByMovementId(int idx, int movId) { return -1; } -int MovGraph2::getItemSubIndexByMGM(int idx, StaticANIObject *ani) { - warning("STUB: MovGraph2::getItemSubIndexByMGM()"); +int MovGraph2::getItemSubIndexByMGM(int index, StaticANIObject *ani) { + if (findNode(ani->_ox, ani->_oy, 0) || findLink1(ani->_ox, ani->_oy, -1, 0) || findLink2(ani->_ox, ani->_oy)) { + int minidx = -1; + int min = 0; + + for (int i = 0; i < 4; i++) { + int tmp = _mgm.refreshOffsets(ani->_id, ani->_statics->_staticsId, _items2[index]->_subItems[i]._staticsId1); + + if (tmp >= 0 && (minidx == -1 || tmp < min)) { + minidx = i; + min = tmp; + } + } + + return minidx; + } return -1; } -- cgit v1.2.3