From c6dc8021b67336a1d11c8de38be11652f9e54901 Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Sat, 13 Jan 2024 18:30:07 -0500 Subject: [PATCH] push changes --- LEGO1/lego/legoomni/include/legoworldlist.h | 9 +++++++++ LEGO1/lego/legoomni/src/main/legoomni.cpp | 20 +++++++++++++++++--- LEGO1/omni/include/mxentity.h | 3 +++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoworldlist.h b/LEGO1/lego/legoomni/include/legoworldlist.h index 22cf5838..dc88a88c 100644 --- a/LEGO1/lego/legoomni/include/legoworldlist.h +++ b/LEGO1/lego/legoomni/include/legoworldlist.h @@ -28,6 +28,12 @@ class LegoWorldList : public MxPtrList { }; // vtable+0x14 }; +// VTABLE: LEGO1 0x100d75a0 +class LegoWorldListCursor : public MxListCursor { +public: + LegoWorldListCursor(LegoWorldList* p_list) : MxListCursor(p_list){}; +}; + // TEMPLATE: LEGO1 0x100598f0 // MxCollection::Compare @@ -52,4 +58,7 @@ class LegoWorldList : public MxPtrList { // SYNTHETIC: LEGO1 0x10059be0 // MxPtrList::`scalar deleting destructor' +// SYNTHETIC: LEGO1 0x1003e870 +// LegoWorldListCursor::`scalar deleting destructor' + #endif // LEGOWORLDLIST_H diff --git a/LEGO1/lego/legoomni/src/main/legoomni.cpp b/LEGO1/lego/legoomni/src/main/legoomni.cpp index ef7cca9b..3c7b4327 100644 --- a/LEGO1/lego/legoomni/src/main/legoomni.cpp +++ b/LEGO1/lego/legoomni/src/main/legoomni.cpp @@ -597,11 +597,25 @@ void LegoOmni::RemoveWorld(const MxAtomId&, MxLong) // TODO } -// STUB: LEGO1 0x1005b0c0 +// FUNCTION: LEGO1 0x1005b0c0 LegoEntity* LegoOmni::FindByEntityIdOrAtomId(const MxAtomId& p_atom, MxS32 p_entityid) { - // TODO - return NULL; + if (m_worldList) { + LegoWorld* world; + LegoWorldListCursor cursor(m_worldList); + + while (cursor.Next()) { + if ((p_entityid != -1 && world->GetEntityId() == p_entityid) || + (p_atom.GetInternal() && world->GetAtom() == p_atom)) { + return world; + } + } + + return NULL; + } + else { + return NULL; + } } // STUB: LEGO1 0x1005b1d0 diff --git a/LEGO1/omni/include/mxentity.h b/LEGO1/omni/include/mxentity.h index 40742896..cc77cea2 100644 --- a/LEGO1/omni/include/mxentity.h +++ b/LEGO1/omni/include/mxentity.h @@ -45,6 +45,9 @@ class MxEntity : public MxCore { return SUCCESS; } + inline MxS32 GetEntityId() { return m_mxEntityId; } + inline MxAtomId& GetAtom() { return m_atom; } + protected: MxS32 m_mxEntityId; // 0x8 MxAtomId m_atom; // 0xc