From 4f9535db1d3f561c64dd7842f8e8cdcb4fae78e8 Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Sat, 10 Feb 2024 12:05:09 -0500 Subject: [PATCH] implement NotifyEntity --- LEGO1/lego/legoomni/include/legoomni.h | 1 + LEGO1/lego/legoomni/src/common/legoutil.cpp | 26 ++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/LEGO1/lego/legoomni/include/legoomni.h b/LEGO1/lego/legoomni/include/legoomni.h index 0d31d48b..701ad105 100644 --- a/LEGO1/lego/legoomni/include/legoomni.h +++ b/LEGO1/lego/legoomni/include/legoomni.h @@ -124,6 +124,7 @@ class LegoOmni : public MxOmni { MxTransitionManager* GetTransitionManager() { return m_transitionManager; } MxDSAction& GetCurrentAction() { return m_action; } LegoUnkSaveDataWriter* GetUnkSaveDataWriter() { return m_saveDataWriter; } + LegoWorldList* GetWorldList() { return m_worldList; } inline void SetNavController(LegoNavController* p_navController) { m_navController = p_navController; } inline void SetCurrentWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; } diff --git a/LEGO1/lego/legoomni/src/common/legoutil.cpp b/LEGO1/lego/legoomni/src/common/legoutil.cpp index c6d0c22e..f45d4832 100644 --- a/LEGO1/lego/legoomni/src/common/legoutil.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutil.cpp @@ -2,7 +2,9 @@ #include "legoomni.h" #include "legoworld.h" +#include "legoworldlist.h" #include "mxdsaction.h" +#include "mxnotificationmanager.h" #include "mxomni.h" #include "mxstreamer.h" #include "mxtypes.h" @@ -128,9 +130,31 @@ MxBool CheckIfEntityExists(MxBool p_enable, const char* p_filename, MxS32 p_enti } } -// STUB: LEGO1 0x1003e700 +// FUNCTION: LEGO1 0x1003e700 void NotifyEntity(const char* p_filename, MxS32 p_entityId, LegoEntity* p_sender) { + MxAtomId atom(p_filename, e_lowerCase2); + LegoEntity* entity = FindWorld(atom, p_entityId); + if (entity == NULL) { + LegoWorldListCursor cursor(Lego()->GetWorldList()); + LegoWorld* current; + while (entity == NULL) { + cursor.Next(current); + entity = (LegoEntity*) current->Find(atom, p_entityId); + } + } + + if (entity != NULL) { + +#ifdef COMPAT_MODE + { + MxNotificationParam param(c_notificationType0, p_sender); + NotificationManager()->Send(entity, ¶m); + } +#else + NotificationManager()->Send(entity, &MxNotificationParam(c_notificationType0, p_sender)); +#endif + } } // FUNCTION: LEGO1 0x1003eae0