diff options
author | Eugene Sandulenko | 2013-12-15 14:20:13 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2013-12-15 14:59:31 +0200 |
commit | 5751f4c1103305465dc3ffaf38a1094724a23be7 (patch) | |
tree | 97fcf46722af741f381095522b145451129d64d9 /engines/fullpipe | |
parent | 7cb658f15245140cdefe42727540ec03251b3d29 (diff) | |
download | scummvm-rg350-5751f4c1103305465dc3ffaf38a1094724a23be7.tar.gz scummvm-rg350-5751f4c1103305465dc3ffaf38a1094724a23be7.tar.bz2 scummvm-rg350-5751f4c1103305465dc3ffaf38a1094724a23be7.zip |
FULLPIPE: Implement MGM::getPoint()
Diffstat (limited to 'engines/fullpipe')
-rw-r--r-- | engines/fullpipe/motion.cpp | 58 | ||||
-rw-r--r-- | engines/fullpipe/motion.h | 5 |
2 files changed, 60 insertions, 3 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 693efcb36e..16ac82be9e 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -1576,12 +1576,66 @@ void MGM::updateAnimStatics(StaticANIObject *ani, int staticsId) { } } -Common::Point *MGM::getPoint(Common::Point *point, int aniId, int staticsId1, int staticsId2) { - warning("STUB: MGM::getPoint()"); +Common::Point *MGM::getPoint(Common::Point *point, int objectId, int staticsId1, int staticsId2) { + int idx = getItemIndexById(objectId); + + if (idx == -1) { + point->x = -1; + point->y = -1; + } else { + int st1idx = getStaticsIndexById(idx, staticsId1); + int st2idx = getStaticsIndexById(idx, staticsId2); + + if (st1idx == st2idx) { + point->x = 0; + point->y = 0; + } else { + int subidx = st1idx + st2idx * _items[idx]->statics.size(); + + if (!_items[idx]->subItems[subidx]->movement) { + clearMovements2(idx); + recalcOffsets(idx, st1idx, st2idx, false, true); + + if (!_items[idx]->subItems[subidx]->movement) { + clearMovements2(idx); + recalcOffsets(idx, st1idx, st2idx, true, false); + } + } + + MGMSubItem *sub = _items[idx]->subItems[subidx]; + + if (sub->movement) { + point->x = sub->x; + point->y = sub->y; + } else { + point->x = 0; + point->y = 0; + } + } + } return point; } +int MGM::getStaticsIndexById(int idx, int16 id) { + for (uint i = 0; i < _items[idx]->statics.size(); i++) { + if (_items[idx]->statics[i]->_staticsId == id) + return i; + } + + return 0; +} + +void MGM::clearMovements2(int idx) { + _items[idx]->movements2.clear(); +} + +int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) { + warning("STUB: MGM::recalcOffsets()"); + + return 0; +} + MovGraphLink::MovGraphLink() { _distance = 0; _angle = 0; diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index c54ba7147b..e5b592876e 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -113,7 +113,7 @@ public: }; struct MGMSubItem { - int movement; + Movement *movement; int staticsIndex; int field_8; int field_C; @@ -162,6 +162,9 @@ public: MessageQueue *genMovement(MGMInfo *mgminfo); void updateAnimStatics(StaticANIObject *ani, int staticsId); Common::Point *getPoint(Common::Point *point, int aniId, int staticsId1, int staticsId2); + int getStaticsIndexById(int idx, int16 id); + void clearMovements2(int idx); + int recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop); }; struct MctlLadderMovementVars { |