Implement/match LegoPartPresenter::Store (#643)

This commit is contained in:
Christian Semmler 2024-03-09 13:03:21 -05:00 committed by GitHub
parent 9f875d01e5
commit 6fa4a0dbec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 95 additions and 7 deletions

View file

@ -25,6 +25,37 @@ class LegoLODList : public MxPtrList<LegoLOD> {
// LegoLODList::`scalar deleting destructor'
};
// VTABLE: LEGO1 0x100d9df0
// class MxListCursor<LegoLOD *>
// VTABLE: LEGO1 0x100d9e08
// class MxPtrListCursor<LegoLOD>
// VTABLE: LEGO1 0x100d9e20
// SIZE 0x10
class LegoLODListCursor : public MxPtrListCursor<LegoLOD> {
public:
LegoLODListCursor(LegoLODList* p_list) : MxPtrListCursor<LegoLOD>(p_list) {}
};
// SYNTHETIC: LEGO1 0x1007d9b0
// LegoLODListCursor::`scalar deleting destructor'
// FUNCTION: LEGO1 0x1007da20
// MxPtrListCursor<LegoLOD>::~MxPtrListCursor<LegoLOD>
// SYNTHETIC: LEGO1 0x1007da70
// MxListCursor<LegoLOD *>::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x1007dae0
// MxPtrListCursor<LegoLOD>::`scalar deleting destructor'
// FUNCTION: LEGO1 0x1007db50
// MxListCursor<LegoLOD *>::~MxListCursor<LegoLOD *>
// FUNCTION: LEGO1 0x1007dba0
// LegoLODListCursor::~LegoLODListCursor
// TEMPLATE: LEGO1 0x1007d480
// MxCollection<LegoLOD *>::Compare

View file

@ -15,7 +15,6 @@ class LegoNamedPart {
~LegoNamedPart() { delete m_list; }
const MxString* GetName() const { return &m_name; }
LegoLODList* GetList() { return m_list; }
private:

View file

@ -23,6 +23,37 @@ class LegoNamedPartList : public MxPtrList<LegoNamedPart> {
// LegoNamedPartList::`scalar deleting destructor'
};
// VTABLE: LEGO1 0x100d9e68
// class MxListCursor<LegoNamedPart *>
// VTABLE: LEGO1 0x100d9e38
// class MxPtrListCursor<LegoNamedPart>
// VTABLE: LEGO1 0x100d9e50
// SIZE 0x10
class LegoNamedPartListCursor : public MxPtrListCursor<LegoNamedPart> {
public:
LegoNamedPartListCursor(LegoNamedPartList* p_list) : MxPtrListCursor<LegoNamedPart>(p_list) {}
};
// SYNTHETIC: LEGO1 0x1007e170
// LegoNamedPartListCursor::`scalar deleting destructor'
// FUNCTION: LEGO1 0x1007e1e0
// MxPtrListCursor<LegoNamedPart>::~MxPtrListCursor<LegoNamedPart>
// SYNTHETIC: LEGO1 0x1007e230
// MxListCursor<LegoNamedPart *>::`scalar deleting destructor'
// SYNTHETIC: LEGO1 0x1007e2a0
// MxPtrListCursor<LegoNamedPart>::`scalar deleting destructor'
// FUNCTION: LEGO1 0x1007e310
// MxListCursor<LegoNamedPart *>::~MxListCursor<LegoNamedPart *>
// FUNCTION: LEGO1 0x1007e360
// LegoNamedPartListCursor::~LegoNamedPartListCursor
// TEMPLATE: LEGO1 0x1007d760
// MxCollection<LegoNamedPart *>::Compare

View file

@ -38,7 +38,7 @@ class LegoPartPresenter : public MxMediaPresenter {
inline void Reset() { m_parts = NULL; }
MxResult Read(MxDSChunk& p_chunk);
void FUN_1007df20();
void Store();
private:
void Destroy(MxBool p_fromDestructor);

View file

@ -246,7 +246,7 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world)
LegoPartPresenter partPresenter;
if (partPresenter.Read(chunk) == SUCCESS) {
partPresenter.FUN_1007df20();
partPresenter.Store();
}
delete[] buff;
@ -335,7 +335,7 @@ MxResult LegoWorldPresenter::FUN_10067360(ModelDbPart& p_part, FILE* p_wdbFile)
result = partPresenter.Read(chunk);
if (result == SUCCESS) {
partPresenter.FUN_1007df20();
partPresenter.Store();
}
delete[] buff;

View file

@ -5,6 +5,7 @@
#include "misc/legocontainer.h"
#include "misc/legostorage.h"
#include "misc/legotexture.h"
#include "viewmanager/viewlodlist.h"
DECOMP_SIZE_ASSERT(LegoLODList, 0x18)
DECOMP_SIZE_ASSERT(LegoNamedPart, 0x14)
@ -216,8 +217,34 @@ void LegoPartPresenter::ReadyTickle()
// TODO
}
// STUB: LEGO1 0x1007df20
void LegoPartPresenter::FUN_1007df20()
// FUNCTION: LEGO1 0x1007df20
void LegoPartPresenter::Store()
{
// TODO
LegoNamedPartListCursor partCursor(m_parts);
LegoNamedPart* part;
while (partCursor.Next(part)) {
ViewLODList* lodList = GetViewLODListManager()->Lookup(part->GetName()->GetData());
if (lodList == NULL) {
lodList = GetViewLODListManager()->Create(part->GetName()->GetData(), part->GetList()->GetCount());
LegoLODListCursor lodCursor(part->GetList());
LegoLOD* lod;
while (lodCursor.First(lod)) {
lodCursor.Detach();
lodList->PushBack(lod);
}
}
else {
lodList->Release();
}
}
if (m_parts != NULL) {
delete m_parts;
}
m_parts = NULL;
}