Implement/match LegoAnimPresenter::FUN_1006a4f0 (#789)

This commit is contained in:
Christian Semmler 2024-04-12 11:53:22 -04:00 committed by GitHub
parent 4374891ac8
commit dc3259bb17
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 110 additions and 39 deletions

View file

@ -10,6 +10,18 @@ class LegoWorld;
class LegoAnimClass; class LegoAnimClass;
class LegoAnimActor; class LegoAnimActor;
struct LegoAnimStructComparator {
MxBool operator()(const char* const& p_a, const char* const& p_b) const { return strcmp(p_a, p_b) < 0; }
};
// SIZE 0x08
struct LegoAnimStruct {
LegoROI* m_roi; // 0x00
undefined4 m_unk0x04; // 0x04
};
typedef map<const char*, LegoAnimStruct, LegoAnimStructComparator> LegoAnimPresenterMap;
// VTABLE: LEGO1 0x100d90c8 // VTABLE: LEGO1 0x100d90c8
// SIZE 0xbc // SIZE 0xbc
class LegoAnimPresenter : public MxVideoPresenter { class LegoAnimPresenter : public MxVideoPresenter {
@ -74,6 +86,8 @@ class LegoAnimPresenter : public MxVideoPresenter {
LegoChar* FUN_100697c0(const LegoChar* p_und1, const LegoChar* p_und2); LegoChar* FUN_100697c0(const LegoChar* p_und1, const LegoChar* p_und2);
LegoBool FUN_100698b0(const CompoundObject& p_rois, const LegoChar* p_und2); LegoBool FUN_100698b0(const CompoundObject& p_rois, const LegoChar* p_und2);
void FUN_10069b10(); void FUN_10069b10();
void FUN_1006a3c0(LegoAnimPresenterMap& p_map, LegoTreeNode* p_root, LegoROI* p_roi);
void FUN_1006a4f0(LegoAnimPresenterMap& p_map, LegoAnimNodeData* p_data, const LegoChar* p_und, LegoROI* p_roi);
LegoBool FUN_1006aba0(); LegoBool FUN_1006aba0();
LegoBool FUN_1006abb0(LegoTreeNode*, undefined4); LegoBool FUN_1006abb0(LegoTreeNode*, undefined4);
void FUN_1006ac90(); void FUN_1006ac90();
@ -102,7 +116,18 @@ class LegoAnimPresenter : public MxVideoPresenter {
Mx3DPointFloat m_unk0xa8; // 0xa8 Mx3DPointFloat m_unk0xa8; // 0xa8
}; };
// clang-format off
// SYNTHETIC: LEGO1 0x10068650 // SYNTHETIC: LEGO1 0x10068650
// LegoAnimPresenter::`scalar deleting destructor' // LegoAnimPresenter::`scalar deleting destructor'
// TEMPLATE: LEGO1 0x1006a750
// _Tree<char const *,pair<char const * const,LegoAnimStruct>,map<char const *,LegoAnimStruct,LegoAnimStructComparator,allocator<LegoAnimStruct> >::_Kfn,LegoAnimStructComparator,allocator<LegoAnimStruct> >::iterator::_Dec
// TEMPLATE: LEGO1 0x1006a7a0
// _Tree<char const *,pair<char const * const,LegoAnimStruct>,map<char const *,LegoAnimStruct,LegoAnimStructComparator,allocator<LegoAnimStruct> >::_Kfn,LegoAnimStructComparator,allocator<LegoAnimStruct> >::_Insert
// GLOBAL: LEGO1 0x100f7688
// _Tree<char const *,pair<char const * const,LegoAnimStruct>,map<char const *,LegoAnimStruct,LegoAnimStructComparator,allocator<LegoAnimStruct> >::_Kfn,LegoAnimStructComparator,allocator<LegoAnimStruct> >::_Nil
// clang-format on
#endif // LEGOANIMPRESENTER_H #endif // LEGOANIMPRESENTER_H

View file

@ -13,7 +13,6 @@ class LegoROI;
#pragma warning(disable : 4237) #pragma warning(disable : 4237)
// TODO: generic string comparator?
struct LegoCharacterComparator { struct LegoCharacterComparator {
MxBool operator()(const char* const& p_a, const char* const& p_b) const { return strcmpi(p_a, p_b) < 0; } MxBool operator()(const char* const& p_a, const char* const& p_b) const { return strcmpi(p_a, p_b) < 0; }
}; };
@ -115,6 +114,15 @@ class LegoCharacterManager {
// TEMPLATE: LEGO1 0x10085500 // TEMPLATE: LEGO1 0x10085500
// _Tree<char const *,pair<char const * const,LegoCharacter *>,map<char const *,LegoCharacter *,LegoCharacterComparator,allocator<LegoCharacter *> >::_Kfn,LegoCharacterComparator,allocator<LegoCharacter *> >::insert // _Tree<char const *,pair<char const * const,LegoCharacter *>,map<char const *,LegoCharacter *,LegoCharacterComparator,allocator<LegoCharacter *> >::_Kfn,LegoCharacterComparator,allocator<LegoCharacter *> >::insert
// TEMPLATE: LEGO1 0x10085790
// _Tree<char const *,pair<char const * const,LegoCharacter *>,map<char const *,LegoCharacter *,LegoCharacterComparator,allocator<LegoCharacter *> >::_Kfn,LegoCharacterComparator,allocator<LegoCharacter *> >::_Buynode
// TEMPLATE: LEGO1 0x100857b0
// _Tree<char const *,pair<char const * const,LegoCharacter *>,map<char const *,LegoCharacter *,LegoCharacterComparator,allocator<LegoCharacter *> >::_Kfn,LegoCharacterComparator,allocator<LegoCharacter *> >::_Lrotate
// TEMPLATE: LEGO1 0x10085810
// _Tree<char const *,pair<char const * const,LegoCharacter *>,map<char const *,LegoCharacter *,LegoCharacterComparator,allocator<LegoCharacter *> >::_Kfn,LegoCharacterComparator,allocator<LegoCharacter *> >::_Rrotate
// GLOBAL: LEGO1 0x100fc508 // GLOBAL: LEGO1 0x100fc508
// _Tree<char const *,pair<char const * const,LegoCharacter *>,map<char const *,LegoCharacter *,LegoCharacterComparator,allocator<LegoCharacter *> >::_Kfn,LegoCharacterComparator,allocator<LegoCharacter *> >::_Nil // _Tree<char const *,pair<char const * const,LegoCharacter *>,map<char const *,LegoCharacter *,LegoCharacterComparator,allocator<LegoCharacter *> >::_Kfn,LegoCharacterComparator,allocator<LegoCharacter *> >::_Nil
// clang-format on // clang-format on

View file

@ -312,6 +312,40 @@ void LegoAnimPresenter::FUN_10069b10()
// TODO // TODO
} }
// STUB: LEGO1 0x1006a3c0
void LegoAnimPresenter::FUN_1006a3c0(LegoAnimPresenterMap& p_map, LegoTreeNode* p_root, LegoROI* p_roi)
{
// TODO
}
// FUNCTION: LEGO1 0x1006a4f0
void LegoAnimPresenter::FUN_1006a4f0(
LegoAnimPresenterMap& p_map,
LegoAnimNodeData* p_data,
const LegoChar* p_und,
LegoROI* p_roi
)
{
LegoAnimPresenterMap::iterator it;
it = p_map.find(p_und);
if (it == p_map.end()) {
LegoAnimStruct animStruct;
animStruct.m_unk0x04 = p_map.size() + 1;
animStruct.m_roi = p_roi;
p_data->SetUnknown0x20(animStruct.m_unk0x04);
LegoChar* und = new LegoChar[strlen(p_und) + 1];
strcpy(und, p_und);
p_map[und] = animStruct;
}
else {
p_data->SetUnknown0x20((*it).second.m_unk0x04);
}
}
// FUNCTION: LEGO1 0x1006aba0 // FUNCTION: LEGO1 0x1006aba0
LegoBool LegoAnimPresenter::FUN_1006aba0() LegoBool LegoAnimPresenter::FUN_1006aba0()
{ {
@ -368,7 +402,10 @@ void LegoAnimPresenter::StartingTickle()
FUN_100692b0(); FUN_100692b0();
FUN_100695c0(); FUN_100695c0();
if ((m_unk0x7c & c_bit2) == 0 || FUN_1006aba0()) { if (m_unk0x7c & c_bit2 && !FUN_1006aba0()) {
goto done;
}
FUN_10069b10(); FUN_10069b10();
FUN_1006c8a0(TRUE); FUN_1006c8a0(TRUE);
@ -406,8 +443,8 @@ void LegoAnimPresenter::StartingTickle()
} }
VTable0x8c(); VTable0x8c();
}
done:
if (m_unk0x70 != NULL) { if (m_unk0x70 != NULL) {
delete m_unk0x70; delete m_unk0x70;
m_unk0x70 = NULL; m_unk0x70 = NULL;

View file

@ -128,6 +128,7 @@ class LegoAnimNodeData : public LegoTreeNodeData {
void SetRotationIndex(LegoU32 p_rotationIndex) { m_rotationIndex = p_rotationIndex; } void SetRotationIndex(LegoU32 p_rotationIndex) { m_rotationIndex = p_rotationIndex; }
void SetScaleIndex(LegoU32 p_scaleIndex) { m_scaleIndex = p_scaleIndex; } void SetScaleIndex(LegoU32 p_scaleIndex) { m_scaleIndex = p_scaleIndex; }
void SetMorphIndex(LegoU32 p_morphIndex) { m_morphIndex = p_morphIndex; } void SetMorphIndex(LegoU32 p_morphIndex) { m_morphIndex = p_morphIndex; }
void SetUnknown0x20(undefined2 p_unk0x20) { m_unk0x20 = p_unk0x20; }
LegoResult CreateLocalTransform(LegoTime p_time, Matrix4& p_matrix) LegoResult CreateLocalTransform(LegoTime p_time, Matrix4& p_matrix)
{ {