Implement/match LegoPathCtrlEdge::FUN_10048c40

This commit is contained in:
Christian Semmler 2024-12-07 09:22:12 -07:00
parent 4d8098a6c2
commit 0bfe6a597f
3 changed files with 66 additions and 9 deletions

View File

@ -23,7 +23,7 @@ class Vector3;
// VTABLE: LEGO1 0x100d7da8
// SIZE 0x40
struct LegoPathCtrlEdge : public LegoUnknown100db7f4 {
undefined4 FUN_10048c40(const Vector3&);
inline MxU32 FUN_10048c40(const Vector3& p_position);
};
struct LegoPathCtrlEdgeCompare {

View File

@ -818,7 +818,10 @@ MxResult LegoPathController::FUN_10048310(
LegoPathBoundary* bOther = (LegoPathBoundary*) e->OtherFace(b);
assert(bOther);
if (e->BETA_1004a830(*bOther, p_mask)) {
if (!e->BETA_1004a830(*bOther, p_mask)) {
// This branch is empty, but present in the BETA - probably had comments only
}
else {
if (bOther == p_newBoundary) {
shouldRemove = FALSE;
@ -917,12 +920,66 @@ MxResult LegoPathController::FUN_10048310(
return FAILURE;
}
// STUB: LEGO1 0x10048c40
// STUB: BETA10 0x1001cc90
undefined4 LegoPathCtrlEdge::FUN_10048c40(const Vector3&)
// FUNCTION: LEGO1 0x10048c40
// FUNCTION: BETA10 0x1001cc90
inline MxU32 LegoPathCtrlEdge::FUN_10048c40(const Vector3& p_position)
{
// TODO
return 0;
MxFloat localc, local10;
MxU32 result = FALSE;
if (m_unk0x28[0] > 0.001 || m_unk0x28[0] < -0.001) {
localc = (p_position[0] - (*m_pointA)[0]) / m_unk0x28[0];
if (localc < 0 || localc > 1) {
return FALSE;
}
result = TRUE;
}
else {
if (p_position[0] > (*m_pointA)[0] + 0.001 || p_position[0] < (*m_pointA)[0] - 0.001) {
return FALSE;
}
}
if (m_unk0x28[1] > 0.001 || m_unk0x28[1] < -0.001) {
local10 = (p_position[1] - (*m_pointA)[1]) / m_unk0x28[1];
if (result) {
if (localc > local10 + 0.001 || localc < local10 - 0.001) {
return FALSE;
}
}
else {
result = TRUE;
localc = local10;
}
}
else {
if (p_position[1] > (*m_pointA)[1] + 0.001 || p_position[1] < (*m_pointA)[1] - 0.001) {
return FALSE;
}
}
if (m_unk0x28[2] > 0.001 || m_unk0x28[2] < -0.001) {
local10 = (p_position[2] - (*m_pointA)[2]) / m_unk0x28[2];
if (result) {
if (localc > local10 + 0.001 || localc < local10 - 0.001) {
return FALSE;
}
}
else {
return TRUE;
}
}
else {
if (p_position[2] > (*m_pointA)[2] + 0.001 || p_position[2] < (*m_pointA)[2] - 0.001) {
return FALSE;
}
}
return TRUE;
}
// FUNCTION: LEGO1 0x1004a240

View File

@ -74,7 +74,7 @@ struct LegoUnknown100db7f4 : public LegoEdge {
((Vector3&) point).Add(*m_pointB);
((Vector3&) point).Mul(0.5f);
((Vector3&) point).Sub(p_vec);
return sqrt(point.LenSquared());
return sqrt((double) point.LenSquared());
}
// FUNCTION: BETA10 0x100bd540
@ -87,7 +87,7 @@ struct LegoUnknown100db7f4 : public LegoEdge {
((Vector3&) point2).Add(*p_other.m_pointB);
((Vector3&) point2).Mul(0.5f);
((Vector3&) point1).Sub(point2);
return sqrt(point1.LenSquared());
return sqrt((double) point1.LenSquared());
}
// FUNCTION: BETA10 0x1001cc60