From 33192c668379f4921e9079127c5b072ef09fc838 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 26 Jan 2024 09:45:19 -0500 Subject: [PATCH] Implement/match LegoWorld::FUN_10021790 --- LEGO1/lego/legoomni/include/legoentitylist.h | 3 ++ LEGO1/lego/legoomni/include/legoworld.h | 2 +- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 37 ++++++++++++++++++- .../legoomni/src/infocenter/infocenter.cpp | 30 +++++++-------- 4 files changed, 54 insertions(+), 18 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoentitylist.h b/LEGO1/lego/legoomni/include/legoentitylist.h index 1d29e65d..05533684 100644 --- a/LEGO1/lego/legoomni/include/legoentitylist.h +++ b/LEGO1/lego/legoomni/include/legoentitylist.h @@ -89,4 +89,7 @@ class LegoEntityListCursor : public MxPtrListCursor { // FUNCTION: LEGO1 0x1001edc6 // LegoEntityListCursor::~LegoEntityListCursor +// TEMPLATE: LEGO1 0x100207d0 +// MxListCursor::MxListCursor + #endif // LEGOENTITYLIST_H diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 115aeef4..ef0e9c15 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -66,7 +66,7 @@ class LegoWorld : public LegoEntity { void FUN_10073430(); MxS32 GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value); MxPresenter* FindPresenter(const char* p_presenter, const char* p_name); - MxPresenter* FUN_10021790(MxAtomId& p_atom, MxS32 p_entityId); + MxCore* FUN_10021790(MxAtomId& p_atom, MxS32 p_entityId); // SYNTHETIC: LEGO1 0x1001dee0 // LegoWorld::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index 60cb941d..93c3f649 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -168,9 +168,42 @@ MxPresenter* LegoWorld::FindPresenter(const char* p_presenter, const char* p_nam return NULL; } -// STUB: LEGO1 0x10021790 -MxPresenter* LegoWorld::FUN_10021790(MxAtomId& p_atom, MxS32 p_entityId) +// FUNCTION: LEGO1 0x10021790 +MxCore* LegoWorld::FUN_10021790(MxAtomId& p_atom, MxS32 p_entityId) { + LegoEntityListCursor entityCursor(m_entityList); + LegoEntity* entity; + + while (entityCursor.Next(entity)) { + if (entity->GetAtom() == p_atom && entity->GetEntityId() == p_entityId) + return entity; + } + + MxPresenterListCursor presenterCursor0xb8(&m_list0xb8); + MxPresenter* presenter; + + while (presenterCursor0xb8.Next(presenter)) { + if (presenter->GetAction()->GetAtomId() == p_atom && presenter->GetAction()->GetObjectId() == p_entityId) + return presenter; + } + + MxPresenterListCursor presenterCursor0x80(&m_list0x80); + + while (presenterCursor0x80.Next(presenter)) { + if (presenter->GetAction() && presenter->GetAction()->GetAtomId() == p_atom && + presenter->GetAction()->GetObjectId() == p_entityId) + return presenter; + } + + for (MxPresenterSet::iterator it = m_set0xa8.begin(); it != m_set0xa8.end(); it++) { + MxCore* core = *it; + if (core->IsA("MxPresenter")) { + presenter = (MxPresenter*) *it; + if (presenter->GetAction()->GetAtomId() == p_atom && presenter->GetAction()->GetObjectId() == p_entityId) + return presenter; + } + } + return NULL; } diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp index 5d3722c1..6b14b8af 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp @@ -365,22 +365,22 @@ void Infocenter::InitializeBitmaps() { m_radio.Initialize(TRUE); - FUN_10021790(m_atom, c_leftArrowCtl)->Enable(TRUE); - FUN_10021790(m_atom, c_rightArrowCtl)->Enable(TRUE); - FUN_10021790(m_atom, c_infoCtl)->Enable(TRUE); - FUN_10021790(m_atom, c_boatCtl)->Enable(TRUE); - FUN_10021790(m_atom, c_raceCtl)->Enable(TRUE); - FUN_10021790(m_atom, c_pizzaCtl)->Enable(TRUE); - FUN_10021790(m_atom, c_gasCtl)->Enable(TRUE); - FUN_10021790(m_atom, c_medCtl)->Enable(TRUE); - FUN_10021790(m_atom, c_copCtl)->Enable(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); - FUN_10021790(m_atom, c_mamaCtl)->Enable(TRUE); - FUN_10021790(m_atom, c_papaCtl)->Enable(TRUE); - FUN_10021790(m_atom, c_pepperCtl)->Enable(TRUE); - FUN_10021790(m_atom, c_nickCtl)->Enable(TRUE); - FUN_10021790(m_atom, c_lauraCtl)->Enable(TRUE); - FUN_10021790(m_atom, c_radioCtl)->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); m_mapAreas[0].m_presenter = (MxStillPresenter*) FindPresenter("MxStillPresenter", "Info_A_Bitmap"); m_mapAreas[0].m_unk0x08 = 391;