Implement LegoPathActor::VTable0x88 (#787)

* Implement LegoPathActor::VTable0x88

* Implement FUN_1002ddc0

* Fixes and match

* refac

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Nathan M Gilbert
2024-04-11 07:35:15 -04:00
committed by GitHub
parent 507cd0cff4
commit ada83989b1
13 changed files with 164 additions and 16 deletions

View File

@@ -52,10 +52,81 @@ MxResult LegoPathActor::VTable0x80(Vector3& p_point1, Vector3& p_point2, Vector3
return FAILURE;
}
// STUB: LEGO1 0x1002d9c0
void LegoPathActor::VTable0x88()
// FUNCTION: LEGO1 0x1002d9c0
MxResult LegoPathActor::VTable0x88(
LegoPathBoundary* p_boundary,
float p_time,
LegoEdge& p_srcEdge,
float p_srcScale,
LegoUnknown100db7f4& p_destEdge,
float p_destScale
)
{
// TODO
Vector3* v1 = p_srcEdge.GetOpposingPoint(p_boundary);
Vector3* v2 = p_srcEdge.GetPoint(p_boundary);
Vector3* v3 = p_destEdge.GetOpposingPoint(p_boundary);
Vector3* v4 = p_destEdge.GetPoint(p_boundary);
Mx3DPointFloat p1, p2, p3, p4, p5;
p1 = *v2;
((Vector3&) p1).Sub(v1);
((Vector3&) p1).Mul(p_srcScale);
((Vector3&) p1).Add(v1);
p2 = *v4;
((Vector3&) p2).Sub(v3);
((Vector3&) p2).Mul(p_destScale);
((Vector3&) p2).Add(v3);
m_boundary = p_boundary;
m_destEdge = &p_destEdge;
m_unk0xe4 = p_destScale;
m_unk0x7c = 0;
m_lastTime = p_time;
m_actorTime = p_time;
p_destEdge.FUN_1002ddc0(*p_boundary, p3);
p4 = p2;
((Vector3&) p4).Sub(&p1);
p4.Unitize();
MxMatrix matrix;
Vector3 pos(matrix[3]);
Vector3 dir(matrix[2]);
Vector3 up(matrix[1]);
Vector3 right(matrix[0]);
matrix.SetIdentity();
pos = p1;
dir = p4;
up = *m_boundary->GetUnknown0x14(); // TODO
if (!m_cameraFlag || !m_userNavFlag) {
((Vector3&) dir).Mul(-1.0f);
}
right.EqualsCross(&up, &dir);
m_roi->FUN_100a46b0(matrix);
if (!m_cameraFlag || !m_userNavFlag) {
p5.EqualsCross(p_boundary->GetUnknown0x14(), &p3);
p5.Unitize();
if (VTable0x80(p1, p4, p2, p5) == SUCCESS) {
m_boundary->AddActor(this);
}
else {
return FAILURE;
}
}
else {
m_boundary->AddActor(this);
FUN_10010c30();
}
m_unk0xec = m_roi->GetLocal2World();
return SUCCESS;
}
// STUB: LEGO1 0x1002de10