From b789a15d0b764b9b65230412e5a01612fdd91233 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 24 Apr 2024 08:51:20 -0400 Subject: [PATCH] Implement/match LegoAnimPresenter::FUN_1006b900 (#844) --- .../lego/legoomni/include/legoanimpresenter.h | 2 +- .../legoomni/src/video/legoanimpresenter.cpp | 24 ++++++++++++++++--- LEGO1/lego/sources/roi/legoroi.cpp | 15 ++++++++---- LEGO1/lego/sources/roi/legoroi.h | 3 ++- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index 0c2f3dcf..02a81b37 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -97,7 +97,7 @@ class LegoAnimPresenter : public MxVideoPresenter { LegoBool FUN_1006aba0(); MxBool FUN_1006abb0(LegoTreeNode* p_node, LegoROI* p_roi); void FUN_1006ac90(); - void FUN_1006b900(LegoAnim* p_anim, MxS32 p_und, MxMatrix* p_matrix); + void FUN_1006b900(LegoAnim* p_anim, MxLong p_time, Matrix4* p_matrix); void FUN_1006b9a0(LegoAnim* p_anim, MxLong p_time, Matrix4* p_matrix); void FUN_1006c8a0(MxBool p_bool); diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index 87cf6ae6..892bc06f 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -741,11 +741,29 @@ const char* LegoAnimPresenter::GetActionObjectName() return m_action->GetObjectName(); } -// STUB: LEGO1 0x1006b900 +// FUNCTION: LEGO1 0x1006b900 // FUNCTION: BETA10 0x100510d8 -void LegoAnimPresenter::FUN_1006b900(LegoAnim* p_anim, MxS32 p_und, MxMatrix* p_matrix) +void LegoAnimPresenter::FUN_1006b900(LegoAnim* p_anim, MxLong p_time, Matrix4* p_matrix) { - // TODO + LegoTreeNode* root = p_anim->GetRoot(); + MxMatrix mat; + LegoAnimNodeData* data = (LegoAnimNodeData*) root->GetData(); + + if (p_matrix != NULL) { + mat = *p_matrix; + } + else { + LegoROI* roi = m_roiMap[data->GetUnknown0x20()]; + + if (roi != NULL) { + mat = roi->GetLocal2World(); + } + else { + mat.SetIdentity(); + } + } + + LegoROI::FUN_100a8fd0(root, mat, p_time, m_roiMap); } // FUNCTION: LEGO1 0x1006b9a0 diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index c18b5de6..0bbed5da 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -405,14 +405,14 @@ LegoResult LegoROI::FUN_100a8da0(LegoTreeNode* p_node, const Matrix4& p_matrix, } // FUNCTION: LEGO1 0x100a8e80 -void LegoROI::FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_rois) +void LegoROI::FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap) { MxMatrix mat; LegoAnimNodeData* data = (LegoAnimNodeData*) p_node->GetData(); FUN_100a8cb0(data, p_time, mat); - LegoROI* roi = p_rois[data->GetUnknown0x20()]; + LegoROI* roi = p_roiMap[data->GetUnknown0x20()]; if (roi != NULL) { roi->m_local2world.Product(mat, p_matrix); roi->VTable0x1c(); @@ -421,7 +421,7 @@ void LegoROI::FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_t roi->SetVisibility(und); for (LegoU32 i = 0; i < p_node->GetNumChildren(); i++) { - FUN_100a8e80(p_node->GetChild(i), roi->m_local2world, p_time, p_rois); + FUN_100a8e80(p_node->GetChild(i), roi->m_local2world, p_time, p_roiMap); } } else { @@ -429,11 +429,18 @@ void LegoROI::FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_t local2world.Product(mat, p_matrix); for (LegoU32 i = 0; i < p_node->GetNumChildren(); i++) { - FUN_100a8e80(p_node->GetChild(i), local2world, p_time, p_rois); + FUN_100a8e80(p_node->GetChild(i), local2world, p_time, p_roiMap); } } } +// STUB: LEGO1 0x100a8fd0 +// FUNCTION: BETA10 0x1018ac81 +void LegoROI::FUN_100a8fd0(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap) +{ + // TODO +} + // FUNCTION: LEGO1 0x100a90f0 LegoResult LegoROI::SetFrame(LegoAnim* p_anim, LegoTime p_time) { diff --git a/LEGO1/lego/sources/roi/legoroi.h b/LEGO1/lego/sources/roi/legoroi.h index 34b5f809..64002d30 100644 --- a/LEGO1/lego/sources/roi/legoroi.h +++ b/LEGO1/lego/sources/roi/legoroi.h @@ -32,7 +32,8 @@ class LegoROI : public ViewROI { ); LegoROI* FindChildROI(const LegoChar* p_name, LegoROI* p_roi); LegoResult FUN_100a8da0(LegoTreeNode* p_node, const Matrix4& p_matrix, LegoTime p_time, LegoROI* p_roi); - static void FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_rois); + static void FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap); + static void FUN_100a8fd0(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap); LegoResult SetFrame(LegoAnim* p_anim, LegoTime p_time); LegoResult FUN_100a9170(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha); LegoResult FUN_100a9210(LegoTextureInfo* p_textureInfo);