This commit is contained in:
Misha 2024-01-28 15:41:58 -05:00
parent ee840f09aa
commit 5c7872cbc0
No known key found for this signature in database
GPG Key ID: 8441D12AEF33FED8
3 changed files with 49 additions and 25 deletions

View File

@ -105,7 +105,7 @@ class LegoOmni : public MxOmni {
LegoWorld* FindWorld(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 DeleteEntity(LegoEntity* p_entity); void DeleteWorld(LegoWorld* p_world);
void FUN_1005b4f0(MxBool p_disable, MxU16 p_flags); void FUN_1005b4f0(MxBool p_disable, MxU16 p_flags);
LegoVideoManager* GetVideoManager() { return (LegoVideoManager*) m_videoManager; } LegoVideoManager* GetVideoManager() { return (LegoVideoManager*) m_videoManager; }

View File

@ -485,12 +485,6 @@ MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId)
return NULL; return NULL;
} }
// STUB: LEGO1 0x10021790
MxCore* LegoWorld::FUN_10021790(const MxAtomId& p_atom, MxS32 p_objectId)
{
return NULL;
}
// STUB: LEGO1 0x10021a70 // STUB: LEGO1 0x10021a70
void LegoWorld::VTable0x68(MxBool p_add) void LegoWorld::VTable0x68(MxBool p_add)
{ {

View File

@ -606,15 +606,44 @@ void LegoOmni::AddWorld(LegoWorld* p_world)
m_worldList->Append(p_world); m_worldList->Append(p_world);
} }
// STUB: LEGO1 0x1005adb0 // FUNCTION: LEGO1 0x1005adb0
void LegoOmni::DeleteEntity(LegoEntity* p_entity) void LegoOmni::DeleteWorld(LegoWorld* p_world)
{ {
if (m_worldList) {
LegoWorldListCursor cursor(m_worldList);
while (cursor.Find(p_world)) {
cursor.Detach();
if (m_currentWorld == p_world) {
m_currentWorld = NULL;
}
delete p_world;
break;
}
}
} }
// STUB: LEGO1 0x1005af10 // FUNCTION: LEGO1 0x1005af10
void LegoOmni::RemoveWorld(const MxAtomId&, MxLong) void LegoOmni::RemoveWorld(const MxAtomId& p_atom, MxLong p_objectId)
{ {
// TODO if (m_worldList) {
LegoWorldListCursor cursor(m_worldList);
LegoWorldListCursor cursor2(m_worldList); // not sure why there are 2 cursors used.
LegoWorld* world;
while (cursor.Next(world)) {
{
if ((p_objectId == -1 || world->GetEntityId() == p_objectId) &&
(!p_atom.GetInternal() || world->GetAtom() == p_atom)) {
cursor.Detach();
delete world;
}
}
}
}
} }
// FUNCTION: LEGO1 0x1005b0c0 // FUNCTION: LEGO1 0x1005b0c0
@ -638,25 +667,26 @@ LegoWorld* LegoOmni::FindWorld(const MxAtomId& p_atom, MxS32 p_entityid)
void LegoOmni::DeleteObject(MxDSAction& p_dsAction) void LegoOmni::DeleteObject(MxDSAction& p_dsAction)
{ {
if (p_dsAction.GetAtomId().GetInternal() != NULL) { if (p_dsAction.GetAtomId().GetInternal() != NULL) {
LegoEntity* entity = FindByEntityIdOrAtomId(p_dsAction.GetAtomId(), p_dsAction.GetObjectId()); LegoWorld* world = FindWorld(p_dsAction.GetAtomId(), p_dsAction.GetObjectId());
if (entity) { if (world) {
DeleteEntity(entity); DeleteWorld(world);
return; return;
} }
if (m_currentWorld != NULL) { if (m_currentWorld != NULL) {
MxCore* entity2 = m_currentWorld->FUN_10021790(p_dsAction.GetAtomId(), p_dsAction.GetObjectId()); MxCore* entity = m_currentWorld->Find(p_dsAction.GetAtomId(), p_dsAction.GetObjectId());
m_currentWorld->EndAction(entity2); if (entity) {
m_currentWorld->Remove(entity);
if (entity2->IsA("MxPresenter")) {
Streamer()->FUN_100b98f0(((MxPresenter*) entity2)->GetAction());
((MxPresenter*) entity2)->EndAction();
if (entity->IsA("MxPresenter")) {
Streamer()->FUN_100b98f0(((MxPresenter*) entity)->GetAction());
((MxPresenter*) entity)->EndAction();
}
else {
delete entity;
}
return;
} }
else {
delete entity2;
}
return;
} }
} }
MxOmni::DeleteObject(p_dsAction); MxOmni::DeleteObject(p_dsAction);