diff --git a/LEGO1/legoentity.cpp b/LEGO1/legoentity.cpp index 26f9daab..0f813029 100644 --- a/LEGO1/legoentity.cpp +++ b/LEGO1/legoentity.cpp @@ -76,6 +76,12 @@ void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) // TODO } +// STUB: LEGO1 0x100109b0 +void LegoEntity::SetLocation(Vector3Data& p_location, Vector3Data& p_direction, Vector3Data& p_up, MxBool) +{ + // TODO +} + // STUB: LEGO1 0x10010c30 void LegoEntity::FUN_10010c30() { diff --git a/LEGO1/legoentity.h b/LEGO1/legoentity.h index cdee29c3..4d4c19b6 100644 --- a/LEGO1/legoentity.h +++ b/LEGO1/legoentity.h @@ -49,6 +49,7 @@ class LegoEntity : public MxEntity { virtual void VTable0x4c(); // vtable+0x4c void FUN_10010c30(); + void SetLocation(Vector3Data& p_location, Vector3Data& p_direction, Vector3Data& p_up, MxBool); protected: void Init(); diff --git a/LEGO1/legoentitypresenter.cpp b/LEGO1/legoentitypresenter.cpp index 9c97d42e..3c343482 100644 --- a/LEGO1/legoentitypresenter.cpp +++ b/LEGO1/legoentitypresenter.cpp @@ -15,7 +15,7 @@ LegoEntityPresenter::LegoEntityPresenter() // FUNCTION: LEGO1 0x100535c0 void LegoEntityPresenter::Init() { - m_unk0x4c = 0; + m_objectBackend = 0; } // FUNCTION: LEGO1 0x100535d0 @@ -25,9 +25,9 @@ LegoEntityPresenter::~LegoEntityPresenter() } // FUNCTION: LEGO1 0x10053630 -undefined4 LegoEntityPresenter::VTable0x6c(IslePathActor* p_unk0x4c) +undefined4 LegoEntityPresenter::SetBackend(LegoEntity* p_backend) { - m_unk0x4c = p_unk0x4c; + m_objectBackend = p_backend; return 0; } @@ -59,10 +59,19 @@ MxResult LegoEntityPresenter::StartAction(MxStreamController* p_controller, MxDS return result; } -// STUB: LEGO1 0x100536c0 +// FUNCTION: LEGO1 0x100536c0 void LegoEntityPresenter::ReadyTickle() { - // TODO + if (GetCurrentWorld()) { + m_objectBackend = (LegoEntity*) MxPresenter::CreateEntityBackend("LegoEntity"); + if (m_objectBackend) { + m_objectBackend->Create(*m_action); + m_objectBackend->SetLocation(m_action->GetLocation(), m_action->GetDirection(), m_action->GetUp(), TRUE); + ParseExtra(); + } + m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState; + m_currentTickleState = TickleState_Starting; + } } // FUNCTION: LEGO1 0x10053720 @@ -83,6 +92,6 @@ void LegoEntityPresenter::ParseExtra() data[len] = 0; len &= MAXWORD; - m_unk0x4c->ParseAction(data); + m_objectBackend->ParseAction(data); } } diff --git a/LEGO1/legoentitypresenter.h b/LEGO1/legoentitypresenter.h index 64e0d279..0d46af18 100644 --- a/LEGO1/legoentitypresenter.h +++ b/LEGO1/legoentitypresenter.h @@ -3,7 +3,7 @@ #include "mxcompositepresenter.h" -class IslePathActor; +class LegoEntity; // VTABLE: LEGO1 0x100d8398 // SIZE 0x50 @@ -31,12 +31,12 @@ class LegoEntityPresenter : public MxCompositePresenter { virtual void Destroy() override; // vtable+0x38 virtual MxResult StartAction(MxStreamController* p_controller, MxDSAction* p_action) override; // vtable+0x3c virtual void Init(); // vtable+0x68 - virtual undefined4 VTable0x6c(IslePathActor* p_unk0x4c); // vtable+0x6c + virtual undefined4 SetBackend(LegoEntity* p_unk0x4c); // vtable+0x6c private: void Destroy(MxBool p_fromDestructor); - IslePathActor* m_unk0x4c; + LegoEntity* m_objectBackend; }; #endif // LEGOENTITYPRESENTER_H diff --git a/LEGO1/mxdsaction.h b/LEGO1/mxdsaction.h index eb70b18f..4898eb91 100644 --- a/LEGO1/mxdsaction.h +++ b/LEGO1/mxdsaction.h @@ -63,7 +63,9 @@ class MxDSAction : public MxDSObject { inline MxLong GetStartTime() const { return m_startTime; } inline MxS32 GetLoopCount() { return m_loopCount; } inline void SetLoopCount(MxS32 p_loopCount) { m_loopCount = p_loopCount; } - inline const Vector3Data& GetLocation() const { return m_location; } + inline Vector3Data& GetLocation() { return m_location; } + inline Vector3Data& GetDirection() { return m_direction; } + inline Vector3Data& GetUp() { return m_up; } inline MxCore* GetUnknown84() { return m_unk0x84; } inline void SetUnknown84(MxCore* p_unk0x84) { m_unk0x84 = p_unk0x84; } inline MxCore* GetOrigin() { return m_origin; } diff --git a/LEGO1/mxpresenter.cpp b/LEGO1/mxpresenter.cpp index 18607f07..b2404439 100644 --- a/LEGO1/mxpresenter.cpp +++ b/LEGO1/mxpresenter.cpp @@ -9,6 +9,7 @@ #include "mxcompositepresenter.h" #include "mxdsanim.h" #include "mxdssound.h" +#include "mxentity.h" #include "mxnotificationmanager.h" #include "mxparam.h" #include "mxstreamer.h" @@ -306,7 +307,7 @@ const char* PresenterNameDispatch(const MxDSAction& p_action) } // FUNCTION: LEGO1 0x100b5410 -void MxPresenter::FUN_100b5410(const char* p_name) +MxEntity* MxPresenter::CreateEntityBackend(const char* p_name) { char buffer[512]; char buffer2[512]; @@ -323,7 +324,7 @@ void MxPresenter::FUN_100b5410(const char* p_name) KeyValueStringParse(buffer, g_strOBJECT, buffer2 + 2); } - ObjectFactory()->Create(buffer); + return (MxEntity*) ObjectFactory()->Create(buffer); } // FUNCTION: LEGO1 0x100b54c0 diff --git a/LEGO1/mxpresenter.h b/LEGO1/mxpresenter.h index 8282ae62..fc158447 100644 --- a/LEGO1/mxpresenter.h +++ b/LEGO1/mxpresenter.h @@ -10,6 +10,7 @@ class MxCompositePresenter; class MxStreamController; +class MxEntity; // VTABLE: LEGO1 0x100d4d38 // SIZE 0x40 @@ -64,7 +65,7 @@ class MxPresenter : public MxCore { virtual MxResult PutData(); // vtable+0x4c virtual MxBool IsHit(MxS32 p_x, MxS32 p_y); // vtable+0x50 __declspec(dllexport) virtual void Enable(MxBool p_enable); // vtable+0x54 - void FUN_100b5410(const char* p_name); + MxEntity* CreateEntityBackend(const char* p_name); MxBool IsEnabled(); inline MxS32 GetCurrentTickleState() const { return this->m_currentTickleState; }