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
This commit is contained in:
Christian Semmler 2024-01-26 16:00:02 -05:00 committed by GitHub
parent 0a672d2146
commit b6aac26269
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 154 additions and 91 deletions

View file

@ -20,7 +20,6 @@ class Act1State;
// VTABLE: LEGO1 0x100d6fb8 // VTABLE: LEGO1 0x100d6fb8
// SIZE 0x140 // SIZE 0x140
// Radio at 0x12c
class Isle : public LegoWorld { class Isle : public LegoWorld {
public: public:
Isle(); Isle();
@ -42,7 +41,7 @@ class Isle : public LegoWorld {
virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 virtual MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
virtual void VTable0x50() override; // vtable+50 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 // FUNCTION: LEGO1 0x10030900
virtual MxBool VTable0x5c() override { return TRUE; } // vtable+5c virtual MxBool VTable0x5c() override { return TRUE; } // vtable+5c
// FUNCTION: LEGO1 0x10033170 // FUNCTION: LEGO1 0x10033170

View file

@ -40,7 +40,7 @@ class LegoAnimPresenter : public MxVideoPresenter {
virtual void PutFrame() override; // vtable+0x6c virtual void PutFrame() override; // vtable+0x6c
virtual MxResult VTable0x88(MxStreamChunk* p_chunk); // vtable+0x88 virtual MxResult VTable0x88(MxStreamChunk* p_chunk); // vtable+0x88
// 6 more virtual functions here const char* GetActionObjectName();
protected: protected:
void Init(); void Init();

View file

@ -92,18 +92,18 @@ class LegoOmni : public MxOmni {
return !strcmp(p_name, LegoOmni::ClassName()) || MxOmni::IsA(p_name); return !strcmp(p_name, LegoOmni::ClassName()) || MxOmni::IsA(p_name);
} }
virtual void Init() override; // vtable+14 virtual void Init() override; // vtable+14
virtual MxResult Create(MxOmniCreateParam& p_param) override; // vtable+18 virtual MxResult Create(MxOmniCreateParam& p_param) override; // vtable+18
virtual void Destroy() override; // vtable+1c virtual void Destroy() override; // vtable+1c
virtual MxResult Start(MxDSAction* p_dsAction) override; // vtable+20 virtual MxResult Start(MxDSAction* p_dsAction) override; // vtable+20
virtual void DeleteObject(MxDSAction& p_dsAction) override; // vtable+24 virtual void DeleteObject(MxDSAction& p_dsAction) override; // vtable+24
virtual MxBool DoesEntityExist(MxDSAction& p_dsAction) override; // vtable+28 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 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 NotifyCurrentEntity(MxNotificationParam* p_param) override; // vtable+34
virtual void StartTimer() override; // vtable+38 virtual void StartTimer() override; // vtable+38
virtual void StopTimer() override; // vtable+3c 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 AddWorld(LegoWorld* p_world);
void FUN_1005b4f0(MxBool p_disable, MxU16 p_flags); void FUN_1005b4f0(MxBool p_disable, MxU16 p_flags);
@ -111,7 +111,7 @@ class LegoOmni : public MxOmni {
LegoSoundManager* GetSoundManager() { return (LegoSoundManager*) m_soundManager; } LegoSoundManager* GetSoundManager() { return (LegoSoundManager*) m_soundManager; }
LegoInputManager* GetInputManager() { return m_inputMgr; } LegoInputManager* GetInputManager() { return m_inputMgr; }
GifManager* GetGifManager() { return m_gifManager; } GifManager* GetGifManager() { return m_gifManager; }
LegoWorld* GetCurrentOmniWorld() { return m_currentWorld; } LegoWorld* GetCurrentWorld() { return m_currentWorld; }
LegoNavController* GetNavController() { return m_navController; } LegoNavController* GetNavController() { return m_navController; }
IslePathActor* GetCurrentVehicle() { return m_currentVehicle; } IslePathActor* GetCurrentVehicle() { return m_currentVehicle; }
LegoPlantManager* GetLegoPlantManager() { return m_plantManager; } LegoPlantManager* GetLegoPlantManager() { return m_plantManager; }
@ -174,7 +174,7 @@ LegoUnkSaveDataWriter* GetUnkSaveDataWriter();
GifManager* GetGifManager(); GifManager* GetGifManager();
void FUN_10015820(MxBool p_disable, MxU16 p_flags); void FUN_10015820(MxBool p_disable, MxU16 p_flags);
void FUN_10015860(const char*, MxU8); 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(); MxDSAction& GetCurrentAction();
void PlayMusic(MxU32 p_index); void PlayMusic(MxU32 p_index);

View file

@ -45,7 +45,7 @@ class LegoWorld : public LegoEntity {
virtual void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c virtual void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c
virtual void VTable0x50(); // vtable+0x50 virtual void VTable0x50(); // vtable+0x50
virtual LegoCameraController* VTable0x54(); // vtable+0x54 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 virtual MxBool VTable0x5c(); // vtable+0x5c
// FUNCTION: LEGO1 0x100010a0 // FUNCTION: LEGO1 0x100010a0
@ -58,28 +58,28 @@ class LegoWorld : public LegoEntity {
inline undefined4 GetUnknown0xec() { return m_unk0xec; } inline undefined4 GetUnknown0xec() { return m_unk0xec; }
undefined FUN_100220e0(); undefined FUN_100220e0();
void EndAction(MxCore* p_object); void Remove(MxCore* p_object);
void FUN_1001fc80(IslePathActor* p_actor); void FUN_1001fc80(IslePathActor* p_actor);
MxBool FUN_100727e0(MxU32, Mx3DPointFloat& p_loc, Mx3DPointFloat& p_dir, Mx3DPointFloat& p_up); 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); MxBool FUN_10072980(MxU32, Mx3DPointFloat& p_loc, Mx3DPointFloat& p_dir, Mx3DPointFloat& p_up);
void FUN_10073400(); void FUN_10073400();
void FUN_10073430(); void FUN_10073430();
MxS32 GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value); MxS32 GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value);
MxPresenter* FindPresenter(const char* p_presenter, const char* p_name); MxCore* Find(const char* p_class, const char* p_name);
MxCore* FUN_10021790(const MxAtomId& p_atom, MxS32 p_entityId); MxCore* Find(const MxAtomId& p_atom, MxS32 p_entityId);
// SYNTHETIC: LEGO1 0x1001dee0 // SYNTHETIC: LEGO1 0x1001dee0
// LegoWorld::`scalar deleting destructor' // LegoWorld::`scalar deleting destructor'
protected: protected:
LegoPathControllerList m_list0x68; // 0x68 LegoPathControllerList m_list0x68; // 0x68
MxPresenterList m_list0x80; // 0x80 MxPresenterList m_animPresenters; // 0x80
LegoCameraController* m_cameraController; // 0x98 LegoCameraController* m_cameraController; // 0x98
LegoEntityList* m_entityList; // 0x9c LegoEntityList* m_entityList; // 0x9c
MxCoreList* m_coreList; // 0xa0 MxCoreList* m_coreList; // 0xa0
undefined m_unk0xa4; // 0xa4 undefined m_unk0xa4; // 0xa4
MxPresenterSet m_set0xa8; // 0xa8 MxPresenterSet m_set0xa8; // 0xa8
MxPresenterList m_list0xb8; // 0xb8 MxPresenterList m_controlPresenters; // 0xb8
MxPresenterSet m_set0xd0; // 0xd0 MxPresenterSet m_set0xd0; // 0xd0
list<AutoROI*> m_list0xe0; // 0xe0 list<AutoROI*> m_list0xe0; // 0xe0
undefined4 m_unk0xec; // 0xec undefined4 m_unk0xec; // 0xec

View file

@ -41,7 +41,7 @@ MxResult Helicopter::Create(MxDSAction& p_dsAction)
} }
world = GetWorld(); world = GetWorld();
if (world) if (world)
world->VTable0x58(this); world->Add(this);
GetState(); GetState();
return result; return result;
} }

