From b7b0ac6ae7b768adcd84c80053a99806214a4a04 Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Wed, 11 Oct 2023 18:15:36 -0400 Subject: [PATCH] Implement a few functions in LegoEntity (#201) --- LEGO1/legoentity.cpp | 19 ++++++++++++++++--- LEGO1/legoentity.h | 4 +++- LEGO1/mxentity.h | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/LEGO1/legoentity.cpp b/LEGO1/legoentity.cpp index e7601cc2..4247e18e 100644 --- a/LEGO1/legoentity.cpp +++ b/LEGO1/legoentity.cpp @@ -36,10 +36,13 @@ void LegoEntity::Reset() m_unk59 = 4; } -// OFFSET: LEGO1 0x100107e0 STUB -void LegoEntity::vtable18() +// OFFSET: LEGO1 0x100107e0 +MxResult LegoEntity::InitFromMxDSObject(MxDSObject& p_object) { - + m_mxEntityId = p_object.GetObjectId(); + m_atom = p_object.GetAtomId(); + AddToCurrentWorld(); + return SUCCESS; } // OFFSET: LEGO1 0x10010810 STUB @@ -53,6 +56,16 @@ void LegoEntity::Destroy(MxBool) Reset(); } +// OFFSET: LEGO1 0x10010880 STUB +void LegoEntity::AddToCurrentWorld() +{ + LegoWorld* world = GetCurrentWorld(); + if (world != NULL && world != (LegoWorld*)this) + { + // TODO: world->vtable58(this); + } +} + // OFFSET: LEGO1 0x10010e10 void LegoEntity::ParseAction(char *p_extra) { diff --git a/LEGO1/legoentity.h b/LEGO1/legoentity.h index 79acca27..66043492 100644 --- a/LEGO1/legoentity.h +++ b/LEGO1/legoentity.h @@ -5,6 +5,7 @@ #include "mxvector.h" #include "extra.h" #include "decomp.h" +#include "mxdsobject.h" // VTABLE 0x100d4858 // SIZE 0x68 (probably) @@ -34,12 +35,13 @@ public: return !strcmp(name, LegoEntity::ClassName()) || MxEntity::IsA(name); } - virtual void vtable18(); // vtable+0x18 + virtual MxResult InitFromMxDSObject(MxDSObject& p_object); // vtable+0x18 virtual void Destroy(MxBool); // vtable+0x1c virtual void ParseAction(char *); // vtable+0x20 protected: void Reset(); + void AddToCurrentWorld(); undefined m_unk10; undefined m_unk11; diff --git a/LEGO1/mxentity.h b/LEGO1/mxentity.h index 44afd9c4..2585f342 100644 --- a/LEGO1/mxentity.h +++ b/LEGO1/mxentity.h @@ -28,7 +28,7 @@ public: } virtual MxResult SetEntityId(MxS32 p_id, const MxAtomId &p_atom); // vtable+0x14 -private: +protected: MxS32 m_mxEntityId; // 0x8 MxAtomId m_atom; // 0xc };