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
class Isle : public LegoWorld {
public:
// For g_unk0x100f1198
enum {
c_bit6 = 0x20,
c_bit7 = 0x40
c_playCamAnims = 0x20,
c_playMusic = 0x40
};
Isle();

View file

@ -102,7 +102,7 @@ class LegoAnimationManager : public MxCore {
MxBool p_param8,
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);
LegoTranInfo* GetTranInfo(MxU32 p_index);
void FUN_10062770();

View file

@ -96,7 +96,7 @@ class LegoPathActor : public LegoActor {
// FUNCTION: LEGO1 0x10002d60
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
// FUNCTION: LEGO1 0x10002d70

View file

@ -1153,7 +1153,7 @@ MxResult LegoAnimationManager::FUN_10060dc0(
// FUNCTION: LEGO1 0x10060eb0
// 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) {
LegoLocation* location = LegoNavController::GetLocation(p_location);

View file

@ -628,14 +628,49 @@ MxResult LegoPathActor::VTable0x9c()
return SUCCESS;
}
// STUB: LEGO1 0x1002f650
void LegoPathActor::VTable0xa4(MxBool&, MxS32&)
// FUNCTION: LEGO1 0x1002f650
// 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()
{
// 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) {
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) {
s->HandleTrigger(p_actor, TRUE, m_unk0x4c[i].m_data);
if (m_pathTrigger[i].m_unk0x08 >= dot1 && m_pathTrigger[i].m_unk0x08 < dot2) {
s->HandleTrigger(p_actor, TRUE, m_pathTrigger[i].m_data);
}
}
}
else if (dot2 < dot1) {
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) {
s->HandleTrigger(p_actor, FALSE, m_unk0x4c[i].m_data);
if (m_pathTrigger[i].m_unk0x08 >= dot2 && m_pathTrigger[i].m_unk0x08 < dot1) {
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) {
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++) {
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
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;
}
if (p_storage->Read(&boundary.m_unk0x4c[j].m_unk0x08, sizeof(boundary.m_unk0x4c[j].m_unk0x08)) !=
SUCCESS) {
if (p_storage->Read(
&boundary.m_pathTrigger[j].m_unk0x08,
sizeof(boundary.m_pathTrigger[j].m_unk0x08)
) != SUCCESS) {
return FAILURE;
}
}

View file

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

View file

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

View file

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

View file

@ -71,7 +71,7 @@ class LegoWEGEdge : public LegoWEEdge {
Mx3DPointFloat m_unk0x30; // 0x30
LegoU32 m_unk0x44; // 0x44
LegoU8 m_unk0x48; // 0x48
PathWithTrigger* m_unk0x4c; // 0x4c
PathWithTrigger* m_pathTrigger; // 0x4c
Mx3DPointFloat* m_unk0x50; // 0x50
};