Implement/match LegoPathCtrlEdge::FUN_10048c40 (#1195)

* Implement/match LegoPathCtrlEdge::FUN_10048c40

* Improve matches
This commit is contained in:
Christian Semmler 2024-12-07 09:58:51 -07:00 committed by GitHub
parent 94ce89cbaa
commit 5be00e1799
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 86 additions and 10 deletions

View file

@ -23,7 +23,7 @@ class Vector3;
// VTABLE: LEGO1 0x100d7da8 // VTABLE: LEGO1 0x100d7da8
// SIZE 0x40 // SIZE 0x40
struct LegoPathCtrlEdge : public LegoUnknown100db7f4 { struct LegoPathCtrlEdge : public LegoUnknown100db7f4 {
undefined4 FUN_10048c40(const Vector3&); inline MxU32 FUN_10048c40(const Vector3& p_position);
}; };
struct LegoPathCtrlEdgeCompare { struct LegoPathCtrlEdgeCompare {
@ -256,6 +256,9 @@ class LegoPathController : public MxCore {
// TEMPLATE: LEGO1 0x10049370 // TEMPLATE: LEGO1 0x10049370
// _Tree<LegoPathCtrlEdge *,LegoPathCtrlEdge *,set<LegoPathCtrlEdge *,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Kfn,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Ubound // _Tree<LegoPathCtrlEdge *,LegoPathCtrlEdge *,set<LegoPathCtrlEdge *,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Kfn,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Ubound
// TEMPLATE: LEGO1 0x100493a0
// list<LegoBEWithFloat,allocator<LegoBEWithFloat> >::~list<LegoBEWithFloat,allocator<LegoBEWithFloat> >
// TEMPLATE: LEGO1 0x10049410 // TEMPLATE: LEGO1 0x10049410
// list<LegoBEWithFloat,allocator<LegoBEWithFloat> >::insert // list<LegoBEWithFloat,allocator<LegoBEWithFloat> >::insert
@ -265,6 +268,9 @@ class LegoPathController : public MxCore {
// TEMPLATE: LEGO1 0x100494a0 // TEMPLATE: LEGO1 0x100494a0
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::iterator::_Inc // _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::iterator::_Inc
// TEMPLATE: LEGO1 0x100494e0
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::~_Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFlo
// TEMPLATE: LEGO1 0x100495b0 // TEMPLATE: LEGO1 0x100495b0
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::insert // _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::insert
@ -283,12 +289,24 @@ class LegoPathController : public MxCore {
// TEMPLATE: LEGO1 0x10049e00 // TEMPLATE: LEGO1 0x10049e00
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Insert // _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Insert
// TEMPLATE: LEGO1 0x10049d10
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Erase
// TEMPLATE: LEGO1 0x1004a090 // TEMPLATE: LEGO1 0x1004a090
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Lrotate // _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Lrotate
// TEMPLATE: LEGO1 0x1004a0f0 // TEMPLATE: LEGO1 0x1004a0f0
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Rrotate // _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Rrotate
// TEMPLATE: LEGO1 0x1004a150
// List<LegoBEWithFloat>::~List<LegoBEWithFloat>
// TEMPLATE: LEGO1 0x1004a1a0
// Multiset<LegoBEWithFloat *,LegoBEWithFloatComparator>::~Multiset<LegoBEWithFloat *,LegoBEWithFloatComparator>
// TEMPLATE: LEGO1 0x1004a1f0
// multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::~multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >
// TEMPLATE: LEGO1 0x1004a760 // TEMPLATE: LEGO1 0x1004a760
// _Construct // _Construct

View file

@ -817,7 +817,10 @@ MxResult LegoPathController::FUN_10048310(
LegoPathBoundary* bOther = (LegoPathBoundary*) e->OtherFace(b); LegoPathBoundary* bOther = (LegoPathBoundary*) e->OtherFace(b);
assert(bOther); 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) { if (bOther == p_newBoundary) {
shouldRemove = FALSE; shouldRemove = FALSE;
@ -826,9 +829,10 @@ MxResult LegoPathController::FUN_10048310(
float dist; float dist;
if ((dist = pfs->m_edge->DistanceToMidpoint(p_newPosition) + pfs->m_unk0x0c) < local70) { if ((dist = pfs->m_edge->DistanceToMidpoint(p_newPosition) + pfs->m_unk0x0c) < local70) {
local70 = dist;
edgeWithFloat.m_edge = NULL; edgeWithFloat.m_edge = NULL;
local70 = dist;
// TODO: Match
if (dist < local14) { if (dist < local14) {
local14 = dist; local14 = dist;
p_grec->erase(p_grec->begin(), p_grec->end()); p_grec->erase(p_grec->begin(), p_grec->end());
@ -916,12 +920,66 @@ MxResult LegoPathController::FUN_10048310(
return FAILURE; return FAILURE;
} }
// STUB: LEGO1 0x10048c40 // FUNCTION: LEGO1 0x10048c40
// STUB: BETA10 0x1001cc90 // FUNCTION: BETA10 0x1001cc90
undefined4 LegoPathCtrlEdge::FUN_10048c40(const Vector3&) inline MxU32 LegoPathCtrlEdge::FUN_10048c40(const Vector3& p_position)
{ {
// TODO MxFloat localc, local10;
return 0; 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 // FUNCTION: LEGO1 0x1004a240

View file

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