Implement/match LegoWorld::Remove (#491)

* Implement/match LegoWorld::Remove

* Fix comparison

* Match 100%
This commit is contained in:
Christian Semmler 2024-01-27 10:10:09 -05:00 committed by GitHub
parent 7b6ec235d8
commit 4df7dee037
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 89 additions and 26 deletions

View file

@ -74,7 +74,7 @@ class LegoCacheSoundListCursor : public MxPtrListCursor<LegoCacheSound> {
// SYNTHETIC: LEGO1 0x1001f350 // SYNTHETIC: LEGO1 0x1001f350
// LegoCacheSoundListCursor::`scalar deleting destructor' // LegoCacheSoundListCursor::`scalar deleting destructor'
// FUNCTION: LEGO1 0x1001f3c0 // TEMPLATE: LEGO1 0x1001f3c0
// MxPtrListCursor<LegoCacheSound>::~MxPtrListCursor<LegoCacheSound> // MxPtrListCursor<LegoCacheSound>::~MxPtrListCursor<LegoCacheSound>
// SYNTHETIC: LEGO1 0x1001f410 // SYNTHETIC: LEGO1 0x1001f410
@ -83,7 +83,7 @@ class LegoCacheSoundListCursor : public MxPtrListCursor<LegoCacheSound> {
// SYNTHETIC: LEGO1 0x1001f480 // SYNTHETIC: LEGO1 0x1001f480
// MxPtrListCursor<LegoCacheSound>::`scalar deleting destructor' // MxPtrListCursor<LegoCacheSound>::`scalar deleting destructor'
// FUNCTION: LEGO1 0x1001f4f0 // TEMPLATE: LEGO1 0x1001f4f0
// MxListCursor<LegoCacheSound *>::~MxListCursor<LegoCacheSound *> // MxListCursor<LegoCacheSound *>::~MxListCursor<LegoCacheSound *>
// FUNCTION: LEGO1 0x1001f540 // FUNCTION: LEGO1 0x1001f540
@ -95,4 +95,10 @@ class LegoCacheSoundListCursor : public MxPtrListCursor<LegoCacheSound> {
// TEMPLATE: LEGO1 0x100224e0 // TEMPLATE: LEGO1 0x100224e0
// MxList<LegoCacheSound *>::InsertEntry // MxList<LegoCacheSound *>::InsertEntry
// TEMPLATE: LEGO1 0x10022590
// MxListCursor<LegoCacheSound *>::Find
// TEMPLATE: LEGO1 0x10022680
// MxList<LegoCacheSound *>::DeleteEntry
#endif // LEGOCACHESOUNDLIST_H #endif // LEGOCACHESOUNDLIST_H

View file

@ -95,4 +95,7 @@ class LegoEntityListCursor : public MxPtrListCursor<LegoEntity> {
// TEMPLATE: LEGO1 0x10022430 // TEMPLATE: LEGO1 0x10022430
// MxList<LegoEntity *>::InsertEntry // MxList<LegoEntity *>::InsertEntry
// TEMPLATE: LEGO1 0x10022630
// MxList<LegoEntity *>::DeleteEntry
#endif // LEGOENTITYLIST_H #endif // LEGOENTITYLIST_H

View file

@ -15,7 +15,7 @@ class LegoPathBoundary;
class LegoHideAnimPresenter; class LegoHideAnimPresenter;
struct CoreSetCompare { struct CoreSetCompare {
MxS32 operator()(MxCore* const& p_a, MxCore* const& p_b) const { return p_a > p_b; } MxS32 operator()(MxCore* const& p_a, MxCore* const& p_b) const { return (MxS32) p_a < (MxS32) p_b; }
}; };
typedef set<MxCore*, CoreSetCompare> MxCoreSet; typedef set<MxCore*, CoreSetCompare> MxCoreSet;
@ -122,27 +122,6 @@ class LegoWorld : public LegoEntity {
// TEMPLATE: LEGO1 0x1001df00 // TEMPLATE: LEGO1 0x1001df00
// Set<MxCore *,CoreSetCompare>::~Set<MxCore *,CoreSetCompare> // Set<MxCore *,CoreSetCompare>::~Set<MxCore *,CoreSetCompare>
// SYNTHETIC: LEGO1 0x1001eed0
// MxPresenterListCursor::`scalar deleting destructor'
// TEMPLATE: LEGO1 0x1001ef40
// MxPtrListCursor<MxPresenter>::~MxPtrListCursor<MxPresenter>
// SYNTHETIC: LEGO1 0x1001ef90
// MxListCursor<MxPresenter *>::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x1001f000
// MxPtrListCursor<MxPresenter>::`scalar deleting destructor'
// TEMPLATE: LEGO1 0x1001f070
// MxListCursor<MxPresenter *>::~MxListCursor<MxPresenter *>
// FUNCTION: LEGO1 0x1001f0c0
// MxPresenterListCursor::~MxPresenterListCursor
// TEMPLATE: LEGO1 0x10020760
// MxListCursor<MxPresenter *>::MxListCursor<MxPresenter *>
// TEMPLATE: LEGO1 0x100208b0 // TEMPLATE: LEGO1 0x100208b0
// _Tree<MxCore *,MxCore *,set<MxCore *,CoreSetCompare,allocator<MxCore *> >::_Kfn,CoreSetCompare,allocator<MxCore *> >::insert // _Tree<MxCore *,MxCore *,set<MxCore *,CoreSetCompare,allocator<MxCore *> >::_Kfn,CoreSetCompare,allocator<MxCore *> >::insert
@ -163,6 +142,9 @@ class LegoWorld : public LegoEntity {
// TEMPLATE: LEGO1 0x10020eb0 // TEMPLATE: LEGO1 0x10020eb0
// _Tree<MxCore *,MxCore *,set<MxCore *,CoreSetCompare,allocator<MxCore *> >::_Kfn,CoreSetCompare,allocator<MxCore *> >::_Rrotate // _Tree<MxCore *,MxCore *,set<MxCore *,CoreSetCompare,allocator<MxCore *> >::_Kfn,CoreSetCompare,allocator<MxCore *> >::_Rrotate
// TEMPLATE: LEGO1 0x10021340
// _Tree<MxCore *,MxCore *,set<MxCore *,CoreSetCompare,allocator<MxCore *> >::_Kfn,CoreSetCompare,allocator<MxCore *> >::find
// TEMPLATE: LEGO1 0x10022360 // TEMPLATE: LEGO1 0x10022360
// _Construct // _Construct

View file

@ -7,6 +7,7 @@
#include "legoutil.h" #include "legoutil.h"
#include "legovideomanager.h" #include "legovideomanager.h"
#include "mxactionnotificationparam.h" #include "mxactionnotificationparam.h"
#include "mxcontrolpresenter.h"
#include "mxnotificationmanager.h" #include "mxnotificationmanager.h"
#include "mxnotificationparam.h" #include "mxnotificationparam.h"
#include "mxomni.h" #include "mxomni.h"
@ -215,10 +216,57 @@ void LegoWorld::Add(MxCore* p_object)
} }
} }
// STUB: LEGO1 0x10020f10 // FUNCTION: LEGO1 0x10020f10
void LegoWorld::Remove(MxCore* p_object) void LegoWorld::Remove(MxCore* p_object)
{ {
// TODO if (p_object) {
MxCoreSet::iterator it;
if (p_object->IsA("MxControlPresenter")) {
MxPresenterListCursor cursor(&m_controlPresenters);
if (cursor.Find((MxControlPresenter*) p_object)) {
cursor.Detach();
((MxControlPresenter*) p_object)->GetAction()->SetOrigin(Lego());
((MxControlPresenter*) p_object)->VTable0x68(TRUE);
}
}
else if (p_object->IsA("LegoLocomotionAnimPresenter") || p_object->IsA("LegoHideAnimPresenter") || p_object->IsA("LegoLoopingAnimPresenter")) {
MxPresenterListCursor cursor(&m_animPresenters);
if (cursor.Find((MxPresenter*) p_object))
cursor.Detach();
if (p_object->IsA("LegoHideAnimPresenter"))
m_hideAnimPresenter = NULL;
}
else if (p_object->IsA("MxEntity")) {
if (p_object->IsA("LegoPathActor"))
FUN_1001fc80((IslePathActor*) p_object);
if (m_entityList) {
LegoEntityListCursor cursor(m_entityList);
if (cursor.Find((LegoEntity*) p_object))
cursor.Detach();
}
}
else if (p_object->IsA("LegoCacheSound")) {
LegoCacheSoundListCursor cursor(m_cacheSoundList);
if (cursor.Find((LegoCacheSound*) p_object))
cursor.Detach();
}
else {
it = m_set0xa8.find(p_object);
if (it != m_set0xa8.end())
m_set0xa8.erase(it);
}
it = m_set0xd0.find(p_object);
if (it != m_set0xd0.end())
m_set0xd0.erase(it);
}
} }
// FUNCTION: LEGO1 0x100213a0 // FUNCTION: LEGO1 0x100213a0

View file

@ -71,7 +71,31 @@ class MxPresenterListCursor : public MxPtrListCursor<MxPresenter> {
// SYNTHETIC: LEGO1 0x1001d100 // SYNTHETIC: LEGO1 0x1001d100
// MxPresenterList::~MxPresenterList // MxPresenterList::~MxPresenterList
// SYNTHETIC: LEGO1 0x1001eed0
// MxPresenterListCursor::`scalar deleting destructor'
// TEMPLATE: LEGO1 0x1001ef40
// MxPtrListCursor<MxPresenter>::~MxPtrListCursor<MxPresenter>
// SYNTHETIC: LEGO1 0x1001ef90
// MxListCursor<MxPresenter *>::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x1001f000
// MxPtrListCursor<MxPresenter>::`scalar deleting destructor'
// TEMPLATE: LEGO1 0x1001f070
// MxListCursor<MxPresenter *>::~MxListCursor<MxPresenter *>
// FUNCTION: LEGO1 0x1001f0c0
// MxPresenterListCursor::~MxPresenterListCursor
// TEMPLATE: LEGO1 0x10020760
// MxListCursor<MxPresenter *>::MxListCursor<MxPresenter *>
// TEMPLATE: LEGO1 0x10022380 // TEMPLATE: LEGO1 0x10022380
// MxList<MxPresenter *>::InsertEntry // MxList<MxPresenter *>::InsertEntry
// TEMPLATE: LEGO1 0x100225e0
// MxList<MxPresenter *>::DeleteEntry
#endif // MXPRESENTERLIST_H #endif // MXPRESENTERLIST_H