Implement/match LegoPathController::FUN_1004a240 (#941)

This commit is contained in:
Christian Semmler 2024-05-20 11:34:31 -04:00 committed by GitHub
parent 8428cde67f
commit 3342464321
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 141 additions and 31 deletions

View file

@ -15,7 +15,7 @@ class Act2Actor : public LegoAnimActor {
MxS32 VTable0x68(Vector3&, Vector3&, Vector3&) override; // vtable+0x68 MxS32 VTable0x68(Vector3&, Vector3&, Vector3&) override; // vtable+0x68
void VTable0x70(float p_und) override; // vtable+0x70 void VTable0x70(float p_und) override; // vtable+0x70
MxResult VTable0x94(LegoPathActor*, MxBool) override; // vtable+0x94 MxResult VTable0x94(LegoPathActor*, MxBool) override; // vtable+0x94
MxResult WaitForAnimation() override; // vtable+0x9c MxResult VTable0x9c() override; // vtable+0x9c
MxS32 VTable0xa0() override; // vtable+0xa0 MxS32 VTable0xa0() override; // vtable+0xa0
// SYNTHETIC: LEGO1 0x1001a0a0 // SYNTHETIC: LEGO1 0x1001a0a0

View file

@ -39,7 +39,7 @@ class LegoCarRaceActor : public virtual LegoRaceActor {
MxU32 VTable0x90(float, Matrix4&) override; // vtable+0x90 MxU32 VTable0x90(float, Matrix4&) override; // vtable+0x90
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
void VTable0x98() override; // vtable+0x98 void VTable0x98() override; // vtable+0x98
MxResult WaitForAnimation() override; // vtable+0x9c MxResult VTable0x9c() override; // vtable+0x9c
virtual void FUN_10080590(); virtual void FUN_10080590();

View file

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

View file

@ -44,7 +44,7 @@ class LegoJetski : public LegoJetskiRaceActor, public LegoRaceMap {
void VTable0x70(float p_float) override; // vtable+0x70 void VTable0x70(float p_float) override; // vtable+0x70
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
void VTable0x98() override; // vtable+0x98 void VTable0x98() override; // vtable+0x98
MxResult WaitForAnimation() override; // vtable+0x9c MxResult VTable0x9c() override; // vtable+0x9c
virtual void FUN_100136f0(float p_worldSpeed); virtual void FUN_100136f0(float p_worldSpeed);

View file

@ -37,7 +37,7 @@ class LegoJetskiRaceActor : public virtual LegoCarRaceActor {
) override; // vtable+0x6c ) override; // vtable+0x6c
void VTable0x70(float p_float) override; // vtable+0x70 void VTable0x70(float p_float) override; // vtable+0x70
void VTable0x98() override; // vtable+0x98 void VTable0x98() override; // vtable+0x98
MxResult WaitForAnimation() override; // vtable+0x9c MxResult VTable0x9c() override; // vtable+0x9c
void VTable0x1c() override; // vtable+0x1c void VTable0x1c() override; // vtable+0x1c
// SYNTHETIC: LEGO1 0x10081d40 // SYNTHETIC: LEGO1 0x10081d40

View file

@ -9,6 +9,7 @@
struct LegoEdge; struct LegoEdge;
class LegoPathBoundary; class LegoPathBoundary;
class LegoPathController; class LegoPathController;
struct LegoPathEdgeContainer;
struct LegoUnknown100db7f4; struct LegoUnknown100db7f4;
class LegoWEEdge; class LegoWEEdge;
@ -86,7 +87,7 @@ class LegoPathActor : public LegoActor {
virtual MxResult VTable0x94(LegoPathActor*, MxBool) { return 0; } // vtable+0x94 virtual MxResult VTable0x94(LegoPathActor*, MxBool) { return 0; } // vtable+0x94
virtual void VTable0x98(); // vtable+0x98 virtual void VTable0x98(); // vtable+0x98
virtual MxResult WaitForAnimation(); // vtable+0x9c virtual MxResult VTable0x9c(); // vtable+0x9c
// FUNCTION: LEGO1 0x10002d60 // FUNCTION: LEGO1 0x10002d60
virtual MxS32 VTable0xa0() { return 0; } // vtable+0xa0 virtual MxS32 VTable0xa0() { return 0; } // vtable+0xa0
@ -148,13 +149,13 @@ class LegoPathActor : public LegoActor {
LegoPathBoundary* m_boundary; // 0x88 LegoPathBoundary* m_boundary; // 0x88
LegoUnknown m_unk0x8c; // 0x8c LegoUnknown m_unk0x8c; // 0x8c
MxU32 m_state; // 0xdc MxU32 m_state; // 0xdc
LegoEdge* m_destEdge; // 0xe0 LegoUnknown100db7f4* m_destEdge; // 0xe0
MxFloat m_unk0xe4; // 0xe4 MxFloat m_unk0xe4; // 0xe4
undefined m_unk0xe8; // 0xe8 undefined m_unk0xe8; // 0xe8
undefined m_unk0xe9; // 0xe9 undefined m_unk0xe9; // 0xe9
MxBool m_userNavFlag; // 0xea MxBool m_userNavFlag; // 0xea
MxMatrix m_unk0xec; // 0xec MxMatrix m_unk0xec; // 0xec
undefined* m_unk0x134; // 0x134 LegoPathEdgeContainer* m_grec; // 0x134
LegoPathController* m_controller; // 0x138 LegoPathController* m_controller; // 0x138
MxFloat m_unk0x13c; // 0x13c MxFloat m_unk0x13c; // 0x13c
MxFloat m_unk0x140; // 0x140 MxFloat m_unk0x140; // 0x140
@ -164,6 +165,12 @@ class LegoPathActor : public LegoActor {
MxFloat m_unk0x150; // 0x150 MxFloat m_unk0x150; // 0x150
}; };
// TEMPLATE: LEGO1 0x10018b70
// List<LegoBoundaryEdge>::~List<LegoBoundaryEdge>
// TEMPLATE: LEGO1 0x10018bc0
// list<LegoBoundaryEdge,allocator<LegoBoundaryEdge> >::~list<LegoBoundaryEdge,allocator<LegoBoundaryEdge> >
// TEMPLATE: LEGO1 0x1002ef10 // TEMPLATE: LEGO1 0x1002ef10
// list<LegoPathBoundary *,allocator<LegoPathBoundary *> >::~list<LegoPathBoundary *,allocator<LegoPathBoundary *> > // list<LegoPathBoundary *,allocator<LegoPathBoundary *> >::~list<LegoPathBoundary *,allocator<LegoPathBoundary *> >

View file

@ -34,7 +34,13 @@ class LegoPathBoundary : public LegoWEGEdge {
MxResult AddActor(LegoPathActor* p_actor); MxResult AddActor(LegoPathActor* p_actor);
MxResult RemoveActor(LegoPathActor* p_actor); MxResult RemoveActor(LegoPathActor* p_actor);
void FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor); void FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor);
MxU32 Intersect(float p_scale, Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, LegoEdge*& p_edge); MxU32 Intersect(
float p_scale,
Vector3& p_point1,
Vector3& p_point2,
Vector3& p_point3,
LegoUnknown100db7f4*& p_edge
);
MxU32 FUN_10057fe0(LegoAnimPresenter* p_presenter); MxU32 FUN_10057fe0(LegoAnimPresenter* p_presenter);
MxU32 FUN_100586e0(LegoAnimPresenter* p_presenter); MxU32 FUN_100586e0(LegoAnimPresenter* p_presenter);

View file

@ -103,6 +103,14 @@ class LegoPathController : public MxCore {
LegoPathBoundary* GetPathBoundary(const char* p_name); LegoPathBoundary* GetPathBoundary(const char* p_name);
void Enable(MxBool p_enable); void Enable(MxBool p_enable);
void FUN_10046bb0(LegoWorld* p_world); void FUN_10046bb0(LegoWorld* p_world);
MxU32 FUN_1004a240(
LegoPathEdgeContainer& p_grec,
Vector3& p_v1,
Vector3& p_v2,
float p_f1,
LegoUnknown100db7f4*& p_edge,
LegoPathBoundary*& p_boundary
);
static MxResult Init(); static MxResult Init();
static MxResult Reset(); static MxResult Reset();
@ -177,6 +185,9 @@ class LegoPathController : public MxCore {
// SYNTHETIC: LEGO1 0x10047ae0 // SYNTHETIC: LEGO1 0x10047ae0
// LegoUnknown100db7f4::~LegoUnknown100db7f4 // LegoUnknown100db7f4::~LegoUnknown100db7f4
// TEMPLATE: LEGO1 0x10048f70
// list<LegoBoundaryEdge,allocator<LegoBoundaryEdge> >::erase
// TEMPLATE: LEGO1 0x1004a780 // TEMPLATE: LEGO1 0x1004a780
// _Construct // _Construct

View file

@ -0,0 +1,49 @@
#ifndef LEGOPATHEDGECONTAINER_H
#define LEGOPATHEDGECONTAINER_H
#include "mxgeometry/mxgeometry3d.h"
#include "mxstl/stlcompat.h"
#include "mxtypes.h"
class LegoPathBoundary;
struct LegoUnknown100db7f4;
// SIZE 0x08
struct LegoBoundaryEdge {
LegoUnknown100db7f4* m_edge; // 0x00
LegoPathBoundary* m_boundary; // 0x04
int operator==(LegoBoundaryEdge) const { return 0; }
int operator<(LegoBoundaryEdge) const { return 0; }
};
// SIZE 0x3c
struct LegoPathEdgeContainer : public list<LegoBoundaryEdge> {
enum {
c_bit1 = 0x01
};
// FUNCTION: BETA10 0x100118e0
LegoPathEdgeContainer()
{
m_boundary = NULL;
m_flags = 0;
}
void SetBit1(MxU32 p_flag)
{
if (p_flag) {
m_flags |= c_bit1;
}
else {
m_flags &= ~c_bit1;
}
}
Mx3DPointFloat m_unk0x0c; // 0x0c
Mx3DPointFloat m_unk0x20; // 0x20
LegoPathBoundary* m_boundary; // 0x34
MxU8 m_flags; // 0x38
};
#endif // LEGOPATHEDGECONTAINER_H

View file

@ -43,7 +43,7 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap {
void VTable0x70(float p_float) override; // vtable+0x70 void VTable0x70(float p_float) override; // vtable+0x70
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
void VTable0x98() override; // vtable+0x98 void VTable0x98() override; // vtable+0x98
MxResult WaitForAnimation() override; // vtable+0x9c MxResult VTable0x9c() override; // vtable+0x9c
virtual void FUN_10012ea0(float p_worldSpeed); virtual void FUN_10012ea0(float p_worldSpeed);
virtual void FUN_10012ff0(float); virtual void FUN_10012ff0(float);

View file

@ -22,7 +22,7 @@ MxResult Act2Actor::VTable0x94(LegoPathActor*, MxBool)
} }
// STUB: LEGO1 0x10018a20 // STUB: LEGO1 0x10018a20
MxResult Act2Actor::WaitForAnimation() MxResult Act2Actor::VTable0x9c()
{ {
// TODO // TODO
return SUCCESS; return SUCCESS;

View file

@ -78,7 +78,7 @@ void LegoCarRaceActor::VTable0x98()
} }
// STUB: LEGO1 0x10081d30 // STUB: LEGO1 0x10081d30
MxResult LegoCarRaceActor::WaitForAnimation() MxResult LegoCarRaceActor::VTable0x9c()
{ {
// TODO // TODO
return SUCCESS; return SUCCESS;

View file

@ -77,7 +77,7 @@ void LegoJetski::VTable0x98()
} }
// STUB: LEGO1 0x10014200 // STUB: LEGO1 0x10014200
MxResult LegoJetski::WaitForAnimation() MxResult LegoJetski::VTable0x9c()
{ {
// TODO // TODO
return SUCCESS; return SUCCESS;

View file

@ -44,7 +44,7 @@ void LegoJetskiRaceActor::VTable0x98()
} }
// STUB: LEGO1 0x100822e0 // STUB: LEGO1 0x100822e0
MxResult LegoJetskiRaceActor::WaitForAnimation() MxResult LegoJetskiRaceActor::VTable0x9c()
{ {
// TODO // TODO
return SUCCESS; return SUCCESS;

View file

@ -151,7 +151,7 @@ MxResult LegoExtraActor::FUN_1002aae0()
m_boundary = oldEdge; m_boundary = oldEdge;
} }
LegoPathActor::WaitForAnimation(); LegoPathActor::VTable0x9c();
return SUCCESS; return SUCCESS;
} }
@ -280,10 +280,10 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
} }
// FUNCTION: LEGO1 0x1002b290 // FUNCTION: LEGO1 0x1002b290
MxResult LegoExtraActor::WaitForAnimation() MxResult LegoExtraActor::VTable0x9c()
{ {
LegoPathBoundary* oldBoundary = m_boundary; LegoPathBoundary* oldBoundary = m_boundary;
MxResult result = LegoPathActor::WaitForAnimation(); MxResult result = LegoPathActor::VTable0x9c();
if (m_boundary != oldBoundary) { if (m_boundary != oldBoundary) {
MxU32 b = FALSE; MxU32 b = FALSE;

View file

@ -5,6 +5,7 @@
#include "legocameracontroller.h" #include "legocameracontroller.h"
#include "legonavcontroller.h" #include "legonavcontroller.h"
#include "legopathboundary.h" #include "legopathboundary.h"
#include "legopathedgecontainer.h"
#include "legosoundmanager.h" #include "legosoundmanager.h"
#include "legoworld.h" #include "legoworld.h"
#include "misc.h" #include "misc.h"
@ -15,6 +16,7 @@
#include <vec.h> #include <vec.h>
DECOMP_SIZE_ASSERT(LegoPathActor, 0x154) DECOMP_SIZE_ASSERT(LegoPathActor, 0x154)
DECOMP_SIZE_ASSERT(LegoPathEdgeContainer, 0x3c)
#ifndef M_PI #ifndef M_PI
#define M_PI 3.1416 #define M_PI 3.1416
@ -40,21 +42,21 @@ LegoPathActor::LegoPathActor()
m_unk0x7c = 0; m_unk0x7c = 0;
m_userNavFlag = FALSE; m_userNavFlag = FALSE;
m_state = 0; m_state = 0;
m_unk0x134 = NULL; m_grec = NULL;
m_controller = NULL; m_controller = NULL;
m_unk0xe8 = 0; m_unk0xe8 = 0;
m_unk0x148 = 0; m_unk0x148 = 0;
m_unk0x14c = 0; m_unk0x14c = 0;
m_unk0x140 = 0.0099999998f; m_unk0x140 = 0.0099999999f;
m_unk0x144 = 0.80000001f; m_unk0x144 = 0.8f;
m_unk0x150 = 2.0f; m_unk0x150 = 2.0f;
} }
// STUB: LEGO1 0x1002d820 // FUNCTION: LEGO1 0x1002d820
LegoPathActor::~LegoPathActor() LegoPathActor::~LegoPathActor()
{ {
if (m_unk0x134) { if (m_grec) {
delete m_unk0x134; delete m_grec;
} }
} }
@ -264,7 +266,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
LegoPathBoundary* oldBoundary = m_boundary; LegoPathBoundary* oldBoundary = m_boundary;
if (m_unk0xe9 != 0) { if (m_unk0xe9 != 0) {
WaitForAnimation(); VTable0x9c();
if (m_boundary == oldBoundary) { if (m_boundary == oldBoundary) {
MxLong time = Timer()->GetTime(); MxLong time = Timer()->GetTime();
@ -344,7 +346,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
pos2 = pos1; pos2 = pos1;
if (m_unk0xe9 != 0) { if (m_unk0xe9 != 0) {
WaitForAnimation(); VTable0x9c();
} }
return 0; return 0;
@ -544,7 +546,8 @@ void LegoPathActor::ParseAction(char* p_extra)
} }
// STUB: LEGO1 0x1002f1b0 // STUB: LEGO1 0x1002f1b0
MxResult LegoPathActor::WaitForAnimation() // FUNCTION: BETA10 0x100af899
MxResult LegoPathActor::VTable0x9c()
{ {
// TODO // TODO
return SUCCESS; return SUCCESS;

View file

@ -87,7 +87,7 @@ MxU32 LegoPathBoundary::Intersect(
Vector3& p_point1, Vector3& p_point1,
Vector3& p_point2, Vector3& p_point2,
Vector3& p_point3, Vector3& p_point3,
LegoEdge*& p_edge LegoUnknown100db7f4*& p_edge
) )
{ {
LegoUnknown100db7f4* e = NULL; LegoUnknown100db7f4* e = NULL;
@ -207,7 +207,7 @@ MxU32 LegoPathBoundary::Intersect(
if (local58 <= 0.0f) { if (local58 <= 0.0f) {
if (!e->GetMask0x03()) { if (!e->GetMask0x03()) {
p_edge = e->GetClockwiseEdge(*this); p_edge = (LegoUnknown100db7f4*) e->GetClockwiseEdge(*this);
} }
else { else {
p_edge = e; p_edge = e;
@ -227,7 +227,7 @@ MxU32 LegoPathBoundary::Intersect(
p_point3 = *e->CCWVertex(*this); p_point3 = *e->CCWVertex(*this);
if (!e->GetMask0x03()) { if (!e->GetMask0x03()) {
p_edge = e->GetCounterclockwiseEdge(*this); p_edge = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(*this);
} }
else { else {
p_edge = e; p_edge = e;

View file

@ -1,5 +1,6 @@
#include "legopathcontroller.h" #include "legopathcontroller.h"
#include "legopathedgecontainer.h"
#include "legopathstruct.h" #include "legopathstruct.h"
#include "misc/legostorage.h" #include "misc/legostorage.h"
#include "mxmisc.h" #include "mxmisc.h"
@ -727,3 +728,36 @@ MxResult LegoPathController::ReadVector(LegoStorage* p_storage, Mx4DPointFloat&
return SUCCESS; return SUCCESS;
} }
// FUNCTION: LEGO1 0x1004a240
// FUNCTION: BETA10 0x100b9160
MxU32 LegoPathController::FUN_1004a240(
LegoPathEdgeContainer& p_grec,
Vector3& p_v1,
Vector3& p_v2,
float p_f1,
LegoUnknown100db7f4*& p_edge,
LegoPathBoundary*& p_boundary
)
{
if (p_grec.size() == 0) {
p_v1 = p_grec.m_unk0x0c;
p_v2 = p_grec.m_unk0x20;
p_boundary = p_grec.m_boundary;
p_grec.SetBit1(FALSE);
return 1;
}
p_edge = p_grec.front().m_edge;
p_boundary = p_grec.front().m_boundary;
p_grec.pop_front();
Mx3DPointFloat vec;
p_v1 = *p_edge->CCWVertex(*p_boundary);
p_v1.Sub(p_edge->GetOpposingPoint(*p_boundary));
p_v1.Mul(p_f1);
p_v1.Add(p_edge->GetOpposingPoint(*p_boundary));
p_edge->FUN_1002ddc0(*p_boundary, vec);
p_v2.EqualsCross(p_boundary->GetUnknown0x14(), &vec);
return 0;
}

View file

@ -97,7 +97,7 @@ void LegoRaceCar::VTable0x98()
} }
// STUB: LEGO1 0x10014580 // STUB: LEGO1 0x10014580
MxResult LegoRaceCar::WaitForAnimation() MxResult LegoRaceCar::VTable0x9c()
{ {
// TODO // TODO
return SUCCESS; return SUCCESS;