Clear unknowns in LegoROI (#1630)

This commit is contained in:
Fabian Neundorf
2025-07-17 01:19:17 +02:00
committed by GitHub
parent 05360b4468
commit 6d6971734b
7 changed files with 38 additions and 33 deletions

View File

@@ -631,7 +631,7 @@ MxU32 Act2Actor::FUN_10019700(MxFloat p_param)
MxFloat time = p_param - (m_unk0x2c - m_shootAnim->GetDuration()); MxFloat time = p_param - (m_unk0x2c - m_shootAnim->GetDuration());
for (MxS32 i = 0; i < root->GetNumChildren(); i++) { for (MxS32 i = 0; i < root->GetNumChildren(); i++) {
LegoROI::FUN_100a8e80(root->GetChild(i), matrix, time, m_shootAnim->GetROIMap()); LegoROI::ApplyAnimationTransformation(root->GetChild(i), matrix, time, m_shootAnim->GetROIMap());
} }
return FALSE; return FALSE;

View File

@@ -638,7 +638,7 @@ void Act3Brickster::Animate(float p_time)
float time = p_time - (m_unk0x50 - m_shootAnim->GetDuration()); float time = p_time - (m_unk0x50 - m_shootAnim->GetDuration());
for (MxS32 i = 0; i < root->GetNumChildren(); i++) { for (MxS32 i = 0; i < root->GetNumChildren(); i++) {
LegoROI::FUN_100a8e80(root->GetChild(i), local70, time, m_shootAnim->GetROIMap()); LegoROI::ApplyAnimationTransformation(root->GetChild(i), local70, time, m_shootAnim->GetROIMap());
} }
} }
@@ -685,7 +685,7 @@ void Act3Brickster::Animate(float p_time)
float time = p_time - (m_unk0x50 - m_shootAnim->GetDuration()); float time = p_time - (m_unk0x50 - m_shootAnim->GetDuration());
for (MxS32 i = 0; i < root->GetNumChildren(); i++) { for (MxS32 i = 0; i < root->GetNumChildren(); i++) {
LegoROI::FUN_100a8e80(root->GetChild(i), locale4, time, m_shootAnim->GetROIMap()); LegoROI::ApplyAnimationTransformation(root->GetChild(i), locale4, time, m_shootAnim->GetROIMap());
} }
} }
@@ -1186,7 +1186,7 @@ void Act3Shark::Animate(float p_time)
vec = m_unk0x3c; vec = m_unk0x3c;
LegoTreeNode* node = m_unk0x34->GetAnimTreePtr()->GetRoot(); LegoTreeNode* node = m_unk0x34->GetAnimTreePtr()->GetRoot();
LegoROI::FUN_100a8e80(node, mat, duration, m_unk0x34->GetROIMap()); LegoROI::ApplyAnimationTransformation(node, mat, duration, m_unk0x34->GetROIMap());
} }
else { else {
roiMap[1] = m_unk0x38; roiMap[1] = m_unk0x38;

View File

@@ -133,7 +133,7 @@ MxResult LegoAnimActor::FUN_1001c360(float p_und, Matrix4& p_transform)
} }
for (MxS32 j = 0; j < n->GetNumChildren(); j++) { for (MxS32 j = 0; j < n->GetNumChildren(); j++) {
LegoROI::FUN_100a8e80(n->GetChild(j), p_transform, p_und, roiMap); LegoROI::ApplyAnimationTransformation(n->GetChild(j), p_transform, p_und, roiMap);
} }
if (m_cameraFlag) { if (m_cameraFlag) {

View File

@@ -373,7 +373,7 @@ void LegoExtraActor::Animate(float p_time)
MxS32 count = root->GetNumChildren(); MxS32 count = root->GetNumChildren();
for (MxS32 i = 0; i < count; i++) { for (MxS32 i = 0; i < count; i++) {
LegoROI::FUN_100a8e80(root->GetChild(i), matrix, duration2, laas->m_roiMap); LegoROI::ApplyAnimationTransformation(root->GetChild(i), matrix, duration2, laas->m_roiMap);
} }
} }
} }

View File

@@ -906,7 +906,7 @@ void LegoAnimPresenter::FUN_1006b900(LegoAnim* p_anim, MxLong p_time, Matrix4* p
} }
} }
LegoROI::FUN_100a8fd0(root, mat, p_time, m_roiMap); LegoROI::ApplyTransform(root, mat, p_time, m_roiMap);
} }
// FUNCTION: LEGO1 0x1006b9a0 // FUNCTION: LEGO1 0x1006b9a0
@@ -940,7 +940,7 @@ void LegoAnimPresenter::FUN_1006b9a0(LegoAnim* p_anim, MxLong p_time, Matrix4* p
} }
} }
LegoROI::FUN_100a8e80(root, mat, p_time, m_roiMap); LegoROI::ApplyAnimationTransformation(root, mat, p_time, m_roiMap);
} }
// FUNCTION: LEGO1 0x1006bac0 // FUNCTION: LEGO1 0x1006bac0

