diff --git a/LEGO1/lego/legoomni/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index c8351413..d4ab3632 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -5,6 +5,8 @@ #include "misc/legostorage.h" #include "mxcore.h" +class LegoROI; + // VTABLE: LEGO1 0x100d6f50 // SIZE 0x30 class LegoBuildingManager : public MxCore { @@ -29,6 +31,7 @@ public: void FUN_1002fb30(); MxResult Save(LegoStorage* p_storage); MxResult Load(LegoStorage* p_storage); + MxU32 FUN_1002ff40(LegoROI*, MxBool); void FUN_10030590(); // SYNTHETIC: LEGO1 0x1002f940 diff --git a/LEGO1/lego/legoomni/include/legoentity.h b/LEGO1/lego/legoomni/include/legoentity.h index 783267bd..a3764eb0 100644 --- a/LEGO1/lego/legoomni/include/legoentity.h +++ b/LEGO1/lego/legoomni/include/legoentity.h @@ -17,6 +17,10 @@ public: c_bit2 = 0x02 }; + enum { + c_altBit1 = 0x01 + }; + inline LegoEntity() { Init(); } // FUNCTION: LEGO1 0x1000c290 @@ -51,13 +55,13 @@ public: // FUNCTION: LEGO1 0x10001090 virtual void SetWorldSpeed(MxFloat p_worldSpeed) { m_worldSpeed = p_worldSpeed; } // vtable+0x30 - virtual void VTable0x34(); // vtable+0x34 - virtual void VTable0x38(); // vtable+0x38 - virtual void VTable0x3c(); // vtable+0x3c - virtual void VTable0x40(); // vtable+0x40 - virtual void VTable0x44(); // vtable+0x44 - virtual void VTable0x48(); // vtable+0x48 - virtual void VTable0x4c(); // vtable+0x4c + virtual void VTable0x34(MxBool p_und); // vtable+0x34 + virtual void VTable0x38(); // vtable+0x38 + virtual void VTable0x3c(); // vtable+0x3c + virtual void VTable0x40(); // vtable+0x40 + virtual void VTable0x44(); // vtable+0x44 + virtual void VTable0x48(); // vtable+0x48 + virtual void VTable0x4c(); // vtable+0x4c void FUN_10010c30(); void FUN_100114e0(MxU8 p_unk0x59); @@ -65,6 +69,7 @@ public: inline LegoROI* GetROI() { return m_roi; } inline MxU8 GetFlags() { return m_flags; } + inline MxBool GetUnknown0x10IsSet(MxU8 p_flag) { return m_unk0x10 & p_flag; } inline void SetFlags(MxU8 p_flags) { m_flags = p_flags; } inline void SetFlag(MxU8 p_flag) { m_flags |= p_flag; } @@ -74,7 +79,7 @@ protected: void Init(); void SetWorld(); - undefined m_unk0x10; // 0x10 + MxU8 m_unk0x10; // 0x10 MxU8 m_flags; // 0x11 Mx3DPointFloat m_worldLocation; // 0x14 Mx3DPointFloat m_worldDirection; // 0x28 diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index 581ec7b4..b5ac4e7b 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -5,6 +5,8 @@ #include "misc/legostorage.h" #include "mxcore.h" +class LegoROI; + // VTABLE: LEGO1 0x100d6758 // SIZE 0x2c class LegoPlantManager : public MxCore { @@ -26,6 +28,7 @@ public: void FUN_100263a0(undefined4 p_und); void Save(LegoStorage* p_storage); MxResult Load(LegoStorage* p_storage); + MxU32 FUN_10026ba0(LegoROI*, MxBool); void FUN_10027120(); static void SetCustomizeAnimFile(const char* p_value); diff --git a/LEGO1/lego/legoomni/include/legounksavedatawriter.h b/LEGO1/lego/legoomni/include/legounksavedatawriter.h index 9f3d1235..0a9167e4 100644 --- a/LEGO1/lego/legoomni/include/legounksavedatawriter.h +++ b/LEGO1/lego/legoomni/include/legounksavedatawriter.h @@ -66,9 +66,12 @@ public: void FUN_100832a0(); void FUN_10083db0(LegoROI* p_roi); void FUN_10083f10(LegoROI* p_roi); + MxU32 FUN_10085140(LegoROI*, MxBool); LegoROI* FUN_10085210(const LegoChar*, LegoChar*, undefined); LegoROI* FUN_10085a80(LegoChar* p_und1, LegoChar* p_und2, undefined p_und3); + static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; } + private: static char* g_customizeAnimFile; diff --git a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp index 42b161f5..613ccca1 100644 --- a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp @@ -56,6 +56,13 @@ MxResult LegoBuildingManager::Load(LegoStorage* p_storage) return SUCCESS; } +// STUB: LEGO1 0x1002ff40 +MxU32 LegoBuildingManager::FUN_1002ff40(LegoROI*, MxBool) +{ + // TODO + return 0; +} + // FUNCTION: LEGO1 0x1002ff90 void LegoBuildingManager::SetCustomizeAnimFile(const char* p_value) { diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index 11f722e8..f4d18d3a 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -47,6 +47,13 @@ MxResult LegoPlantManager::Load(LegoStorage* p_storage) return SUCCESS; } +// STUB: LEGO1 0x10026ba0 +MxU32 LegoPlantManager::FUN_10026ba0(LegoROI*, MxBool) +{ + // TODO + return 0; +} + // FUNCTION: LEGO1 0x10026be0 void LegoPlantManager::SetCustomizeAnimFile(const char* p_value) { diff --git a/LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp b/LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp index 74d1ff22..5a0dcac1 100644 --- a/LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp +++ b/LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp @@ -123,6 +123,13 @@ MxBool LegoUnkSaveDataWriter::FUN_10084c00(const LegoChar*) return FALSE; } +// STUB: LEGO1 0x10085140 +MxU32 LegoUnkSaveDataWriter::FUN_10085140(LegoROI*, MxBool) +{ + // TODO + return 0; +} + // FUNCTION: LEGO1 0x100851a0 void LegoUnkSaveDataWriter::SetCustomizeAnimFile(const char* p_value) { diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index 67d8deae..94e731a8 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -1,7 +1,9 @@ #include "legoentity.h" #include "define.h" +#include "legobuildingmanager.h" #include "legoomni.h" +#include "legoplantmanager.h" #include "legounksavedatawriter.h" #include "legoutil.h" #include "legovideomanager.h" @@ -80,7 +82,7 @@ void LegoEntity::Destroy(MxBool p_fromDestructor) { if (m_roi) { if (m_flags & c_bit1) { - if (m_roi->GetUnknown0x104() == this) { + if (m_roi->GetEntity() == this) { m_roi->SetEntity(NULL); } @@ -203,10 +205,35 @@ void LegoEntity::ParseAction(char* p_extra) } } -// STUB: LEGO1 0x10010f10 -void LegoEntity::VTable0x34() +// FUNCTION: LEGO1 0x10010f10 +void LegoEntity::VTable0x34(MxBool p_und) { - // TODO + if (!GetUnknown0x10IsSet(c_altBit1)) { + MxU32 objectId = 0; + const LegoChar* roiName = m_roi->GetName(); + + switch (m_unk0x59) { + case 0: + objectId = UnkSaveDataWriter()->FUN_10085140(m_roi, p_und); + break; + case 1: + break; + case 2: + objectId = PlantManager()->FUN_10026ba0(m_roi, p_und); + break; + case 3: + objectId = BuildingManager()->FUN_1002ff40(m_roi, p_und); + break; + } + + if (objectId) { + MxDSAction action; + action.SetAtomId(MxAtomId(UnkSaveDataWriter()->GetCustomizeAnimFile(), e_lowerCase2)); + action.SetObjectId(objectId); + action.AppendData(strlen(roiName) + 1, roiName); + Start(&action); + } + } } // STUB: LEGO1 0x10011070 diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index 1b70583c..00b5ecec 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -392,7 +392,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) roi = (LegoROI*) oroi; } - LegoEntity* entity = roi->GetUnknown0x104(); + LegoEntity* entity = roi->GetEntity(); if (entity && entity->Notify(p_param) != 0) { return TRUE; } diff --git a/LEGO1/lego/sources/roi/legoroi.h b/LEGO1/lego/sources/roi/legoroi.h index 9c5028c3..e12cdb88 100644 --- a/LEGO1/lego/sources/roi/legoroi.h +++ b/LEGO1/lego/sources/roi/legoroi.h @@ -76,7 +76,7 @@ public: ); inline const LegoChar* GetName() const { return m_name; } - inline LegoEntity* GetUnknown0x104() { return m_entity; } + inline LegoEntity* GetEntity() { return m_entity; } inline void SetEntity(LegoEntity* p_entity) { m_entity = p_entity; }