From f5e81777bc12ffcbb00326f2d157fcd6e03503e0 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 13 Apr 2024 08:57:18 -0400 Subject: [PATCH] Implement LegoAnimPresenter::FUN_1006a3c0 (#791) --- .../lego/legoomni/include/legoanimpresenter.h | 3 +- .../lego/legoomni/src/paths/legoanimactor.cpp | 7 +-- .../legoomni/src/video/legoanimpresenter.cpp | 59 ++++++++++++++++++- 3 files changed, 61 insertions(+), 8 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index 5b6c62fc..f22e9ba9 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -85,8 +85,9 @@ class LegoAnimPresenter : public MxVideoPresenter { void FUN_100695c0(); LegoChar* FUN_100697c0(const LegoChar* p_und1, const LegoChar* p_und2); LegoBool FUN_100698b0(const CompoundObject& p_rois, const LegoChar* p_und2); + LegoROI* FUN_100699e0(const LegoChar*); void FUN_10069b10(); - void FUN_1006a3c0(LegoAnimPresenterMap& p_map, LegoTreeNode* p_root, LegoROI* p_roi); + void FUN_1006a3c0(LegoAnimPresenterMap& p_map, LegoTreeNode* p_node, LegoROI* p_roi); void FUN_1006a4f0(LegoAnimPresenterMap& p_map, LegoAnimNodeData* p_data, const LegoChar* p_und, LegoROI* p_roi); LegoBool FUN_1006aba0(); LegoBool FUN_1006abb0(LegoTreeNode*, undefined4); diff --git a/LEGO1/lego/legoomni/src/paths/legoanimactor.cpp b/LEGO1/lego/legoomni/src/paths/legoanimactor.cpp index d35578de..1bac6592 100644 --- a/LEGO1/lego/legoomni/src/paths/legoanimactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoanimactor.cpp @@ -104,11 +104,10 @@ MxResult LegoAnimActor::FUN_1001c360(float p_und, Matrix4& p_transform) } } else { - MxU32 i; LegoTreeNode* root = m_animMaps[m_curAnim]->m_AnimTreePtr->GetRoot(); m_roi->SetVisibility(TRUE); - for (i = 0; i < numROIs; i++) { + for (MxU32 i = 0; i < numROIs; i++) { LegoROI* roi = roiMap[i]; if (roi != NULL && m_roi != roi) { @@ -116,8 +115,8 @@ MxResult LegoAnimActor::FUN_1001c360(float p_und, Matrix4& p_transform) } } - for (i = 0; i < root->GetNumChildren(); i++) { - LegoROI::FUN_100a8e80(root->GetChild(i), p_transform, p_und, roiMap); + for (MxS32 j = 0; j < root->GetNumChildren(); j++) { + LegoROI::FUN_100a8e80(root->GetChild(j), p_transform, p_und, roiMap); } if (m_cameraFlag) { diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index c124409b..b5bb0163 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -306,16 +306,69 @@ LegoBool LegoAnimPresenter::FUN_100698b0(const CompoundObject& p_rois, const Leg return result; } +// STUB: LEGO1 0x100699e0 +LegoROI* LegoAnimPresenter::FUN_100699e0(const LegoChar*) +{ + // TODO + return NULL; +} + // STUB: LEGO1 0x10069b10 void LegoAnimPresenter::FUN_10069b10() { // TODO } -// STUB: LEGO1 0x1006a3c0 -void LegoAnimPresenter::FUN_1006a3c0(LegoAnimPresenterMap& p_map, LegoTreeNode* p_root, LegoROI* p_roi) +// FUNCTION: LEGO1 0x1006a3c0 +void LegoAnimPresenter::FUN_1006a3c0(LegoAnimPresenterMap& p_map, LegoTreeNode* p_node, LegoROI* p_roi) { - // TODO + LegoROI* roi = p_roi; + LegoChar* und = NULL; + LegoChar* und2 = NULL; + LegoAnimNodeData* data = (LegoAnimNodeData*) p_node->GetData(); + const LegoChar* name = data->GetName(); + + if (name != NULL && *name != '-') { + if (*name == '*') { + name = und2 = FUN_10069150(name); + } + + und = FUN_100697c0(name, p_roi != NULL ? p_roi->GetName() : NULL); + + if (p_roi == NULL) { + roi = FUN_100699e0(und); + + if (roi != NULL) { + FUN_1006a4f0(p_map, data, und, roi); + } + else { + data->SetUnknown0x20(0); + } + } + else { + LegoROI* roi2 = p_roi->FUN_100a8ce0(name, p_roi); + + if (roi2 != NULL) { + FUN_1006a4f0(p_map, data, und, roi2); + } + else { + if (FUN_100699e0(name) != NULL) { + FUN_1006a3c0(p_map, p_node, NULL); + delete[] und; + delete[] und2; + return; + } + } + } + } + + delete[] und; + delete[] und2; + + MxS32 count = p_node->GetNumChildren(); + for (MxS32 i = 0; i < count; i++) { + FUN_1006a3c0(p_map, p_node->GetChild(i), roi); + } } // FUNCTION: LEGO1 0x1006a4f0