Implement PathActor VTable0x80 and PathActorStruct FUN_1009a140 (#781)

* Implement PathActor VTable0x80 and PathActorStruct FUN_1009a140

* Match functions, fixes

* fixes

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Nathan M Gilbert
2024-04-07 08:03:21 -04:00
committed by GitHub
parent 17680522c2
commit b394770864
8 changed files with 57 additions and 24 deletions

View File

@@ -11,6 +11,7 @@ class LegoPathController;
struct LegoActorStruct {
LegoActorStruct();
~LegoActorStruct();
void FUN_1009a140(Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, Vector3& p_point4);
Mx3DPointFloat m_unk0x00[4]; // 0x00
};
@@ -47,7 +48,12 @@ public:
// FUNCTION: LEGO1 0x10002d30
virtual MxU8 GetUserNavFlag() { return m_userNavFlag; } // vtable+0x7c
virtual void VTable0x80(); // vtable+0x80
virtual MxResult VTable0x80(
Vector3& p_point1,
Vector3& p_point2,
Vector3& p_point3,
Vector3& p_point4
); // vtable+0x80
virtual void VTable0x84(); // vtable+0x84
virtual void VTable0x88(); // vtable+0x88
virtual void VTable0x8c(); // vtable+0x8c

View File

@@ -1,5 +1,7 @@
#include "legopathactor.h"
#include <vec.h>
DECOMP_SIZE_ASSERT(LegoPathActor, 0x154)
// FUNCTION: LEGO1 0x1002d700
@@ -29,10 +31,25 @@ LegoPathActor::~LegoPathActor()
}
}
// STUB: LEGO1 0x1002d8d0
void LegoPathActor::VTable0x80()
// FUNCTION: LEGO1 0x1002d8d0
MxResult LegoPathActor::VTable0x80(Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, Vector3& p_point4)
{
// TODO
Mx3DPointFloat p1, p2, p3;
p1 = p_point3;
((Vector3&) p1).Sub(&p_point1);
m_BADuration = p1.LenSquared();
if (m_BADuration > 0.0f) {
m_BADuration = sqrtf(m_BADuration);
p2 = p_point2;
p3 = p_point4;
m_unk0x8c.FUN_1009a140(p_point1, p2, p_point3, p3);
m_BADuration /= 0.001;
return SUCCESS;
}
return FAILURE;
}
// STUB: LEGO1 0x1002d9c0
@@ -120,3 +137,15 @@ LegoActorStruct::LegoActorStruct()
LegoActorStruct::~LegoActorStruct()
{
}
// FUNCTION: LEGO1 0x1009a140
void LegoActorStruct::FUN_1009a140(Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, Vector3& p_point4)
{
m_unk0x00[0] = p_point1;
m_unk0x00[1] = p_point2;
for (MxS32 i = 0; i < 3; i++) {
m_unk0x00[2][i] = (p_point3[i] - p_point1[i]) * 3.0f - p_point2[i] * 2.0f - p_point4[i];
m_unk0x00[3][i] = (p_point1[i] - p_point3[i]) * 2.0f + p_point4[i] + p_point2[i];
}
}

View File

@@ -30,8 +30,6 @@
#include "skateboard.h"
#include "towtrack.h"
#include <vec.h>
DECOMP_SIZE_ASSERT(Isle, 0x140)
// GLOBAL: LEGO1 0x100f1198
@@ -664,14 +662,14 @@ void Isle::Enable(MxBool p_enable)
Mx3DPointFloat position(CurrentActor()->GetROI()->GetWorldPosition());
Mx3DPointFloat sub(-21.375f, 0.0f, -41.75f);
sub.Sub(&position);
if (NORMSQRD3(sub) < 1024.0f) {
((Vector3&) sub).Sub(&position);
if (sub.LenSquared() < 1024.0f) {
AnimationManager()->FUN_10064740(FALSE);
}
Mx3DPointFloat sub2(98.874992f, 0.0f, -46.156292f);
sub2.Sub(&position);
if (NORMSQRD3(sub2) < 1024.0f) {
((Vector3&) sub2).Sub(&position);
if (sub2.LenSquared() < 1024.0f) {
AnimationManager()->FUN_10064670(FALSE);
}
}