Implement various small LegoPathController functions (#914)

* Implement/match LegoPathController::Tickle

* Implement various small LegoPathController functions

* Add 0x10046b30
This commit is contained in:
Christian Semmler 2024-05-12 15:30:34 -04:00 committed by GitHub
parent b6fc8e27b1
commit 91fe09af3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 64 additions and 19 deletions

View file

@ -31,6 +31,8 @@ class LegoPathBoundary : public LegoWEGEdge {
MxResult AddActor(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 FUN_10057fe0(LegoAnimPresenter* p_presenter);
MxU32 FUN_100586e0(LegoAnimPresenter* p_presenter);
inline LegoPathActorSet* GetActors() { return &m_actors; }
inline LegoAnimPresenterSet* GetPresenters() { return &m_presenters; }

View file

@ -92,7 +92,7 @@ class LegoPathController : public MxCore {
undefined4 FUN_10046770(LegoPathActor* p_actor);
void FUN_100468f0(LegoAnimPresenter* p_presenter);
void FUN_10046930(LegoAnimPresenter* p_presenter);
MxResult FUN_10046b30(LegoPathBoundary** p_path, MxS32& p_value);
MxResult FUN_10046b30(LegoPathBoundary*& p_boundaries, MxS32& p_numL);
LegoPathBoundary* GetPathBoundary(const char* p_name);
void Enable(MxBool p_enable);
void FUN_10046bb0(LegoWorld* p_world);

View file

@ -5,6 +5,8 @@
#include "mxatom.h"
#include "mxtypes.h"
class LegoWorld;
// VTABLE: LEGO1 0x100d7d9c
// SIZE 0x0c
struct LegoPathStructBase {
@ -28,17 +30,18 @@ struct LegoPathStructBase {
struct LegoPathStruct : public LegoPathStructBase {
public:
// FUNCTION: LEGO1 0x100473a0
LegoPathStruct() : m_unk0x0c(0) {}
LegoPathStruct() : m_world(NULL) {}
// FUNCTION: LEGO1 0x10047470
~LegoPathStruct() override {}
void VTable0x04(undefined4, undefined4, undefined4); // vtable+0x04
inline void SetWorld(LegoWorld* p_world) { m_world = p_world; }
inline void SetAtomId(const MxAtomId& p_atomId) { m_atomId = p_atomId; }
undefined4 m_unk0x0c; // 0x0c
MxAtomId m_atomId; // 0x10
LegoWorld* m_world; // 0x0c
MxAtomId m_atomId; // 0x10
};
// SYNTHETIC: LEGO1 0x10047440

View file

@ -85,7 +85,7 @@ class LegoWorld : public LegoEntity {
void FUN_1001fe90(LegoAnimPresenter* p_presenter);
LegoPathBoundary* FindPathBoundary(const char* p_name);
void AddPath(LegoPathController* p_controller);
MxResult GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value);
MxResult GetCurrPathInfo(LegoPathBoundary** p_boundaries, MxS32& p_numL);
MxCore* Find(const char* p_class, const char* p_name);
MxCore* Find(const MxAtomId& p_atom, MxS32 p_entityId);

View file

@ -376,7 +376,7 @@ LegoPathBoundary* LegoWorld::FindPathBoundary(const char* p_name)
}
// FUNCTION: LEGO1 0x10020120
MxResult LegoWorld::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value)
MxResult LegoWorld::GetCurrPathInfo(LegoPathBoundary** p_boundaries, MxS32& p_numL)
{
LegoPathControllerListCursor cursor(&m_list0x68);
LegoPathController* controller;
@ -387,7 +387,7 @@ MxResult LegoWorld::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value)
return FAILURE;
}
return controller->FUN_10046b30(p_path, p_value);
return controller->FUN_10046b30(*p_boundaries, p_numL);
}
// FUNCTION: LEGO1 0x10020220

View file

@ -41,3 +41,19 @@ MxU32 LegoPathBoundary::Intersect(
{
return 0;
}
// STUB: LEGO1 0x10057fe0
// FUNCTION: BETA10 0x100b2220
MxU32 LegoPathBoundary::FUN_10057fe0(LegoAnimPresenter* p_presenter)
{
// TODO
return 0;
}
// STUB: LEGO1 0x100586e0
// FUNCTION: BETA10 0x100b22d1
MxU32 LegoPathBoundary::FUN_100586e0(LegoAnimPresenter* p_presenter)
{
// TODO
return 0;
}

View file

@ -233,16 +233,24 @@ undefined4 LegoPathController::FUN_10046770(LegoPathActor* p_actor)
return 0;
}
// STUB: LEGO1 0x100468f0
// FUNCTION: LEGO1 0x100468f0
// FUNCTION: BETA10 0x100b72f7
void LegoPathController::FUN_100468f0(LegoAnimPresenter* p_presenter)
{
for (MxS32 i = 0; i < m_numL; i++) {
if (!(m_boundaries[i].m_flags & LegoWEGEdge::c_bit3)) {
m_boundaries[i].FUN_10057fe0(p_presenter);
}
}
}
// STUB: LEGO1 0x10046930
// FUNCTION: LEGO1 0x10046930
// FUNCTION: BETA10 0x100b737b
void LegoPathController::FUN_10046930(LegoAnimPresenter* p_presenter)
{
for (MxS32 i = 0; i < m_numL; i++) {
m_boundaries[i].FUN_100586e0(p_presenter);
}
}
// FUNCTION: LEGO1 0x10046970
@ -264,9 +272,11 @@ void LegoPathController::FUN_10046970()
}
}
// STUB: LEGO1 0x10046b30
MxResult LegoPathController::FUN_10046b30(LegoPathBoundary** p_path, MxS32& p_value)
// FUNCTION: LEGO1 0x10046b30
MxResult LegoPathController::FUN_10046b30(LegoPathBoundary*& p_boundaries, MxS32& p_numL)
{
p_boundaries = m_boundaries;
p_numL = m_numL;
return SUCCESS;
}
@ -283,16 +293,25 @@ LegoPathBoundary* LegoPathController::GetPathBoundary(const char* p_name)
return NULL;
}
// STUB: LEGO1 0x10046bb0
// FUNCTION: LEGO1 0x10046bb0
// FUNCTION: BETA10 0x100b75bc
void LegoPathController::FUN_10046bb0(LegoWorld* p_world)
{
// TODO
for (MxS32 i = 0; i < m_numT; i++) {
m_structs[i].SetWorld(p_world);
}
}
// STUB: LEGO1 0x10046be0
// FUNCTION: LEGO1 0x10046be0
// FUNCTION: BETA10 0x100b7614
void LegoPathController::Enable(MxBool p_enable)
{
// TODO
if (p_enable) {
TickleManager()->RegisterClient(this, 10);
}
else {
TickleManager()->UnregisterClient(this);
}
}
// FUNCTION: LEGO1 0x10046c10
@ -493,7 +512,7 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage)
edges[j] = &m_edges[s];
}
if (p_storage->Read(&boundary.m_unk0x0c, sizeof(boundary.m_unk0x0c)) != SUCCESS) {
if (p_storage->Read(&boundary.m_flags, sizeof(boundary.m_flags)) != SUCCESS) {
return FAILURE;
}

View file

@ -10,7 +10,7 @@ LegoWEGEdge::LegoWEGEdge()
m_name = NULL;
m_unk0x14.Clear();
m_edgeNormals = NULL;
m_unk0x0c = 0;
m_flags = 0;
m_unk0x48 = 0;
m_unk0x4c = NULL;
m_unk0x50 = NULL;

View file

@ -12,6 +12,11 @@ struct LegoPathStruct;
// SIZE 0x54
class LegoWEGEdge : public LegoWEEdge {
public:
enum {
c_bit3 = 0x04,
c_bit5 = 0x10
};
// SIZE 0x0c
struct Path {
// FUNCTION: LEGO1 0x10048280
@ -33,7 +38,7 @@ class LegoWEGEdge : public LegoWEEdge {
LegoResult VTable0x04() override; // vtable+0x04
inline LegoU32 GetFlag0x10() { return m_unk0x0c & 0x10 ? FALSE : TRUE; }
inline LegoU32 GetFlag0x10() { return m_flags & c_bit5 ? FALSE : TRUE; }
inline Mx4DPointFloat* GetUnknown0x14() { return &m_unk0x14; }
inline Mx4DPointFloat* GetEdgeNormal(int index) { return &m_edgeNormals[index]; }
inline LegoChar* GetName() { return m_name; }
@ -44,7 +49,7 @@ class LegoWEGEdge : public LegoWEEdge {
friend class LegoPathController;
private:
LegoU8 m_unk0x0c; // 0x0c
LegoU8 m_flags; // 0x0c
LegoU8 m_unk0x0d; // 0x0d
LegoChar* m_name; // 0x10
Mx4DPointFloat m_unk0x14; // 0x14