diff --git a/LEGO1/define.cpp b/LEGO1/define.cpp index 31f1e521..acd811a8 100644 --- a/LEGO1/define.cpp +++ b/LEGO1/define.cpp @@ -19,6 +19,9 @@ const char* g_strWORLD = "WORLD"; // GLOBAL: LEGO1 0x10101f20 const char* g_strSOUND = "SOUND"; +// GLOBAL: LEGO1 0x10101f58 +const char* g_strOBJECT = "OBJECT"; + // GLOBAL: LEGO1 0x10102040 const char* g_strACTION = "ACTION"; diff --git a/LEGO1/define.h b/LEGO1/define.h index 82e93375..45a536a9 100644 --- a/LEGO1/define.h +++ b/LEGO1/define.h @@ -7,6 +7,7 @@ extern MxU32 g_mxcoreCount[101]; extern const char* g_parseExtraTokens; extern const char* g_strWORLD; extern const char* g_strSOUND; +extern const char* g_strOBJECT; extern const char* g_strACTION; extern const char* g_strVISIBILITY; diff --git a/LEGO1/legoentitypresenter.cpp b/LEGO1/legoentitypresenter.cpp index dc1a44eb..9c97d42e 100644 --- a/LEGO1/legoentitypresenter.cpp +++ b/LEGO1/legoentitypresenter.cpp @@ -1,5 +1,6 @@ #include "legoentitypresenter.h" +#include "islepathactor.h" #include "legoomni.h" #include "legovideomanager.h" @@ -24,7 +25,7 @@ LegoEntityPresenter::~LegoEntityPresenter() } // FUNCTION: LEGO1 0x10053630 -undefined4 LegoEntityPresenter::VTable0x6c(undefined4 p_unk0x4c) +undefined4 LegoEntityPresenter::VTable0x6c(IslePathActor* p_unk0x4c) { m_unk0x4c = p_unk0x4c; return 0; @@ -45,3 +46,43 @@ void LegoEntityPresenter::Destroy() { Destroy(FALSE); } + +// FUNCTION: LEGO1 0x10053680 +MxResult LegoEntityPresenter::StartAction(MxStreamController* p_controller, MxDSAction* p_action) +{ + MxResult result = MxCompositePresenter::StartAction(p_controller, p_action); + + if (VideoManager()) { + VideoManager()->AddPresenter(*this); + } + + return result; +} + +// STUB: LEGO1 0x100536c0 +void LegoEntityPresenter::ReadyTickle() +{ + // TODO +} + +// FUNCTION: LEGO1 0x10053720 +void LegoEntityPresenter::RepeatingTickle() +{ + if (m_list.size() == 0) { + EndAction(); + } +} + +// FUNCTION: LEGO1 0x10053750 +void LegoEntityPresenter::ParseExtra() +{ + char data[512]; + MxU16 len = m_action->GetExtraLength(); + if (len) { + memcpy(data, m_action->GetExtraData(), len); + data[len] = 0; + + len &= MAXWORD; + m_unk0x4c->ParseAction(data); + } +} diff --git a/LEGO1/legoentitypresenter.h b/LEGO1/legoentitypresenter.h index 9e072498..64e0d279 100644 --- a/LEGO1/legoentitypresenter.h +++ b/LEGO1/legoentitypresenter.h @@ -3,6 +3,8 @@ #include "mxcompositepresenter.h" +class IslePathActor; + // VTABLE: LEGO1 0x100d8398 // SIZE 0x50 class LegoEntityPresenter : public MxCompositePresenter { @@ -23,14 +25,18 @@ class LegoEntityPresenter : public MxCompositePresenter { return !strcmp(p_name, LegoEntityPresenter::ClassName()) || MxCompositePresenter::IsA(p_name); } - virtual void Destroy() override; // vtable+0x38 - virtual void Init(); // vtable+0x68 - virtual undefined4 VTable0x6c(undefined4 p_unk0x4c); // vtable+0x6c + virtual void ReadyTickle() override; // vtable+0x18 + virtual void RepeatingTickle(); // vtable+0x24 + virtual void ParseExtra(); // vtable+0x30 + 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 private: void Destroy(MxBool p_fromDestructor); - undefined4 m_unk0x4c; + IslePathActor* m_unk0x4c; }; #endif // LEGOENTITYPRESENTER_H diff --git a/LEGO1/mxpresenter.cpp b/LEGO1/mxpresenter.cpp index 31279513..18607f07 100644 --- a/LEGO1/mxpresenter.cpp +++ b/LEGO1/mxpresenter.cpp @@ -2,6 +2,7 @@ #include "decomp.h" #include "define.h" +#include "legoobjectfactory.h" #include "legoomni.h" #include "mxactionnotificationparam.h" #include "mxautolocker.h" @@ -304,6 +305,27 @@ const char* PresenterNameDispatch(const MxDSAction& p_action) return name; } +// FUNCTION: LEGO1 0x100b5410 +void MxPresenter::FUN_100b5410(const char* p_name) +{ + char buffer[512]; + char buffer2[512]; + strcpy(buffer, p_name); + + MxU16 extraLen = m_action->GetExtraLength(); + + buffer[0] = extraLen; + buffer[1] = extraLen >> 8; + if (extraLen) { + extraLen &= MAXWORD; + memcpy(buffer2 + 2, m_action->GetExtraData(), extraLen); + buffer2[extraLen + 2] = 0; + KeyValueStringParse(buffer, g_strOBJECT, buffer2 + 2); + } + + ObjectFactory()->Create(buffer); +} + // FUNCTION: LEGO1 0x100b54c0 MxBool MxPresenter::IsEnabled() { diff --git a/LEGO1/mxpresenter.h b/LEGO1/mxpresenter.h index 160329c1..8282ae62 100644 --- a/LEGO1/mxpresenter.h +++ b/LEGO1/mxpresenter.h @@ -64,7 +64,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); MxBool IsEnabled(); inline MxS32 GetCurrentTickleState() const { return this->m_currentTickleState; }