Implement Act2Actor::VTable0xa0

This commit is contained in:
jonschz 2024-11-30 15:18:11 +01:00
parent f066e2ee2e
commit 15a9067407
2 changed files with 122 additions and 7 deletions

View File

@ -2,6 +2,7 @@
#define ACT2ACTOR_H #define ACT2ACTOR_H
#include "legoanimactor.h" #include "legoanimactor.h"
#include "legopathedgecontainer.h"
// VTABLE: LEGO1 0x100d6078 LegoPathActor // VTABLE: LEGO1 0x100d6078 LegoPathActor
// VTABLE: LEGO1 0x100d6148 LegoAnimActor // VTABLE: LEGO1 0x100d6148 LegoAnimActor
@ -27,6 +28,7 @@ class Act2Actor : public LegoAnimActor {
MxS32 VTable0xa0() override; // vtable+0xa0 MxS32 VTable0xa0() override; // vtable+0xa0
void FUN_10019520(); void FUN_10019520();
void FUN_100192a0(undefined4 p_param);
// SYNTHETIC: LEGO1 0x1001a0a0 // SYNTHETIC: LEGO1 0x1001a0a0
// Act2Actor::`scalar deleting destructor' // Act2Actor::`scalar deleting destructor'
@ -37,7 +39,7 @@ class Act2Actor : public LegoAnimActor {
private: private:
undefined m_unk0x1c; // 0x1c undefined m_unk0x1c; // 0x1c
undefined m_unk0x1d; // 0x1d MxS8 m_unk0x1d; // 0x1d
undefined m_unk0x1e; // 0x1e undefined m_unk0x1e; // 0x1e
MxBool m_unk0x1f; // 0x1f MxBool m_unk0x1f; // 0x1f
undefined4 m_unk0x20; // 0x20 undefined4 m_unk0x20; // 0x20
@ -50,7 +52,7 @@ class Act2Actor : public LegoAnimActor {
undefined4 m_unk0x3c; // 0x3c undefined4 m_unk0x3c; // 0x3c
undefined m_unk0x40; // 0x40 undefined m_unk0x40; // 0x40
undefined4 m_unk0x44; // 0x44 undefined4 m_unk0x44; // 0x44
undefined m_unk0x48; // 0x48 MxS8 m_unk0x48; // 0x48
undefined4 m_unk0x4c; // 0x4c undefined4 m_unk0x4c; // 0x4c
}; };

View File

@ -9,7 +9,8 @@ DECOMP_SIZE_ASSERT(Act2Actor, 0x1a8)
DECOMP_SIZE_ASSERT(Act2Actor::UnknownListStructure, 0x20) DECOMP_SIZE_ASSERT(Act2Actor::UnknownListStructure, 0x20)
// TODO: Copy the data once we know more about its fields. Total: 10 entries // TODO: Copy the data once we know more about its fields. Total: 10 entries
// // GLOBAL: LEGO1 0x100f0db8 // GLOBAL: LEGO1 0x100f0db8
// GLOBAL: BETA10 0x101dbd00
Act2Actor::UnknownListStructure g_unk0x100f0db8[] = {{{0}, 0, {0}}}; Act2Actor::UnknownListStructure g_unk0x100f0db8[] = {{{0}, 0, {0}}};
// FUNCTION: LEGO1 0x100187e0 // FUNCTION: LEGO1 0x100187e0
@ -82,6 +83,12 @@ void Act2Actor::SetWorldSpeed(MxFloat p_worldSpeed)
m_unk0x44 = 0; m_unk0x44 = 0;
} }
// FUNCTION: LEGO1 0x100192a0
void Act2Actor::FUN_100192a0(undefined4 p_param)
{
// TODO
}
// STUB: LEGO1 0x10019520 // STUB: LEGO1 0x10019520
// STUB: BETA10 0x1000d4d6 // STUB: BETA10 0x1000d4d6
void Act2Actor::FUN_10019520() void Act2Actor::FUN_10019520()
@ -89,12 +96,118 @@ void Act2Actor::FUN_10019520()
// TODO // TODO
} }
// STUB: LEGO1 0x100195a0 // FUNCTION: LEGO1 0x100195a0
// STUB: BETA10 0x1000d7d3 // FUNCTION: BETA10 0x1000d7d3
MxS32 Act2Actor::VTable0xa0() MxS32 Act2Actor::VTable0xa0()
{ {
// TODO undefined4 newLocation;
return 0;
CurrentWorld();
MxU16 randomVal = rand() / (RAND_MAX / 2) + 1;
if (m_unk0x48 == 8 && m_unk0x1d != 8) {
newLocation = 8;
}
else {
switch (m_unk0x1d) {
case 0:
if (randomVal == 1) {
newLocation = 3;
}
else {
newLocation = 7;
}
break;
case 1:
if (randomVal == 1) {
newLocation = 2;
}
else {
newLocation = 4;
}
break;
case 2:
if (randomVal == 1) {
newLocation = 3;
}
else {
newLocation = 6;
}
break;
case 3:
if (randomVal == 1) {
newLocation = 5;
}
else {
newLocation = 1;
}
break;
case 4:
if (randomVal == 1) {
newLocation = 7;
}
else {
newLocation = 0;
}
break;
case 5:
if (randomVal == 1) {
newLocation = 6;
}
else {
newLocation = 1;
}
break;
case 6:
if (randomVal == 1) {
newLocation = 0;
}
else {
newLocation = 4;
}
break;
case 7:
if (randomVal == 1) {
newLocation = 2;
}
else {
newLocation = 5;
}
break;
case 8:
if (randomVal == 1) {
newLocation = 0;
}
else {
newLocation = 4;
}
}
}
undefined4 firstChoice = newLocation;
if (m_unk0x48 < 7 || g_unk0x100f0db8[m_unk0x1d].m_unk0x1c) {
while (g_unk0x100f0db8[newLocation].m_unk0x1c || m_unk0x1d == newLocation) {
if (newLocation == 7) {
newLocation = 0;
}
else {
newLocation++;
}
assert(newLocation != firstChoice);
}
}
m_unk0x1d = newLocation;
FUN_100192a0(newLocation);
if (m_grec) {
return SUCCESS;
}
else {
return FAILURE;
}
} }
// FUNCTION: LEGO1 0x1001a180 // FUNCTION: LEGO1 0x1001a180