Implement/match LegoPathActor::VTable0xa4 and VTable0xa8 (#945)

* Implement/match LegoPathActor::VTable0xa4

* Implement/match LegoPathActor::VTable0xa8

* Name enum constants
This commit is contained in:
Christian Semmler 2024-05-22 14:09:06 -04:00 committed by GitHub
parent 8fee73c525
commit 6774784b37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 79 additions and 42 deletions

View file

@ -24,10 +24,9 @@ class Act1State;
// SIZE 0x140 // SIZE 0x140
class Isle : public LegoWorld { class Isle : public LegoWorld {
public: public:
// For g_unk0x100f1198
enum { enum {
c_bit6 = 0x20, c_playCamAnims = 0x20,
c_bit7 = 0x40 c_playMusic = 0x40
}; };
Isle(); Isle();

View file

@ -102,7 +102,7 @@ class LegoAnimationManager : public MxCore {
MxBool p_param8, MxBool p_param8,
MxBool p_param9 MxBool p_param9
); );
void CameraTriggerFire(LegoPathActor* p_actor, undefined4, MxU32 p_location, MxBool p_bool); void CameraTriggerFire(LegoPathActor* p_actor, MxBool, MxU32 p_location, MxBool p_bool);
void FUN_10061010(MxBool p_und); void FUN_10061010(MxBool p_und);
LegoTranInfo* GetTranInfo(MxU32 p_index); LegoTranInfo* GetTranInfo(MxU32 p_index);
void FUN_10062770(); void FUN_10062770();

View file

@ -96,8 +96,8 @@ 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(MxBool&, MxS32&); // vtable+0xa4 virtual void VTable0xa4(MxBool& p_und1, MxS32& p_und2); // vtable+0xa4
virtual void VTable0xa8(); // vtable+0xa8 virtual void VTable0xa8(); // vtable+0xa8
// FUNCTION: LEGO1 0x10002d70 // FUNCTION: LEGO1 0x10002d70
virtual void VTable0xac(MxFloat p_unk0x13c) { m_unk0x13c = p_unk0x13c; } // vtable+0xac virtual void VTable0xac(MxFloat p_unk0x13c) { m_unk0x13c = p_unk0x13c; } // vtable+0xac

View file

@ -1153,7 +1153,7 @@ MxResult LegoAnimationManager::FUN_10060dc0(
// FUNCTION: LEGO1 0x10060eb0 // FUNCTION: LEGO1 0x10060eb0
// FUNCTION: BETA10 0x1004206c // FUNCTION: BETA10 0x1004206c
void LegoAnimationManager::CameraTriggerFire(LegoPathActor* p_actor, undefined4, MxU32 p_location, MxBool p_bool) void LegoAnimationManager::CameraTriggerFire(LegoPathActor* p_actor, MxBool, MxU32 p_location, MxBool p_bool)
{ {
if (Lego()->m_unk0x13c && m_enableCamAnims && !m_animRunning) { if (Lego()->m_unk0x13c && m_enableCamAnims && !m_animRunning) {
LegoLocation* location = LegoNavController::GetLocation(p_location); LegoLocation* location = LegoNavController::GetLocation(p_location);

View file

@ -628,14 +628,49 @@ MxResult LegoPathActor::VTable0x9c()
return SUCCESS; return SUCCESS;
} }
// STUB: LEGO1 0x1002f650 // FUNCTION: LEGO1 0x1002f650
void LegoPathActor::VTable0xa4(MxBool&, MxS32&) // FUNCTION: BETA10 0x100afd67
void LegoPathActor::VTable0xa4(MxBool& p_und1, MxS32& p_und2)
{ {
// TODO switch (GetActorId()) {
case 1:
p_und1 = TRUE;
p_und2 = 2;
break;
case 2:
p_und1 = FALSE;
p_und2 = 1;
break;
case 3:
p_und1 = TRUE;
p_und2 = 1;
break;
case 4:
case 6:
p_und1 = TRUE;
p_und2 = rand() % p_und2 + 1;
break;
case 5:
p_und1 = FALSE;
p_und2 = 2;
break;
default:
p_und1 = TRUE;
p_und2 = 1;
break;
}
} }
// STUB: LEGO1 0x1002f700 // FUNCTION: LEGO1 0x1002f700
// FUNCTION: BETA10 0x100afe4c
void LegoPathActor::VTable0xa8() void LegoPathActor::VTable0xa8()
{ {
// TODO m_lastTime = Timer()->GetTime();
m_roi->FUN_100a58f0(m_unk0xec);
m_roi->VTable0x14();
if (m_userNavFlag) {
m_roi->WrappedSetLocalTransform(m_unk0xec);
FUN_10010c30();
}
} }

View file

@ -61,19 +61,19 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa
if (dot2 > dot1) { if (dot2 > dot1) {
for (MxS32 i = 0; i < m_unk0x48; i++) { for (MxS32 i = 0; i < m_unk0x48; i++) {
LegoPathStruct* s = m_unk0x4c[i].m_pathStruct; LegoPathStruct* s = m_pathTrigger[i].m_pathStruct;
if (m_unk0x4c[i].m_unk0x08 >= dot1 && m_unk0x4c[i].m_unk0x08 < dot2) { if (m_pathTrigger[i].m_unk0x08 >= dot1 && m_pathTrigger[i].m_unk0x08 < dot2) {
s->HandleTrigger(p_actor, TRUE, m_unk0x4c[i].m_data); s->HandleTrigger(p_actor, TRUE, m_pathTrigger[i].m_data);
} }
} }
} }
else if (dot2 < dot1) { else if (dot2 < dot1) {
for (MxS32 i = 0; i < m_unk0x48; i++) { for (MxS32 i = 0; i < m_unk0x48; i++) {
LegoPathStruct* s = m_unk0x4c[i].m_pathStruct; LegoPathStruct* s = m_pathTrigger[i].m_pathStruct;
if (m_unk0x4c[i].m_unk0x08 >= dot2 && m_unk0x4c[i].m_unk0x08 < dot1) { if (m_pathTrigger[i].m_unk0x08 >= dot2 && m_pathTrigger[i].m_unk0x08 < dot1) {
s->HandleTrigger(p_actor, FALSE, m_unk0x4c[i].m_data); s->HandleTrigger(p_actor, FALSE, m_pathTrigger[i].m_data);
} }
} }
} }

View file

@ -678,21 +678,24 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage)
if (boundary.m_unk0x48 > 0) { if (boundary.m_unk0x48 > 0) {
boundary.m_unk0x50 = new Mx3DPointFloat; boundary.m_unk0x50 = new Mx3DPointFloat;
boundary.m_unk0x4c = new LegoWEGEdge::PathWithTrigger[boundary.m_unk0x48]; boundary.m_pathTrigger = new LegoWEGEdge::PathWithTrigger[boundary.m_unk0x48];
for (j = 0; j < boundary.m_unk0x48; j++) { for (j = 0; j < boundary.m_unk0x48; j++) {
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
return FAILURE; return FAILURE;
} }
boundary.m_unk0x4c[j].m_pathStruct = &m_structs[s]; boundary.m_pathTrigger[j].m_pathStruct = &m_structs[s];
if (p_storage->Read(&boundary.m_unk0x4c[j].m_data, sizeof(boundary.m_unk0x4c[j].m_data)) != SUCCESS) { if (p_storage->Read(&boundary.m_pathTrigger[j].m_data, sizeof(boundary.m_pathTrigger[j].m_data)) !=
SUCCESS) {
return FAILURE; return FAILURE;
} }
if (p_storage->Read(&boundary.m_unk0x4c[j].m_unk0x08, sizeof(boundary.m_unk0x4c[j].m_unk0x08)) != if (p_storage->Read(
SUCCESS) { &boundary.m_pathTrigger[j].m_unk0x08,
sizeof(boundary.m_pathTrigger[j].m_unk0x08)
) != SUCCESS) {
return FAILURE; return FAILURE;
} }
} }

View file

@ -17,7 +17,7 @@ DECOMP_SIZE_ASSERT(LegoPathStructBase, 0x0c)
DECOMP_SIZE_ASSERT(LegoPathStruct, 0x14) DECOMP_SIZE_ASSERT(LegoPathStruct, 0x14)
// Flags used in isle.cpp // Flags used in isle.cpp
extern MxU32 g_unk0x100f1198; extern MxU32 g_isleFlags;
// GLOBAL: LEGO1 0x100f119c // GLOBAL: LEGO1 0x100f119c
MxBool g_unk0x100f119c = FALSE; MxBool g_unk0x100f119c = FALSE;
@ -45,7 +45,7 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction,
switch (m_name[2]) { switch (m_name[2]) {
case c_camAnim: case c_camAnim:
if (g_unk0x100f1198 & Isle::c_bit6) { if (g_isleFlags & Isle::c_playCamAnims) {
PlayCamAnim(p_actor, bool2, p_data, TRUE); PlayCamAnim(p_actor, bool2, p_data, TRUE);
} }
break; break;
@ -75,7 +75,7 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction,
break; break;
} }
case c_music: case c_music:
if (g_unk0x100f1198 & Isle::c_bit7) { if (g_isleFlags & Isle::c_playMusic) {
PlayMusic(p_direction, p_data); PlayMusic(p_direction, p_data);
} }
break; break;

View file

@ -38,7 +38,7 @@
DECOMP_SIZE_ASSERT(Isle, 0x140) DECOMP_SIZE_ASSERT(Isle, 0x140)
// GLOBAL: LEGO1 0x100f1198 // GLOBAL: LEGO1 0x100f1198
MxU32 g_unk0x100f1198 = 0x7f; MxU32 g_isleFlags = 0x7f;
// FUNCTION: LEGO1 0x10030820 // FUNCTION: LEGO1 0x10030820
Isle::Isle() Isle::Isle()
@ -724,7 +724,7 @@ void Isle::Enable(MxBool p_enable)
AnimationManager()->FUN_1005f6d0(FALSE); AnimationManager()->FUN_1005f6d0(FALSE);
AnimationManager()->EnableCamAnims(FALSE); AnimationManager()->EnableCamAnims(FALSE);
g_unk0x100f1198 &= ~c_bit7; g_isleFlags &= ~c_playMusic;
m_towtrack->FUN_1004dab0(); m_towtrack->FUN_1004dab0();
break; break;
case 9: case 9:
@ -733,7 +733,7 @@ void Isle::Enable(MxBool p_enable)
AnimationManager()->FUN_1005f6d0(FALSE); AnimationManager()->FUN_1005f6d0(FALSE);
AnimationManager()->EnableCamAnims(FALSE); AnimationManager()->EnableCamAnims(FALSE);
g_unk0x100f1198 &= ~c_bit7; g_isleFlags &= ~c_playMusic;
m_ambulance->FUN_10036e60(); m_ambulance->FUN_10036e60();
break; break;
case 11: case 11:

View file

@ -12,7 +12,7 @@ LegoWEGEdge::LegoWEGEdge()
m_edgeNormals = NULL; m_edgeNormals = NULL;
m_flags = 0; m_flags = 0;
m_unk0x48 = 0; m_unk0x48 = 0;
m_unk0x4c = NULL; m_pathTrigger = NULL;
m_unk0x50 = NULL; m_unk0x50 = NULL;
} }
@ -29,8 +29,8 @@ LegoWEGEdge::~LegoWEGEdge()
if (m_edgeNormals) { if (m_edgeNormals) {
delete[] m_edgeNormals; delete[] m_edgeNormals;
} }
if (m_unk0x4c) { if (m_pathTrigger) {
delete m_unk0x4c; delete m_pathTrigger;
} }
if (m_unk0x50) { if (m_unk0x50) {
delete m_unk0x50; delete m_unk0x50;

View file

@ -63,16 +63,16 @@ class LegoWEGEdge : public LegoWEEdge {
friend class LegoPathController; friend class LegoPathController;
protected: protected:
LegoU8 m_flags; // 0x0c LegoU8 m_flags; // 0x0c
LegoU8 m_unk0x0d; // 0x0d LegoU8 m_unk0x0d; // 0x0d
LegoChar* m_name; // 0x10 LegoChar* m_name; // 0x10
Mx4DPointFloat m_unk0x14; // 0x14 Mx4DPointFloat m_unk0x14; // 0x14
Mx4DPointFloat* m_edgeNormals; // 0x2c Mx4DPointFloat* m_edgeNormals; // 0x2c
Mx3DPointFloat m_unk0x30; // 0x30 Mx3DPointFloat m_unk0x30; // 0x30
LegoU32 m_unk0x44; // 0x44 LegoU32 m_unk0x44; // 0x44
LegoU8 m_unk0x48; // 0x48 LegoU8 m_unk0x48; // 0x48
PathWithTrigger* m_unk0x4c; // 0x4c PathWithTrigger* m_pathTrigger; // 0x4c
Mx3DPointFloat* m_unk0x50; // 0x50 Mx3DPointFloat* m_unk0x50; // 0x50
}; };
#endif // __LEGOWEGEDGE_H #endif // __LEGOWEGEDGE_H