diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 5450841d..4bcf17c9 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -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 { @@ -256,6 +256,9 @@ class LegoPathController : public MxCore { // TEMPLATE: LEGO1 0x10049370 // _Tree >::_Kfn,LegoPathCtrlEdgeCompare,allocator >::_Ubound +// TEMPLATE: LEGO1 0x100493a0 +// list >::~list > + // TEMPLATE: LEGO1 0x10049410 // list >::insert @@ -265,6 +268,9 @@ class LegoPathController : public MxCore { // TEMPLATE: LEGO1 0x100494a0 // _Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::iterator::_Inc +// TEMPLATE: LEGO1 0x100494e0 +// _Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::~_Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::insert @@ -283,12 +289,24 @@ class LegoPathController : public MxCore { // TEMPLATE: LEGO1 0x10049e00 // _Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::_Insert +// TEMPLATE: LEGO1 0x10049d10 +// _Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::_Erase + // TEMPLATE: LEGO1 0x1004a090 // _Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::_Lrotate // TEMPLATE: LEGO1 0x1004a0f0 // _Tree >::_Kfn,LegoBEWithFloatComparator,allocator >::_Rrotate +// TEMPLATE: LEGO1 0x1004a150 +// List::~List + +// TEMPLATE: LEGO1 0x1004a1a0 +// Multiset::~Multiset + +// TEMPLATE: LEGO1 0x1004a1f0 +// multiset >::~multiset > + // TEMPLATE: LEGO1 0x1004a760 // _Construct diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index b2d9ceee..4fd0ace2 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -817,7 +817,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; @@ -826,9 +829,10 @@ MxResult LegoPathController::FUN_10048310( float dist; if ((dist = pfs->m_edge->DistanceToMidpoint(p_newPosition) + pfs->m_unk0x0c) < local70) { - local70 = dist; edgeWithFloat.m_edge = NULL; + local70 = dist; + // TODO: Match if (dist < local14) { local14 = dist; p_grec->erase(p_grec->begin(), p_grec->end()); @@ -916,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 diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.h b/LEGO1/lego/sources/geom/legounkown100db7f4.h index adae57a9..bd19ee78 100644 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.h +++ b/LEGO1/lego/sources/geom/legounkown100db7f4.h @@ -74,7 +74,7 @@ struct LegoUnknown100db7f4 : public LegoEdge { point += *m_pointB; point *= 0.5f; point -= p_vec; - return sqrt(point.LenSquared()); + return sqrt((double) point.LenSquared()); } // FUNCTION: BETA10 0x100bd540 @@ -87,7 +87,7 @@ struct LegoUnknown100db7f4 : public LegoEdge { point2 += *p_other.m_pointB; point2 *= 0.5f; point1 -= point2; - return sqrt(point1.LenSquared()); + return sqrt((double) point1.LenSquared()); } // FUNCTION: BETA10 0x1001cc60