Implement LegoPathActor::VTable0x70 (#807)

* Implement LegoPathActor::VTable0x70

* match

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Nathan M Gilbert 2024-04-16 06:54:08 -04:00 committed by GitHub
parent 46362a0f6e
commit 41281dcbec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 57 additions and 4 deletions

View file

@ -37,6 +37,7 @@ class LegoCameraController : public LegoPointOfViewController {
virtual MxResult Create(); // vtable+0x44 virtual MxResult Create(); // vtable+0x44
void SetWorldTransform(const Vector3& p_at, const Vector3& p_dir, const Vector3& p_up); void SetWorldTransform(const Vector3& p_at, const Vector3& p_dir, const Vector3& p_up);
void FUN_10012290(float);
void FUN_10012320(MxFloat); void FUN_10012320(MxFloat);
void FUN_100123e0(const Matrix4& p_transform, MxU32 p_und); void FUN_100123e0(const Matrix4& p_transform, MxU32 p_und);
Mx3DPointFloat GetWorldUp(); Mx3DPointFloat GetWorldUp();

View file

@ -74,6 +74,7 @@ class LegoNavController : public MxCore {
static MxResult UpdateCameraLocation(const char* p_location); static MxResult UpdateCameraLocation(const char* p_location);
inline void SetLinearVel(MxFloat p_linearVel) { m_linearVel = p_linearVel; } inline void SetLinearVel(MxFloat p_linearVel) { m_linearVel = p_linearVel; }
inline MxFloat GetLinearVel() { return m_linearVel; } inline MxFloat GetLinearVel() { return m_linearVel; }
inline MxFloat GetRotationalVel() { return m_rotationalVel; }
inline MxFloat GetMaxLinearVel() { return m_maxLinearVel; } inline MxFloat GetMaxLinearVel() { return m_maxLinearVel; }
inline void ResetLinearVel(MxFloat p_maxLinearVel) inline void ResetLinearVel(MxFloat p_maxLinearVel)
{ {

View file

@ -33,7 +33,7 @@ class LegoPathActor : public LegoActor {
void ParseAction(char* p_extra) override; // vtable+0x20 void ParseAction(char* p_extra) override; // vtable+0x20
virtual MxS32 VTable0x68(Vector3&, Vector3&, Vector3&); // vtable+0x68 virtual MxS32 VTable0x68(Vector3&, Vector3&, Vector3&); // vtable+0x68
virtual void VTable0x6c(); // vtable+0x6c virtual void VTable0x6c(); // vtable+0x6c
virtual void VTable0x70(float p_float); // vtable+0x70 virtual void VTable0x70(float p_time); // vtable+0x70
virtual void VTable0x74(Matrix4& p_transform); // vtable+0x74 virtual void VTable0x74(Matrix4& p_transform); // vtable+0x74
// FUNCTION: LEGO1 0x10002d20 // FUNCTION: LEGO1 0x10002d20

View file

@ -122,6 +122,11 @@ void LegoCameraController::SetWorldTransform(const Vector3& p_at, const Vector3&
m_matrix2 = m_matrix1; m_matrix2 = m_matrix1;
} }
// STUB: LEGO1 0x10012290
void LegoCameraController::FUN_10012290(float)
{
}
// STUB: LEGO1 0x10012320 // STUB: LEGO1 0x10012320
void LegoCameraController::FUN_10012320(MxFloat) void LegoCameraController::FUN_10012320(MxFloat)
{ {

View file

@ -10,6 +10,14 @@
DECOMP_SIZE_ASSERT(LegoPathActor, 0x154) DECOMP_SIZE_ASSERT(LegoPathActor, 0x154)
#ifndef M_PI
#define M_PI 3.1416
#endif
#ifdef DTOR
#undef DTOR
#endif
#define DTOR(angle) ((angle) * M_PI / 180.)
// GLOBAL: LEGO1 0x100f3304 // GLOBAL: LEGO1 0x100f3304
// STRING: LEGO1 0x100f32f4 // STRING: LEGO1 0x100f32f4
const char* g_strHIT_WALL_SOUND = "HIT_WALL_SOUND"; const char* g_strHIT_WALL_SOUND = "HIT_WALL_SOUND";
@ -355,10 +363,48 @@ void LegoPathActor::VTable0x74(Matrix4& p_transform)
} }
} }
// STUB: LEGO1 0x1002e790 // FUNCTION: LEGO1 0x1002e790
void LegoPathActor::VTable0x70(float) void LegoPathActor::VTable0x70(float p_time)
{ {
// TODO MxMatrix transform;
MxU32 b = FALSE;
while (m_lastTime < p_time) {
if (m_state != 0 && !VTable0x90(p_time, transform)) {
return;
}
if (VTable0x8c(p_time, transform) != 0) {
break;
}
m_unk0xec = transform;
b = TRUE;
if (m_unk0xe9 != 0) {
break;
}
}
if (m_userNavFlag && m_unk0x148) {
LegoNavController* nav = NavController();
float vel = (nav->GetLinearVel() > 0)
? -(nav->GetRotationalVel() / (nav->GetMaxLinearVel() * m_unk0x150) * nav->GetLinearVel())
: 0;
if ((MxS32) vel != m_unk0x14c) {
m_unk0x14c = vel;
LegoWorld* world = CurrentWorld();
if (world) {
world->GetCamera()->FUN_10012290(DTOR(m_unk0x14c));
}
}
}
if (b) {
VTable0x74(transform);
}
} }
// STUB: LEGO1 0x1002e8b0 // STUB: LEGO1 0x1002e8b0