Implement/match LegoAnimPresenter::FUN_10069b10 (#792)

This commit is contained in:
Christian Semmler 2024-04-13 09:55:26 -04:00 committed by GitHub
parent f5e81777bc
commit e43749c8bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 64 additions and 20 deletions

View file

@ -16,8 +16,8 @@ struct LegoAnimStructComparator {
// SIZE 0x08 // SIZE 0x08
struct LegoAnimStruct { struct LegoAnimStruct {
LegoROI* m_roi; // 0x00 LegoROI* m_roi; // 0x00
undefined4 m_unk0x04; // 0x04 MxU32 m_index; // 0x04
}; };
typedef map<const char*, LegoAnimStruct, LegoAnimStructComparator> LegoAnimPresenterMap; typedef map<const char*, LegoAnimStruct, LegoAnimStructComparator> LegoAnimPresenterMap;
@ -62,8 +62,8 @@ class LegoAnimPresenter : public MxVideoPresenter {
virtual void VTable0x94(); // vtable+0x94 virtual void VTable0x94(); // vtable+0x94
virtual void VTable0x98(); // vtable+0x98 virtual void VTable0x98(); // vtable+0x98
// STUB: LEGO1 0x1000c990 // FUNCTION: LEGO1 0x1000c990
virtual undefined4* VTable0x9c(undefined4& p_unk0x6c) virtual LegoROI** VTable0x9c(MxU32& p_unk0x6c)
{ {
p_unk0x6c = m_unk0x6c; p_unk0x6c = m_unk0x6c;
return m_unk0x68; return m_unk0x68;
@ -95,8 +95,8 @@ class LegoAnimPresenter : public MxVideoPresenter {
void FUN_1006c8a0(LegoBool); void FUN_1006c8a0(LegoBool);
LegoAnim* m_anim; // 0x64 LegoAnim* m_anim; // 0x64
undefined4* m_unk0x68; // 0x68 LegoROI** m_unk0x68; // 0x68
undefined4 m_unk0x6c; // 0x6c MxU32 m_unk0x6c; // 0x6c
LegoROIList* m_unk0x70; // 0x70 LegoROIList* m_unk0x70; // 0x70
LegoROIList* m_unk0x74; // 0x74 LegoROIList* m_unk0x74; // 0x74
MxMatrix* m_unk0x78; // 0x78 MxMatrix* m_unk0x78; // 0x78
@ -104,9 +104,9 @@ class LegoAnimPresenter : public MxVideoPresenter {
LegoWorld* m_currentWorld; // 0x80 LegoWorld* m_currentWorld; // 0x80
MxAtomId m_animAtom; // 0x84 MxAtomId m_animAtom; // 0x84
undefined4 m_unk0x88; // 0x88 undefined4 m_unk0x88; // 0x88
undefined4 m_unk0x8c; // 0x8c LegoROI** m_unk0x8c; // 0x8c
undefined4 m_unk0x90; // 0x90 const char** m_unk0x90; // 0x90
undefined m_unk0x94; // 0x94 MxU8 m_unk0x94; // 0x94
undefined m_unk0x95; // 0x95 undefined m_unk0x95; // 0x95
MxBool m_unk0x96; // 0x96 MxBool m_unk0x96; // 0x96
undefined m_unk0x97; // 0x97 undefined m_unk0x97; // 0x97
@ -121,6 +121,15 @@ class LegoAnimPresenter : public MxVideoPresenter {
// SYNTHETIC: LEGO1 0x10068650 // SYNTHETIC: LEGO1 0x10068650
// LegoAnimPresenter::`scalar deleting destructor' // LegoAnimPresenter::`scalar deleting destructor'
// TEMPLATE: LEGO1 0x10069d80
// _Tree<char const *,pair<char const * const,LegoAnimStruct>,map<char const *,LegoAnimStruct,LegoAnimStructComparator,allocator<LegoAnimStruct> >::_Kfn,LegoAnimStructComparator,allocator<LegoAnimStruct> >::~_Tree<char const *,pair<char const * const,LegoAni
// TEMPLATE: LEGO1 0x1006a320
// Map<char const *,LegoAnimStruct,LegoAnimStructComparator>::~Map<char const *,LegoAnimStruct,LegoAnimStructComparator>
// TEMPLATE: LEGO1 0x1006a370
// map<char const *,LegoAnimStruct,LegoAnimStructComparator,allocator<LegoAnimStruct> >::~map<char const *,LegoAnimStruct,LegoAnimStructComparator,allocator<LegoAnimStruct> >
// TEMPLATE: LEGO1 0x1006a750 // TEMPLATE: LEGO1 0x1006a750
// _Tree<char const *,pair<char const * const,LegoAnimStruct>,map<char const *,LegoAnimStruct,LegoAnimStructComparator,allocator<LegoAnimStruct> >::_Kfn,LegoAnimStructComparator,allocator<LegoAnimStruct> >::iterator::_Dec // _Tree<char const *,pair<char const * const,LegoAnimStruct>,map<char const *,LegoAnimStruct,LegoAnimStructComparator,allocator<LegoAnimStruct> >::_Kfn,LegoAnimStructComparator,allocator<LegoAnimStruct> >::iterator::_Dec

View file

@ -45,8 +45,8 @@ void LegoAnimPresenter::Init()
m_unk0x98 = 0; m_unk0x98 = 0;
m_animAtom.Clear(); m_animAtom.Clear();
m_unk0x9c = 0; m_unk0x9c = 0;
m_unk0x8c = 0; m_unk0x8c = NULL;
m_unk0x90 = 0; m_unk0x90 = NULL;
m_unk0x94 = 0; m_unk0x94 = 0;
m_unk0x96 = TRUE; m_unk0x96 = TRUE;
m_unk0xa0 = 0; m_unk0xa0 = 0;
@ -313,10 +313,45 @@ LegoROI* LegoAnimPresenter::FUN_100699e0(const LegoChar*)
return NULL; return NULL;
} }
// STUB: LEGO1 0x10069b10 // FUNCTION: LEGO1 0x10069b10
void LegoAnimPresenter::FUN_10069b10() void LegoAnimPresenter::FUN_10069b10()
{ {
// TODO LegoAnimPresenterMap map;
if (m_unk0x8c != NULL) {
memset(m_unk0x8c, 0, m_unk0x94 * sizeof(*m_unk0x8c));
}
FUN_1006a3c0(map, m_anim->GetRoot(), NULL);
if (m_unk0x68 != NULL) {
delete[] m_unk0x68;
m_unk0x6c = 0;
}
m_unk0x6c = 0;
m_unk0x68 = new LegoROI*[map.size() + 1];
memset(m_unk0x68, 0, (map.size() + 1) * sizeof(*m_unk0x68));
for (LegoAnimPresenterMap::iterator it = map.begin(); it != map.end();) {
MxU32 index = (*it).second.m_index;
m_unk0x68[index] = (*it).second.m_roi;
if (m_unk0x68[index]->GetName() != NULL) {
for (MxS32 i = 0; i < m_unk0x94; i++) {
if (m_unk0x8c[i] == NULL && m_unk0x90[i] != NULL) {
if (!strcmpi(m_unk0x90[i], m_unk0x68[index]->GetName())) {
m_unk0x8c[i] = m_unk0x68[index];
break;
}
}
}
}
delete[] const_cast<char*>((*it).first);
it++;
m_unk0x6c++;
}
} }
// FUNCTION: LEGO1 0x1006a3c0 // FUNCTION: LEGO1 0x1006a3c0
@ -384,10 +419,10 @@ void LegoAnimPresenter::FUN_1006a4f0(
it = p_map.find(p_und); it = p_map.find(p_und);
if (it == p_map.end()) { if (it == p_map.end()) {
LegoAnimStruct animStruct; LegoAnimStruct animStruct;
animStruct.m_unk0x04 = p_map.size() + 1; animStruct.m_index = p_map.size() + 1;
animStruct.m_roi = p_roi; animStruct.m_roi = p_roi;
p_data->SetUnknown0x20(animStruct.m_unk0x04); p_data->SetUnknown0x20(animStruct.m_index);
LegoChar* und = new LegoChar[strlen(p_und) + 1]; LegoChar* und = new LegoChar[strlen(p_und) + 1];
strcpy(und, p_und); strcpy(und, p_und);
@ -395,7 +430,7 @@ void LegoAnimPresenter::FUN_1006a4f0(
p_map[und] = animStruct; p_map[und] = animStruct;
} }
else { else {
p_data->SetUnknown0x20((*it).second.m_unk0x04); p_data->SetUnknown0x20((*it).second.m_index);
} }
} }
@ -469,12 +504,12 @@ void LegoAnimPresenter::StartingTickle()
m_unk0x78 = new MxMatrix(); m_unk0x78 = new MxMatrix();
CalcLocalTransform(m_action->GetLocation(), m_action->GetDirection(), m_action->GetUp(), *m_unk0x78); CalcLocalTransform(m_action->GetLocation(), m_action->GetDirection(), m_action->GetUp(), *m_unk0x78);
} }
else if (m_unk0x68) { else if (m_unk0x68 != NULL) {
MxU8* und = (MxU8*) m_unk0x68[1]; LegoROI* roi = m_unk0x68[1];
if (und) { if (roi != NULL) {
MxMatrix mat; MxMatrix mat;
mat = *(Matrix4*) (und + 0x10); mat = roi->GetLocal2World();
m_unk0x78 = new MxMatrix(mat); m_unk0x78 = new MxMatrix(mat);
} }
} }