From deaed23e414e9eefac7f10d1839ad3a76c8c1ea9 Mon Sep 17 00:00:00 2001 From: Nathan M Gilbert Date: Thu, 14 Dec 2023 11:50:29 -0500 Subject: [PATCH] Implement Helicopter (#329) * Implement Helicopter * Fix names * Fix some issues * Disable warning --------- Co-authored-by: Christian Semmler --- LEGO1/act1state.h | 6 + LEGO1/act2brick.h | 2 +- LEGO1/act3.h | 8 +- LEGO1/helicopter.cpp | 270 ++++++++++++++++++++++++++++-- LEGO1/helicopter.h | 37 ++-- LEGO1/helicopterstate.h | 5 +- LEGO1/isle.h | 5 + LEGO1/islepathactor.cpp | 32 ---- LEGO1/islepathactor.h | 38 +++-- LEGO1/legoactor.cpp | 38 ----- LEGO1/legoactor.h | 26 +-- LEGO1/legoanimationmanager.cpp | 5 + LEGO1/legoanimationmanager.h | 1 + LEGO1/legocameracontroller.cpp | 28 ++++ LEGO1/legocameracontroller.h | 8 + LEGO1/legoentity.cpp | 5 + LEGO1/legoentity.h | 1 + LEGO1/legogamestate.h | 23 +-- LEGO1/legoomni.cpp | 2 +- LEGO1/legoomni.h | 7 +- LEGO1/legopathactor.cpp | 84 +--------- LEGO1/legopathactor.h | 87 ++++++---- LEGO1/legoroi.cpp | 10 ++ LEGO1/legoroi.h | 5 +- LEGO1/legoutil.cpp | 11 ++ LEGO1/legoutil.h | 4 + LEGO1/legoworld.cpp | 38 ++++- LEGO1/legoworld.h | 27 ++- LEGO1/mxtype18notificationparam.h | 14 ++ LEGO1/mxtype19notificationparam.h | 15 ++ LEGO1/realtime/matrix.cpp | 2 +- LEGO1/realtime/matrix.h | 2 +- LEGO1/realtime/orientableroi.h | 38 ++--- LEGO1/realtime/roi.h | 20 ++- LEGO1/realtime/vector.cpp | 22 +-- LEGO1/realtime/vector.h | 19 ++- LEGO1/viewmanager/viewlodlist.h | 1 + 37 files changed, 628 insertions(+), 318 deletions(-) create mode 100644 LEGO1/mxtype18notificationparam.h create mode 100644 LEGO1/mxtype19notificationparam.h diff --git a/LEGO1/act1state.h b/LEGO1/act1state.h index f0393498..772d39c1 100644 --- a/LEGO1/act1state.h +++ b/LEGO1/act1state.h @@ -21,6 +21,12 @@ class Act1State : public LegoState { { return !strcmp(p_name, Act1State::ClassName()) || LegoState::IsA(p_name); }; + + inline void SetUnknown18(MxU32 p_unk0x18) { m_unk0x18 = p_unk0x18; } + +protected: + undefined m_unk0x8[0x10]; // 0x8 + MxU32 m_unk0x18; // 0x18 }; #endif // ACT1STATE_H diff --git a/LEGO1/act2brick.h b/LEGO1/act2brick.h index adb3bf2f..de4f29b1 100644 --- a/LEGO1/act2brick.h +++ b/LEGO1/act2brick.h @@ -23,7 +23,7 @@ class Act2Brick : public LegoPathActor { // FUNCTION: LEGO1 0x1007a370 inline virtual MxBool IsA(const char* p_name) const override // vtable+0x10 { - return !strcmp(Act2Brick::ClassName(), p_name) || LegoEntity::IsA(p_name); + return !strcmp(p_name, Act2Brick::ClassName()) || LegoEntity::IsA(p_name); } }; diff --git a/LEGO1/act3.h b/LEGO1/act3.h index 3d627267..cc4a2c3f 100644 --- a/LEGO1/act3.h +++ b/LEGO1/act3.h @@ -25,11 +25,13 @@ class Act3 : public LegoWorld { } inline void SetUnkown420c(MxEntity* p_entity) { m_unk0x420c = p_entity; } + inline void SetUnkown4270(MxU32 p_unk0x4270) { m_unk0x4270 = p_unk0x4270; } protected: - undefined m_unk0xf8[0x4114]; - MxEntity* m_unk0x420c; - undefined m_unk0x4210[0x64]; + undefined m_unk0xf8[0x4114]; // 0xf8 + MxEntity* m_unk0x420c; // 0x420c + undefined m_unk0x4210[0x60]; // 0x4210 + MxU32 m_unk0x4270; // 0x4270 }; #endif // ACT3_H diff --git a/LEGO1/helicopter.cpp b/LEGO1/helicopter.cpp index 582e2539..ed75b92d 100644 --- a/LEGO1/helicopter.cpp +++ b/LEGO1/helicopter.cpp @@ -1,12 +1,15 @@ #include "helicopter.h" +#include "act1state.h" #include "act3.h" +#include "isle.h" #include "legoanimationmanager.h" #include "legocontrolmanager.h" #include "legogamestate.h" #include "legoomni.h" #include "legoutil.h" #include "legoworld.h" +#include "mxtransitionmanager.h" DECOMP_SIZE_ASSERT(Helicopter, 0x230) @@ -63,16 +66,263 @@ void Helicopter::VTable0xe4() } } m_state->SetUnknown8(0); - FUN_1003ee00(m_unk0x22c, 0x16); - FUN_1003ee00(m_unk0x22c, 0x17); - FUN_1003ee00(m_unk0x22c, 0x18); - FUN_1003ee00(m_unk0x22c, 0x19); - FUN_1003ee00(m_unk0x22c, 0x1a); - FUN_1003ee00(m_unk0x22c, 0x1b); - FUN_1003ee00(m_unk0x22c, 0x1c); - FUN_1003ee00(m_unk0x22c, 0x1d); - FUN_1003ee00(m_unk0x22c, 0x1e); - FUN_1003ee00(m_unk0x22c, 0x1f); + FUN_1003ee00(m_script, 0x16); + FUN_1003ee00(m_script, 0x17); + FUN_1003ee00(m_script, 0x18); + FUN_1003ee00(m_script, 0x19); + FUN_1003ee00(m_script, 0x1a); + FUN_1003ee00(m_script, 0x1b); + FUN_1003ee00(m_script, 0x1c); + FUN_1003ee00(m_script, 0x1d); + FUN_1003ee00(m_script, 0x1e); + FUN_1003ee00(m_script, 0x1f); AnimationManager()->FUN_1005f6d0(TRUE); ControlManager()->Unregister(this); } + +// FUNCTION: LEGO1 0x10003480 +MxU32 Helicopter::VTable0xcc() +{ + if (!FUN_1003ef60()) + return 1; + if (!m_world) + m_world = GetCurrentWorld(); + AnimationManager()->FUN_1005f6d0(FALSE); + if (GetCurrentVehicle()) { + if (GetCurrentVehicle()->VTable0x60() != GameState()->GetUnknownC()) { + GetCurrentVehicle()->VTable0xe4(); + } + } + switch (GameState()->GetUnknown10()) { + case 0: + m_script = *g_isleScript; + AnimationManager()->FUN_10064670(FALSE); + VTable0xe8(0x29, TRUE, 7); + ((Isle*) GetCurrentWorld())->SetUnknown13c(0x3c); + FUN_10015820(1, 0); + TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 50, FALSE, TRUE); + SetUnknownDC(4); + FUN_10015910(9); + break; + case 1: + m_script = *g_act2mainScript; + break; + case 2: + m_script = *g_act3Script; + break; + } + VTable0xe0(); + InvokeAction(ExtraActionType_start, m_script, 0x15, NULL); + GetCurrentAction().SetObjectId(-1); + ControlManager()->Register(this); + return 1; +} + +// FUNCTION: LEGO1 0x100035e0 +MxU32 Helicopter::VTable0xd4(MxType17NotificationParam& p_param) +{ + MxU32 ret = 0; + MxAtomId script; + switch (GameState()->GetUnknown10()) { + case 0: + script = *g_isleScript; + break; + case 1: + script = *g_act2mainScript; + break; + case 2: + script = *g_act3Script; + break; + } + if (p_param.GetUnknown28() == 1) { + switch (p_param.GetUnknown20()) { + case 0x17: + if (*g_act3Script == script) { + ((Act3*) GetCurrentWorld())->SetUnkown4270(2); + TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 50, FALSE, FALSE); + } + else if (m_state->GetUnkown8() != 0) + break; + VTable0xe4(); + GameState()->SetUnknown424(0x42); + ret = 1; + break; + case 0x18: { + if (*g_act3Script == script) + break; + Act1State* state = (Act1State*) GameState()->GetState("Act1State"); + if (m_state->GetUnkown8() == 0) { + state->SetUnknown18(4); + m_state->SetUnknown8(1); + m_world->FUN_1001fc80(this); + InvokeAction(ExtraActionType_start, script, 0x20, NULL); + SetUnknownDC(0); + } + ret = 1; + break; + } + case 0x19: + if (*g_act3Script == script) + break; + if (m_state->GetUnkown8() == 2) { + m_state->SetUnknown8(3); + m_world->FUN_1001fc80(this); + InvokeAction(ExtraActionType_start, script, 0x21, NULL); + SetUnknownDC(4); + } + ret = 1; + break; + case 0x1a: + if (*g_act3Script != script) + break; + ret = 1; + /* fall through */ + case 0x1b: + if (*g_act3Script != script) + break; + if (m_world && m_world->GetCamera()) { + Vector3Data loc, dir, lookat; + loc.CopyFrom(m_world->GetCamera()->FUN_100127f0()); + dir.CopyFrom(m_world->GetCamera()->FUN_100128a0()); + lookat = dir; + float scale = 3; + lookat.Mul(scale); + lookat.Add(&loc); + Vector3Data v68, v7c, v90(0, 1, 0), va4; + v68.CopyFrom(m_world->GetCamera()->FUN_10012740()); + va4.EqualsCross(v68, dir); + v7c.EqualsCross(va4, v90); + if (ret) + if (m_world->FUN_100727e0(m_unk0x138, loc, dir, v7c)) + break; + else if (m_world->FUN_10072980(m_unk0x138, loc, dir, v7c)) + break; + } + ret = 1; + break; + case 0x1c: + if (GameState()->GetUnknown10() == 0) { + ((Isle*) GetCurrentWorld())->SetUnknown13c(2); + TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 50, FALSE, FALSE); + VTable0xe4(); + } + ret = 1; + break; + case 0x1d: + ret = 1; + break; + } + } + return ret; +} + +// FUNCTION: LEGO1 0x10003c20 +MxU32 Helicopter::VTable0xd8(MxType18NotificationParam& p_param) +{ + switch (m_state->GetUnkown8()) { + case 1: { + if (GameState()->GetUnknown10() == 0) { + ((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(4); + VTable0xe8(0x2a, TRUE, 7); + } + else + VTable0xe8(0x31, TRUE, 7); + m_state->SetUnknown8(2); + Matrix4Data mat; + mat.SetIdentity(); + Matrix4 mat2 = mat.GetMatrix(); + float s = sin(0.5235987901687622); // PI / 6, 30 deg + float c = cos(0.5235987901687622); // PI / 6, 30 deg + for (int i = 0; i < 4; i++) { + mat.GetMatrix()[i][1] = mat2[i][1] * c - mat2[i][2] * s; + mat.GetMatrix()[i][2] = mat2[i][2] * c + mat2[i][1] * s; + } + Vector3Impl at(mat.GetMatrix()[3]), dir(mat.GetMatrix()[2]), up(mat.GetMatrix()[1]); + m_world->GetCamera()->LookAt(at, dir, up); + FUN_10010c30(); + break; + } + case 3: { + Matrix4Data mat; + mat.SetIdentity(); + Vector3Impl at(mat.GetMatrix()[3]), dir(mat.GetMatrix()[2]), up(mat.GetMatrix()[1]); + at[1] = 1.25; + m_world->GetCamera()->LookAt(at, dir, up); + if (GameState()->GetUnknown10() == 0) { + ((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(0); + VTable0xe8(0x29, TRUE, 7); + } + else + VTable0xe8(0x30, TRUE, 7); + m_state->SetUnknown8(0); + break; + } + default: + return 0; + } + return 1; +} + +// FUNCTION: LEGO1 0x10003e90 +void Helicopter::VTable0x74(Matrix4Impl& p_transform) +{ + if (m_unk0xea != 0) { + m_roi->FUN_100a46b0(p_transform); + FUN_10010c30(); + } + else { + m_roi->FUN_100a58f0(p_transform); + m_roi->VTable0x14(); + if (m_cameraFlag) + FUN_10010c30(); + } +} + +// FUNCTION: LEGO1 0x10003ee0 +void Helicopter::VTable0x70(float p_float) +{ + MxU32 state = m_state->GetUnkown8(); + switch (state) { + default: + LegoPathActor::VTable0x70(p_float); + return; + case 4: + case 5: + float f = m_unk0x1f0 - p_float + 3000; + if (f >= 0) { + float f2 = f / 3000 + 1; + if (f2 < 0) + f2 = 0; + if (1.0f < f2) + f2 = 1.0f; + Vector3Impl v(m_unk0x160.GetMatrix()[3]); + Matrix4Data mat; + Vector3Impl v2(m_unk0x1a8.GetMatrix()[3]); + float* loc = m_unk0x1a8.GetMatrix()[3]; + mat.SetIdentity(); + float fa[4]; + Vector4Impl v3(fa); + if (m_unk0x1f4.FUN_100040a0(v3, f2) == SUCCESS) { + mat.FromQuaternion(v3); + } + v2.SetVector(loc); + v2.Sub(&v); + v2.Mul(f2); + v2.Add(&v); + m_world->GetCamera()->FUN_100123e0(mat, 0); + } + else { + if (state == 4) + m_world->FUN_10073400(); + else + m_world->FUN_10073430(); + m_unk0xdc = 4; + } + } +} + +// STUB: LEGO1 0x100040a0 +MxResult HelicopterSubclass::FUN_100040a0(Vector4Impl& p_v, float p_f) +{ + return SUCCESS; +} diff --git a/LEGO1/helicopter.h b/LEGO1/helicopter.h index 1bb7c22a..cc4f3b35 100644 --- a/LEGO1/helicopter.h +++ b/LEGO1/helicopter.h @@ -5,11 +5,24 @@ #include "islepathactor.h" #include "realtime/matrix.h" +// SIZE 0x34 +class HelicopterSubclass { +public: + inline HelicopterSubclass() : m_unk0x30(0) {} + MxResult FUN_100040a0(Vector4Impl& p_v, float p_f); + +private: + Vector4Data m_unk0x0; // 0x0 + Vector4Data m_unk0x18; // 0x18 + undefined4 m_unk0x30; // 0x30 +}; + // VTABLE: LEGO1 0x100d40f8 // SIZE 0x230 class Helicopter : public IslePathActor { public: Helicopter(); + virtual ~Helicopter() override; // vtable+0x0 // FUNCTION: LEGO1 0x10003070 inline virtual const char* ClassName() const override // vtable+0x0c @@ -24,22 +37,24 @@ class Helicopter : public IslePathActor { return !strcmp(p_name, Helicopter::ClassName()) || IslePathActor::IsA(p_name); } - virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18 - virtual void VTable0xe4() override; + virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + void VTable0x74(Matrix4Impl& p_transform) override; // vtable+0x74 + virtual MxU32 VTable0xcc() override; // vtable+0xcc + virtual MxU32 VTable0xd4(MxType17NotificationParam& p_param) override; // vtable+0xd4 + virtual MxU32 VTable0xd8(MxType18NotificationParam& p_param) override; // vtable+0xd8 + virtual void VTable0xe4() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x10003210 // Helicopter::`scalar deleting destructor' - virtual ~Helicopter() override; // vtable+0x0 protected: - Matrix4Data m_unk0x160; - Matrix4Data m_unk0x1a8; - undefined4 m_unk0x1f0; - Vector4Data m_unk0x1f4; - Vector4Data m_unk0x20c; - undefined4 m_unk0x224; - HelicopterState* m_state; - MxAtomId m_unk0x22c; + Matrix4Data m_unk0x160; // 0x160 + Matrix4Data m_unk0x1a8; // 0x1a8 + float m_unk0x1f0; // 0x1f0 + HelicopterSubclass m_unk0x1f4; // 0x1f4 + HelicopterState* m_state; // 0x228 + MxAtomId m_script; // 0x22c private: void GetState(); diff --git a/LEGO1/helicopterstate.h b/LEGO1/helicopterstate.h index 3525303d..1c43b04f 100644 --- a/LEGO1/helicopterstate.h +++ b/LEGO1/helicopterstate.h @@ -21,10 +21,11 @@ class HelicopterState : public LegoState { return !strcmp(p_name, HelicopterState::ClassName()) || LegoState::IsA(p_name); } - inline void SetUnknown8(undefined4 p_unk0x8) { m_unk0x8 = p_unk0x8; } + inline void SetUnknown8(MxU32 p_unk0x8) { m_unk0x8 = p_unk0x8; } + inline MxU32 GetUnkown8() { return m_unk0x8; } protected: - undefined4 m_unk0x8; + MxU32 m_unk0x8; // 0x8 }; #endif // HELICOPTERSTATE_H diff --git a/LEGO1/isle.h b/LEGO1/isle.h index 42984858..16989416 100644 --- a/LEGO1/isle.h +++ b/LEGO1/isle.h @@ -22,6 +22,11 @@ class Isle : public LegoWorld { { return !strcmp(p_name, Isle::ClassName()) || LegoWorld::IsA(p_name); } + inline void SetUnknown13c(MxU32 p_unk0x13c) { m_unk0x13c = p_unk0x13c; } + +protected: + undefined m_unk0xf8[0x44]; // 0xf8 + MxU32 m_unk0x13c; // 0x13c }; #endif // ISLE_H diff --git a/LEGO1/islepathactor.cpp b/LEGO1/islepathactor.cpp index 89151230..528bbde8 100644 --- a/LEGO1/islepathactor.cpp +++ b/LEGO1/islepathactor.cpp @@ -2,38 +2,6 @@ DECOMP_SIZE_ASSERT(IslePathActor, 0x160) -// Probably in header -// STUB: LEGO1 0x10002df0 -void IslePathActor::VTable0xd0() -{ - // TODO -} - -// STUB: LEGO1 0x10002e00 -void IslePathActor::VTable0xdc() -{ - // TODO -} - -// STUB: LEGO1 0x10002e70 -void IslePathActor::VTable0xcc() -{ - // TODO -} - -// STUB: LEGO1 0x10002e80 -void IslePathActor::VTable0xd4() -{ - // TODO -} - -// STUB: LEGO1 0x10002e90 -void IslePathActor::VTable0xd8() -{ - // TODO -} -// End header - // FUNCTION: LEGO1 0x1001a200 IslePathActor::IslePathActor() { diff --git a/LEGO1/islepathactor.h b/LEGO1/islepathactor.h index f0e616c4..44f50475 100644 --- a/LEGO1/islepathactor.h +++ b/LEGO1/islepathactor.h @@ -3,6 +3,9 @@ #include "legopathactor.h" #include "legoworld.h" +#include "mxtype17notificationparam.h" +#include "mxtype18notificationparam.h" +#include "mxtype19notificationparam.h" #include "mxtypes.h" // VTABLE: LEGO1 0x100d4398 @@ -10,6 +13,7 @@ class IslePathActor : public LegoPathActor { public: IslePathActor(); + inline virtual ~IslePathActor() override { IslePathActor::Destroy(TRUE); } // vtable+0x0 // FUNCTION: LEGO1 0x10002ea0 inline virtual const char* ClassName() const override // vtable+0x0c @@ -24,28 +28,32 @@ class IslePathActor : public LegoPathActor { return !strcmp(p_name, IslePathActor::ClassName()) || LegoPathActor::IsA(p_name); } + virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18 + // FUNCTION: LEGO1 0x10002e70 + virtual MxU32 VTable0xcc() { return 0; } // vtable+0xcc + // FUNCTION: LEGO1 0x10002df0 + virtual MxU32 VTable0xd0() { return 0; } // vtable+0xd0 + // FUNCTION: LEGO1 0x10002e80 + virtual MxU32 VTable0xd4(MxType17NotificationParam&) { return 0; } // vtable+0xd4 + // FUNCTION: LEGO1 0x10002e90 + virtual MxU32 VTable0xd8(MxType18NotificationParam&) { return 0; } // vtable+0xd8 + // FUNCTION: LEGO1 0x10002e00 + virtual MxU32 VTable0xdc(MxType19NotificationParam&) { return 0; } // vtable+0xdc + virtual void VTable0xe0(); // vtable+0xe0 + virtual void VTable0xe4(); // vtable+0xe4 + virtual void VTable0xe8(MxU32, MxBool, MxU8); // vtable+0xe8 + virtual void VTable0xec(); // vtable+0xec + // SYNTHETIC: LEGO1 0x10002ff0 // IslePathActor::`scalar deleting destructor' - inline virtual ~IslePathActor() override { IslePathActor::Destroy(TRUE); } - - virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18 - virtual void VTable0xcc(); // vtable+0xcc - virtual void VTable0xd0(); // vtable+0xd0 - virtual void VTable0xd4(); // vtable+0xd4 - virtual void VTable0xd8(); // vtable+0xd8 - virtual void VTable0xdc(); // vtable+0xdc - virtual void VTable0xe0(); // vtable+0xe0 - virtual void VTable0xe4(); // vtable+0xe4 - virtual void VTable0xe8(MxU32, MxBool, MxU8); // vtable+0xe8 - virtual void VTable0xec(); // vtable+0xec inline void SetWorld(LegoWorld* p_world) { m_world = p_world; } inline LegoWorld* GetWorld() { return m_world; } -private: +protected: LegoWorld* m_world; // 0x154 - MxFloat m_unk0x158; - MxFloat m_unk0x15c; + MxFloat m_unk0x158; // 0x158 + MxFloat m_unk0x15c; // 0x15c }; #endif // ISLEPATHACTOR_H diff --git a/LEGO1/legoactor.cpp b/LEGO1/legoactor.cpp index d4c90cb9..46f59a77 100644 --- a/LEGO1/legoactor.cpp +++ b/LEGO1/legoactor.cpp @@ -2,44 +2,6 @@ DECOMP_SIZE_ASSERT(LegoActor, 0x78) -// Probably in header -// FUNCTION: LEGO1 0x10002cc0 -MxFloat LegoActor::VTable0x50() -{ - return m_unk0x68; -} - -// FUNCTION: LEGO1 0x10002cd0 -void LegoActor::VTable0x54(MxFloat p_unk0x68) -{ - m_unk0x68 = p_unk0x68; -} - -// FUNCTION: LEGO1 0x10002ce0 -void LegoActor::VTable0x58(MxFloat p_unk0x70) -{ - m_unk0x70 = p_unk0x70; -} - -// FUNCTION: LEGO1 0x10002cf0 -MxFloat LegoActor::VTable0x5c() -{ - return m_unk0x70; -} - -// FUNCTION: LEGO1 0x10002d00 -undefined LegoActor::VTable0x60() -{ - return m_unk0x74; -} - -// FUNCTION: LEGO1 0x10002d10 -void LegoActor::VTable0x64(undefined p_unk0x74) -{ - m_unk0x74 = p_unk0x74; -} -// End header - // FUNCTION: LEGO1 0x1002d110 LegoActor::LegoActor() { diff --git a/LEGO1/legoactor.h b/LEGO1/legoactor.h index 1459e29f..c8380177 100644 --- a/LEGO1/legoactor.h +++ b/LEGO1/legoactor.h @@ -23,18 +23,24 @@ class LegoActor : public LegoEntity { return !strcmp(p_name, LegoActor::ClassName()) || LegoEntity::IsA(p_name); } - virtual MxFloat VTable0x50(); // vtable+0x50 - virtual void VTable0x54(MxFloat p_unk0x68); // vtable+0x54 - virtual void VTable0x58(MxFloat p_unk0x70); // vtable+0x58 - virtual MxFloat VTable0x5c(); // vtable+0x5c - virtual undefined VTable0x60(); // vtable+0x60 - virtual void VTable0x64(undefined p_unk0x74); // vtable+0x64 + // FUNCTION: LEGO1 0x10002cc0 + virtual MxFloat VTable0x50() { return m_unk0x68; } // vtable+0x50 + // FUNCTION: LEGO1 0x10002cd0 + virtual void VTable0x54(MxFloat p_unk0x68) { m_unk0x68 = p_unk0x68; } // vtable+0x54 + // FUNCTION: LEGO1 0x10002ce0 + virtual void VTable0x58(MxFloat p_unk0x70) { m_unk0x70 = p_unk0x70; } // vtable+0x58 + // FUNCTION: LEGO1 0x10002cf0 + virtual MxFloat VTable0x5c() { return m_unk0x70; } // vtable+0x5c + // FUNCTION: LEGO1 0x10002d00 + virtual MxU8 VTable0x60() { return m_unk0x74; } // vtable+0x60 + // FUNCTION: LEGO1 0x10002d10 + virtual void VTable0x64(MxU8 p_unk0x74) { m_unk0x74 = p_unk0x74; } // vtable+0x64 private: - MxFloat m_unk0x68; - undefined4 m_unk0x6c; - MxFloat m_unk0x70; - undefined m_unk0x74; + MxFloat m_unk0x68; // 0x68 + undefined4 m_unk0x6c; // 0x6c + MxFloat m_unk0x70; // 0x70 + MxU8 m_unk0x74; // 0x74 }; #endif // LEGOACTOR_H diff --git a/LEGO1/legoanimationmanager.cpp b/LEGO1/legoanimationmanager.cpp index 55ac2856..444eeccf 100644 --- a/LEGO1/legoanimationmanager.cpp +++ b/LEGO1/legoanimationmanager.cpp @@ -48,3 +48,8 @@ MxResult LegoAnimationManager::Tickle() return SUCCESS; } + +// STUB: LEGO1 0x10064670 +void LegoAnimationManager::FUN_10064670(MxBool) +{ +} diff --git a/LEGO1/legoanimationmanager.h b/LEGO1/legoanimationmanager.h index d2578383..0a647e8f 100644 --- a/LEGO1/legoanimationmanager.h +++ b/LEGO1/legoanimationmanager.h @@ -27,6 +27,7 @@ class LegoAnimationManager : public MxCore { } void FUN_1005f6d0(MxBool); + void FUN_10064670(MxBool); __declspec(dllexport) static void configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig); diff --git a/LEGO1/legocameracontroller.cpp b/LEGO1/legocameracontroller.cpp index cf68f0d1..a182d025 100644 --- a/LEGO1/legocameracontroller.cpp +++ b/LEGO1/legocameracontroller.cpp @@ -11,3 +11,31 @@ LegoCameraController::~LegoCameraController() { // TODO } + +// STUB: LEGO1 0x10012260 +void LegoCameraController::LookAt(Vector3Impl& p_at, Vector3Impl& p_dir, Vector3Impl& p_up) +{ +} + +// STUB: LEGO1 0x100123e0 +void LegoCameraController::FUN_100123e0(Matrix4Data& p_transform, MxU32) +{ +} + +// STUB: LEGO1 0x10012740 +Vector3Data& LegoCameraController::FUN_10012740() +{ + return Vector3Data(); +} + +// STUB: LEGO1 0x100127f0 +Vector3Data& LegoCameraController::FUN_100127f0() +{ + return Vector3Data(); +} + +// STUB: LEGO1 0x100128a0 +Vector3Data& LegoCameraController::FUN_100128a0() +{ + return Vector3Data(); +} diff --git a/LEGO1/legocameracontroller.h b/LEGO1/legocameracontroller.h index c6dd1573..7fa9552d 100644 --- a/LEGO1/legocameracontroller.h +++ b/LEGO1/legocameracontroller.h @@ -2,6 +2,8 @@ #define LEGOCAMERACONTROLLER_H #include "mxcore.h" +#include "realtime/matrix.h" +#include "realtime/vector.h" // VTABLE: LEGO1 0x100d57b0 // SIZE 0xc8 @@ -22,6 +24,12 @@ class LegoCameraController : public MxCore { { return !strcmp(p_name, ClassName()) || MxCore::IsA(p_name); } + + void LookAt(Vector3Impl& p_at, Vector3Impl& p_dir, Vector3Impl& p_up); + void FUN_100123e0(Matrix4Data& p_transform, MxU32); + Vector3Data& FUN_10012740(); + Vector3Data& FUN_100127f0(); + Vector3Data& FUN_100128a0(); }; #endif // LEGOCAMERACONTROLLER_H diff --git a/LEGO1/legoentity.cpp b/LEGO1/legoentity.cpp index 0213145e..26f9daab 100644 --- a/LEGO1/legoentity.cpp +++ b/LEGO1/legoentity.cpp @@ -76,6 +76,11 @@ void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) // TODO } +// STUB: LEGO1 0x10010c30 +void LegoEntity::FUN_10010c30() +{ +} + // FUNCTION: LEGO1 0x10010e10 void LegoEntity::ParseAction(char* p_extra) { diff --git a/LEGO1/legoentity.h b/LEGO1/legoentity.h index 8d4471d4..fe013beb 100644 --- a/LEGO1/legoentity.h +++ b/LEGO1/legoentity.h @@ -47,6 +47,7 @@ class LegoEntity : public MxEntity { virtual void VTable0x44(); // vtable+0x44 virtual void VTable0x48(); // vtable+0x48 virtual void VTable0x4c(); // vtable+0x4c + void FUN_10010c30(); protected: void Init(); diff --git a/LEGO1/legogamestate.h b/LEGO1/legogamestate.h index 073352e5..4951df0f 100644 --- a/LEGO1/legogamestate.h +++ b/LEGO1/legogamestate.h @@ -16,7 +16,7 @@ struct ColorStringStruct { const char* m_colorName; }; -// SIZE 0x430 (at least) +// SIZE 0x430 class LegoGameState { public: __declspec(dllexport) LegoGameState(); @@ -34,6 +34,7 @@ class LegoGameState { void FUN_1003a720(MxU32); void HandleAction(MxU32); + inline MxU8 GetUnknownC() { return m_unk0xc; } inline MxU32 GetUnknown10() { return m_unk0x10; } inline void SetUnknown424(undefined4 p_unk0x424) { m_unk0x424 = p_unk0x424; } @@ -45,20 +46,20 @@ class LegoGameState { void SetROIHandlerFunction(); private: - char* m_savePath; // 0x0 - MxS16 m_stateCount; - LegoState** m_stateArray; - MxU8 m_unk0xc; - MxU32 m_unk0x10; - undefined4 m_unk0x14; + char* m_savePath; // 0x0 + MxS16 m_stateCount; // 0x4 + LegoState** m_stateArray; // 0x8 + MxU8 m_unk0xc; // 0xc + MxU32 m_unk0x10; // 0x10 + undefined4 m_unk0x14; // 0x14 LegoBackgroundColor* m_backgroundColor; // 0x18 LegoBackgroundColor* m_tempBackgroundColor; // 0x1c LegoFullScreenMovie* m_fullScreenMovie; // 0x20 MxU16 m_unk0x24; // 0x24 - undefined m_unk0x28[1020]; - undefined4 m_unk0x424; - undefined4 m_unk0x428; - undefined4 m_unk0x42c; + undefined m_unk0x28[1020]; // 0x28 + undefined4 m_unk0x424; // 0x424 + undefined4 m_unk0x428; // 0x428 + undefined4 m_unk0x42c; // 0x42c }; MxBool ROIHandlerFunction(char* p_input, char* p_output, MxU32 p_copyLen); diff --git a/LEGO1/legoomni.cpp b/LEGO1/legoomni.cpp index c59258d6..88f6bb26 100644 --- a/LEGO1/legoomni.cpp +++ b/LEGO1/legoomni.cpp @@ -165,7 +165,7 @@ LegoNavController* NavController() } // FUNCTION: LEGO1 0x10015790 -LegoWorld* GetCurrentVehicle() +IslePathActor* GetCurrentVehicle() { return LegoOmni::GetInstance()->GetCurrentVehicle(); } diff --git a/LEGO1/legoomni.h b/LEGO1/legoomni.h index 5aba7c50..ba6e6051 100644 --- a/LEGO1/legoomni.h +++ b/LEGO1/legoomni.h @@ -7,6 +7,7 @@ class GifManager; class Isle; +class IslePathActor; class LegoAnimationManager; class LegoBuildingManager; class LegoControlManager; @@ -104,7 +105,7 @@ class LegoOmni : public MxOmni { GifManager* GetGifManager() { return m_gifManager; } LegoWorld* GetCurrentWorld() { return m_currentWorld; } LegoNavController* GetNavController() { return m_navController; } - LegoWorld* GetCurrentVehicle() { return m_currentVehicle; } + IslePathActor* GetCurrentVehicle() { return m_currentVehicle; } LegoPlantManager* GetLegoPlantManager() { return m_plantManager; } LegoAnimationManager* GetAnimationManager() { return m_animationManager; } LegoBuildingManager* GetLegoBuildingManager() { return m_buildingManager; } @@ -122,7 +123,7 @@ class LegoOmni : public MxOmni { LegoWorld* m_currentWorld; MxBool m_unk0x80; LegoNavController* m_navController; // 0x84 - LegoWorld* m_currentVehicle; // 0x88 + IslePathActor* m_currentVehicle; // 0x88 LegoUnkSaveDataWriter* m_saveDataWriter; LegoPlantManager* m_plantManager; // 0x90 LegoAnimationManager* m_animationManager; @@ -152,7 +153,7 @@ __declspec(dllexport) LegoVideoManager* VideoManager(); LegoAnimationManager* AnimationManager(); LegoBuildingManager* BuildingManager(); LegoControlManager* ControlManager(); -LegoWorld* GetCurrentVehicle(); +IslePathActor* GetCurrentVehicle(); LegoPlantManager* PlantManager(); MxBool KeyValueStringParse(char*, const char*, const char*); LegoWorld* GetCurrentWorld(); diff --git a/LEGO1/legopathactor.cpp b/LEGO1/legopathactor.cpp index a87355f6..f6d0a10d 100644 --- a/LEGO1/legopathactor.cpp +++ b/LEGO1/legopathactor.cpp @@ -2,86 +2,6 @@ DECOMP_SIZE_ASSERT(LegoPathActor, 0x154) -// Probably in header -// STUB: LEGO1 0x10002d20 -void LegoPathActor::VTable0x78() -{ - // TODO -} - -// STUB: LEGO1 0x10002d30 -void LegoPathActor::VTable0x7c() -{ - // TODO -} - -// STUB: LEGO1 0x10002d40 -void LegoPathActor::VTable0x90() -{ - // TODO -} - -// STUB: LEGO1 0x10002d50 -void LegoPathActor::VTable0x94() -{ - // TODO -} - -// STUB: LEGO1 0x10002d60 -void LegoPathActor::VTable0xa0() -{ - // TODO -} - -// STUB: LEGO1 0x10002d70 -void LegoPathActor::VTable0xac() -{ - // TODO -} - -// STUB: LEGO1 0x10002d80 -void LegoPathActor::VTable0xb0() -{ - // TODO -} - -// STUB: LEGO1 0x10002d90 -void LegoPathActor::VTable0xb4() -{ - // TODO -} - -// STUB: LEGO1 0x10002da0 -void LegoPathActor::VTable0xb8() -{ - // TODO -} - -// STUB: LEGO1 0x10002db0 -void LegoPathActor::VTable0xbc() -{ - // TODO -} - -// STUB: LEGO1 0x10002dc0 -void LegoPathActor::VTable0xc0() -{ - // TODO -} - -// STUB: LEGO1 0x10002dd0 -void LegoPathActor::VTable0xc4() -{ - // TODO -} - -// STUB: LEGO1 0x10002de0 -void LegoPathActor::VTable0xc8() -{ - // TODO -} -// End header - // STUB: LEGO1 0x1002d700 LegoPathActor::LegoPathActor() { @@ -119,13 +39,13 @@ void LegoPathActor::VTable0x8c() } // STUB: LEGO1 0x1002e740 -void LegoPathActor::VTable0x74() +void LegoPathActor::VTable0x74(Matrix4Impl& p_transform) { // TODO } // STUB: LEGO1 0x1002e790 -void LegoPathActor::VTable0x70() +void LegoPathActor::VTable0x70(float) { // TODO } diff --git a/LEGO1/legopathactor.h b/LEGO1/legopathactor.h index 119a8e79..f331e8ce 100644 --- a/LEGO1/legopathactor.h +++ b/LEGO1/legopathactor.h @@ -3,13 +3,13 @@ #include "legoactor.h" #include "mxtypes.h" +#include "realtime/matrix.h" // VTABLE: LEGO1 0x100d6e28 // SIZE 0x154 (from inlined construction at 0x1000a346) class LegoPathActor : public LegoActor { public: LegoPathActor(); - virtual ~LegoPathActor() override; // FUNCTION: LEGO1 0x1000c430 @@ -25,41 +25,60 @@ class LegoPathActor : public LegoActor { return !strcmp(p_name, LegoPathActor::ClassName()) || LegoActor::IsA(p_name); } - virtual void VTable0x68(); // vtable+0x68 - virtual void VTable0x6c(); // vtable+0x6c - virtual void VTable0x70(); // vtable+0x70 - virtual void VTable0x74(); // vtable+0x74 - virtual void VTable0x78(); // vtable+0x78 - virtual void VTable0x7c(); // vtable+0x7c - virtual void VTable0x80(); // vtable+0x80 - virtual void VTable0x84(); // vtable+0x84 - virtual void VTable0x88(); // vtable+0x88 - virtual void VTable0x8c(); // vtable+0x8c - virtual void VTable0x90(); // vtable+0x90 - virtual void VTable0x94(); // vtable+0x94 - virtual void VTable0x98(); // vtable+0x98 - virtual void VTable0x9c(); // vtable+0x9c - virtual void VTable0xa0(); // vtable+0xa0 - virtual void VTable0xa4(); // vtable+0xa4 - virtual void VTable0xa8(); // vtable+0xa8 - virtual void VTable0xac(); // vtable+0xac - virtual void VTable0xb0(); // vtable+0xb0 - virtual void VTable0xb4(); // vtable+0xb4 - virtual void VTable0xb8(); // vtable+0xb8 - virtual void VTable0xbc(); // vtable+0xbc - virtual void VTable0xc0(); // vtable+0xc0 - virtual void VTable0xc4(); // vtable+0xc4 - virtual void VTable0xc8(); // vtable+0xc8 + virtual void VTable0x68(); // vtable+0x68 + virtual void VTable0x6c(); // vtable+0x6c + virtual void VTable0x70(float p_float); // vtable+0x70 + virtual void VTable0x74(Matrix4Impl& p_transform); // vtable+0x74 + // FUNCTION: LEGO1 0x10002d20 + virtual void VTable0x78(MxU8 p_unk0xea) { m_unk0xea = p_unk0xea; } // vtable+0x78 + // FUNCTION: LEGO1 0x10002d30 + virtual MxU8 VTable0x7c() { return m_unk0xea; } // vtable+0x7c + virtual void VTable0x80(); // vtable+0x80 + virtual void VTable0x84(); // vtable+0x84 + virtual void VTable0x88(); // vtable+0x88 + virtual void VTable0x8c(); // vtable+0x8c + // FUNCTION: LEGO1 0x10002d40 + virtual MxS32 VTable0x90() { return 0; } // vtable+0x90 + // FUNCTION: LEGO1 0x10002d50 + virtual MxS32 VTable0x94() { return 0; } // vtable+0x94 + virtual void VTable0x98(); // vtable+0x98 + virtual void VTable0x9c(); // vtable+0x9c + // FUNCTION: LEGO1 0x10002d60 + virtual MxS32 VTable0xa0() { return 0; } // vtable+0xa0 + virtual void VTable0xa4(); // vtable+0xa4 + virtual void VTable0xa8(); // vtable+0xa8 + // FUNCTION: LEGO1 0x10002d70 + virtual void VTable0xac(MxFloat p_unk0x13c) { m_unk0x13c = p_unk0x13c; } // vtable+0xac + // FUNCTION: LEGO1 0x10002d80 + virtual MxFloat VTable0xb0() { return m_unk0x13c; } // vtable+0xb0 + // FUNCTION: LEGO1 0x10002d90 + virtual MxFloat VTable0xb4() { return m_unk0x140; } // vtable+0xb4 + // FUNCTION: LEGO1 0x10002da0 + virtual MxFloat VTable0xb8() { return m_unk0x144; } // vtable+0xb8 + // FUNCTION: LEGO1 0x10002db0 + virtual void VTable0xbc(MxFloat p_unk0x140) { m_unk0x140 = p_unk0x140; } // vtable+0xbc + // FUNCTION: LEGO1 0x10002dc0 + virtual void VTable0xc0(MxFloat p_unk0x144) { m_unk0x144 = p_unk0x144; } // vtable+0xc0 + // FUNCTION: LEGO1 0x10002dd0 + virtual void VTable0xc4() {} // vtable+0xc4 + // FUNCTION: LEGO1 0x10002de0 + virtual void VTable0xc8(MxU8 p_unk0x148) { m_unk0x148 = p_unk0x148; } // vtable+0xc8 + + inline void SetUnknownDC(MxU32 p_unk0xdc) { m_unk0xdc = p_unk0xdc; } protected: - // TODO: the types - undefined m_pad[0xc4]; - MxFloat m_unk0x13c; - MxS32 m_unk0x140; - MxS32 m_unk0x144; - undefined m_unk0x148; - MxS32 m_unk0x14c; - MxFloat m_unk0x150; + undefined m_unk0x78[0x64]; // 0x78 + MxU32 m_unk0xdc; // 0xdc + undefined m_unk0xe0[0xa]; // 0xe0 + MxU8 m_unk0xea; // 0xea + undefined m_unk0xef[0x4d]; // 0xef + MxU32 m_unk0x138; // 0x138 + MxFloat m_unk0x13c; // 0x13c + MxFloat m_unk0x140; // 0x140 + MxFloat m_unk0x144; // 0x144 + MxU8 m_unk0x148; // 0x148 + MxS32 m_unk0x14c; // 0x14c + MxFloat m_unk0x150; // 0x150 }; #endif // LEGOPATHACTOR_H diff --git a/LEGO1/legoroi.cpp b/LEGO1/legoroi.cpp index 77dc2f78..f23901ad 100644 --- a/LEGO1/legoroi.cpp +++ b/LEGO1/legoroi.cpp @@ -35,6 +35,16 @@ MxS32 g_roiConfig = 100; // GLOBAL: LEGO1 0x101013ac ROIHandler g_someHandlerFunction = NULL; +// STUB: LEGO1 0x100a46b0 +void LegoROI::FUN_100a46b0(Matrix4Impl& p_transform) +{ +} + +// STUB: LEGO1 0x100a58f0 +void LegoROI::FUN_100a58f0(Matrix4Impl& p_transform) +{ +} + // FUNCTION: LEGO1 0x100a81c0 void LegoROI::configureLegoROI(MxS32 p_roiConfig) { diff --git a/LEGO1/legoroi.h b/LEGO1/legoroi.h index 341c9bd2..74024ce6 100644 --- a/LEGO1/legoroi.h +++ b/LEGO1/legoroi.h @@ -2,10 +2,11 @@ #define LEGOROI_H #include "mxtypes.h" +#include "viewmanager/viewroi.h" typedef MxBool (*ROIHandler)(char*, char*, MxU32); -class LegoROI { +class LegoROI : public ViewROI { public: __declspec(dllexport) void SetDisplayBB(MxS32 p_displayBB); __declspec(dllexport) static void configureLegoROI(MxS32 p_roi); @@ -19,6 +20,8 @@ class LegoROI { MxFloat& p_other ); static MxBool ColorAliasLookup(char* p_param, MxFloat& p_red, MxFloat& p_green, MxFloat& p_blue, MxFloat& p_other); + void FUN_100a46b0(Matrix4Impl& p_transform); + void FUN_100a58f0(Matrix4Impl& p_transform); }; #endif // LEGOROI_H diff --git a/LEGO1/legoutil.cpp b/LEGO1/legoutil.cpp index c4728524..e608609b 100644 --- a/LEGO1/legoutil.cpp +++ b/LEGO1/legoutil.cpp @@ -34,6 +34,11 @@ ExtraActionType MatchActionString(const char* p_str) return result; } +// STUB: LEGO1 0x1003e430 +void InvokeAction(ExtraActionType p_actionId, MxAtomId& p_pAtom, int p_targetEntityId, LegoEntity* p_sender) +{ +} + // FUNCTION: LEGO1 0x1003eae0 void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut) { @@ -112,3 +117,9 @@ void SetAppCursor(WPARAM p_wparam) { PostMessageA(MxOmni::GetInstance()->GetWindowHandle(), 0x5400, p_wparam, 0); } + +// STUB: LEGO1 0x1003ef60 +MxBool FUN_1003ef60() +{ + return TRUE; +} diff --git a/LEGO1/legoutil.h b/LEGO1/legoutil.h index 24db48a0..f2413450 100644 --- a/LEGO1/legoutil.h +++ b/LEGO1/legoutil.h @@ -2,7 +2,9 @@ #define LEGOUTIL_H #include "extra.h" +#include "legoentity.h" #include "mxatomid.h" +#include "mxtypes.h" #include @@ -54,8 +56,10 @@ inline void GetString(char** p_source, const char* p_dest, T* p_obj, void (T::*p } ExtraActionType MatchActionString(const char*); +void InvokeAction(ExtraActionType p_actionId, MxAtomId& p_pAtom, int p_targetEntityId, LegoEntity* p_sender); void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut); void FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id); void SetAppCursor(WPARAM p_wparam); +MxBool FUN_1003ef60(); #endif // LEGOUTIL_H diff --git a/LEGO1/legoworld.cpp b/LEGO1/legoworld.cpp index 2379b375..2d52b031 100644 --- a/LEGO1/legoworld.cpp +++ b/LEGO1/legoworld.cpp @@ -11,11 +11,6 @@ DECOMP_SIZE_ASSERT(LegoWorld, 0xf8); MxBool g_isWorldActive; -// FUNCTION: LEGO1 0x100010a0 -void LegoWorld::VTable0x60() -{ -} - // STUB: LEGO1 0x10015820 void FUN_10015820(MxU32, MxU32) { @@ -91,6 +86,11 @@ void LegoWorld::VTable0x54() // TODO } +// STUB: LEGO1 0x1001fc80 +void LegoWorld::FUN_1001fc80(IslePathActor* p_actor) +{ +} + // STUB: LEGO1 0x10020220 void LegoWorld::VTable0x58(MxCore* p_object) { @@ -108,8 +108,36 @@ void LegoWorld::VTable0x68(MxBool p_add) // TODO } +// STUB: LEGO1 0x10022080 +MxResult LegoWorld::Tickle() +{ + return SUCCESS; +} + // FUNCTION: LEGO1 0x10022340 void LegoWorld::Stop() { TickleManager()->UnregisterClient(this); } + +// STUB: LEGO1 0x100727e0 +MxBool LegoWorld::FUN_100727e0(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up) +{ + return FALSE; +} + +// STUB: LEGO1 0x10072980 +MxBool LegoWorld::FUN_10072980(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up) +{ + return FALSE; +} + +// STUB: LEGO1 0x10073400 +void LegoWorld::FUN_10073400() +{ +} + +// STUB: LEGO1 0x10073400 +void LegoWorld::FUN_10073430() +{ +} diff --git a/LEGO1/legoworld.h b/LEGO1/legoworld.h index 2e97076f..87508ae1 100644 --- a/LEGO1/legoworld.h +++ b/LEGO1/legoworld.h @@ -7,6 +7,8 @@ #include "mxpresenter.h" #include "mxpresenterlist.h" +class IslePathActor; + // VTABLE: LEGO1 0x100d6280 // SIZE 0xf8 class LegoWorld : public LegoEntity { @@ -15,6 +17,7 @@ class LegoWorld : public LegoEntity { __declspec(dllexport) virtual ~LegoWorld(); // vtable+0x0 virtual MxLong Notify(MxParam& p_param) override; // vtable+0x4 + virtual MxResult Tickle() override; // vtable+0x8 // FUNCTION: LEGO1 0x1001d690 inline virtual const char* ClassName() const override // vtable+0x0c @@ -33,22 +36,30 @@ class LegoWorld : public LegoEntity { virtual void VTable0x54(); // vtable+54 virtual void VTable0x58(MxCore* p_object); // vtable+58 virtual MxBool VTable0x5c(); // vtable+5c - virtual void VTable0x60(); // vtable+60 - virtual MxBool VTable0x64(); // vtable+64 - virtual void VTable0x68(MxBool p_add); // vtable+68 + // FUNCTION: LEGO1 0x100010a0 + virtual void VTable0x60() {} // vtable+60 + virtual MxBool VTable0x64(); // vtable+64 + virtual void VTable0x68(MxBool p_add); // vtable+68 + + inline LegoCameraController* GetCamera() { return m_camera; } MxResult SetAsCurrentWorld(MxDSObject& p_dsObject); void EndAction(MxPresenter* p_presenter); + void FUN_1001fc80(IslePathActor* p_actor); + MxBool FUN_100727e0(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up); + MxBool FUN_10072980(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up); + void FUN_10073400(); + void FUN_10073430(); protected: LegoPathControllerList m_list0x68; // 0x68 MxPresenterList m_list0x80; // 0x80 LegoCameraController* m_camera; // 0x98 - undefined m_unk0x9c[0x1c]; - MxPresenterList m_list0xb8; // 0xb8 - undefined m_unk0xd0[0x26]; - undefined m_unk0xf6; - undefined m_unk0xf7; + undefined m_unk0x9c[0x1c]; // 0x9c + MxPresenterList m_list0xb8; // 0xb8 + undefined m_unk0xd0[0x26]; // 0xd0 + undefined m_unk0xf6; // 0xf6 + undefined m_unk0xf7; // 0xf7 }; void FUN_10015820(MxU32, MxU32); diff --git a/LEGO1/mxtype18notificationparam.h b/LEGO1/mxtype18notificationparam.h new file mode 100644 index 00000000..bce896e3 --- /dev/null +++ b/LEGO1/mxtype18notificationparam.h @@ -0,0 +1,14 @@ +#ifndef MXTYPE18NOTIFICATIONPARAM_H +#define MXTYPE18NOTIFICATIONPARAM_H + +#include "decomp.h" +#include "mxnotificationparam.h" + +// VTABLE: LEGO1 0x100d7e80 +// SIZE 0x10 +class MxType18NotificationParam : public MxNotificationParam { +protected: + undefined4 m_unk0xc; // 0xc +}; + +#endif // MXTYPE18NOTIFICATIONPARAM_H diff --git a/LEGO1/mxtype19notificationparam.h b/LEGO1/mxtype19notificationparam.h new file mode 100644 index 00000000..ddd47998 --- /dev/null +++ b/LEGO1/mxtype19notificationparam.h @@ -0,0 +1,15 @@ +#ifndef MXTYPE19NOTIFICATIONPARAM_H +#define MXTYPE19NOTIFICATIONPARAM_H + +#include "decomp.h" +#include "mxnotificationparam.h" + +// VTABLE: LEGO1 0x100d6230 +// SIZE 0x10 +class MxType19NotificationParam : public MxNotificationParam { +protected: + MxU16 m_unk0xc; // 0xc + MxU8 m_unk0xe; // 0xe +}; + +#endif // MXTYPE19NOTIFICATIONPARAM_H diff --git a/LEGO1/realtime/matrix.cpp b/LEGO1/realtime/matrix.cpp index 3ba63ca5..852e14d0 100644 --- a/LEGO1/realtime/matrix.cpp +++ b/LEGO1/realtime/matrix.cpp @@ -168,7 +168,7 @@ void Matrix4Impl::ToQuaternion(Vector4Impl* p_outQuat) // No idea what this function is doing and it will be hard to tell until // we have a confirmed usage site. // STUB: LEGO1 0x10002710 -int Matrix4Impl::FUN_10002710(const Vector3Impl* p_vec) +int Matrix4Impl::FromQuaternion(const Vector4Impl& p_vec) { return -1; } diff --git a/LEGO1/realtime/matrix.h b/LEGO1/realtime/matrix.h index a577815f..58db7a9f 100644 --- a/LEGO1/realtime/matrix.h +++ b/LEGO1/realtime/matrix.h @@ -63,7 +63,7 @@ class Matrix4Impl { // vtable + 0x40 virtual void ToQuaternion(Vector4Impl* p_resultQuat); - virtual int FUN_10002710(const Vector3Impl* p_vec); + virtual int FromQuaternion(const Vector4Impl& p_vec); inline float& operator[](size_t idx) { return ((float*) m_data)[idx]; } diff --git a/LEGO1/realtime/orientableroi.h b/LEGO1/realtime/orientableroi.h index ddc93103..82db8271 100644 --- a/LEGO1/realtime/orientableroi.h +++ b/LEGO1/realtime/orientableroi.h @@ -4,6 +4,8 @@ #include "matrix.h" #include "roi.h" +// VTABLE: LEGO1 0x100dbc08 +// SIZE 0xdc class OrientableROI : public ROI { public: // FUNCTION: LEGO1 0x100a4420 @@ -16,34 +18,30 @@ class OrientableROI : public ROI { ZEROVEC3(m_world_velocity); IDENTMAT4(m_local2world.GetMatrix()); } + + virtual const Vector3& GetWorldVelocity() const override; // vtable+0x8 + virtual const BoundingBox& GetWorldBoundingBox() const override; // vtable+0xc + virtual const BoundingSphere& GetWorldBoundingSphere() const override; // vtable+0x10 + // FUNCTION: LEGO1 0x100a5db0 + virtual void VTable0x14() { VTable0x1c(); } // vtable+0x14 + virtual void UpdateWorldBoundingVolumes() = 0; // vtable+0x18 + virtual void VTable0x1c(); // vtable+0x1c + virtual void SetLocalTransform(const Matrix4Impl& p_transform); // vtable+0x20 + virtual void VTable0x24(const Matrix4Data& p_transform); // vtable+0x24 + virtual void UpdateWorldData(const Matrix4Data& p_transform); // vtable+0x28 + virtual void UpdateWorldVelocity(); // vtable+0x2c + // SYNTHETIC: LEGO1 0x100a4630 // OrientableROI::`scalar deleting destructor' - virtual const Vector3& GetWorldVelocity() const; - virtual const BoundingBox& GetWorldBoundingBox() const; - virtual const BoundingSphere& GetWorldBoundingSphere() const; - protected: - // vtable + 0x14 - virtual void VTable0x14() { VTable0x1c(); } - virtual void UpdateWorldBoundingVolumes() = 0; - -public: - virtual void VTable0x1c(); - // vtable + 0x20 - virtual void SetLocalTransform(const Matrix4Impl& p_transform); - virtual void VTable0x24(const Matrix4Data& p_transform); - virtual void UpdateWorldData(const Matrix4Data& p_transform); - virtual void UpdateWorldVelocity(); - -protected: - char m_unk0xc; + char m_unk0xc; // 0xc Matrix4Data m_local2world; // 0x10 BoundingBox m_world_bounding_box; // 0x58 BoundingSphere m_world_bounding_sphere; // 0xa8 Vector3Data m_world_velocity; // 0xc0 - unsigned int m_unk0xd4; - unsigned int m_unk0xd8; + unsigned int m_unk0xd4; // 0xd4 + unsigned int m_unk0xd8; // 0xd8 }; #endif // ORIENTABLEROI_H diff --git a/LEGO1/realtime/roi.h b/LEGO1/realtime/roi.h index 223d5326..287407ac 100644 --- a/LEGO1/realtime/roi.h +++ b/LEGO1/realtime/roi.h @@ -49,9 +49,9 @@ class LODObject { public: // LODObject(); virtual ~LODObject() {} - virtual float Cost(float pixels_covered) const = 0; - virtual float AveragePolyArea() const = 0; - virtual int NVerts() const = 0; + virtual float Cost(float pixels_covered) const = 0; // vtable+0x4 + virtual float AveragePolyArea() const = 0; // vtable+0x8 + virtual int NVerts() const = 0; // vtable+0xc }; /* @@ -73,6 +73,8 @@ typedef vector ROIList; */ typedef vector IntList; +// VTABLE: LEGO1 0x100dbc38 +// SIZE 0xc class ROI { public: ROI() @@ -86,10 +88,10 @@ class ROI { assert(!m_comp); assert(!m_lods); } - virtual float IntrinsicImportance() const = 0; - virtual const Vector3& GetWorldVelocity() const = 0; - virtual const BoundingBox& GetWorldBoundingBox() const = 0; - virtual const BoundingSphere& GetWorldBoundingSphere() const = 0; + virtual float IntrinsicImportance() const = 0; // vtable+0x4 + virtual const Vector3& GetWorldVelocity() const = 0; // vtable+0x8 + virtual const BoundingBox& GetWorldBoundingBox() const = 0; // vtable+0xc + virtual const BoundingSphere& GetWorldBoundingSphere() const = 0; // vtable+0x10 const LODListBase* GetLODs() const { return m_lods; } const LODObject* GetLOD(int i) const @@ -101,7 +103,7 @@ class ROI { const CompoundObject* GetComp() const { return m_comp; } protected: - CompoundObject* m_comp; - LODListBase* m_lods; + CompoundObject* m_comp; // 0x4 + LODListBase* m_lods; // 0x8 }; #endif // ROI_H diff --git a/LEGO1/realtime/vector.cpp b/LEGO1/realtime/vector.cpp index 5826fcec..390cfdd9 100644 --- a/LEGO1/realtime/vector.cpp +++ b/LEGO1/realtime/vector.cpp @@ -133,57 +133,57 @@ int Vector2Impl::Unitize() } // FUNCTION: LEGO1 0x100021c0 -void Vector2Impl::AddScalar(float p_value) +void Vector2Impl::Add(float p_value) { AddScalarImpl(p_value); } // FUNCTION: LEGO1 0x100021d0 -void Vector2Impl::AddVector(float* p_other) +void Vector2Impl::Add(float* p_other) { AddVectorImpl(p_other); } // FUNCTION: LEGO1 0x100021e0 -void Vector2Impl::AddVector(Vector2Impl* p_other) +void Vector2Impl::Add(Vector2Impl* p_other) { AddVectorImpl(p_other->m_data); } // FUNCTION: LEGO1 0x100021f0 -void Vector2Impl::SubVector(float* p_other) +void Vector2Impl::Sub(float* p_other) { SubVectorImpl(p_other); } // FUNCTION: LEGO1 0x10002200 -void Vector2Impl::SubVector(Vector2Impl* p_other) +void Vector2Impl::Sub(Vector2Impl* p_other) { SubVectorImpl(p_other->m_data); } // FUNCTION: LEGO1 0x10002210 -void Vector2Impl::MullVector(float* p_other) +void Vector2Impl::Mul(float* p_other) { MullVectorImpl(p_other); } // FUNCTION: LEGO1 0x10002220 -void Vector2Impl::MullVector(Vector2Impl* p_other) +void Vector2Impl::Mul(Vector2Impl* p_other) { MullVectorImpl(p_other->m_data); } // FUNCTION: LEGO1 0x10002230 -void Vector2Impl::MullScalar(float* p_value) +void Vector2Impl::Mul(float& p_value) { - MullScalarImpl(p_value); + MullScalarImpl(&p_value); } // FUNCTION: LEGO1 0x10002240 -void Vector2Impl::DivScalar(float* p_value) +void Vector2Impl::Div(float& p_value) { - DivScalarImpl(p_value); + DivScalarImpl(&p_value); } // FUNCTION: LEGO1 0x10002250 diff --git a/LEGO1/realtime/vector.h b/LEGO1/realtime/vector.h index 2b03d6c3..3f61fb9a 100644 --- a/LEGO1/realtime/vector.h +++ b/LEGO1/realtime/vector.h @@ -93,19 +93,19 @@ class Vector2Impl { virtual int Unitize(); // vtable + 0x48 - virtual void AddVector(Vector2Impl* p_other); - virtual void AddVector(float* p_other); - virtual void AddScalar(float p_value); + virtual void Add(Vector2Impl* p_other); + virtual void Add(float* p_other); + virtual void Add(float p_value); // vtable + 0x54 - virtual void SubVector(Vector2Impl* p_other); - virtual void SubVector(float* p_other); + virtual void Sub(Vector2Impl* p_other); + virtual void Sub(float* p_other); // vtable + 0x5C - virtual void MullScalar(float* p_value); - virtual void MullVector(Vector2Impl* p_other); - virtual void MullVector(float* p_other); - virtual void DivScalar(float* p_value); + virtual void Mul(float* p_value); + virtual void Mul(Vector2Impl* p_other); + virtual void Mul(float& p_other); + virtual void Div(float& p_value); // vtable + 0x6C virtual void SetVector(Vector2Impl* p_other); @@ -197,6 +197,7 @@ class Vector3Data : public Vector3Impl { for (size_t i = sizeof(m_vector) / sizeof(float); i > 0; --i) *dest++ = *src++; } + inline void EqualsCross(Vector3Data& p_a, Vector3Data& p_b) { EqualsCrossImpl(p_a.m_data, p_b.m_data); } private: Vector3 m_vector; diff --git a/LEGO1/viewmanager/viewlodlist.h b/LEGO1/viewmanager/viewlodlist.h index d695624f..5fa31454 100644 --- a/LEGO1/viewmanager/viewlodlist.h +++ b/LEGO1/viewmanager/viewlodlist.h @@ -5,6 +5,7 @@ #include "assert.h" #include "compat.h" +#pragma warning(disable : 4237) #pragma warning(disable : 4786) class ViewLOD;