Implement/match LegoPlantManager::FUN_10026410 (#1223)

* Implement/match  `LegoPlantManager::FUN_10026410`

* Full match on LEGO1 and BETA10

* Improve `LegoBuildingManager::FUN_10030630`

---------

Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
jonschz
2024-12-14 16:35:08 +01:00
committed by GitHub
parent 57aa5a9f8a
commit 97ff27af9e
4 changed files with 101 additions and 25 deletions

View File

@@ -221,6 +221,7 @@ char* LegoBuildingManager::g_customizeAnimFile = NULL;
MxS32 g_buildingManagerConfig = 1;
// GLOBAL: LEGO1 0x10104c30
// GLOBAL: BETA10 0x10209fa0
LegoBuildingInfo g_buildingInfo[16];
// GLOBAL: LEGO1 0x100f3748
@@ -808,7 +809,7 @@ MxResult LegoBuildingManager::FUN_10030630()
for (MxS32 j = 0; j < boundary->GetNumEdges(); j++) {
Mx4DPointFloat* normal = boundary->GetEdgeNormal(j);
if (position.Dot(normal, &position) + (*normal)[3] < -0.001) {
if (position.Dot(normal, &position) + (*normal).index_operator(3) < -0.001) {
MxTrace(
"Building %d shot location (%g, %g, %g) is not in boundary %s.\n",
i,
@@ -825,26 +826,28 @@ MxResult LegoBuildingManager::FUN_10030630()
if (g_buildingInfo[i].m_boundary != NULL) {
Mx4DPointFloat& unk0x14 = *g_buildingInfo[i].m_boundary->GetUnknown0x14();
if (position.Dot(&position, &unk0x14) + unk0x14[3] <= 0.001 &&
position.Dot(&position, &unk0x14) + unk0x14[3] >= -0.001) {
continue;
if (position.Dot(&position, &unk0x14) + unk0x14.index_operator(3) > 0.001 ||
position.Dot(&position, &unk0x14) + unk0x14.index_operator(3) < -0.001) {
g_buildingInfo[i].m_y =
-((position[0] * unk0x14.index_operator(0) + unk0x14.index_operator(3) +
position[2] * unk0x14.index_operator(2)) /
unk0x14.index_operator(1));
MxTrace(
"Building %d shot location (%g, %g, %g) is not on plane of boundary %s...adjusting to (%g, "
"%g, "
"%g)\n",
i,
position[0],
position[1],
position[2],
g_buildingInfo[i].m_boundary->GetName(),
position[0],
g_buildingInfo[i].m_y,
position[2]
);
}
g_buildingInfo[i].m_y =
-((unk0x14[3] + unk0x14[0] * position[0] + unk0x14[2] * position[2]) / unk0x14[1]);
MxTrace(
"Building %d shot location (%g, %g, %g) is not on plane of boundary %s...adjusting to (%g, %g, "
"%g)\n",
i,
position[0],
position[1],
position[2],
g_buildingInfo[i].m_boundary->GetName(),
position[0],
g_buildingInfo[i].m_y,
position[2]
);
}
}
else {