View file

@ -398,13 +398,13 @@ void LegoGameState::SetSomeEnumState(undefined4 p_state)
// FUNCTION: LEGO1 0x1003ceb0 // FUNCTION: LEGO1 0x1003ceb0
void LegoGameState::FUN_1003ceb0() void LegoGameState::FUN_1003ceb0()
{ {
if (FindEntityByAtomIdOrEntityId(*g_isleScript, 0)) { if (FindWorld(*g_isleScript, 0)) {
m_currentAct = 0; m_currentAct = 0;
} }
else if (FindEntityByAtomIdOrEntityId(*g_act2mainScript, 0)) { else if (FindWorld(*g_act2mainScript, 0)) {
m_currentAct = 1; m_currentAct = 1;
} }
else if (FindEntityByAtomIdOrEntityId(*g_act3Script, 0)) { else if (FindWorld(*g_act3Script, 0)) {
m_currentAct = 2; m_currentAct = 2;
} }
else { else {

View file

@ -99,7 +99,8 @@ void InvokeAction(Extra::ActionType p_actionId, MxAtomId& p_pAtom, int p_targetE
// FUNCTION: LEGO1 0x1003e670 // FUNCTION: LEGO1 0x1003e670
MxBool CheckIfEntityExists(MxBool p_enable, const char* p_filename, MxS32 p_entityId) 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) { if (world) {
world->VTable0x68(p_enable); world->VTable0x68(p_enable);
return TRUE; return TRUE;

View file

@ -71,7 +71,7 @@ void LegoEntity::SetWorld()
{ {
LegoWorld* world = GetCurrentWorld(); LegoWorld* world = GetCurrentWorld();
if (world != NULL && world != (LegoWorld*) this) { if (world != NULL && world != (LegoWorld*) this) {
world->VTable0x58(this); world->Add(this);
} }
} }

View file

@ -1,5 +1,6 @@
#include "legoworld.h" #include "legoworld.h"
#include "legoanimpresenter.h"
#include "legocontrolmanager.h" #include "legocontrolmanager.h"
#include "legoinputmanager.h" #include "legoinputmanager.h"
#include "legoomni.h" #include "legoomni.h"
@ -73,7 +74,7 @@ MxResult LegoWorld::Create(MxDSAction& p_dsAction)
} }
SetCurrentWorld(this); SetCurrentWorld(this);
ControlManager()->FUN_10028df0(&m_list0xb8); ControlManager()->FUN_10028df0(&m_controlPresenters);
} }
SetIsWorldActive(TRUE); SetIsWorldActive(TRUE);
@ -95,7 +96,7 @@ MxLong LegoWorld::Notify(MxParam& p_param)
switch (((MxNotificationParam&) p_param).GetNotification()) { switch (((MxNotificationParam&) p_param).GetNotification()) {
case c_notificationEndAction: { case c_notificationEndAction: {
MxPresenter* presenter = (MxPresenter*) ((MxEndActionNotificationParam&) p_param).GetSender(); MxPresenter* presenter = (MxPresenter*) ((MxEndActionNotificationParam&) p_param).GetSender();
EndAction(presenter); Remove(presenter);
ret = 1; ret = 1;
break; break;
} }
@ -152,24 +153,75 @@ MxS32 LegoWorld::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value)
} }
// STUB: LEGO1 0x10020220 // STUB: LEGO1 0x10020220
void LegoWorld::VTable0x58(MxCore* p_object) void LegoWorld::Add(MxCore* p_object)
{ {
// TODO // TODO
} }
// STUB: LEGO1 0x10020f10 // STUB: LEGO1 0x10020f10
void LegoWorld::EndAction(MxCore* p_object) void LegoWorld::Remove(MxCore* p_object)
{ {
// TODO
} }
// STUB: LEGO1 0x100213a0 // FUNCTION: LEGO1 0x100213a0
MxPresenter* LegoWorld::FindPresenter(const char* p_presenter, const char* p_name) 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 // 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); LegoEntityListCursor entityCursor(m_entityList);
LegoEntity* entity; LegoEntity* entity;
@ -179,19 +231,19 @@ MxCore* LegoWorld::FUN_10021790(const MxAtomId& p_atom, MxS32 p_entityId)
return entity; return entity;
} }
MxPresenterListCursor presenterCursor0xb8(&m_list0xb8); MxPresenterListCursor controlPresenterCursor(&m_controlPresenters);
MxPresenter* presenter; MxPresenter* presenter;
while (presenterCursor0xb8.Next(presenter)) { while (controlPresenterCursor.Next(presenter)) {
MxDSAction* action = presenter->GetAction(); MxDSAction* action = presenter->GetAction();
if (action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) if (action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId)
return presenter; return presenter;
} }
MxPresenterListCursor presenterCursor0x80(&m_list0x80); MxPresenterListCursor animPresenterCursor(&m_animPresenters);
while (presenterCursor0x80.Next(presenter)) { while (animPresenterCursor.Next(presenter)) {
MxDSAction* action = presenter->GetAction(); MxDSAction* action = presenter->GetAction();
if (action && action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId) if (action && action->GetAtomId() == p_atom && action->GetObjectId() == p_entityId)

View file

@ -165,7 +165,7 @@ void LegoWorldPresenter::VTable0x60(MxPresenter* p_presenter)
if (!p_presenter->IsA("LegoAnimPresenter") && !p_presenter->IsA("MxControlPresenter") && if (!p_presenter->IsA("LegoAnimPresenter") && !p_presenter->IsA("MxControlPresenter") &&
!p_presenter->IsA("MxCompositePresenter")) { !p_presenter->IsA("MxCompositePresenter")) {
p_presenter->SendToCompositePresenter(Lego()); p_presenter->SendToCompositePresenter(Lego());
((LegoWorld*) m_entity)->VTable0x58(p_presenter); ((LegoWorld*) m_entity)->Add(p_presenter);
} }
} }

