From e8b61d5a1d3409e3745963ba732eb90052bcd44e Mon Sep 17 00:00:00 2001 From: Nathan M Gilbert Date: Sat, 13 Apr 2024 08:05:20 -0400 Subject: [PATCH] Implement LegoPathActor::Vtable0x84 (#790) * Implement LegoPathActor::Vtable0x84 * fix condition --------- Co-authored-by: Christian Semmler --- LEGO1/lego/legoomni/include/legopathactor.h | 11 +++- .../lego/legoomni/src/paths/legopathactor.cpp | 66 ++++++++++++++++++- 2 files changed, 72 insertions(+), 5 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index 176a7278..93eb6479 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -47,8 +47,15 @@ class LegoPathActor : public LegoActor { Vector3& p_point2, Vector3& p_point3, Vector3& p_point4 - ); // vtable+0x80 - virtual void VTable0x84(); // vtable+0x84 + ); // vtable+0x80 + virtual MxResult VTable0x84( + LegoPathBoundary* p_boundary, + float p_time, + Vector3& p_p1, + Vector3& p_p4, + LegoUnknown100db7f4& p_destEdge, + float p_destScale + ); // vtable+0x84 virtual MxResult VTable0x88( LegoPathBoundary* p_boundary, float p_time, diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 5c3f85b3..7afcee61 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -129,10 +129,70 @@ MxResult LegoPathActor::VTable0x88( return SUCCESS; } -// STUB: LEGO1 0x1002de10 -void LegoPathActor::VTable0x84() +// FUNCTION: LEGO1 0x1002de10 +MxResult LegoPathActor::VTable0x84( + LegoPathBoundary* p_boundary, + float p_time, + Vector3& p_p1, + Vector3& p_p4, + LegoUnknown100db7f4& p_destEdge, + float p_destScale +) { - // TODO + Vector3* v3 = p_destEdge.GetOpposingPoint(p_boundary); + Vector3* v4 = p_destEdge.GetPoint(p_boundary); + + Mx3DPointFloat p2, p3, p5; + + 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); + + MxMatrix matrix; + Vector3 pos(matrix[3]); + Vector3 dir(matrix[2]); + Vector3 up(matrix[1]); + Vector3 right(matrix[0]); + + matrix.SetIdentity(); + pos = p_p1; + dir = p_p4; + up = *m_boundary->GetUnknown0x14(); + + 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(p_p1, p_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 0x1002e100