diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index 979860cf..7544b63e 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -140,7 +140,7 @@ MxResult LegoPlantManager::FUN_10026410() 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( "Plant %d shot location (%g, %g, %g) is not in boundary %s.\n", i, @@ -157,25 +157,28 @@ MxResult LegoPlantManager::FUN_10026410() if (g_plantInfo[i].m_boundary != NULL) { Mx4DPointFloat& unk0x14 = *g_plantInfo[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_plantInfo[i].m_y = + -((position[0] * unk0x14.index_operator(0) + unk0x14.index_operator(3) + + position[2] * unk0x14.index_operator(2)) / + unk0x14.index_operator(1)); + + MxTrace( + "Plant %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_plantInfo[i].m_boundary->GetName(), + position[0], + g_plantInfo[i].m_y, + position[2] + ); } - - g_plantInfo[i].m_y = - -((unk0x14[3] + unk0x14[0] * position[0] + unk0x14[2] * position[2]) / unk0x14[1]); - - MxTrace( - "Plant %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_plantInfo[i].m_boundary->GetName(), - position[0], - g_plantInfo[i].m_y, - position[2] - ); } } else { diff --git a/LEGO1/mxgeometry/mxgeometry3d.h b/LEGO1/mxgeometry/mxgeometry3d.h index d7a87447..039d96af 100644 --- a/LEGO1/mxgeometry/mxgeometry3d.h +++ b/LEGO1/mxgeometry/mxgeometry3d.h @@ -78,6 +78,11 @@ class Mx4DPointFloat : public Vector4 { const float& operator[](int idx) const { return m_data[idx]; } + + // only used by a couple of BETA10 functions for some unknown reason + // FUNCTION: BETA10 0x1001c950 + float& index_operator(int idx) { return m_data[idx]; } + // SYNTHETIC: LEGO1 0x10064b20 // SYNTHETIC: BETA10 0x10070420 // ??4Mx4DPointFloat@@QAEAAV0@ABV0@@Z