Implement/match LegoPathActor::SwitchBoundary (#943)

* Implement/match LegoPathActor::SwitchBoundary

* Rename var
This commit is contained in:
Christian Semmler 2024-05-20 14:27:00 -04:00 committed by GitHub
parent 7538988f50
commit bc91fd2189
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 131 additions and 22 deletions

View file

@ -38,7 +38,7 @@ class LegoCarRaceActor : public virtual LegoRaceActor {
void VTable0x70(float p_float) override; // vtable+0x70
MxU32 VTable0x90(float, Matrix4&) override; // vtable+0x90
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
void VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
override; // vtable+0x98
MxResult VTable0x9c() override; // vtable+0x9c

View file

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

View file

@ -43,7 +43,7 @@ class LegoJetski : public LegoJetskiRaceActor, public LegoRaceMap {
) override; // vtable+0x6c
void VTable0x70(float p_float) override; // vtable+0x70
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
void VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
override; // vtable+0x98
MxResult VTable0x9c() override; // vtable+0x9c

View file

@ -36,7 +36,7 @@ class LegoJetskiRaceActor : public virtual LegoCarRaceActor {
Vector3& p_v3
) override; // vtable+0x6c
void VTable0x70(float p_float) override; // vtable+0x70
void VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
override; // vtable+0x98
MxResult VTable0x9c() override; // vtable+0x9c
void VTable0x1c() override; // vtable+0x1c

View file

@ -54,7 +54,7 @@ class LegoPathActor : public LegoActor {
virtual void SetUserNavFlag(MxBool p_userNavFlag) { m_userNavFlag = p_userNavFlag; } // vtable+0x78
// FUNCTION: LEGO1 0x10002d30
virtual MxU8 GetUserNavFlag() { return m_userNavFlag; } // vtable+0x7c
virtual MxBool GetUserNavFlag() { return m_userNavFlag; } // vtable+0x7c
virtual MxResult VTable0x80(
Vector3& p_point1,
@ -86,7 +86,7 @@ class LegoPathActor : public LegoActor {
// FUNCTION: LEGO1 0x10002d50
virtual MxResult VTable0x94(LegoPathActor*, MxBool) { return 0; } // vtable+0x94
virtual void VTable0x98(
virtual void SwitchBoundary(
LegoPathBoundary*& p_boundary,
LegoUnknown100db7f4*& p_edge,
float& p_unk0xe4
@ -96,7 +96,7 @@ class LegoPathActor : public LegoActor {
// FUNCTION: LEGO1 0x10002d60
virtual MxS32 VTable0xa0() { return 0; } // vtable+0xa0
virtual void VTable0xa4(MxU8&, MxS32&); // vtable+0xa4
virtual void VTable0xa4(MxBool&, MxS32&); // vtable+0xa4
virtual void VTable0xa8(); // vtable+0xa8
// FUNCTION: LEGO1 0x10002d70

View file

@ -34,6 +34,12 @@ class LegoPathBoundary : public LegoWEGEdge {
MxResult AddActor(LegoPathActor* p_actor);
MxResult RemoveActor(LegoPathActor* p_actor);
void FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor);
void SwitchBoundary(
LegoPathActor* p_actor,
LegoPathBoundary*& p_boundary,
LegoUnknown100db7f4*& p_edge,
float& p_unk0xe4
);
MxU32 Intersect(
float p_scale,
Vector3& p_point1,

View file

@ -42,7 +42,7 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap {
) override; // vtable+0x6c
void VTable0x70(float p_float) override; // vtable+0x70
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
void VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
override; // vtable+0x98
MxResult VTable0x9c() override; // vtable+0x9c

View file

@ -72,7 +72,7 @@ void LegoCarRaceActor::VTable0x70(float p_float)
}
// STUB: LEGO1 0x10081d20
void LegoCarRaceActor::VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
void LegoCarRaceActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
{
// TODO
}

View file

@ -71,7 +71,7 @@ MxResult LegoJetski::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
}
// STUB: LEGO1 0x100141c0
void LegoJetski::VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
void LegoJetski::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
{
// TODO
}

View file

@ -38,7 +38,7 @@ void LegoJetskiRaceActor::VTable0x70(float p_float)
}
// STUB: LEGO1 0x100822d0
void LegoJetskiRaceActor::VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
void LegoJetskiRaceActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
{
// TODO
}

View file

@ -109,19 +109,19 @@ MxU32 LegoExtraActor::VTable0x90(float p_time, Matrix4& p_transform)
}
// FUNCTION: LEGO1 0x1002aa90
void LegoExtraActor::VTable0xa4(MxU8& p_und1, MxS32& p_und2)
void LegoExtraActor::VTable0xa4(MxBool& p_und1, MxS32& p_und2)
{
switch (m_unk0x0c) {
case 1:
p_und1 = 1;
p_und1 = TRUE;
p_und2 = 1;
break;
case 2:
p_und1 = 0;
p_und1 = FALSE;
p_und2 = 1;
break;
default:
p_und1 = 1;
p_und1 = TRUE;
p_und2 = rand() % p_und2 + 1;
break;
}

View file

@ -417,11 +417,11 @@ void LegoPathActor::VTable0x70(float p_time)
}
}
// STUB: LEGO1 0x1002e8b0
// FUNCTION: LEGO1 0x1002e8b0
// FUNCTION: BETA10 0x100af2f7
void LegoPathActor::VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
void LegoPathActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
{
// TODO
m_boundary->SwitchBoundary(this, p_boundary, p_edge, p_unk0xe4);
}
// FUNCTION: LEGO1 0x1002e8d0
@ -576,7 +576,7 @@ MxResult LegoPathActor::VTable0x9c()
}
if (local1c != 0) {
VTable0x98(m_boundary, m_destEdge, m_unk0xe4);
SwitchBoundary(m_boundary, m_destEdge, m_unk0xe4);
}
if (local20 != 0) {
@ -629,7 +629,7 @@ MxResult LegoPathActor::VTable0x9c()
}
// STUB: LEGO1 0x1002f650
void LegoPathActor::VTable0xa4(MxU8&, MxS32&)
void LegoPathActor::VTable0xa4(MxBool&, MxS32&)
{
// TODO
}

View file

@ -80,6 +80,103 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa
}
}
// FUNCTION: LEGO1 0x10057720
// FUNCTION: BETA10 0x100b17ef
void LegoPathBoundary::SwitchBoundary(
LegoPathActor* p_actor,
LegoPathBoundary*& p_boundary,
LegoUnknown100db7f4*& p_edge,
float& p_unk0xe4
)
{
LegoUnknown100db7f4* e = p_edge;
if (p_edge->Unknown2(*p_boundary)) {
LegoPathBoundary* newBoundary = (LegoPathBoundary*) p_edge->OtherFace(p_boundary);
if (newBoundary == NULL) {
newBoundary = p_boundary;
}
MxS32 local10 = 0;
MxU8 userNavFlag;
if (e->Unknown(*newBoundary, 1)) {
userNavFlag = p_actor->GetUserNavFlag();
}
else {
userNavFlag = TRUE;
}
do {
p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary);
LegoPathBoundary* local20 = (LegoPathBoundary*) p_edge->OtherFace(newBoundary);
if (p_edge->GetMask0x03() && (userNavFlag || p_edge->Unknown(*local20, 1))) {
local10++;
}
} while (p_edge != e);
MxBool localc = TRUE;
MxS32 local8 = local10 - 1;
if (local10 <= 1) {
local8 = 0;
}
else if (local10 == 2) {
local8 = 1;
}
else {
p_actor->VTable0xa4(localc, local8);
}
while (local8 > 0) {
if (localc) {
p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary);
}
else {
p_edge = (LegoUnknown100db7f4*) p_edge->GetClockwiseEdge(*newBoundary);
}
LegoPathBoundary* local20 = (LegoPathBoundary*) p_edge->OtherFace(newBoundary);
if (p_edge->GetMask0x03() && (userNavFlag || p_edge->Unknown(*local20, 1))) {
local8--;
}
}
if (p_edge == e) {
p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary);
p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary);
}
if (p_boundary != newBoundary) {
p_boundary->RemoveActor(p_actor);
p_boundary = newBoundary;
p_boundary->AddActor(p_actor);
}
else {
p_unk0xe4 = 1.0 - p_unk0xe4;
}
}
else {
do {
p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*p_boundary);
if (p_edge->GetMask0x03()) {
break;
}
} while (p_edge != e);
if (p_edge == e) {
p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*p_boundary);
p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*p_boundary);
}
p_unk0xe4 = 1.0 - p_unk0xe4;
}
}
// FUNCTION: LEGO1 0x10057950
// FUNCTION: BETA10 0x100b1adc
MxU32 LegoPathBoundary::Intersect(

View file

@ -91,7 +91,7 @@ MxResult LegoRaceCar::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
}
// STUB: LEGO1 0x10014550
void LegoRaceCar::VTable0x98(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
void LegoRaceCar::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
{
// TODO
}

View file

@ -41,6 +41,12 @@ struct LegoUnknown100db7f4 : public LegoEdge {
(p_face.IsEqual(*m_faceA) && (m_flags & c_bit2) && (p_face.GetMask0x03() & p_mask) == p_mask);
}
// FUNCTION: BETA10 0x100b53b0
LegoU32 Unknown2(LegoWEGEdge& p_face)
{
return (p_face.IsEqual(*m_faceA) && (m_flags & c_bit1)) || (p_face.IsEqual(*m_faceB) && (m_flags & c_bit2));
}
// FUNCTION: BETA10 0x1001cbe0
LegoWEEdge* OtherFace(LegoWEEdge* p_other)
{