diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 6e4e724e..10e85e0d 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -29,7 +29,7 @@ jobs: - name: Install python libraries shell: bash run: | - pip install black pylint pytest -r tools/requirements.txt + pip install black==23.* pylint==3.* pytest==7.* -r tools/requirements.txt - name: Run pylint and black shell: bash diff --git a/LEGO1/lego/legoomni/include/helicopterstate.h b/LEGO1/lego/legoomni/include/helicopterstate.h index eb104c93..52a92192 100644 --- a/LEGO1/lego/legoomni/include/helicopterstate.h +++ b/LEGO1/lego/legoomni/include/helicopterstate.h @@ -21,8 +21,15 @@ class HelicopterState : public LegoState { return !strcmp(p_name, HelicopterState::ClassName()) || LegoState::IsA(p_name); } - virtual MxBool VTable0x14() override; // vtable+0x14 - virtual MxBool SetFlag() override; // vtable+0x18 + // FUNCTION: LEGO1 0x1000e0b0 + virtual MxBool VTable0x14() override { return FALSE; }; // vtable+0x14 + + // FUNCTION: LEGO1 0x1000e0c0 + virtual MxBool SetFlag() override + { + m_unk0x8 = 0; + return TRUE; + }; // vtable+0x18 inline void SetUnknown8(MxU32 p_unk0x8) { m_unk0x8 = p_unk0x8; } inline MxU32 GetUnkown8() { return m_unk0x8; } diff --git a/LEGO1/lego/legoomni/include/legoentitylist.h b/LEGO1/lego/legoomni/include/legoentitylist.h index 1d29e65d..04935769 100644 --- a/LEGO1/lego/legoomni/include/legoentitylist.h +++ b/LEGO1/lego/legoomni/include/legoentitylist.h @@ -86,7 +86,10 @@ class LegoEntityListCursor : public MxPtrListCursor { // FUNCTION: LEGO1 0x1001f2b0 // MxListCursor::~MxListCursor -// FUNCTION: LEGO1 0x1001edc6 +// FUNCTION: LEGO1 0x1001f300 // 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 90aedfd6..3ef5c26d 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); MxCore* FUN_100213a0(const char* p_class, const char* p_name); - MxPresenter* FUN_10021790(MxAtomId& p_atom, MxS32 p_entityId); + MxCore* FUN_10021790(const MxAtomId& p_atom, MxS32 p_entityId); // SYNTHETIC: LEGO1 0x1001dee0 // LegoWorld::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/src/build/helicopterstate.cpp b/LEGO1/lego/legoomni/src/build/helicopterstate.cpp index 368edfad..70d71a0c 100644 --- a/LEGO1/lego/legoomni/src/build/helicopterstate.cpp +++ b/LEGO1/lego/legoomni/src/build/helicopterstate.cpp @@ -1,15 +1 @@ #include "helicopterstate.h" - -// STUB: LEGO1 0x1000e0b0 -MxBool HelicopterState::VTable0x14() -{ - // TODO - return FALSE; -} - -// STUB: LEGO1 0x1000e0c0 -MxBool HelicopterState::SetFlag() -{ - // TODO - return FALSE; -} diff --git a/LEGO1/lego/legoomni/src/build/racecar.cpp b/LEGO1/lego/legoomni/src/build/racecar.cpp index 02f3a09d..a057b8a4 100644 --- a/LEGO1/lego/legoomni/src/build/racecar.cpp +++ b/LEGO1/lego/legoomni/src/build/racecar.cpp @@ -1,17 +1,21 @@ #include "racecar.h" +#include "legocontrolmanager.h" +#include "legoomni.h" + DECOMP_SIZE_ASSERT(RaceCar, 0x164); // FUNCTION: LEGO1 0x10028200 RaceCar::RaceCar() { - this->m_unk0x13c = 40.0; + m_unk0x13c = 40.0; } -// STUB: LEGO1 0x10028420 +// FUNCTION: LEGO1 0x10028420 RaceCar::~RaceCar() { - // TODO + ControlManager()->Unregister(this); + VTable0xe4(); } // STUB: LEGO1 0x10028490 diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index 0f7cf937..695df6e4 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -219,9 +219,48 @@ MxCore* LegoWorld::FUN_100213a0(const char* p_class, const char* p_name) } } -// STUB: LEGO1 0x10021790 -MxPresenter* LegoWorld::FUN_10021790(MxAtomId& p_atom, MxS32 p_entityId) +// FUNCTION: LEGO1 0x10021790 +MxCore* LegoWorld::FUN_10021790(const 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)) { + MxDSAction* action = presenter->GetAction(); + + if (action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) + return presenter; + } + + MxPresenterListCursor presenterCursor0x80(&m_list0x80); + + while (presenterCursor0x80.Next(presenter)) { + MxDSAction* action = presenter->GetAction(); + + if (action && action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) + return presenter; + } + + for (MxPresenterSet::iterator it = m_set0xa8.begin(); it != m_set0xa8.end(); it++) { + MxCore* core = *it; + + if (core->IsA("MxPresenter")) { + MxPresenter* presenter = (MxPresenter*) *it; + MxDSAction* action = presenter->GetAction(); + + if (action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) + return *it; + } + } + return NULL; } diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp index 2df59474..0c64a294 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*) FUN_100213a0("MxStillPresenter", "Info_A_Bitmap"); m_mapAreas[0].m_unk0x08 = 391;