View File

@@ -114,7 +114,7 @@ LegoROI::~LegoROI()
// FUNCTION: LEGO1 0x100a84a0 // FUNCTION: LEGO1 0x100a84a0
// FUNCTION: BETA10 0x10189b99 // FUNCTION: BETA10 0x10189b99
LegoResult LegoROI::Read( LegoResult LegoROI::Read(
OrientableROI* p_unk0xd4, OrientableROI* p_parentROI,
Tgl::Renderer* p_renderer, Tgl::Renderer* p_renderer,
ViewLODListManager* p_viewLODListManager, ViewLODListManager* p_viewLODListManager,
LegoTextureContainer* p_textureContainer, LegoTextureContainer* p_textureContainer,
@@ -134,7 +134,7 @@ LegoResult LegoROI::Read(
LegoSphere sphere; LegoSphere sphere;
LegoBox box; LegoBox box;
m_parentROI = p_unk0xd4; m_parentROI = p_parentROI;
if (p_storage->Read(&length, sizeof(LegoU32)) != SUCCESS) { if (p_storage->Read(&length, sizeof(LegoU32)) != SUCCESS) {
goto done; goto done;
@@ -177,11 +177,11 @@ LegoResult LegoROI::Read(
textureName = NULL; textureName = NULL;
} }
if (p_storage->Read(&m_unk0x100, sizeof(undefined)) != SUCCESS) { if (p_storage->Read(&m_sharedLodList, sizeof(LegoBool)) != SUCCESS) {
goto done; goto done;
} }
if (m_unk0x100) { if (m_sharedLodList) {
for (roiLength = strlen(m_name); roiLength; roiLength--) { for (roiLength = strlen(m_name); roiLength; roiLength--) {
if (m_name[roiLength - 1] < '0' || m_name[roiLength - 1] > '9') { if (m_name[roiLength - 1] < '0' || m_name[roiLength - 1] > '9') {
break; break;
@@ -389,7 +389,7 @@ LegoROI* LegoROI::FindChildROI(const LegoChar* p_name, LegoROI* p_roi)
// FUNCTION: LEGO1 0x100a8da0 // FUNCTION: LEGO1 0x100a8da0
// FUNCTION: BETA10 0x1018a9fb // FUNCTION: BETA10 0x1018a9fb
LegoResult LegoROI::ApplyAnimationTransformation( LegoResult LegoROI::ApplyChildAnimationTransformation(
LegoTreeNode* p_node, LegoTreeNode* p_node,
const Matrix4& p_matrix, const Matrix4& p_matrix,
LegoTime p_time, LegoTime p_time,
@@ -410,11 +410,11 @@ LegoResult LegoROI::ApplyAnimationTransformation(
roi->m_local2world.Product(mat, p_matrix); roi->m_local2world.Product(mat, p_matrix);
roi->UpdateWorldData(); roi->UpdateWorldData();
LegoBool und = data->GetVisibility(p_time); LegoBool visibility = data->GetVisibility(p_time);
roi->SetVisibility(und); roi->SetVisibility(visibility);
for (LegoU32 i = 0; i < p_node->GetNumChildren(); i++) { for (LegoU32 i = 0; i < p_node->GetNumChildren(); i++) {
ApplyAnimationTransformation(p_node->GetChild(i), roi->m_local2world, p_time, roi); ApplyChildAnimationTransformation(p_node->GetChild(i), roi->m_local2world, p_time, roi);
} }
} }
else { else {
@@ -426,7 +426,7 @@ LegoResult LegoROI::ApplyAnimationTransformation(
// FUNCTION: LEGO1 0x100a8e80 // FUNCTION: LEGO1 0x100a8e80
// FUNCTION: BETA10 0x1018ab3a // FUNCTION: BETA10 0x1018ab3a
void LegoROI::FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap) void LegoROI::ApplyAnimationTransformation(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap)
{ {
MxMatrix mat; MxMatrix mat;
@@ -438,11 +438,11 @@ void LegoROI::FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_t
roi->m_local2world.Product(mat, p_matrix); roi->m_local2world.Product(mat, p_matrix);
roi->UpdateWorldData(); roi->UpdateWorldData();
LegoBool und = data->GetVisibility(p_time); LegoBool visiblity = data->GetVisibility(p_time);
roi->SetVisibility(und); roi->SetVisibility(visiblity);
for (LegoU32 i = 0; i < p_node->GetNumChildren(); i++) { for (LegoU32 i = 0; i < p_node->GetNumChildren(); i++) {
FUN_100a8e80(p_node->GetChild(i), roi->m_local2world, p_time, p_roiMap); ApplyAnimationTransformation(p_node->GetChild(i), roi->m_local2world, p_time, p_roiMap);
} }
} }
else { else {
@@ -450,14 +450,14 @@ void LegoROI::FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_t
local2world.Product(mat, p_matrix); local2world.Product(mat, p_matrix);
for (LegoU32 i = 0; i < p_node->GetNumChildren(); i++) { for (LegoU32 i = 0; i < p_node->GetNumChildren(); i++) {
FUN_100a8e80(p_node->GetChild(i), local2world, p_time, p_roiMap); ApplyAnimationTransformation(p_node->GetChild(i), local2world, p_time, p_roiMap);
} }
} }
} }
// FUNCTION: LEGO1 0x100a8fd0 // FUNCTION: LEGO1 0x100a8fd0
// FUNCTION: BETA10 0x1018ac81 // FUNCTION: BETA10 0x1018ac81
void LegoROI::FUN_100a8fd0(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap) void LegoROI::ApplyTransform(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap)
{ {
MxMatrix mat; MxMatrix mat;
@@ -469,7 +469,7 @@ void LegoROI::FUN_100a8fd0(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_t
roi->m_local2world.Product(mat, p_matrix); roi->m_local2world.Product(mat, p_matrix);
for (LegoU32 i = 0; i < p_node->GetNumChildren(); i++) { for (LegoU32 i = 0; i < p_node->GetNumChildren(); i++) {
FUN_100a8fd0(p_node->GetChild(i), roi->m_local2world, p_time, p_roiMap); ApplyTransform(p_node->GetChild(i), roi->m_local2world, p_time, p_roiMap);
} }
} }
else { else {
@@ -477,7 +477,7 @@ void LegoROI::FUN_100a8fd0(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_t
local2world.Product(mat, p_matrix); local2world.Product(mat, p_matrix);
for (LegoU32 i = 0; i < p_node->GetNumChildren(); i++) { for (LegoU32 i = 0; i < p_node->GetNumChildren(); i++) {
FUN_100a8fd0(p_node->GetChild(i), local2world, p_time, p_roiMap); ApplyTransform(p_node->GetChild(i), local2world, p_time, p_roiMap);
} }
} }
} }
@@ -492,7 +492,7 @@ LegoResult LegoROI::SetFrame(LegoAnim* p_anim, LegoTime p_time)
mat = m_local2world; mat = m_local2world;
mat.SetIdentity(); // this clears the matrix, assignment above is redundant mat.SetIdentity(); // this clears the matrix, assignment above is redundant
return ApplyAnimationTransformation(root, mat, p_time, this); return ApplyChildAnimationTransformation(root, mat, p_time, this);
} }
// FUNCTION: LEGO1 0x100a9170 // FUNCTION: LEGO1 0x100a9170

View File

@@ -26,21 +26,26 @@ public:
~LegoROI() override; ~LegoROI() override;
LegoResult Read( LegoResult Read(
OrientableROI* p_unk0xd4, OrientableROI* p_parentROI,
Tgl::Renderer* p_renderer, Tgl::Renderer* p_renderer,
ViewLODListManager* p_viewLODListManager, ViewLODListManager* p_viewLODListManager,
LegoTextureContainer* p_textureContainer, LegoTextureContainer* p_textureContainer,
LegoStorage* p_storage LegoStorage* p_storage
); );
LegoROI* FindChildROI(const LegoChar* p_name, LegoROI* p_roi); LegoROI* FindChildROI(const LegoChar* p_name, LegoROI* p_roi);
LegoResult ApplyAnimationTransformation( LegoResult ApplyChildAnimationTransformation(
LegoTreeNode* p_node, LegoTreeNode* p_node,
const Matrix4& p_matrix, const Matrix4& p_matrix,
LegoTime p_time, LegoTime p_time,
LegoROI* p_roi LegoROI* p_roi
); );
static void FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap); static void ApplyAnimationTransformation(
static void FUN_100a8fd0(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap); LegoTreeNode* p_node,
Matrix4& p_matrix,
LegoTime p_time,
LegoROI** p_roiMap
);
static void ApplyTransform(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap);
LegoResult SetFrame(LegoAnim* p_anim, LegoTime p_time); LegoResult SetFrame(LegoAnim* p_anim, LegoTime p_time);
LegoResult SetLodColor(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha); LegoResult SetLodColor(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha);
LegoResult SetTextureInfo(LegoTextureInfo* p_textureInfo); LegoResult SetTextureInfo(LegoTextureInfo* p_textureInfo);
@@ -91,10 +96,10 @@ public:
// LegoROI::`scalar deleting destructor' // LegoROI::`scalar deleting destructor'
private: private:
LegoChar* m_name; // 0xe4 LegoChar* m_name; // 0xe4
BoundingSphere m_sphere; // 0xe8 BoundingSphere m_sphere; // 0xe8
undefined m_unk0x100; // 0x100 LegoBool m_sharedLodList; // 0x100
LegoEntity* m_entity; // 0x104 LegoEntity* m_entity; // 0x104
}; };
// VTABLE: LEGO1 0x100dbea8 // VTABLE: LEGO1 0x100dbea8