View file

@ -305,8 +305,8 @@ void Infocenter::VTable0x50()
m_unk0x1d4 = 0; m_unk0x1d4 = 0;
m_unk0x1d6 = 0; m_unk0x1d6 = 0;
MxStillPresenter* bg = (MxStillPresenter*) FindPresenter("MxStillPresenter", "Background_Bitmap"); MxStillPresenter* bg = (MxStillPresenter*) Find("MxStillPresenter", "Background_Bitmap");
MxStillPresenter* bgRed = (MxStillPresenter*) FindPresenter("MxStillPresenter", "BackgroundRed_Bitmap"); MxStillPresenter* bgRed = (MxStillPresenter*) Find("MxStillPresenter", "BackgroundRed_Bitmap");
switch (GameState()->GetUnknown10()) { switch (GameState()->GetUnknown10()) {
case 0: case 0:
@ -365,73 +365,73 @@ void Infocenter::InitializeBitmaps()
{ {
m_radio.Initialize(TRUE); m_radio.Initialize(TRUE);
((MxPresenter*) FUN_10021790(m_atom, c_leftArrowCtl))->Enable(TRUE); ((MxPresenter*) Find(m_atom, c_leftArrowCtl))->Enable(TRUE);
((MxPresenter*) FUN_10021790(m_atom, c_rightArrowCtl))->Enable(TRUE); ((MxPresenter*) Find(m_atom, c_rightArrowCtl))->Enable(TRUE);
((MxPresenter*) FUN_10021790(m_atom, c_infoCtl))->Enable(TRUE); ((MxPresenter*) Find(m_atom, c_infoCtl))->Enable(TRUE);
((MxPresenter*) FUN_10021790(m_atom, c_boatCtl))->Enable(TRUE); ((MxPresenter*) Find(m_atom, c_boatCtl))->Enable(TRUE);
((MxPresenter*) FUN_10021790(m_atom, c_raceCtl))->Enable(TRUE); ((MxPresenter*) Find(m_atom, c_raceCtl))->Enable(TRUE);
((MxPresenter*) FUN_10021790(m_atom, c_pizzaCtl))->Enable(TRUE); ((MxPresenter*) Find(m_atom, c_pizzaCtl))->Enable(TRUE);
((MxPresenter*) FUN_10021790(m_atom, c_gasCtl))->Enable(TRUE); ((MxPresenter*) Find(m_atom, c_gasCtl))->Enable(TRUE);
((MxPresenter*) FUN_10021790(m_atom, c_medCtl))->Enable(TRUE); ((MxPresenter*) Find(m_atom, c_medCtl))->Enable(TRUE);
((MxPresenter*) FUN_10021790(m_atom, c_copCtl))->Enable(TRUE); ((MxPresenter*) Find(m_atom, c_copCtl))->Enable(TRUE);
((MxPresenter*) FUN_10021790(m_atom, c_mamaCtl))->Enable(TRUE); ((MxPresenter*) Find(m_atom, c_mamaCtl))->Enable(TRUE);
((MxPresenter*) FUN_10021790(m_atom, c_papaCtl))->Enable(TRUE); ((MxPresenter*) Find(m_atom, c_papaCtl))->Enable(TRUE);
((MxPresenter*) FUN_10021790(m_atom, c_pepperCtl))->Enable(TRUE); ((MxPresenter*) Find(m_atom, c_pepperCtl))->Enable(TRUE);
((MxPresenter*) FUN_10021790(m_atom, c_nickCtl))->Enable(TRUE); ((MxPresenter*) Find(m_atom, c_nickCtl))->Enable(TRUE);
((MxPresenter*) FUN_10021790(m_atom, c_lauraCtl))->Enable(TRUE); ((MxPresenter*) Find(m_atom, c_lauraCtl))->Enable(TRUE);
((MxPresenter*) FUN_10021790(m_atom, c_radioCtl))->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_unk0x08 = 391;
m_mapAreas[0].m_unk0x0c = 182; m_mapAreas[0].m_unk0x0c = 182;
m_mapAreas[0].m_unk0x10 = 427; m_mapAreas[0].m_unk0x10 = 427;
m_mapAreas[0].m_unk0x14 = 230; m_mapAreas[0].m_unk0x14 = 230;
m_mapAreas[0].m_unk0x04 = 3; 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_unk0x08 = 304;
m_mapAreas[1].m_unk0x0c = 225; m_mapAreas[1].m_unk0x0c = 225;
m_mapAreas[1].m_unk0x10 = 350; m_mapAreas[1].m_unk0x10 = 350;
m_mapAreas[1].m_unk0x14 = 268; m_mapAreas[1].m_unk0x14 = 268;
m_mapAreas[1].m_unk0x04 = 10; 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_unk0x08 = 301;
m_mapAreas[2].m_unk0x0c = 133; m_mapAreas[2].m_unk0x0c = 133;
m_mapAreas[2].m_unk0x10 = 347; m_mapAreas[2].m_unk0x10 = 347;
m_mapAreas[2].m_unk0x14 = 181; m_mapAreas[2].m_unk0x14 = 181;
m_mapAreas[2].m_unk0x04 = 11; 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_unk0x08 = 289;
m_mapAreas[3].m_unk0x0c = 182; m_mapAreas[3].m_unk0x0c = 182;
m_mapAreas[3].m_unk0x10 = 335; m_mapAreas[3].m_unk0x10 = 335;
m_mapAreas[3].m_unk0x14 = 225; m_mapAreas[3].m_unk0x14 = 225;
m_mapAreas[3].m_unk0x04 = 12; 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_unk0x10 = 391;
m_mapAreas[4].m_unk0x08 = 350; m_mapAreas[4].m_unk0x08 = 350;
m_mapAreas[4].m_unk0x0c = 161; m_mapAreas[4].m_unk0x0c = 161;
m_mapAreas[4].m_unk0x14 = 209; m_mapAreas[4].m_unk0x14 = 209;
m_mapAreas[4].m_unk0x04 = 13; 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_unk0x08 = 392;
m_mapAreas[5].m_unk0x0c = 130; m_mapAreas[5].m_unk0x0c = 130;
m_mapAreas[5].m_unk0x10 = 438; m_mapAreas[5].m_unk0x10 = 438;
m_mapAreas[5].m_unk0x14 = 176; m_mapAreas[5].m_unk0x14 = 176;
m_mapAreas[5].m_unk0x04 = 14; 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_unk0x08 = 396;
m_mapAreas[6].m_unk0x0c = 229; m_mapAreas[6].m_unk0x0c = 229;
m_mapAreas[6].m_unk0x10 = 442; m_mapAreas[6].m_unk0x10 = 442;
m_mapAreas[6].m_unk0x14 = 272; m_mapAreas[6].m_unk0x14 = 272;
m_mapAreas[6].m_unk0x04 = 15; m_mapAreas[6].m_unk0x04 = 15;
m_frameHotBitmap = (MxStillPresenter*) FindPresenter("MxStillPresenter", "FrameHot_Bitmap"); m_frameHotBitmap = (MxStillPresenter*) Find("MxStillPresenter", "FrameHot_Bitmap");
FUN_10070dc0(TRUE); FUN_10070dc0(TRUE);
} }

View file

@ -201,9 +201,9 @@ MxLong Isle::HandleTransitionEnd()
} }
// FUNCTION: LEGO1 0x10032f10 // 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")) { if (p_object->IsA("Pizza")) {
m_pizza = (Pizza*) p_object; m_pizza = (Pizza*) p_object;
@ -246,7 +246,7 @@ void Isle::VTable0x58(MxCore* p_object)
// FUNCTION: LEGO1 0x10033050 // FUNCTION: LEGO1 0x10033050
void Isle::VTable0x6c(IslePathActor* p_actor) void Isle::VTable0x6c(IslePathActor* p_actor)
{ {
LegoWorld::EndAction(p_actor); LegoWorld::Remove(p_actor);
if (p_actor->IsA("Helicopter")) { if (p_actor->IsA("Helicopter")) {
m_helicopter = NULL; m_helicopter = NULL;

View file

@ -179,7 +179,7 @@ IslePathActor* GetCurrentVehicle()
// FUNCTION: LEGO1 0x100157a0 // FUNCTION: LEGO1 0x100157a0
LegoWorld* GetCurrentWorld() LegoWorld* GetCurrentWorld()
{ {
return LegoOmni::GetInstance()->GetCurrentOmniWorld(); return LegoOmni::GetInstance()->GetCurrentWorld();
} }
// FUNCTION: LEGO1 0x100157b0 // FUNCTION: LEGO1 0x100157b0
@ -219,9 +219,9 @@ void FUN_10015860(const char*, MxU8)
} }
// FUNCTION: LEGO1 0x100158c0 // 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 // FUNCTION: LEGO1 0x100158e0
@ -612,11 +612,11 @@ void LegoOmni::RemoveWorld(const MxAtomId&, MxLong)
} }
// FUNCTION: LEGO1 0x1005b0c0 // 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) { if (m_worldList) {
LegoWorld* world;
LegoWorldListCursor cursor(m_worldList); LegoWorldListCursor cursor(m_worldList);
LegoWorld* world;
while (cursor.Next(world)) { while (cursor.Next(world)) {
if ((p_entityid == -1 || world->GetEntityId() == p_entityid) && if ((p_entityid == -1 || world->GetEntityId() == p_entityid) &&
@ -635,21 +635,22 @@ void LegoOmni::DeleteObject(MxDSAction& p_dsAction)
} }
// FUNCTION: LEGO1 0x1005b2f0 // 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)) { 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 { else {
foundEntity = this->m_currentWorld; world = this->m_currentWorld;
} }
if (foundEntity != NULL) { if (world != NULL) {
foundEntity->VTable0x58(p_presenter); world->Add(p_presenter);
} }
return foundEntity; return world;
} }
// FUNCTION: LEGO1 0x1005b3a0 // FUNCTION: LEGO1 0x1005b3a0
@ -663,7 +664,7 @@ void LegoOmni::NotifyCurrentEntity(MxNotificationParam* p_param)
MxBool LegoOmni::DoesEntityExist(MxDSAction& p_dsAction) MxBool LegoOmni::DoesEntityExist(MxDSAction& p_dsAction)
{ {
if (MxOmni::DoesEntityExist(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; return TRUE;
} }
} }
@ -673,11 +674,11 @@ MxBool LegoOmni::DoesEntityExist(MxDSAction& p_dsAction)
// FUNCTION: LEGO1 0x1005b400 // FUNCTION: LEGO1 0x1005b400
MxS32 LegoOmni::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value) MxS32 LegoOmni::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value)
{ {
if (GetCurrentWorld() == NULL) { if (::GetCurrentWorld() == NULL) {
return -1; return -1;
} }
return GetCurrentWorld()->GetCurrPathInfo(p_path, p_value); return ::GetCurrentWorld()->GetCurrPathInfo(p_path, p_value);
} }
// FUNCTION: LEGO1 0x1005b4f0 // FUNCTION: LEGO1 0x1005b4f0

