From b6aac26269f91d53ccf79ff5ce9ff9cd0e205ddf Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 26 Jan 2024 16:00:02 -0500 Subject: [PATCH] Implement LegoWorld::Find (#489) * Implement LegoWorld::FUN_100213a0 * Rename lists * Rename cursors * Rename cursor * Rename functions * Remove a comment * Rename more functions * Fix return type --- LEGO1/lego/legoomni/include/isle.h | 3 +- .../lego/legoomni/include/legoanimpresenter.h | 2 +- LEGO1/lego/legoomni/include/legoomni.h | 26 +++---- LEGO1/lego/legoomni/include/legoworld.h | 12 +-- LEGO1/lego/legoomni/src/build/helicopter.cpp | 2 +- .../legoomni/src/common/legogamestate.cpp | 6 +- LEGO1/lego/legoomni/src/common/legoutil.cpp | 3 +- LEGO1/lego/legoomni/src/entity/legoentity.cpp | 2 +- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 76 ++++++++++++++++--- .../src/entity/legoworldpresenter.cpp | 2 +- .../legoomni/src/infocenter/infocenter.cpp | 50 ++++++------ LEGO1/lego/legoomni/src/isle/isle.cpp | 6 +- LEGO1/lego/legoomni/src/main/legoomni.cpp | 31 ++++---- .../legoomni/src/video/legoanimpresenter.cpp | 6 ++ .../src/video/legolocomotionanimpresenter.cpp | 2 +- LEGO1/lego/sources/roi/legoroi.h | 9 ++- LEGO1/omni/include/mxdsobject.h | 1 + LEGO1/omni/include/mxomni.h | 2 +- LEGO1/omni/src/common/mxpresenter.cpp | 2 +- LEGO1/omni/src/main/mxomni.cpp | 2 +- 20 files changed, 154 insertions(+), 91 deletions(-) diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index 681e0337..e91982ee 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -20,7 +20,6 @@ class Act1State; // VTABLE: LEGO1 0x100d6fb8 // SIZE 0x140 -// Radio at 0x12c class Isle : public LegoWorld { public: Isle(); @@ -42,7 +41,7 @@ class Isle : public LegoWorld { virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 virtual void VTable0x50() override; // vtable+50 - virtual void VTable0x58(MxCore* p_object) override; // vtable+58 + virtual void Add(MxCore* p_object) override; // vtable+58 // FUNCTION: LEGO1 0x10030900 virtual MxBool VTable0x5c() override { return TRUE; } // vtable+5c // FUNCTION: LEGO1 0x10033170 diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index 94832a61..394147e5 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -40,7 +40,7 @@ class LegoAnimPresenter : public MxVideoPresenter { virtual void PutFrame() override; // vtable+0x6c virtual MxResult VTable0x88(MxStreamChunk* p_chunk); // vtable+0x88 - // 6 more virtual functions here + const char* GetActionObjectName(); protected: void Init(); diff --git a/LEGO1/lego/legoomni/include/legoomni.h b/LEGO1/lego/legoomni/include/legoomni.h index 4265c7d2..2f2622c7 100644 --- a/LEGO1/lego/legoomni/include/legoomni.h +++ b/LEGO1/lego/legoomni/include/legoomni.h @@ -92,18 +92,18 @@ class LegoOmni : public MxOmni { return !strcmp(p_name, LegoOmni::ClassName()) || MxOmni::IsA(p_name); } - virtual void Init() override; // vtable+14 - virtual MxResult Create(MxOmniCreateParam& p_param) override; // vtable+18 - virtual void Destroy() override; // vtable+1c - virtual MxResult Start(MxDSAction* p_dsAction) override; // vtable+20 - virtual void DeleteObject(MxDSAction& p_dsAction) override; // vtable+24 - virtual MxBool DoesEntityExist(MxDSAction& p_dsAction) override; // vtable+28 - virtual MxEntity* FindWorld(const char* p_id, MxS32 p_entityId, MxPresenter* p_presenter) override; // vtable+30 - virtual void NotifyCurrentEntity(MxNotificationParam* p_param) override; // vtable+34 - virtual void StartTimer() override; // vtable+38 - virtual void StopTimer() override; // vtable+3c + virtual void Init() override; // vtable+14 + virtual MxResult Create(MxOmniCreateParam& p_param) override; // vtable+18 + virtual void Destroy() override; // vtable+1c + virtual MxResult Start(MxDSAction* p_dsAction) override; // vtable+20 + virtual void DeleteObject(MxDSAction& p_dsAction) override; // vtable+24 + virtual MxBool DoesEntityExist(MxDSAction& p_dsAction) override; // vtable+28 + virtual MxEntity* AddToWorld(const char* p_id, MxS32 p_entityId, MxPresenter* p_presenter) override; // vtable+30 + virtual void NotifyCurrentEntity(MxNotificationParam* p_param) override; // vtable+34 + virtual void StartTimer() override; // vtable+38 + virtual void StopTimer() override; // vtable+3c - LegoEntity* FindByEntityIdOrAtomId(const MxAtomId& p_atom, MxS32 p_entityid); + LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid); void AddWorld(LegoWorld* p_world); void FUN_1005b4f0(MxBool p_disable, MxU16 p_flags); @@ -111,7 +111,7 @@ class LegoOmni : public MxOmni { LegoSoundManager* GetSoundManager() { return (LegoSoundManager*) m_soundManager; } LegoInputManager* GetInputManager() { return m_inputMgr; } GifManager* GetGifManager() { return m_gifManager; } - LegoWorld* GetCurrentOmniWorld() { return m_currentWorld; } + LegoWorld* GetCurrentWorld() { return m_currentWorld; } LegoNavController* GetNavController() { return m_navController; } IslePathActor* GetCurrentVehicle() { return m_currentVehicle; } LegoPlantManager* GetLegoPlantManager() { return m_plantManager; } @@ -174,7 +174,7 @@ LegoUnkSaveDataWriter* GetUnkSaveDataWriter(); GifManager* GetGifManager(); void FUN_10015820(MxBool p_disable, MxU16 p_flags); void FUN_10015860(const char*, MxU8); -LegoEntity* FindEntityByAtomIdOrEntityId(const MxAtomId& p_atom, MxS32 p_entityid); +LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid); MxDSAction& GetCurrentAction(); void PlayMusic(MxU32 p_index); diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 72fc69b6..4bc7ab70 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -45,7 +45,7 @@ class LegoWorld : public LegoEntity { virtual void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c virtual void VTable0x50(); // vtable+0x50 virtual LegoCameraController* VTable0x54(); // vtable+0x54 - virtual void VTable0x58(MxCore* p_object); // vtable+0x58 + virtual void Add(MxCore* p_object); // vtable+0x58 virtual MxBool VTable0x5c(); // vtable+0x5c // FUNCTION: LEGO1 0x100010a0 @@ -58,28 +58,28 @@ class LegoWorld : public LegoEntity { inline undefined4 GetUnknown0xec() { return m_unk0xec; } undefined FUN_100220e0(); - void EndAction(MxCore* p_object); + void Remove(MxCore* p_object); void FUN_1001fc80(IslePathActor* p_actor); MxBool FUN_100727e0(MxU32, Mx3DPointFloat& p_loc, Mx3DPointFloat& p_dir, Mx3DPointFloat& p_up); MxBool FUN_10072980(MxU32, Mx3DPointFloat& p_loc, Mx3DPointFloat& p_dir, Mx3DPointFloat& p_up); void FUN_10073400(); void FUN_10073430(); MxS32 GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value); - MxPresenter* FindPresenter(const char* p_presenter, const char* p_name); - MxCore* FUN_10021790(const MxAtomId& p_atom, MxS32 p_entityId); + MxCore* Find(const char* p_class, const char* p_name); + MxCore* Find(const MxAtomId& p_atom, MxS32 p_entityId); // SYNTHETIC: LEGO1 0x1001dee0 // LegoWorld::`scalar deleting destructor' protected: LegoPathControllerList m_list0x68; // 0x68 - MxPresenterList m_list0x80; // 0x80 + MxPresenterList m_animPresenters; // 0x80 LegoCameraController* m_cameraController; // 0x98 LegoEntityList* m_entityList; // 0x9c MxCoreList* m_coreList; // 0xa0 undefined m_unk0xa4; // 0xa4 MxPresenterSet m_set0xa8; // 0xa8 - MxPresenterList m_list0xb8; // 0xb8 + MxPresenterList m_controlPresenters; // 0xb8 MxPresenterSet m_set0xd0; // 0xd0 list m_list0xe0; // 0xe0 undefined4 m_unk0xec; // 0xec diff --git a/LEGO1/lego/legoomni/src/build/helicopter.cpp b/LEGO1/lego/legoomni/src/build/helicopter.cpp index adfb1692..3bf55354 100644 --- a/LEGO1/lego/legoomni/src/build/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/build/helicopter.cpp @@ -41,7 +41,7 @@ MxResult Helicopter::Create(MxDSAction& p_dsAction) } world = GetWorld(); if (world) - world->VTable0x58(this); + world->Add(this); GetState(); return result; } diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 93a9544b..87466e2b 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -398,13 +398,13 @@ void LegoGameState::SetSomeEnumState(undefined4 p_state) // FUNCTION: LEGO1 0x1003ceb0 void LegoGameState::FUN_1003ceb0() { - if (FindEntityByAtomIdOrEntityId(*g_isleScript, 0)) { + if (FindWorld(*g_isleScript, 0)) { m_currentAct = 0; } - else if (FindEntityByAtomIdOrEntityId(*g_act2mainScript, 0)) { + else if (FindWorld(*g_act2mainScript, 0)) { m_currentAct = 1; } - else if (FindEntityByAtomIdOrEntityId(*g_act3Script, 0)) { + else if (FindWorld(*g_act3Script, 0)) { m_currentAct = 2; } else { diff --git a/LEGO1/lego/legoomni/src/common/legoutil.cpp b/LEGO1/lego/legoomni/src/common/legoutil.cpp index fb207f50..843f4abb 100644 --- a/LEGO1/lego/legoomni/src/common/legoutil.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutil.cpp @@ -99,7 +99,8 @@ void InvokeAction(Extra::ActionType p_actionId, MxAtomId& p_pAtom, int p_targetE // FUNCTION: LEGO1 0x1003e670 MxBool CheckIfEntityExists(MxBool p_enable, const char* p_filename, MxS32 p_entityId) { - LegoWorld* world = (LegoWorld*) FindEntityByAtomIdOrEntityId(MxAtomId(p_filename, e_lowerCase2), p_entityId); + LegoWorld* world = FindWorld(MxAtomId(p_filename, e_lowerCase2), p_entityId); + if (world) { world->VTable0x68(p_enable); return TRUE; diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index 2c482715..8ad66afb 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -71,7 +71,7 @@ void LegoEntity::SetWorld() { LegoWorld* world = GetCurrentWorld(); if (world != NULL && world != (LegoWorld*) this) { - world->VTable0x58(this); + world->Add(this); } } diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index 6cc2363a..c9381197 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -1,5 +1,6 @@ #include "legoworld.h" +#include "legoanimpresenter.h" #include "legocontrolmanager.h" #include "legoinputmanager.h" #include "legoomni.h" @@ -73,7 +74,7 @@ MxResult LegoWorld::Create(MxDSAction& p_dsAction) } SetCurrentWorld(this); - ControlManager()->FUN_10028df0(&m_list0xb8); + ControlManager()->FUN_10028df0(&m_controlPresenters); } SetIsWorldActive(TRUE); @@ -95,7 +96,7 @@ MxLong LegoWorld::Notify(MxParam& p_param) switch (((MxNotificationParam&) p_param).GetNotification()) { case c_notificationEndAction: { MxPresenter* presenter = (MxPresenter*) ((MxEndActionNotificationParam&) p_param).GetSender(); - EndAction(presenter); + Remove(presenter); ret = 1; break; } @@ -152,24 +153,75 @@ MxS32 LegoWorld::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value) } // STUB: LEGO1 0x10020220 -void LegoWorld::VTable0x58(MxCore* p_object) +void LegoWorld::Add(MxCore* p_object) { // TODO } // STUB: LEGO1 0x10020f10 -void LegoWorld::EndAction(MxCore* p_object) +void LegoWorld::Remove(MxCore* p_object) { + // TODO } -// STUB: LEGO1 0x100213a0 -MxPresenter* LegoWorld::FindPresenter(const char* p_presenter, const char* p_name) +// FUNCTION: LEGO1 0x100213a0 +MxCore* LegoWorld::Find(const char* p_class, const char* p_name) { - return NULL; + if (!strcmp(p_class, "MxControlPresenter")) { + MxPresenterListCursor cursor(&m_controlPresenters); + MxPresenter* presenter; + + while (cursor.Next(presenter)) { + MxDSAction* action = presenter->GetAction(); + if (!strcmp(action->GetObjectName(), p_name)) + return presenter; + } + + return NULL; + } + else if (!strcmp(p_class, "MxEntity")) { + LegoEntityListCursor cursor(m_entityList); + LegoEntity* entity; + + while (cursor.Next(entity)) { + if (!p_name) + return entity; + + LegoROI* roi = entity->GetROI(); + if (roi && !strcmpi(roi->GetUnknown0xe4(), p_name)) + return entity; + } + + return NULL; + } + else if (!strcmp(p_class, "LegoAnimPresenter")) { + MxPresenterListCursor cursor(&m_animPresenters); + MxPresenter* presenter; + + while (cursor.Next(presenter)) { + if (!strcmpi(((LegoAnimPresenter*) presenter)->GetActionObjectName(), p_name)) + return presenter; + } + + return NULL; + } + else { + for (MxPresenterSet::iterator it = m_set0xa8.begin(); it != m_set0xa8.end(); it++) { + if ((*it)->IsA(p_class) && (*it)->IsA("MxPresenter")) { + MxPresenter* presenter = (MxPresenter*) *it; + MxDSAction* action = presenter->GetAction(); + + if (!strcmp(action->GetObjectName(), p_name)) + return *it; + } + } + + return NULL; + } } // FUNCTION: LEGO1 0x10021790 -MxCore* LegoWorld::FUN_10021790(const MxAtomId& p_atom, MxS32 p_entityId) +MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId) { LegoEntityListCursor entityCursor(m_entityList); LegoEntity* entity; @@ -179,19 +231,19 @@ MxCore* LegoWorld::FUN_10021790(const MxAtomId& p_atom, MxS32 p_entityId) return entity; } - MxPresenterListCursor presenterCursor0xb8(&m_list0xb8); + MxPresenterListCursor controlPresenterCursor(&m_controlPresenters); MxPresenter* presenter; - while (presenterCursor0xb8.Next(presenter)) { + while (controlPresenterCursor.Next(presenter)) { MxDSAction* action = presenter->GetAction(); if (action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) return presenter; } - MxPresenterListCursor presenterCursor0x80(&m_list0x80); + MxPresenterListCursor animPresenterCursor(&m_animPresenters); - while (presenterCursor0x80.Next(presenter)) { + while (animPresenterCursor.Next(presenter)) { MxDSAction* action = presenter->GetAction(); if (action && action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) diff --git a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp index 55f908bd..072da137 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp @@ -165,7 +165,7 @@ void LegoWorldPresenter::VTable0x60(MxPresenter* p_presenter) if (!p_presenter->IsA("LegoAnimPresenter") && !p_presenter->IsA("MxControlPresenter") && !p_presenter->IsA("MxCompositePresenter")) { p_presenter->SendToCompositePresenter(Lego()); - ((LegoWorld*) m_entity)->VTable0x58(p_presenter); + ((LegoWorld*) m_entity)->Add(p_presenter); } } diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp index 6b14b8af..38b95622 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp @@ -305,8 +305,8 @@ void Infocenter::VTable0x50() m_unk0x1d4 = 0; m_unk0x1d6 = 0; - MxStillPresenter* bg = (MxStillPresenter*) FindPresenter("MxStillPresenter", "Background_Bitmap"); - MxStillPresenter* bgRed = (MxStillPresenter*) FindPresenter("MxStillPresenter", "BackgroundRed_Bitmap"); + MxStillPresenter* bg = (MxStillPresenter*) Find("MxStillPresenter", "Background_Bitmap"); + MxStillPresenter* bgRed = (MxStillPresenter*) Find("MxStillPresenter", "BackgroundRed_Bitmap"); switch (GameState()->GetUnknown10()) { case 0: @@ -365,73 +365,73 @@ void Infocenter::InitializeBitmaps() { m_radio.Initialize(TRUE); - ((MxPresenter*) FUN_10021790(m_atom, c_leftArrowCtl))->Enable(TRUE); - ((MxPresenter*) FUN_10021790(m_atom, c_rightArrowCtl))->Enable(TRUE); - ((MxPresenter*) FUN_10021790(m_atom, c_infoCtl))->Enable(TRUE); - ((MxPresenter*) FUN_10021790(m_atom, c_boatCtl))->Enable(TRUE); - ((MxPresenter*) FUN_10021790(m_atom, c_raceCtl))->Enable(TRUE); - ((MxPresenter*) FUN_10021790(m_atom, c_pizzaCtl))->Enable(TRUE); - ((MxPresenter*) FUN_10021790(m_atom, c_gasCtl))->Enable(TRUE); - ((MxPresenter*) FUN_10021790(m_atom, c_medCtl))->Enable(TRUE); - ((MxPresenter*) FUN_10021790(m_atom, c_copCtl))->Enable(TRUE); + ((MxPresenter*) Find(m_atom, c_leftArrowCtl))->Enable(TRUE); + ((MxPresenter*) Find(m_atom, c_rightArrowCtl))->Enable(TRUE); + ((MxPresenter*) Find(m_atom, c_infoCtl))->Enable(TRUE); + ((MxPresenter*) Find(m_atom, c_boatCtl))->Enable(TRUE); + ((MxPresenter*) Find(m_atom, c_raceCtl))->Enable(TRUE); + ((MxPresenter*) Find(m_atom, c_pizzaCtl))->Enable(TRUE); + ((MxPresenter*) Find(m_atom, c_gasCtl))->Enable(TRUE); + ((MxPresenter*) Find(m_atom, c_medCtl))->Enable(TRUE); + ((MxPresenter*) Find(m_atom, c_copCtl))->Enable(TRUE); - ((MxPresenter*) FUN_10021790(m_atom, c_mamaCtl))->Enable(TRUE); - ((MxPresenter*) FUN_10021790(m_atom, c_papaCtl))->Enable(TRUE); - ((MxPresenter*) FUN_10021790(m_atom, c_pepperCtl))->Enable(TRUE); - ((MxPresenter*) FUN_10021790(m_atom, c_nickCtl))->Enable(TRUE); - ((MxPresenter*) FUN_10021790(m_atom, c_lauraCtl))->Enable(TRUE); - ((MxPresenter*) FUN_10021790(m_atom, c_radioCtl))->Enable(TRUE); + ((MxPresenter*) Find(m_atom, c_mamaCtl))->Enable(TRUE); + ((MxPresenter*) Find(m_atom, c_papaCtl))->Enable(TRUE); + ((MxPresenter*) Find(m_atom, c_pepperCtl))->Enable(TRUE); + ((MxPresenter*) Find(m_atom, c_nickCtl))->Enable(TRUE); + ((MxPresenter*) Find(m_atom, c_lauraCtl))->Enable(TRUE); + ((MxPresenter*) Find(m_atom, c_radioCtl))->Enable(TRUE); - m_mapAreas[0].m_presenter = (MxStillPresenter*) FindPresenter("MxStillPresenter", "Info_A_Bitmap"); + m_mapAreas[0].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Info_A_Bitmap"); m_mapAreas[0].m_unk0x08 = 391; m_mapAreas[0].m_unk0x0c = 182; m_mapAreas[0].m_unk0x10 = 427; m_mapAreas[0].m_unk0x14 = 230; m_mapAreas[0].m_unk0x04 = 3; - m_mapAreas[1].m_presenter = (MxStillPresenter*) FindPresenter("MxStillPresenter", "Boat_A_Bitmap"); + m_mapAreas[1].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Boat_A_Bitmap"); m_mapAreas[1].m_unk0x08 = 304; m_mapAreas[1].m_unk0x0c = 225; m_mapAreas[1].m_unk0x10 = 350; m_mapAreas[1].m_unk0x14 = 268; m_mapAreas[1].m_unk0x04 = 10; - m_mapAreas[2].m_presenter = (MxStillPresenter*) FindPresenter("MxStillPresenter", "Race_A_Bitmap"); + m_mapAreas[2].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Race_A_Bitmap"); m_mapAreas[2].m_unk0x08 = 301; m_mapAreas[2].m_unk0x0c = 133; m_mapAreas[2].m_unk0x10 = 347; m_mapAreas[2].m_unk0x14 = 181; m_mapAreas[2].m_unk0x04 = 11; - m_mapAreas[3].m_presenter = (MxStillPresenter*) FindPresenter("MxStillPresenter", "Pizza_A_Bitmap"); + m_mapAreas[3].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Pizza_A_Bitmap"); m_mapAreas[3].m_unk0x08 = 289; m_mapAreas[3].m_unk0x0c = 182; m_mapAreas[3].m_unk0x10 = 335; m_mapAreas[3].m_unk0x14 = 225; m_mapAreas[3].m_unk0x04 = 12; - m_mapAreas[4].m_presenter = (MxStillPresenter*) FindPresenter("MxStillPresenter", "Gas_A_Bitmap"); + m_mapAreas[4].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Gas_A_Bitmap"); m_mapAreas[4].m_unk0x10 = 391; m_mapAreas[4].m_unk0x08 = 350; m_mapAreas[4].m_unk0x0c = 161; m_mapAreas[4].m_unk0x14 = 209; m_mapAreas[4].m_unk0x04 = 13; - m_mapAreas[5].m_presenter = (MxStillPresenter*) FindPresenter("MxStillPresenter", "Med_A_Bitmap"); + m_mapAreas[5].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Med_A_Bitmap"); m_mapAreas[5].m_unk0x08 = 392; m_mapAreas[5].m_unk0x0c = 130; m_mapAreas[5].m_unk0x10 = 438; m_mapAreas[5].m_unk0x14 = 176; m_mapAreas[5].m_unk0x04 = 14; - m_mapAreas[6].m_presenter = (MxStillPresenter*) FindPresenter("MxStillPresenter", "Cop_A_Bitmap"); + m_mapAreas[6].m_presenter = (MxStillPresenter*) Find("MxStillPresenter", "Cop_A_Bitmap"); m_mapAreas[6].m_unk0x08 = 396; m_mapAreas[6].m_unk0x0c = 229; m_mapAreas[6].m_unk0x10 = 442; m_mapAreas[6].m_unk0x14 = 272; m_mapAreas[6].m_unk0x04 = 15; - m_frameHotBitmap = (MxStillPresenter*) FindPresenter("MxStillPresenter", "FrameHot_Bitmap"); + m_frameHotBitmap = (MxStillPresenter*) Find("MxStillPresenter", "FrameHot_Bitmap"); FUN_10070dc0(TRUE); } diff --git a/LEGO1/lego/legoomni/src/isle/isle.cpp b/LEGO1/lego/legoomni/src/isle/isle.cpp index 7172a7a6..e26e0797 100644 --- a/LEGO1/lego/legoomni/src/isle/isle.cpp +++ b/LEGO1/lego/legoomni/src/isle/isle.cpp @@ -201,9 +201,9 @@ MxLong Isle::HandleTransitionEnd() } // FUNCTION: LEGO1 0x10032f10 -void Isle::VTable0x58(MxCore* p_object) +void Isle::Add(MxCore* p_object) { - LegoWorld::VTable0x58(p_object); + LegoWorld::Add(p_object); if (p_object->IsA("Pizza")) { m_pizza = (Pizza*) p_object; @@ -246,7 +246,7 @@ void Isle::VTable0x58(MxCore* p_object) // FUNCTION: LEGO1 0x10033050 void Isle::VTable0x6c(IslePathActor* p_actor) { - LegoWorld::EndAction(p_actor); + LegoWorld::Remove(p_actor); if (p_actor->IsA("Helicopter")) { m_helicopter = NULL; diff --git a/LEGO1/lego/legoomni/src/main/legoomni.cpp b/LEGO1/lego/legoomni/src/main/legoomni.cpp index a8d06b89..bd28f071 100644 --- a/LEGO1/lego/legoomni/src/main/legoomni.cpp +++ b/LEGO1/lego/legoomni/src/main/legoomni.cpp @@ -179,7 +179,7 @@ IslePathActor* GetCurrentVehicle() // FUNCTION: LEGO1 0x100157a0 LegoWorld* GetCurrentWorld() { - return LegoOmni::GetInstance()->GetCurrentOmniWorld(); + return LegoOmni::GetInstance()->GetCurrentWorld(); } // FUNCTION: LEGO1 0x100157b0 @@ -219,9 +219,9 @@ void FUN_10015860(const char*, MxU8) } // FUNCTION: LEGO1 0x100158c0 -LegoEntity* FindEntityByAtomIdOrEntityId(const MxAtomId& p_atom, MxS32 p_entityid) +LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid) { - return LegoOmni::GetInstance()->FindByEntityIdOrAtomId(p_atom, p_entityid); + return LegoOmni::GetInstance()->FindWorld(p_atom, p_entityid); } // FUNCTION: LEGO1 0x100158e0 @@ -612,11 +612,11 @@ void LegoOmni::RemoveWorld(const MxAtomId&, MxLong) } // FUNCTION: LEGO1 0x1005b0c0 -LegoEntity* LegoOmni::FindByEntityIdOrAtomId(const MxAtomId& p_atom, MxS32 p_entityid) +LegoWorld* LegoOmni::FindWorld(const MxAtomId& p_atom, MxS32 p_entityid) { if (m_worldList) { - LegoWorld* world; LegoWorldListCursor cursor(m_worldList); + LegoWorld* world; while (cursor.Next(world)) { if ((p_entityid == -1 || world->GetEntityId() == p_entityid) && @@ -635,21 +635,22 @@ void LegoOmni::DeleteObject(MxDSAction& p_dsAction) } // FUNCTION: LEGO1 0x1005b2f0 -MxEntity* LegoOmni::FindWorld(const char* p_id, MxS32 p_entityId, MxPresenter* p_presenter) +MxEntity* LegoOmni::AddToWorld(const char* p_id, MxS32 p_entityId, MxPresenter* p_presenter) { - LegoWorld* foundEntity = NULL; + LegoWorld* world = NULL; + if (strcmpi(p_id, g_current)) { - foundEntity = (LegoWorld*) FindByEntityIdOrAtomId(MxAtomId(p_id, e_lowerCase2), p_entityId); + world = FindWorld(MxAtomId(p_id, e_lowerCase2), p_entityId); } else { - foundEntity = this->m_currentWorld; + world = this->m_currentWorld; } - if (foundEntity != NULL) { - foundEntity->VTable0x58(p_presenter); + if (world != NULL) { + world->Add(p_presenter); } - return foundEntity; + return world; } // FUNCTION: LEGO1 0x1005b3a0 @@ -663,7 +664,7 @@ void LegoOmni::NotifyCurrentEntity(MxNotificationParam* p_param) MxBool LegoOmni::DoesEntityExist(MxDSAction& p_dsAction) { if (MxOmni::DoesEntityExist(p_dsAction)) { - if (FindByEntityIdOrAtomId(p_dsAction.GetAtomId(), p_dsAction.GetObjectId()) == NULL) { + if (FindWorld(p_dsAction.GetAtomId(), p_dsAction.GetObjectId()) == NULL) { return TRUE; } } @@ -673,11 +674,11 @@ MxBool LegoOmni::DoesEntityExist(MxDSAction& p_dsAction) // FUNCTION: LEGO1 0x1005b400 MxS32 LegoOmni::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value) { - if (GetCurrentWorld() == NULL) { + if (::GetCurrentWorld() == NULL) { return -1; } - return GetCurrentWorld()->GetCurrPathInfo(p_path, p_value); + return ::GetCurrentWorld()->GetCurrPathInfo(p_path, p_value); } // FUNCTION: LEGO1 0x1005b4f0 diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index 0167833d..6da994ec 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -173,6 +173,12 @@ void LegoAnimPresenter::Destroy() Destroy(FALSE); } +// FUNCTION: LEGO1 0x1006b8f0 +const char* LegoAnimPresenter::GetActionObjectName() +{ + return m_action->GetObjectName(); +} + // STUB: LEGO1 0x1006bac0 void LegoAnimPresenter::ParseExtra() { diff --git a/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp index db6e6a79..45098aac 100644 --- a/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp @@ -82,7 +82,7 @@ void LegoLocomotionAnimPresenter::ReadyTickle() LegoAnimPresenter::ReadyTickle(); if (m_currentWorld != NULL && m_currentTickleState == e_starting) { - m_currentWorld->VTable0x58(this); + m_currentWorld->Add(this); if (m_compositePresenter != NULL) { SendToCompositePresenter(Lego()); } diff --git a/LEGO1/lego/sources/roi/legoroi.h b/LEGO1/lego/sources/roi/legoroi.h index 2fb03c63..9b586353 100644 --- a/LEGO1/lego/sources/roi/legoroi.h +++ b/LEGO1/lego/sources/roi/legoroi.h @@ -40,6 +40,7 @@ class LegoROI : public ViewROI { void FUN_100a46b0(Matrix4& p_transform); void FUN_100a58f0(Matrix4& p_transform); + inline const char* GetUnknown0xe4() { return m_unk0xe4; } inline LegoEntity* GetUnknown0x104() { return m_unk0x104; } inline void SetUnknown0x104(LegoEntity* p_unk0x104) { m_unk0x104 = p_unk0x104; } @@ -47,9 +48,11 @@ class LegoROI : public ViewROI { // LegoROI::`scalar deleting destructor' private: - undefined m_pad[0x24]; // 0xe0 - LegoEntity* m_unk0x104; // 0x104 - int m_time; // 0x108 + undefined4 m_unk0xe0; // 0xe0 + const char* m_unk0xe4; // 0xe4 + undefined m_unk0xe8[0x1c]; // 0xe8 + LegoEntity* m_unk0x104; // 0x104 + int m_time; // 0x108 }; #endif // LEGOROI_H diff --git a/LEGO1/omni/include/mxdsobject.h b/LEGO1/omni/include/mxdsobject.h index 45a3b360..5fa1d4fb 100644 --- a/LEGO1/omni/include/mxdsobject.h +++ b/LEGO1/omni/include/mxdsobject.h @@ -51,6 +51,7 @@ class MxDSObject : public MxCore { inline Type GetType() const { return (Type) this->m_type; } inline const char* GetSourceName() const { return this->m_sourceName; } + inline const char* GetObjectName() const { return this->m_objectName; } inline MxU32 GetObjectId() { return this->m_objectId; } inline const MxAtomId& GetAtomId() { return this->m_atomId; } inline MxS16 GetUnknown24() { return this->m_unk0x24; } diff --git a/LEGO1/omni/include/mxomni.h b/LEGO1/omni/include/mxomni.h index d92f2b38..9ba344b7 100644 --- a/LEGO1/omni/include/mxomni.h +++ b/LEGO1/omni/include/mxomni.h @@ -48,7 +48,7 @@ class MxOmni : public MxCore { virtual void DeleteObject(MxDSAction& p_dsAction); // vtable+24 virtual MxBool DoesEntityExist(MxDSAction& p_dsAction); // vtable+28 virtual MxResult CreatePresenter(MxStreamController* p_controller, MxDSAction& p_action); // vtable+2c - virtual MxEntity* FindWorld(const char*, MxS32, MxPresenter*); // vtable+30 + virtual MxEntity* AddToWorld(const char*, MxS32, MxPresenter*); // vtable+30 virtual void NotifyCurrentEntity(MxNotificationParam* p_param); // vtable+34 virtual void StartTimer(); // vtable+38 virtual void StopTimer(); // vtable+3c diff --git a/LEGO1/omni/src/common/mxpresenter.cpp b/LEGO1/omni/src/common/mxpresenter.cpp index 9d074278..ab803493 100644 --- a/LEGO1/omni/src/common/mxpresenter.cpp +++ b/LEGO1/omni/src/common/mxpresenter.cpp @@ -94,7 +94,7 @@ void MxPresenter::ParseExtra() token = strtok(NULL, g_parseExtraTokens); MxS32 val = token ? atoi(token) : 0; - MxEntity* result = MxOmni::GetInstance()->FindWorld(buf, val, this); + MxEntity* result = MxOmni::GetInstance()->AddToWorld(buf, val, this); m_action->SetFlags(m_action->GetFlags() | MxDSAction::c_world); diff --git a/LEGO1/omni/src/main/mxomni.cpp b/LEGO1/omni/src/main/mxomni.cpp index f9fa5733..2b266b3b 100644 --- a/LEGO1/omni/src/main/mxomni.cpp +++ b/LEGO1/omni/src/main/mxomni.cpp @@ -113,7 +113,7 @@ MxOmni::MxOmni() } // FUNCTION: LEGO1 0x100aefb0 -MxEntity* MxOmni::FindWorld(const char*, MxS32, MxPresenter*) +MxEntity* MxOmni::AddToWorld(const char*, MxS32, MxPresenter*) { return NULL; }