Implement LegoExtraActor:: VTable0xa4 & FUN_1002aae0 (#742)

* Implement LegoExtraActor:: VTable0xa4 & FUN_1002aae0

* Match LegoExtraActor::FUN_1002aae0

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Nathan M Gilbert 2024-03-28 09:19:32 -04:00 committed by GitHub
parent 3b68a90a08
commit 13d994a1ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 50 additions and 11 deletions

View file

@ -41,7 +41,7 @@ class LegoExtraActor : public virtual LegoAnimActor {
MxU32 VTable0x90(float p_float, Matrix4& p_matrix) override; // vtable+0x90 MxU32 VTable0x90(float p_float, Matrix4& p_matrix) override; // vtable+0x90
MxS32 VTable0x94() override; // vtable+0x94 MxS32 VTable0x94() override; // vtable+0x94
void VTable0x9c() override; // vtable+0x9c void VTable0x9c() override; // vtable+0x9c
void VTable0xa4() override; // vtable+0xa4 void VTable0xa4(MxU8& p_und1, MxS32& p_und2) override; // vtable+0xa4
void VTable0xc4() override; // vtable+0xc4 void VTable0xc4() override; // vtable+0xc4
virtual MxResult FUN_1002aae0(); virtual MxResult FUN_1002aae0();

View file

@ -57,7 +57,7 @@ class LegoPathActor : public LegoActor {
// FUNCTION: LEGO1 0x10002d60 // FUNCTION: LEGO1 0x10002d60
virtual MxS32 VTable0xa0() { return 0; } // vtable+0xa0 virtual MxS32 VTable0xa0() { return 0; } // vtable+0xa0
virtual void VTable0xa4(); // vtable+0xa4 virtual void VTable0xa4(MxU8&, MxS32&); // vtable+0xa4
virtual void VTable0xa8(); // vtable+0xa8 virtual void VTable0xa8(); // vtable+0xa8
// FUNCTION: LEGO1 0x10002d70 // FUNCTION: LEGO1 0x10002d70
@ -104,7 +104,7 @@ class LegoPathActor : public LegoActor {
MxFloat m_unk0xa0; // 0xa0 MxFloat m_unk0xa0; // 0xa0
undefined m_unk0xa4[0x38]; // 0xa4 undefined m_unk0xa4[0x38]; // 0xa4
MxU32 m_unk0xdc; // 0xdc MxU32 m_unk0xdc; // 0xdc
undefined4 m_destEdge; // 0xe0 Edge* m_destEdge; // 0xe0
undefined4 m_unk0xe4; // 0xe4 undefined4 m_unk0xe4; // 0xe4
undefined2 m_unk0xe8; // 0xe8 undefined2 m_unk0xe8; // 0xe8
MxBool m_userNavFlag; // 0xea MxBool m_userNavFlag; // 0xea

View file

@ -86,16 +86,49 @@ MxU32 LegoExtraActor::VTable0x90(float p_time, Matrix4& p_transform)
} }
} }
// STUB: LEGO1 0x1002aa90 // FUNCTION: LEGO1 0x1002aa90
void LegoExtraActor::VTable0xa4() void LegoExtraActor::VTable0xa4(MxU8& p_und1, MxS32& p_und2)
{ {
switch (m_unk0x0c) {
case 1:
p_und1 = 1;
p_und2 = 1;
break;
case 2:
p_und1 = 0;
p_und2 = 1;
break;
default:
p_und1 = 1;
p_und2 = rand() % p_und2 + 1;
break;
}
} }
// STUB: LEGO1 0x1002aae0 // FUNCTION: LEGO1 0x1002aae0
MxResult LegoExtraActor::FUN_1002aae0() MxResult LegoExtraActor::FUN_1002aae0()
{ {
// TODO LegoPathBoundary* oldEdge = m_boundary;
VTable0x9c(); Vector3 dir(m_unk0xec[0]);
Vector3 right(m_unk0xec[1]);
Vector3 up(m_unk0xec[2]);
Vector3 unused(m_unk0xec[3]);
up.Mul(-1.0f);
dir.EqualsCross(&right, &up);
if (m_boundary == m_destEdge->m_faceA) {
m_boundary = (LegoPathBoundary*) m_destEdge->m_faceB;
}
else {
m_boundary = (LegoPathBoundary*) m_destEdge->m_faceA;
}
if (!m_boundary) {
m_boundary = oldEdge;
}
LegoPathActor::VTable0x9c();
return SUCCESS; return SUCCESS;
} }

View file

@ -81,7 +81,7 @@ void LegoPathActor::VTable0x9c()
} }
// STUB: LEGO1 0x1002f650 // STUB: LEGO1 0x1002f650
void LegoPathActor::VTable0xa4() void LegoPathActor::VTable0xa4(MxU8&, MxS32&)
{ {
// TODO // TODO
} }

View file

@ -9,6 +9,9 @@ struct UnknownMatrixType {
float m_data[4][4]; float m_data[4][4];
}; };
// Note: Many functions most likely take const references/pointers instead of non-const.
// The class needs to undergo a very careful refactoring to fix that (no matches should break).
// VTABLE: LEGO1 0x100d4350 // VTABLE: LEGO1 0x100d4350
// SIZE 0x08 // SIZE 0x08
class Matrix4 { class Matrix4 {

View file

@ -6,6 +6,9 @@
#include <math.h> #include <math.h>
#include <memory.h> #include <memory.h>
// Note: Many functions most likely take const references/pointers instead of non-const.
// The class needs to undergo a very careful refactoring to fix that (no matches should break).
// VTABLE: LEGO1 0x100d4288 // VTABLE: LEGO1 0x100d4288
// SIZE 0x08 // SIZE 0x08
class Vector2 { class Vector2 {
@ -130,7 +133,7 @@ class Vector2 {
virtual void Mul(Vector2* p_other) { MulVectorImpl(p_other->m_data); } // vtable+0x60 virtual void Mul(Vector2* p_other) { MulVectorImpl(p_other->m_data); } // vtable+0x60
// FUNCTION: LEGO1 0x10002230 // FUNCTION: LEGO1 0x10002230
virtual void Mul(float& p_value) { MulScalarImpl(&p_value); } // vtable+0x5c virtual void Mul(const float& p_value) { MulScalarImpl((float*) &p_value); } // vtable+0x5c
// FUNCTION: LEGO1 0x10002240 // FUNCTION: LEGO1 0x10002240
virtual void Div(float& p_value) { DivScalarImpl(&p_value); } // vtable+0x68 virtual void Div(float& p_value) { DivScalarImpl(&p_value); } // vtable+0x68