View file

@ -173,6 +173,12 @@ void LegoAnimPresenter::Destroy()
Destroy(FALSE); Destroy(FALSE);
} }
// FUNCTION: LEGO1 0x1006b8f0
const char* LegoAnimPresenter::GetActionObjectName()
{
return m_action->GetObjectName();
}
// STUB: LEGO1 0x1006bac0 // STUB: LEGO1 0x1006bac0
void LegoAnimPresenter::ParseExtra() void LegoAnimPresenter::ParseExtra()
{ {

View file

@ -82,7 +82,7 @@ void LegoLocomotionAnimPresenter::ReadyTickle()
LegoAnimPresenter::ReadyTickle(); LegoAnimPresenter::ReadyTickle();
if (m_currentWorld != NULL && m_currentTickleState == e_starting) { if (m_currentWorld != NULL && m_currentTickleState == e_starting) {
m_currentWorld->VTable0x58(this); m_currentWorld->Add(this);
if (m_compositePresenter != NULL) { if (m_compositePresenter != NULL) {
SendToCompositePresenter(Lego()); SendToCompositePresenter(Lego());
} }

View file

@ -40,6 +40,7 @@ class LegoROI : public ViewROI {
void FUN_100a46b0(Matrix4& p_transform); void FUN_100a46b0(Matrix4& p_transform);
void FUN_100a58f0(Matrix4& p_transform); void FUN_100a58f0(Matrix4& p_transform);
inline const char* GetUnknown0xe4() { return m_unk0xe4; }
inline LegoEntity* GetUnknown0x104() { return m_unk0x104; } inline LegoEntity* GetUnknown0x104() { return m_unk0x104; }
inline void SetUnknown0x104(LegoEntity* p_unk0x104) { m_unk0x104 = p_unk0x104; } inline void SetUnknown0x104(LegoEntity* p_unk0x104) { m_unk0x104 = p_unk0x104; }
@ -47,9 +48,11 @@ class LegoROI : public ViewROI {
// LegoROI::`scalar deleting destructor' // LegoROI::`scalar deleting destructor'
private: private:
undefined m_pad[0x24]; // 0xe0 undefined4 m_unk0xe0; // 0xe0
LegoEntity* m_unk0x104; // 0x104 const char* m_unk0xe4; // 0xe4
int m_time; // 0x108 undefined m_unk0xe8[0x1c]; // 0xe8
LegoEntity* m_unk0x104; // 0x104
int m_time; // 0x108
}; };
#endif // LEGOROI_H #endif // LEGOROI_H

View file

@ -51,6 +51,7 @@ class MxDSObject : public MxCore {
inline Type GetType() const { return (Type) this->m_type; } inline Type GetType() const { return (Type) this->m_type; }
inline const char* GetSourceName() const { return this->m_sourceName; } 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 MxU32 GetObjectId() { return this->m_objectId; }
inline const MxAtomId& GetAtomId() { return this->m_atomId; } inline const MxAtomId& GetAtomId() { return this->m_atomId; }
inline MxS16 GetUnknown24() { return this->m_unk0x24; } inline MxS16 GetUnknown24() { return this->m_unk0x24; }

View file

@ -48,7 +48,7 @@ class MxOmni : public MxCore {
virtual void DeleteObject(MxDSAction& p_dsAction); // vtable+24 virtual void DeleteObject(MxDSAction& p_dsAction); // vtable+24
virtual MxBool DoesEntityExist(MxDSAction& p_dsAction); // vtable+28 virtual MxBool DoesEntityExist(MxDSAction& p_dsAction); // vtable+28
virtual MxResult CreatePresenter(MxStreamController* p_controller, MxDSAction& p_action); // vtable+2c 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 NotifyCurrentEntity(MxNotificationParam* p_param); // vtable+34
virtual void StartTimer(); // vtable+38 virtual void StartTimer(); // vtable+38
virtual void StopTimer(); // vtable+3c virtual void StopTimer(); // vtable+3c

View file

@ -94,7 +94,7 @@ void MxPresenter::ParseExtra()
token = strtok(NULL, g_parseExtraTokens); token = strtok(NULL, g_parseExtraTokens);
MxS32 val = token ? atoi(token) : 0; 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); m_action->SetFlags(m_action->GetFlags() | MxDSAction::c_world);

View file

@ -113,7 +113,7 @@ MxOmni::MxOmni()
} }
// FUNCTION: LEGO1 0x100aefb0 // FUNCTION: LEGO1 0x100aefb0
MxEntity* MxOmni::FindWorld(const char*, MxS32, MxPresenter*) MxEntity* MxOmni::AddToWorld(const char*, MxS32, MxPresenter*)
{ {
return NULL; return NULL;
} }