From dcc42c33d85c94dee077902ba2c28103978dc70c Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 14 Apr 2024 11:46:56 -0400 Subject: [PATCH] Implement/match LegoROI::FUN_100a8e80 (#801) --- LEGO1/lego/sources/roi/legoroi.cpp | 30 +++++++++++++++++++++++++++--- LEGO1/lego/sources/roi/legoroi.h | 2 +- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index d4649093..e5f5e490 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -404,10 +404,34 @@ LegoResult LegoROI::FUN_100a8da0(LegoTreeNode* p_node, const Matrix4& p_matrix, return SUCCESS; } -// STUB: LEGO1 0x100a8e80 -void LegoROI::FUN_100a8e80(LegoTreeNode*, Matrix4&, LegoTime, LegoROI**) +// FUNCTION: LEGO1 0x100a8e80 +void LegoROI::FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_rois) { - // TODO + MxMatrix mat; + + LegoAnimNodeData* data = (LegoAnimNodeData*) p_node->GetData(); + FUN_100a8cb0(data, p_time, mat); + + LegoROI* roi = p_rois[data->GetUnknown0x20()]; + if (roi != NULL) { + roi->m_local2world.Product(mat, p_matrix); + roi->VTable0x1c(); + + LegoBool und = data->FUN_100a0990(p_time); + 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); + } + } + else { + MxMatrix local2world; + 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); + } + } } // FUNCTION: LEGO1 0x100a90f0 diff --git a/LEGO1/lego/sources/roi/legoroi.h b/LEGO1/lego/sources/roi/legoroi.h index 32ce1371..68309a91 100644 --- a/LEGO1/lego/sources/roi/legoroi.h +++ b/LEGO1/lego/sources/roi/legoroi.h @@ -32,7 +32,7 @@ class LegoROI : public ViewROI { ); LegoROI* FUN_100a8ce0(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*, Matrix4&, LegoTime, LegoROI**); + static void FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_rois); 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);