diff options
-rw-r--r-- | engines/fullpipe/motion.cpp | 67 | ||||
-rw-r--r-- | engines/fullpipe/motion.h | 13 |
2 files changed, 78 insertions, 2 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 6a39b9f7b5..c86f956508 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -486,6 +486,15 @@ MGMItem::MGMItem() { objId = 0; } +MGMSubItem::MGMSubItem() { + movement = 0; + staticsIndex = 0; + field_8 = 0; + field_C = 0; + x = 0; + y = 0; +} + void MGM::addItem(int objId) { if (getItemIndexById(objId) == -1) { MGMItem *item = new MGMItem(); @@ -497,7 +506,63 @@ void MGM::addItem(int objId) { } void MGM::rebuildTables(int objId) { - warning("STUB: MGM:rebuildTables()"); + int idx = getItemIndexById(objId); + + if (idx == -1) + return; + + _items[idx]->subItems.clear(); + _items[idx]->statics.clear(); + _items[idx]->movements1.clear(); + _items[idx]->movements2.clear(); + + StaticANIObject *obj = g_fullpipe->_currentScene->getStaticANIObject1ById(objId, -1); + + if (!obj) + return; + +#if 0 + this_->items[idx].staticsListCount = obj->staticsList.m_nCount; + this_->items[idx].movementListCount = obj->movements.m_nCount; + this_->items[idx].statics = (Statics *)operator new(4 * this_->items[idx].staticsListCount); + this_->items[idx].movements1 = (Movement *)operator new(4 * this_->items[idx].movementListCount); + this_->items[idx].movements2 = (Movement *)operator new(4 * this_->items[idx].movementListCount); + v10 = this_->items; + v11 = v10[idx].movements2; + v12 = 4 * LOBYTE(v10[idx].movementListCount); + v13 = (unsigned int)(4 * v10[idx].movementListCount) >> 2; + memset(v11, 0, 4 * v13); + v14 = (char *)v11 + 4 * v13; + LOBYTE(v13) = v12; + v15 = 0; + memset(v14, 0, v13 & 3); + v16 = obj->staticsList.m_pNodeHead; + v17 = &this_->items[idx]; + if (v17->staticsListCount > 0) { + do { + v18 = v16; + v16 = v16->pNext; + ++v15; + *((_DWORD *)&v17->statics[-1].picture + v15) = v18->data; + v17 = &this_->items[idx]; + } while (v15 < v17->staticsListCount); + } + v19 = obj->movements.m_pNodeHead; + v20 = &this_->items[idx]; + for (i = 0; i < v20->movementListCount; v20 = &this_->items[idx]) { + v22 = v19; + v19 = v19->pNext; + ++i; + *(&v20->movements1[-1].field_94 + i) = (int)v22->data; + } + this_->items[idx].staticsListCount = obj->staticsList.m_nCount; + this_->items[idx].subItems = (MGMSubItem *)operator new(0x18 * this_->items[idx].staticsListCount + * this_->items[idx].staticsListCount); + memset( + this_->items[idx].subItems, + 0, + 24 * this_->items[idx].staticsListCount * this_->items[idx].staticsListCount); +#endif } int MGM::getItemIndexById(int objId) { diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index bf0b1bedd4..a5bbfbe075 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -103,9 +103,20 @@ class MctlCompound : public MotionController { void initMovGraph2(); }; +struct MGMSubItem { + int movement; + int staticsIndex; + int field_8; + int field_C; + int x; + int y; + + MGMSubItem(); +}; + struct MGMItem { int16 objId; - Common::Array<int> subItems; + Common::Array<MGMSubItem *> subItems; Common::Array<Statics *> statics; Common::Array<Movement *> movements1; Common::Array<Movement *> movements2; |