diff --git a/CMakeLists.txt b/CMakeLists.txt index f6ff00b0..4cb01936 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,8 @@ option(ISLE_USE_SMARTHEAP "Build with SmartHeap" ${MSVC}) option(ISLE_USE_DX5 "Build with internal DirectX 5 SDK" ON) add_library(lego1 SHARED + LEGO1/score.cpp + LEGO1/helicopter.cpp LEGO1/act1state.cpp LEGO1/act2brick.cpp LEGO1/act2policestation.cpp @@ -29,7 +31,6 @@ add_library(lego1 SHARED LEGO1/gasstationentity.cpp LEGO1/gasstationstate.cpp LEGO1/gifmanager.cpp - LEGO1/helicopter.cpp LEGO1/helicopterstate.cpp LEGO1/historybook.cpp LEGO1/hospital.cpp @@ -207,7 +208,6 @@ add_library(lego1 SHARED LEGO1/realtime/realtimeview.cpp LEGO1/realtime/vector.cpp LEGO1/registrationbook.cpp - LEGO1/score.cpp LEGO1/scorestate.cpp LEGO1/skateboard.cpp LEGO1/towtrack.cpp diff --git a/LEGO1/act1state.h b/LEGO1/act1state.h index 09a3ecd8..a52900c6 100644 --- a/LEGO1/act1state.h +++ b/LEGO1/act1state.h @@ -21,6 +21,12 @@ class Act1State : public LegoState { { return !strcmp(name, Act1State::ClassName()) || LegoState::IsA(name); }; + + inline void SetUnknown18(MxU32 p) { m_unk18 = p; } + +protected: + undefined m_unk8[0x10]; + MxU32 m_unk18; }; #endif // ACT1STATE_H diff --git a/LEGO1/act3.h b/LEGO1/act3.h index edc88571..42255511 100644 --- a/LEGO1/act3.h +++ b/LEGO1/act3.h @@ -25,11 +25,13 @@ class Act3 : public LegoWorld { } inline void SetUnkown420c(MxEntity* p_entity) { m_unk420c = p_entity; } + inline void SetUnkown4270(MxU32 p) { m_unk4270 = p; } protected: undefined m_unkf8[0x4114]; MxEntity* m_unk420c; - undefined m_unk4210[0x64]; + undefined m_unk4210[0x60]; + MxU32 m_unk4270; }; #endif // ACT3_H diff --git a/LEGO1/gifmanager.cpp b/LEGO1/gifmanager.cpp index ef4beb22..fdc8a0c4 100644 --- a/LEGO1/gifmanager.cpp +++ b/LEGO1/gifmanager.cpp @@ -3,23 +3,7 @@ DECOMP_SIZE_ASSERT(GifData, 0x14); DECOMP_SIZE_ASSERT(GifMapEntry, 0x14); DECOMP_SIZE_ASSERT(GifMap, 0x08); -DECOMP_SIZE_ASSERT(GifManagerBase, 0x14); -DECOMP_SIZE_ASSERT(GifManager, 0x30); +DECOMP_SIZE_ASSERT(GifManagerBase, 0x10); +DECOMP_SIZE_ASSERT(GifManager, 0x24); GifMapEntry* DAT_100f0100; - -// FUNCTION: LEGO1 0x10001cc0 -GifMapEntry* GifMap::FindNode(const char*& string) -{ - GifMapEntry* ret = m_unk4; - GifMapEntry* current = ret->m_parent; - while (current != DAT_100f0100) { - if (strcmp(current->m_key, string) <= 0) { - ret = current; - current = current->m_right; - } - else - current = current->m_left; - } - return ret; -} diff --git a/LEGO1/gifmanager.h b/LEGO1/gifmanager.h index b5c52971..b5b9b44c 100644 --- a/LEGO1/gifmanager.h +++ b/LEGO1/gifmanager.h @@ -24,10 +24,25 @@ struct GifMapEntry { const char* m_key; GifData* m_value; }; +extern GifMapEntry* DAT_100f0100; class GifMap { public: - GifMapEntry* FindNode(const char*& string); + // FUNCTION: LEGO1 0x10001cc0 + GifMapEntry* GifMap::FindNode(const char*& string) + { + GifMapEntry* ret = m_unk4; + GifMapEntry* current = ret->m_parent; + while (current != DAT_100f0100) { + if (strcmp(current->m_key, string) <= 0) { + ret = current; + current = current->m_right; + } + else + current = current->m_left; + } + return ret; + } inline GifData* Get(const char* string) { @@ -51,7 +66,6 @@ class GifManagerBase { inline GifData* Get(const char* name) { return m_unk8.Get(name); } protected: - undefined4 m_unk0; undefined4 m_unk4; GifMap m_unk8; }; @@ -63,7 +77,7 @@ class GifManager : public GifManagerBase { virtual ~GifManager() {} // vtable+00 protected: - undefined m_unk[0x1c]; + undefined m_unk[0x14]; }; #endif // GIFMANAGER_H diff --git a/LEGO1/helicopter.cpp b/LEGO1/helicopter.cpp index 4397ae55..726419a3 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_unk22c, 0x16); - FUN_1003ee00(m_unk22c, 0x17); - FUN_1003ee00(m_unk22c, 0x18); - FUN_1003ee00(m_unk22c, 0x19); - FUN_1003ee00(m_unk22c, 0x1a); - FUN_1003ee00(m_unk22c, 0x1b); - FUN_1003ee00(m_unk22c, 0x1c); - FUN_1003ee00(m_unk22c, 0x1d); - FUN_1003ee00(m_unk22c, 0x1e); - FUN_1003ee00(m_unk22c, 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_LegoWorld) + m_LegoWorld = 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) +{ + MxU32 ret = 0; + MxAtomId l_script; + switch (GameState()->GetUnknown10()) { + case 0: + l_script = *g_isleScript; + break; + case 1: + l_script = *g_act2mainScript; + break; + case 2: + l_script = *g_act3Script; + break; + } + if (p.GetUnknown28() == 1) { + switch (p.GetUnknown20()) { + case 0x17: + if (*g_act3Script == l_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 == l_script) + break; + Act1State* state = (Act1State*) GameState()->GetState("Act1State"); + if (m_state->GetUnkown8() == 0) { + state->SetUnknown18(4); + m_state->SetUnknown8(1); + m_LegoWorld->FUN_1001fc80(this); + InvokeAction(ExtraActionType_start, l_script, 0x20, NULL); + SetUnknownDC(0); + } + ret = 1; + break; + } + case 0x19: + if (*g_act3Script == l_script) + break; + if (m_state->GetUnkown8() == 2) { + m_state->SetUnknown8(3); + m_LegoWorld->FUN_1001fc80(this); + InvokeAction(ExtraActionType_start, l_script, 0x21, NULL); + SetUnknownDC(4); + } + ret = 1; + break; + case 0x1a: + if (*g_act3Script != l_script) + break; + ret = 1; + /* fall through */ + case 0x1b: + if (*g_act3Script != l_script) + break; + if (m_LegoWorld && m_LegoWorld->GetCamera()) { + Vector3Data loc, dir, lookat; + loc.CopyFrom(m_LegoWorld->GetCamera()->FUN_100127f0()); + dir.CopyFrom(m_LegoWorld->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_LegoWorld->GetCamera()->FUN_10012740()); + va4.EqualsCross(v68, dir); + v7c.EqualsCross(va4, v90); + if (ret) + if (m_LegoWorld->FUN_100727e0(m_unk138, loc, dir, v7c)) + break; + else if (m_LegoWorld->FUN_10072980(m_unk138, 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) +{ + 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_LegoWorld->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_LegoWorld->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_unkea != 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) +{ + int state = m_state->GetUnkown8(); + switch (state) { + default: + LegoPathActor::VTable0x70(p); + return; + case 4: + case 5: + float f = m_unk1f0 - p + 3000; + if (f >= 0) { + float f2 = f / 3000 + 1; + if (f2 < 0) + f2 = 0; + if (1.0f < f2) + f2 = 1.0f; + Vector3Impl v(m_unk160.GetMatrix()[3]); + Matrix4Data mat; + Vector3Impl v2(m_unk1a8.GetMatrix()[3]); + float* loc = m_unk1a8.GetMatrix()[3]; + mat.SetIdentity(); + float fa[4]; + Vector4Impl v3(fa); + if (m_unk1f4.FUN_100040a0(v3, f2) == SUCCESS) { + mat.FromQuaternion(v3); + } + v2.SetVector(loc); + v2.Sub(&v); + v2.Mul(f2); + v2.Add(&v); + m_LegoWorld->GetCamera()->FUN_100123e0(mat, 0); + } + else { + if (state == 4) + m_LegoWorld->FUN_10073400(); + else + m_LegoWorld->FUN_10073430(); + m_unkdc = 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 8bf00412..069be4db 100644 --- a/LEGO1/helicopter.h +++ b/LEGO1/helicopter.h @@ -5,11 +5,23 @@ #include "islepathactor.h" #include "realtime/matrix.h" +class HelicopterSubclass { +public: + inline HelicopterSubclass() : m_unk30(0) {} + MxResult FUN_100040a0(Vector4Impl& p_v, float p_f); + +private: + Vector4Data m_unk0; + Vector4Data m_unk18; + undefined4 m_unk30; +}; + // 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 @@ -26,20 +38,22 @@ class Helicopter : public IslePathActor { virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18 virtual void VTable0xe4() override; + virtual MxU32 VTable0xcc() override; + virtual MxU32 VTable0xd4(MxType17NotificationParam& p) override; + virtual MxU32 VTable0xd8(MxType18NotificationParam& p) override; + void VTable0x74(Matrix4Impl& p_transform); + void VTable0x70(float p); // SYNTHETIC: LEGO1 0x10003210 // Helicopter::`scalar deleting destructor' - virtual ~Helicopter() override; // vtable+0x0 protected: Matrix4Data m_unk160; Matrix4Data m_unk1a8; - undefined4 m_unk1f0; - Vector4Data m_unk1f4; - Vector4Data m_unk20c; - undefined4 m_unk224; + float m_unk1f0; + HelicopterSubclass m_unk1f4; HelicopterState* m_state; - MxAtomId m_unk22c; + MxAtomId m_script; private: void GetState(); diff --git a/LEGO1/helicopterstate.h b/LEGO1/helicopterstate.h index f95e331b..3db5f08d 100644 --- a/LEGO1/helicopterstate.h +++ b/LEGO1/helicopterstate.h @@ -21,10 +21,11 @@ class HelicopterState : public LegoState { return !strcmp(name, HelicopterState::ClassName()) || LegoState::IsA(name); } - inline void SetUnknown8(undefined4 p_unk8) { m_unk8 = p_unk8; } + inline void SetUnknown8(MxU32 p_unk8) { m_unk8 = p_unk8; } + inline MxU32 GetUnkown8() { return m_unk8; } protected: - undefined4 m_unk8; + MxU32 m_unk8; }; #endif // HELICOPTERSTATE_H diff --git a/LEGO1/isle.h b/LEGO1/isle.h index da83a203..6e81081e 100644 --- a/LEGO1/isle.h +++ b/LEGO1/isle.h @@ -22,6 +22,12 @@ class Isle : public LegoWorld { { return !strcmp(name, Isle::ClassName()) || LegoWorld::IsA(name); } + + inline void setUnknown13c(MxU32 p) { m_unk13c = p; } + +protected: + undefined m_unkf8[0x44]; + MxU32 m_unk13c; }; #endif // ISLE_H diff --git a/LEGO1/islepathactor.cpp b/LEGO1/islepathactor.cpp index 805fc287..e82b498b 100644 --- a/LEGO1/islepathactor.cpp +++ b/LEGO1/islepathactor.cpp @@ -2,42 +2,10 @@ 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() { - this->m_pLegoWorld = NULL; + this->m_LegoWorld = NULL; this->m_unk13c = 6.0; this->m_unk15c = 1.0; this->m_unk158 = 0; diff --git a/LEGO1/islepathactor.h b/LEGO1/islepathactor.h index be728a74..dce3b3df 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 @@ -11,6 +14,19 @@ class IslePathActor : public LegoPathActor { public: IslePathActor(); + // FUNCTION: LEGO1 0x10002e70 + virtual MxU32 VTable0xcc() { return 0; } // vtable+0xcc + // FUNCTION: LEGO1 0x10002df0 + virtual MxU32 VTable0xd0() { return 0; } // vtable+0xd0 + // FUNCTION: LEGO1 0x10002e10 + inline virtual ~IslePathActor() override { IslePathActor::Destroy(TRUE); } + // FUNCTION: LEGO1 0x10002e80 + virtual MxU32 VTable0xd4(MxType17NotificationParam& p) { return 0; } // vtable+0xd4 + // FUNCTION: LEGO1 0x10002e90 + virtual MxU32 VTable0xd8(MxType18NotificationParam& p) { return 0; } // vtable+0xd8 + // FUNCTION: LEGO1 0x10002e00 + virtual MxU32 VTable0xdc(MxType19NotificationParam& p) { return 0; } // vtable+0xdc + // FUNCTION: LEGO1 0x10002ea0 inline virtual const char* ClassName() const override // vtable+0x0c { @@ -26,24 +42,18 @@ class IslePathActor : public LegoPathActor { // 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 p_1, MxBool p_2, MxU8 p_3); // vtable+0xe8 virtual void VTable0xec(); // vtable+0xec - inline void SetWorld(LegoWorld* p_world) { m_pLegoWorld = p_world; } - inline LegoWorld* GetWorld() { return m_pLegoWorld; } + inline void SetWorld(LegoWorld* p_world) { m_LegoWorld = p_world; } + inline LegoWorld* GetWorld() { return m_LegoWorld; } -private: - LegoWorld* m_pLegoWorld; // 0x154 +protected: + LegoWorld* m_LegoWorld; // 0x154 MxFloat m_unk158; MxFloat m_unk15c; }; diff --git a/LEGO1/legoanimationmanager.cpp b/LEGO1/legoanimationmanager.cpp index ffb420f6..8c1b3d79 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 p) +{ +} diff --git a/LEGO1/legoanimationmanager.h b/LEGO1/legoanimationmanager.h index 89fb427c..1932d117 100644 --- a/LEGO1/legoanimationmanager.h +++ b/LEGO1/legoanimationmanager.h @@ -27,6 +27,7 @@ class LegoAnimationManager : public MxCore { } void FUN_1005f6d0(MxBool p); + void FUN_10064670(MxBool p); __declspec(dllexport) static void configureLegoAnimationManager(int param_1); diff --git a/LEGO1/legocameracontroller.cpp b/LEGO1/legocameracontroller.cpp index cf68f0d1..8a74e7df 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 p_2) +{ +} + +// 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 d12f333d..9b4c7db2 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,11 @@ class LegoCameraController : public MxCore { { return !strcmp(name, ClassName()) || MxCore::IsA(name); } + void LegoCameraController::LookAt(Vector3Impl& p_at, Vector3Impl& p_dir, Vector3Impl& p_up); + void LegoCameraController::FUN_100123e0(Matrix4Data& p_transform, MxU32 p_2); + Vector3Data& FUN_10012740(); + Vector3Data& FUN_100127f0(); + Vector3Data& FUN_100128a0(); }; #endif // LEGOCAMERACONTROLLER_H diff --git a/LEGO1/legoentity.cpp b/LEGO1/legoentity.cpp index 7e8a953f..f73fbcf0 100644 --- a/LEGO1/legoentity.cpp +++ b/LEGO1/legoentity.cpp @@ -102,6 +102,11 @@ void LegoEntity::ParseAction(char* p_extra) } } +// STUB: LEGO1 0x10010c30 +void LegoEntity::FUN_10010c30() +{ +} + // STUB: LEGO1 0x10010f10 void LegoEntity::VTable0x34() { diff --git a/LEGO1/legoentity.h b/LEGO1/legoentity.h index f3da7325..6ec8735a 100644 --- a/LEGO1/legoentity.h +++ b/LEGO1/legoentity.h @@ -46,6 +46,7 @@ class LegoEntity : public MxEntity { virtual void VTable0x44(); // vtable+0x44 virtual void VTable0x48(); // vtable+0x48 virtual void VTable0x4c(); // vtable+0x4c + void LegoEntity::FUN_10010c30(); protected: void Init(); diff --git a/LEGO1/legogamestate.cpp b/LEGO1/legogamestate.cpp index 99e3f47e..d32bcc0b 100644 --- a/LEGO1/legogamestate.cpp +++ b/LEGO1/legogamestate.cpp @@ -9,8 +9,6 @@ #include "mxstring.h" #include "mxvariabletable.h" -// Based on the highest dword offset (0x42c) referenced in the constructor. -// There may be other members that come after. DECOMP_SIZE_ASSERT(LegoGameState, 0x430) // GLOBAL: LEGO1 0x100f3e40 diff --git a/LEGO1/legogamestate.h b/LEGO1/legogamestate.h index 82ff4d9c..350d588c 100644 --- a/LEGO1/legogamestate.h +++ b/LEGO1/legogamestate.h @@ -16,7 +16,6 @@ struct ColorStringStruct { const char* m_colorName; }; -// SIZE 0x430 (at least) class LegoGameState { public: __declspec(dllexport) LegoGameState(); @@ -34,6 +33,7 @@ class LegoGameState { void FUN_1003a720(MxU32 p_unk); void HandleAction(MxU32 p_unk); + inline MxU32 GetUnknownC() { return m_unkC; } inline MxU32 GetUnknown10() { return m_unk10; } inline void SetUnknown424(undefined4 p_unk424) { m_unk424 = p_unk424; } diff --git a/LEGO1/legoomni.cpp b/LEGO1/legoomni.cpp index 887b8cad..014c09cd 100644 --- a/LEGO1/legoomni.cpp +++ b/LEGO1/legoomni.cpp @@ -1,6 +1,7 @@ #include "legoomni.h" #include "gifmanager.h" +#include "islepathactor.h" #include "legoanimationmanager.h" #include "legobuildingmanager.h" #include "legogamestate.h" @@ -164,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 d5063235..4211489b 100644 --- a/LEGO1/legoomni.h +++ b/LEGO1/legoomni.h @@ -2,6 +2,7 @@ #define LEGOOMNI_H #include "compat.h" +#include "islepathactor.h" #include "mxdsaction.h" #include "mxomni.h" @@ -103,7 +104,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; } @@ -121,7 +122,7 @@ class LegoOmni : public MxOmni { LegoWorld* m_currentWorld; MxBool m_unk80; LegoNavController* m_navController; // 0x84 - LegoWorld* m_currentVehicle; // 0x88 + IslePathActor* m_currentVehicle; // 0x88 LegoUnkSaveDataWriter* m_unkLegoSaveDataWriter; LegoPlantManager* m_plantManager; // 0x90 LegoAnimationManager* m_animationManager; @@ -151,7 +152,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..9f2b48c0 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 p) { // TODO } diff --git a/LEGO1/legopathactor.h b/LEGO1/legopathactor.h index fbf2a51c..4108cb5f 100644 --- a/LEGO1/legopathactor.h +++ b/LEGO1/legopathactor.h @@ -25,39 +25,59 @@ class LegoPathActor : public LegoActor { return !strcmp(name, LegoPathActor::ClassName()) || LegoActor::IsA(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 + inline void SetUnknownDC(MxU32 p) { m_unkdc = p; } + + virtual void VTable0x68(); // vtable+0x68 + virtual void VTable0x6c(); // vtable+0x6c + virtual void VTable0x70(float p); // vtable+0x70 + virtual void VTable0x74(Matrix4Impl& p_transform); // vtable+0x74 + // FUNCTION: LEGO1 0x10002d20 + virtual void VTable0x78(MxU8 p_1) { m_unkea = p_1; } // vtable+0x78 + // FUNCTION: LEGO1 0x10002d30 + virtual MxU8 VTable0x7c() { return m_unkea; } // 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_1) { m_unk140 = p_1; } // vtable+0xac + // FUNCTION: LEGO1 0x10002d80 + virtual MxFloat VTable0xb0() { return m_unk13c; } // vtable+0xb0 + // FUNCTION: LEGO1 0x10002d90 + virtual MxFloat VTable0xb4() { return m_unk140; } // vtable+0xb4 + // FUNCTION: LEGO1 0x10002da0 + virtual MxFloat VTable0xb8() { return m_unk144; } // vtable+0xb8 + // FUNCTION: LEGO1 0x10002db0 + virtual void VTable0xbc(MxFloat p_1) { m_unk140 = p_1; } // vtable+0xbc + // FUNCTION: LEGO1 0x10002dc0 + virtual void VTable0xc0(MxFloat p_1) { m_unk144 = p_1; } // vtable+0xc0 + // FUNCTION: LEGO1 0x10002dd0 + virtual void VTable0xc4() {} // vtable+0xc4 + // FUNCTION: LEGO1 0x10002de0 + virtual void VTable0xc8(MxU8 p_1) { m_unk148 = p_1; } // vtable+0xc8 protected: // TODO: the types - undefined unk78[0xc4]; + undefined m_unk78[0x64]; + MxU32 m_unkdc; + undefined m_unke0[0xa]; + MxU8 m_unkea; + undefined m_unk[0x4d]; + MxU32 m_unk138; MxFloat m_unk13c; - MxS32 m_unk140; - MxS32 m_unk144; - undefined m_unk148; + MxFloat m_unk140; + MxFloat m_unk144; + MxU8 m_unk148; MxS32 m_unk14c; MxFloat m_unk150; }; diff --git a/LEGO1/legoroi.cpp b/LEGO1/legoroi.cpp index 70cb1faf..206c71b0 100644 --- a/LEGO1/legoroi.cpp +++ b/LEGO1/legoroi.cpp @@ -35,6 +35,15 @@ MxS32 g_roiConfig = 100; // GLOBAL: LEGO1 0x101013ac ROIHandler g_someHandlerFunction = NULL; +// STUB: LEGO1 0x100a46b0 +void LegoROI::FUN_100a46b0(Matrix4Impl& p_transform) +{ +} + +void LegoROI::FUN_100a58f0(Matrix4Impl& p_transform) +{ +} + // FUNCTION: LEGO1 0x100a81c0 void LegoROI::configureLegoROI(MxS32 p_roi) { 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 b1ba6add..feeb29c0 100644 --- a/LEGO1/legoutil.cpp +++ b/LEGO1/legoutil.cpp @@ -1,5 +1,6 @@ #include "legoutil.h" +#include "legoentity.h" #include "mxomni.h" #include "mxtypes.h" @@ -34,6 +35,11 @@ ExtraActionType MatchActionString(const char* p_str) return result; } +// STUB: LEGO1 0x1003e430 +void InvokeAction(ExtraActionType actionId, MxAtomId& pAtom, int targetEntityId, LegoEntity* sender) +{ +} + // FUNCTION: LEGO1 0x1003eae0 void ConvertHSVToRGB(float h, float s, float v, float* r_out, float* b_out, float* g_out) { @@ -112,3 +118,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 d9035b14..3589c453 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 actionId, MxAtomId& pAtom, int targetEntityId, LegoEntity* sender); void ConvertHSVToRGB(float r, float g, float b, float* out_r, float* out_g, float* out_b); 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 938abe3a..babaf6c1 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 p_unk1, MxU32 p_unk2) { @@ -91,6 +86,11 @@ void LegoWorld::VTable0x54() // TODO } +// FUNCTION: LEGO1 0x1001fc80 +void LegoWorld::FUN_1001fc80(IslePathActor* 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 p, Vector3Data& loc, Vector3Data& dir, Vector3Data& up) +{ + return FALSE; +} + +// STUB: LEGO1 0x10072980 +MxBool LegoWorld::FUN_10072980(MxU32 p, Vector3Data& loc, Vector3Data& dir, Vector3Data& 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 6bade062..9cd107e6 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) override; // vtable+0x4 + MxResult Tickle(); // FUNCTION: LEGO1 0x1001d690 inline virtual const char* ClassName() const override // vtable+0x0c @@ -33,12 +36,19 @@ 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 MxResult SetAsCurrentWorld(MxDSObject& p_dsObject); void EndAction(MxPresenter* p_presenter); + void FUN_1001fc80(IslePathActor* actor); + inline LegoCameraController* GetCamera() { return m_camera; } + MxBool FUN_100727e0(MxU32 p, Vector3Data& loc, Vector3Data& dir, Vector3Data& up); + MxBool FUN_10072980(MxU32 p, Vector3Data& loc, Vector3Data& dir, Vector3Data& up); + void FUN_10073400(); + void FUN_10073430(); protected: LegoPathControllerList m_list0x68; // 0x68 @@ -52,6 +62,7 @@ class LegoWorld : public LegoEntity { }; void FUN_10015820(MxU32 p_unk1, MxU32 p_unk2); +void FUN_100158e0(); void FUN_10015910(MxU32 p_unk1); void SetIsWorldActive(MxBool p_isWorldActive); diff --git a/LEGO1/mxcore.cpp b/LEGO1/mxcore.cpp index 3a8270df..241bcfd4 100644 --- a/LEGO1/mxcore.cpp +++ b/LEGO1/mxcore.cpp @@ -2,12 +2,6 @@ #include "define.h" -// FUNCTION: LEGO1 0x10001f70 -MxResult MxCore::Tickle() -{ - return SUCCESS; -} - // FUNCTION: LEGO1 0x100ae1a0 MxCore::MxCore() { diff --git a/LEGO1/mxcore.h b/LEGO1/mxcore.h index 4de691cc..ab73b538 100644 --- a/LEGO1/mxcore.h +++ b/LEGO1/mxcore.h @@ -22,7 +22,9 @@ class MxCore { __declspec(dllexport) MxCore(); __declspec(dllexport) virtual ~MxCore(); // vtable+00 __declspec(dllexport) virtual MxLong Notify(MxParam& p); // vtable+04 - virtual MxResult Tickle(); // vtable+08 + + // FUNCTION: LEGO1 0x10001f70 + virtual MxResult Tickle() { return SUCCESS; } // vtable+08 inline virtual const char* ClassName() const // vtable+0c { diff --git a/LEGO1/mxentity.cpp b/LEGO1/mxentity.cpp index 1f507257..20dfbc5c 100644 --- a/LEGO1/mxentity.cpp +++ b/LEGO1/mxentity.cpp @@ -2,14 +2,6 @@ DECOMP_SIZE_ASSERT(MxEntity, 0x10) -// FUNCTION: LEGO1 0x10001070 -MxResult MxEntity::Create(MxS32 p_id, const MxAtomId& p_atom) -{ - this->m_mxEntityId = p_id; - this->m_atom = p_atom; - return SUCCESS; -} - // FUNCTION: LEGO1 0x1000c110 MxEntity::~MxEntity() { diff --git a/LEGO1/mxentity.h b/LEGO1/mxentity.h index 7950bca5..4a7ace40 100644 --- a/LEGO1/mxentity.h +++ b/LEGO1/mxentity.h @@ -27,7 +27,14 @@ class MxEntity : public MxCore { return !strcmp(name, MxEntity::ClassName()) || MxCore::IsA(name); } - virtual MxResult Create(MxS32 p_id, const MxAtomId& p_atom); // vtable+0x14 + // FUNCTION: LEGO1 0x10001070 + virtual MxResult Create(MxS32 p_id, const MxAtomId& p_atom) + { + this->m_mxEntityId = p_id; + this->m_atom = p_atom; + return SUCCESS; + } + inline MxResult Create(MxDSObject& p_dsObject) { m_mxEntityId = p_dsObject.GetObjectId(); diff --git a/LEGO1/mxtype18notificationparam.h b/LEGO1/mxtype18notificationparam.h new file mode 100644 index 00000000..195e5cf5 --- /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 +class MxType18NotificationParam : public MxNotificationParam { +public: +protected: + undefined4 m_unkc; +}; + +#endif // MXTYPE18NOTIFICATIONPARAM_H diff --git a/LEGO1/mxtype19notificationparam.h b/LEGO1/mxtype19notificationparam.h new file mode 100644 index 00000000..1bd9d8db --- /dev/null +++ b/LEGO1/mxtype19notificationparam.h @@ -0,0 +1,14 @@ +#ifndef MXTYPE19NOTIFICATIONPARAM_H +#define MXTYPE19NOTIFICATIONPARAM_H + +#include "decomp.h" +#include "mxnotificationparam.h" + +// VTABLE: LEGO1 0x100d6230 +class MxType19NotificationParam : public MxNotificationParam { +public: +protected: + undefined4 m_unkc; +}; + +#endif // MXTYPE19NOTIFICATIONPARAM_H diff --git a/LEGO1/realtime/matrix.cpp b/LEGO1/realtime/matrix.cpp index 7b2a94b3..5cd7ae17 100644 --- a/LEGO1/realtime/matrix.cpp +++ b/LEGO1/realtime/matrix.cpp @@ -9,178 +9,3 @@ DECOMP_SIZE_ASSERT(Matrix4, 0x40); DECOMP_SIZE_ASSERT(Matrix4Impl, 0x8); DECOMP_SIZE_ASSERT(Matrix4Data, 0x48); - -// FUNCTION: LEGO1 0x10002320 -void Matrix4Impl::EqualsMatrixData(const Matrix4& p_matrix) -{ - *m_data = p_matrix; -} - -// FUNCTION: LEGO1 0x10002340 -void Matrix4Impl::EqualsMatrixImpl(const Matrix4Impl* p_other) -{ - *m_data = *p_other->m_data; -} - -// FUNCTION: LEGO1 0x10002360 -void Matrix4Impl::AnotherSetData(Matrix4& p_data) -{ - m_data = &p_data; -} - -// FUNCTION: LEGO1 0x10002370 -void Matrix4Impl::SetData(Matrix4& p_data) -{ - m_data = &p_data; -} - -// FUNCTION: LEGO1 0x10002380 -const Matrix4* Matrix4Impl::GetData() const -{ - return m_data; -} - -// FUNCTION: LEGO1 0x10002390 -Matrix4* Matrix4Impl::GetData() -{ - return m_data; -} - -// FUNCTION: LEGO1 0x100023a0 -const float* Matrix4Impl::Element(int p_row, int p_col) const -{ - return &(*m_data)[p_row][p_col]; -} - -// FUNCTION: LEGO1 0x100023c0 -float* Matrix4Impl::Element(int p_row, int p_col) -{ - return &(*m_data)[p_row][p_col]; -} - -// FUNCTION: LEGO1 0x100023e0 -void Matrix4Impl::Clear() -{ - memset(m_data, 0, 16 * sizeof(float)); -} - -// FUNCTION: LEGO1 0x100023f0 -void Matrix4Impl::SetIdentity() -{ - Clear(); - (*m_data)[0][0] = 1.0f; - (*m_data)[1][1] = 1.0f; - (*m_data)[2][2] = 1.0f; - (*m_data)[3][3] = 1.0f; -} - -// FUNCTION: LEGO1 0x10002430 -Matrix4Impl* Matrix4Impl::operator+=(const Matrix4& p_matrix) -{ - for (int i = 0; i < 16; ++i) - ((float*) m_data)[i] += ((float*) &p_matrix)[i]; - return this; -} - -// Matches but instructions are significantly out of order. Probably not wrong -// code given that the very similar SetTranslation does match. -// FUNCTION: LEGO1 0x10002460 -void Matrix4Impl::TranslateBy(const float* p_x, const float* p_y, const float* p_z) -{ - ((float*) m_data)[12] += *p_x; - ((float*) m_data)[13] += *p_y; - ((float*) m_data)[14] += *p_z; -} - -// FUNCTION: LEGO1 0x100024a0 -void Matrix4Impl::SetTranslation(const float* p_x, const float* p_y, const float* p_z) -{ - (*m_data)[3][0] = *p_x; - (*m_data)[3][1] = *p_y; - (*m_data)[3][2] = *p_z; -} - -// FUNCTION: LEGO1 0x100024d0 -void Matrix4Impl::EqualsDataProduct(const Matrix4& p_a, const Matrix4& p_b) -{ - float* cur = (float*) m_data; - for (int row = 0; row < 4; ++row) { - for (int col = 0; col < 4; ++col) { - *cur = 0.0f; - for (int k = 0; k < 4; ++k) { - *cur += p_a[row][k] * p_b[k][col]; - } - cur++; - } - } -} - -// FUNCTION: LEGO1 0x10002530 -void Matrix4Impl::EqualsMxProduct(const Matrix4Impl* p_a, const Matrix4Impl* p_b) -{ - EqualsDataProduct(*p_a->m_data, *p_b->m_data); -} - -// Not close, Ghidra struggles understinging this method so it will have to -// be manually worked out. Included since I at least figured out what it was -// doing with rotateIndex and what overall operation it's trying to do. -// STUB: LEGO1 0x10002550 -void Matrix4Impl::ToQuaternion(Vector4Impl* p_outQuat) -{ - /* - float trace = m_data[0] + m_data[5] + m_data[10]; - if (trace > 0) { - trace = sqrt(trace + 1.0); - p_outQuat->GetData()[3] = trace * 0.5f; - p_outQuat->GetData()[0] = (m_data[9] - m_data[6]) * trace; - p_outQuat->GetData()[1] = (m_data[2] - m_data[8]) * trace; - p_outQuat->GetData()[2] = (m_data[4] - m_data[1]) * trace; - return; - } - - // GLOBAL: LEGO1 0x100d4090 - static int rotateIndex[] = {1, 2, 0}; - - // Largest element along the trace - int largest = m_data[0] < m_data[5]; - if (*Element(largest, largest) < m_data[10]) - largest = 2; - - int next = rotateIndex[largest]; - int nextNext = rotateIndex[next]; - float valueA = *Element(nextNext, nextNext); - float valueB = *Element(next, next); - float valueC = *Element(largest, largest); - - // Above is somewhat decomped, below is pure speculation since the automatic - // decomp becomes very garbled. - float traceValue = sqrt(valueA - valueB - valueC + 1.0); - - p_outQuat->GetData()[largest] = traceValue * 0.5f; - traceValue = 0.5f / traceValue; - - p_outQuat->GetData()[3] = (m_data[next + 4 * nextNext] - m_data[nextNext + 4 * next]) * traceValue; - p_outQuat->GetData()[next] = (m_data[next + 4 * largest] + m_data[largest + 4 * next]) * traceValue; - p_outQuat->GetData()[nextNext] = (m_data[nextNext + 4 * largest] + m_data[largest + 4 * nextNext]) * traceValue; - */ -} - -// 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) -{ - return -1; -} - -// FUNCTION: LEGO1 0x10002850 -void Matrix4Impl::operator=(const Matrix4Impl& p_other) -{ - EqualsMatrixImpl(&p_other); -} - -// FUNCTION: LEGO1 0x10002860 -void Matrix4Data::operator=(const Matrix4Data& p_other) -{ - EqualsMatrixImpl(&p_other); -} diff --git a/LEGO1/realtime/matrix.h b/LEGO1/realtime/matrix.h index a577815f..ac9f1a98 100644 --- a/LEGO1/realtime/matrix.h +++ b/LEGO1/realtime/matrix.h @@ -1,8 +1,8 @@ #ifndef MATRIX_H #define MATRIX_H +#include "memory.h" #include "vector.h" - /* * A simple array of four Vector4s that can be indexed into. */ @@ -35,35 +35,178 @@ class Matrix4 { // SIZE 0x8 class Matrix4Impl { public: - inline Matrix4Impl(Matrix4& p_data) : m_data(&p_data) {} + inline Matrix4Impl(Matrix4& p_data) { m_data = &p_data; } - // vtable + 0x00 - virtual void EqualsMatrixImpl(const Matrix4Impl* p_other); - virtual void EqualsMatrixData(const Matrix4& p_matrix); - virtual void SetData(Matrix4& p_data); - virtual void AnotherSetData(Matrix4& p_data); + // FUNCTION: LEGO1 0x10002340 + virtual void EqualsMatrixImpl(const Matrix4Impl* p_other) { *m_data = *p_other->m_data; } - // vtable + 0x10 - virtual Matrix4* GetData(); - virtual const Matrix4* GetData() const; - virtual float* Element(int p_row, int p_col); - virtual const float* Element(int p_row, int p_col) const; + // FUNCTION: LEGO1 0x10002320 + virtual void EqualsMatrixData(const Matrix4& p_matrix) { *m_data = p_matrix; } - // vtable + 0x20 - virtual void Clear(); - virtual void SetIdentity(); - virtual void operator=(const Matrix4Impl& p_other); - virtual Matrix4Impl* operator+=(const Matrix4& p_matrix); + // FUNCTION: LEGO1 0x10002370 + virtual void SetData(Matrix4& p_data) { m_data = &p_data; } - // vtable + 0x30 - virtual void TranslateBy(const float* p_x, const float* p_y, const float* p_z); - virtual void SetTranslation(const float* p_x, const float* p_y, const float* p_z); - virtual void EqualsMxProduct(const Matrix4Impl* p_a, const Matrix4Impl* p_b); - virtual void EqualsDataProduct(const Matrix4& p_a, const Matrix4& p_b); + // FUNCTION: LEGO1 0x10002360 + virtual void AnotherSetData(Matrix4& p_data) { m_data = &p_data; } - // vtable + 0x40 - virtual void ToQuaternion(Vector4Impl* p_resultQuat); - virtual int FUN_10002710(const Vector3Impl* p_vec); + // FUNCTION: LEGO1 0x10002390 + virtual Matrix4* GetData() { return m_data; } + + // FUNCTION: LEGO1 0x10002380 + virtual const Matrix4* GetData() const { return m_data; } + + // FUNCTION: LEGO1 0x100023c0 + virtual float* Element(int p_row, int p_col) { return &(*m_data)[p_row][p_col]; } + + // FUNCTION: LEGO1 0x100023a0 + virtual const float* Element(int p_row, int p_col) const { return &(*m_data)[p_row][p_col]; } + + // FUNCTION: LEGO1 0x100023e0 + virtual void Clear() { memset(m_data, 0, 16 * sizeof(float)); } + + // FUNCTION: LEGO1 0x100023f0 + virtual inline void SetIdentity() + { + Clear(); + (*m_data)[0][0] = 1.0f; + (*m_data)[1][1] = 1.0f; + (*m_data)[2][2] = 1.0f; + (*m_data)[3][3] = 1.0f; + } + + // FUNCTION: LEGO1 0x10002420 + virtual void operator=(const Matrix4Impl& p_other) { EqualsMatrixImpl(&p_other); } + + // FUNCTION: LEGO1 0x10002430 + virtual Matrix4Impl* operator+=(const Matrix4& p_matrix) + { + for (int i = 0; i < 16; ++i) + ((float*) m_data)[i] += ((float*) &p_matrix)[i]; + return this; + } + + // Matches but instructions are significantly out of order. Probably not wrong + // code given that the very similar SetTranslation does match. + // FUNCTION: LEGO1 0x10002460 + virtual void TranslateBy(const float* p_x, const float* p_y, const float* p_z) + { + ((float*) m_data)[12] += *p_x; + ((float*) m_data)[13] += *p_y; + ((float*) m_data)[14] += *p_z; + } + + // FUNCTION: LEGO1 0x100024a0 + virtual void SetTranslation(const float* p_x, const float* p_y, const float* p_z) + { + (*m_data)[3][0] = *p_x; + (*m_data)[3][1] = *p_y; + (*m_data)[3][2] = *p_z; + } + + // FUNCTION: LEGO1 0x10002530 + virtual void EqualsMxProduct(const Matrix4Impl* p_a, const Matrix4Impl* p_b) + { + EqualsDataProduct(*p_a->m_data, *p_b->m_data); + } + + // FUNCTION: LEGO1 0x100024d0 + virtual void EqualsDataProduct(const Matrix4& p_a, const Matrix4& p_b) + { + float* cur = (float*) m_data; + for (int row = 0; row < 4; ++row) { + for (int col = 0; col < 4; ++col) { + *cur = 0.0f; + for (int k = 0; k < 4; ++k) { + *cur += p_a[row][k] * p_b[k][col]; + } + cur++; + } + } + } + + // FUNCTION: LEGO1 0x10002550 + virtual void ToQuaternion(Vector4Impl& p_outQuat) + { + + float trace = TRACE3(*m_data); + if (trace > 0) { + trace = sqrt(trace + 1.0); + p_outQuat[3] = trace * 0.5f; + trace = 0.5f / trace; + p_outQuat[0] = ((*m_data)[2][1] - (*m_data)[1][2]) * trace; + p_outQuat[1] = ((*m_data)[0][2] - (*m_data)[2][0]) * trace; + p_outQuat[2] = ((*m_data)[1][0] - (*m_data)[0][1]) * trace; + } + else { + // FUNCTION: LEGO1 0x100d4090 + static int rotateIndex[] = {1, 2, 0}; + + int i, j, k; + i = 0; + // Largest element along the trace + if ((*m_data)[1][1] > (*m_data)[0][0]) + i = 1; + if ((*m_data)[2][2] > *Element(i, i)) + i = 2; + + j = rotateIndex[i]; + k = rotateIndex[j]; + + // Above is somewhat decomped, below is pure speculation since the automatic + // decomp becomes very garbled. + float traceValue = sqrt(*Element(i, i) - (*Element(j, j) + *Element(k, k)) + 1.0); + + p_outQuat[i] = traceValue * 0.5f; + traceValue = 0.5f / traceValue; + + p_outQuat.GetData()[3] = traceValue * ((*m_data)[k][j] - (*m_data)[j][k]); + p_outQuat.GetData()[j] = traceValue * (*m_data)[j][i] + (*m_data)[i][j]; + p_outQuat.GetData()[k] = traceValue * (*m_data)[k][i] + (*m_data)[i][k]; + } + } + + // FUNCTION: LEGO1 0x10002710 + virtual int FromQuaternion(const Vector4Impl& p_quat) + { + float lensq; + if ((lensq = p_quat.LenSquared()) > 0) { + lensq = 2 / lensq; + float XX = p_quat[0] * lensq; + float YY = p_quat[1] * lensq; + float ZZ = p_quat[2] * lensq; + + float WXX = p_quat[3] * XX; + float XXX = p_quat[0] * XX; + + float WYY = p_quat[3] * YY; + float XYY = p_quat[0] * YY; + float YYY = p_quat[1] * YY; + + float WZZ = p_quat[3] * ZZ; + float XZZ = p_quat[0] * ZZ; + float YZZ = p_quat[1] * ZZ; + float ZZZ = p_quat[2] * ZZ; + + (*m_data)[0][0] = 1 - (YYY + ZZZ); + (*m_data)[1][0] = XYY + WZZ; + (*m_data)[2][0] = XZZ - WYY; + (*m_data)[0][1] = XYY - WZZ; + (*m_data)[1][1] = 1 - (XXX + ZZZ); + (*m_data)[2][1] = YZZ + WXX; + (*m_data)[0][2] = XZZ + WYY; + (*m_data)[1][2] = YZZ - WXX; + (*m_data)[2][2] = 1 - (XXX + YYY); + (*m_data)[3][0] = 0; + (*m_data)[3][1] = 0; + (*m_data)[3][2] = 0; + (*m_data)[3][3] = 1; + (*m_data)[0][3] = 0; + (*m_data)[1][3] = 0; + (*m_data)[2][3] = 0; + return 0; + } + return -1; + } inline float& operator[](size_t idx) { return ((float*) m_data)[idx]; } @@ -80,10 +223,11 @@ class Matrix4Data : public Matrix4Impl { inline Matrix4Data(Matrix4Data& p_other) : Matrix4Impl(m_matrix) { m_matrix = *p_other.m_data; } inline Matrix4& GetMatrix() { return *m_data; } - // No idea why there's another equals. Maybe to some other type like the - // DirectX Retained Mode Matrix type which is also a float* alias? - // vtable + 0x44 - virtual void operator=(const Matrix4Data& p_other); + // FUNCTION: LEGO1 0x10002850 + virtual void Matrix4Data::operator=(const Matrix4Impl& p_other) { EqualsMatrixImpl(&p_other); } + + // FUNCTION: LEGO1 0x10002860 + virtual void Matrix4Data::operator=(const Matrix4Data& p_other) { EqualsMatrixImpl(&p_other); } Matrix4 m_matrix; }; diff --git a/LEGO1/realtime/orientableroi.h b/LEGO1/realtime/orientableroi.h index bb14815b..55bcf530 100644 --- a/LEGO1/realtime/orientableroi.h +++ b/LEGO1/realtime/orientableroi.h @@ -23,13 +23,11 @@ class OrientableROI : public ROI { 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); diff --git a/LEGO1/realtime/vector.cpp b/LEGO1/realtime/vector.cpp index 1d41470c..46d9172b 100644 --- a/LEGO1/realtime/vector.cpp +++ b/LEGO1/realtime/vector.cpp @@ -11,450 +11,3 @@ DECOMP_SIZE_ASSERT(Vector3Impl, 0x8); DECOMP_SIZE_ASSERT(Vector4Impl, 0x8); DECOMP_SIZE_ASSERT(Vector3Data, 0x14); DECOMP_SIZE_ASSERT(Vector4Data, 0x18); - -// FUNCTION: LEGO1 0x10001f80 -void Vector2Impl::AddVectorImpl(float* p_value) -{ - m_data[0] += p_value[0]; - m_data[1] += p_value[1]; -} - -// FUNCTION: LEGO1 0x10001fa0 -void Vector2Impl::AddScalarImpl(float p_value) -{ - m_data[0] += p_value; - m_data[1] += p_value; -} - -// FUNCTION: LEGO1 0x10001fc0 -void Vector2Impl::SubVectorImpl(float* p_value) -{ - m_data[0] -= p_value[0]; - m_data[1] -= p_value[1]; -} - -// FUNCTION: LEGO1 0x10001fe0 -void Vector2Impl::MullVectorImpl(float* p_value) -{ - m_data[0] *= p_value[0]; - m_data[1] *= p_value[1]; -} - -// FUNCTION: LEGO1 0x10002000 -void Vector2Impl::MullScalarImpl(float* p_value) -{ - m_data[0] *= *p_value; - m_data[1] *= *p_value; -} - -// FUNCTION: LEGO1 0x10002020 -void Vector2Impl::DivScalarImpl(float* p_value) -{ - m_data[0] /= *p_value; - m_data[1] /= *p_value; -} - -// FUNCTION: LEGO1 0x10002040 -float Vector2Impl::DotImpl(float* p_a, float* p_b) const -{ - return p_b[0] * p_a[0] + p_b[1] * p_a[1]; -} - -// FUNCTION: LEGO1 0x10002060 -// Vector2Impl::SetData - -// FUNCTION: LEGO1 0x10002070 -void Vector2Impl::EqualsImpl(float* p_data) -{ - float* vec = m_data; - vec[0] = p_data[0]; - vec[1] = p_data[1]; -} - -// FUNCTION: LEGO1 0x10002090 -float* Vector2Impl::GetData() -{ - return m_data; -} - -// FUNCTION: LEGO1 0x100020a0 -const float* Vector2Impl::GetData() const -{ - return m_data; -} - -// FUNCTION: LEGO1 0x100020b0 -void Vector2Impl::Clear() -{ - float* vec = m_data; - vec[0] = 0.0f; - vec[1] = 0.0f; -} - -// FUNCTION: LEGO1 0x100020d0 -float Vector2Impl::Dot(float* p_a, float* p_b) const -{ - return DotImpl(p_a, p_b); -} - -// FUNCTION: LEGO1 0x100020f0 -float Vector2Impl::Dot(Vector2Impl* p_a, Vector2Impl* p_b) const -{ - return DotImpl(p_a->m_data, p_b->m_data); -} - -// FUNCTION: LEGO1 0x10002110 -float Vector2Impl::Dot(float* p_a, Vector2Impl* p_b) const -{ - return DotImpl(p_a, p_b->m_data); -} - -// FUNCTION: LEGO1 0x10002130 -float Vector2Impl::Dot(Vector2Impl* p_a, float* p_b) const -{ - return DotImpl(p_a->m_data, p_b); -} - -// FUNCTION: LEGO1 0x10002150 -float Vector2Impl::LenSquared() const -{ - return m_data[0] * m_data[0] + m_data[1] * m_data[1]; -} - -// FUNCTION: LEGO1 0x10002160 -int Vector2Impl::Unitize() -{ - float sq = LenSquared(); - if (sq > 0.0f) { - float root = sqrt(sq); - if (root > 0) { - DivScalarImpl(&root); - return 0; - } - } - return -1; -} - -// FUNCTION: LEGO1 0x100021c0 -void Vector2Impl::AddScalar(float p_value) -{ - AddScalarImpl(p_value); -} - -// FUNCTION: LEGO1 0x100021d0 -void Vector2Impl::AddVector(float* p_other) -{ - AddVectorImpl(p_other); -} - -// FUNCTION: LEGO1 0x100021e0 -void Vector2Impl::AddVector(Vector2Impl* p_other) -{ - AddVectorImpl(p_other->m_data); -} - -// FUNCTION: LEGO1 0x100021f0 -void Vector2Impl::SubVector(float* p_other) -{ - SubVectorImpl(p_other); -} - -// FUNCTION: LEGO1 0x10002200 -void Vector2Impl::SubVector(Vector2Impl* p_other) -{ - SubVectorImpl(p_other->m_data); -} - -// FUNCTION: LEGO1 0x10002210 -void Vector2Impl::MullVector(float* p_other) -{ - MullVectorImpl(p_other); -} - -// FUNCTION: LEGO1 0x10002220 -void Vector2Impl::MullVector(Vector2Impl* p_other) -{ - MullVectorImpl(p_other->m_data); -} - -// FUNCTION: LEGO1 0x10002230 -void Vector2Impl::MullScalar(float* p_value) -{ - MullScalarImpl(p_value); -} - -// FUNCTION: LEGO1 0x10002240 -void Vector2Impl::DivScalar(float* p_value) -{ - DivScalarImpl(p_value); -} - -// FUNCTION: LEGO1 0x10002250 -void Vector2Impl::SetVector(float* p_other) -{ - EqualsImpl(p_other); -} - -// FUNCTION: LEGO1 0x10002260 -void Vector2Impl::SetVector(Vector2Impl* p_other) -{ - EqualsImpl(p_other->m_data); -} - -// FUNCTION: LEGO1 0x10002270 -void Vector3Impl::EqualsCrossImpl(float* p_a, float* p_b) -{ - m_data[0] = p_a[1] * p_b[2] - p_a[2] * p_b[1]; - m_data[1] = p_a[2] * p_b[0] - p_a[0] * p_b[2]; - m_data[2] = p_a[0] * p_b[1] - p_a[1] * p_b[0]; -} - -// FUNCTION: LEGO1 0x100022c0 -void Vector3Impl::EqualsCross(Vector3Impl* p_a, Vector3Impl* p_b) -{ - EqualsCrossImpl(p_a->m_data, p_b->m_data); -} - -// FUNCTION: LEGO1 0x100022e0 -void Vector3Impl::EqualsCross(Vector3Impl* p_a, float* p_b) -{ - EqualsCrossImpl(p_a->m_data, p_b); -} - -// FUNCTION: LEGO1 0x10002300 -void Vector3Impl::EqualsCross(float* p_a, Vector3Impl* p_b) -{ - EqualsCrossImpl(p_a, p_b->m_data); -} - -// FUNCTION: LEGO1 0x10002870 -void Vector4Impl::AddVectorImpl(float* p_value) -{ - m_data[0] += p_value[0]; - m_data[1] += p_value[1]; - m_data[2] += p_value[2]; - m_data[3] += p_value[3]; -} - -// FUNCTION: LEGO1 0x100028b0 -void Vector4Impl::AddScalarImpl(float p_value) -{ - m_data[0] += p_value; - m_data[1] += p_value; - m_data[2] += p_value; - m_data[3] += p_value; -} - -// FUNCTION: LEGO1 0x100028f0 -void Vector4Impl::SubVectorImpl(float* p_value) -{ - m_data[0] -= p_value[0]; - m_data[1] -= p_value[1]; - m_data[2] -= p_value[2]; - m_data[3] -= p_value[3]; -} - -// FUNCTION: LEGO1 0x10002930 -void Vector4Impl::MullVectorImpl(float* p_value) -{ - m_data[0] *= p_value[0]; - m_data[1] *= p_value[1]; - m_data[2] *= p_value[2]; - m_data[3] *= p_value[3]; -} - -// FUNCTION: LEGO1 0x10002970 -void Vector4Impl::MullScalarImpl(float* p_value) -{ - m_data[0] *= *p_value; - m_data[1] *= *p_value; - m_data[2] *= *p_value; - m_data[3] *= *p_value; -} - -// FUNCTION: LEGO1 0x100029b0 -void Vector4Impl::DivScalarImpl(float* p_value) -{ - m_data[0] /= *p_value; - m_data[1] /= *p_value; - m_data[2] /= *p_value; - m_data[3] /= *p_value; -} - -// FUNCTION: LEGO1 0x100029f0 -float Vector4Impl::DotImpl(float* p_a, float* p_b) const -{ - return p_a[0] * p_b[0] + p_a[2] * p_b[2] + (p_a[1] * p_b[1] + p_a[3] * p_b[3]); -} - -// FUNCTION: LEGO1 0x10002a20 -void Vector4Impl::EqualsImpl(float* p_data) -{ - float* vec = m_data; - vec[0] = p_data[0]; - vec[1] = p_data[1]; - vec[2] = p_data[2]; - vec[3] = p_data[3]; -} - -// FUNCTION: LEGO1 0x10002a40 -void Vector4Impl::SetMatrixProductImpl(float* p_vec, float* p_mat) -{ - m_data[0] = p_vec[0] * p_mat[0] + p_vec[1] * p_mat[4] + p_vec[2] * p_mat[8] + p_vec[3] * p_mat[12]; - m_data[1] = p_vec[0] * p_mat[1] + p_vec[1] * p_mat[5] + p_vec[2] * p_mat[9] + p_vec[4] * p_mat[13]; - m_data[2] = p_vec[0] * p_mat[2] + p_vec[1] * p_mat[6] + p_vec[2] * p_mat[10] + p_vec[4] * p_mat[14]; - m_data[3] = p_vec[0] * p_mat[3] + p_vec[1] * p_mat[7] + p_vec[2] * p_mat[11] + p_vec[4] * p_mat[15]; -} - -// FUNCTION: LEGO1 0x10002ae0 -void Vector4Impl::SetMatrixProduct(Vector4Impl* p_a, float* p_b) -{ - SetMatrixProductImpl(p_a->m_data, p_b); -} - -// FUNCTION: LEGO1 0x10002b00 -void Vector4Impl::Clear() -{ - float* vec = m_data; - vec[0] = 0.0f; - vec[1] = 0.0f; - vec[2] = 0.0f; - vec[3] = 0.0f; -} - -// FUNCTION: LEGO1 0x10002b20 -float Vector4Impl::LenSquared() const -{ - return m_data[1] * m_data[1] + m_data[0] * m_data[0] + m_data[2] * m_data[2] + m_data[3] * m_data[3]; -} - -// FUNCTION: LEGO1 0x10002b40 -void Vector4Impl::EqualsScalar(float* p_value) -{ - m_data[0] = *p_value; - m_data[1] = *p_value; - m_data[2] = *p_value; - m_data[3] = *p_value; -} - -// Note close yet, included because I'm at least confident I know what operation -// it's trying to do. -// STUB: LEGO1 0x10002b70 -int Vector4Impl::NormalizeQuaternion() -{ - float* v = m_data; - float magnitude = v[1] * v[1] + v[2] * v[2] + v[0] * v[0]; - if (magnitude > 0.0f) { - float theta = v[3] * 0.5f; - v[3] = cos(theta); - float frac = sin(theta); - magnitude = frac / sqrt(magnitude); - v[0] *= magnitude; - v[1] *= magnitude; - v[2] *= magnitude; - return 0; - } - return -1; -} - -// FUNCTION: LEGO1 0x10002bf0 -void Vector4Impl::UnknownQuaternionOp(Vector4Impl* p_a, Vector4Impl* p_b) -{ - float* bDat = p_b->m_data; - float* aDat = p_a->m_data; - - this->m_data[3] = aDat[3] * bDat[3] - (bDat[0] * aDat[0] + aDat[2] * bDat[2] + aDat[1] * aDat[1]); - this->m_data[0] = bDat[2] * aDat[1] - bDat[1] * aDat[2]; - this->m_data[1] = aDat[2] * bDat[0] - bDat[2] * aDat[0]; - this->m_data[2] = bDat[1] * aDat[0] - aDat[1] * bDat[0]; - - m_data[0] = p_b->m_data[3] * p_a->m_data[0] + p_a->m_data[3] * p_b->m_data[0] + m_data[0]; - m_data[1] = p_b->m_data[1] * p_a->m_data[3] + p_a->m_data[1] * p_b->m_data[3] + m_data[1]; - m_data[2] = p_b->m_data[2] * p_a->m_data[3] + p_a->m_data[2] * p_b->m_data[3] + m_data[2]; -} - -// FUNCTION: LEGO1 0x10003a60 -void Vector3Impl::AddVectorImpl(float* p_value) -{ - m_data[0] += p_value[0]; - m_data[1] += p_value[1]; - m_data[2] += p_value[2]; -} - -// FUNCTION: LEGO1 0x10003a90 -void Vector3Impl::AddScalarImpl(float p_value) -{ - m_data[0] += p_value; - m_data[1] += p_value; - m_data[2] += p_value; -} - -// FUNCTION: LEGO1 0x10003ac0 -void Vector3Impl::SubVectorImpl(float* p_value) -{ - m_data[0] -= p_value[0]; - m_data[1] -= p_value[1]; - m_data[2] -= p_value[2]; -} - -// FUNCTION: LEGO1 0x10003af0 -void Vector3Impl::MullVectorImpl(float* p_value) -{ - m_data[0] *= p_value[0]; - m_data[1] *= p_value[1]; - m_data[2] *= p_value[2]; -} - -// FUNCTION: LEGO1 0x10003b20 -void Vector3Impl::MullScalarImpl(float* p_value) -{ - m_data[0] *= *p_value; - m_data[1] *= *p_value; - m_data[2] *= *p_value; -} - -// FUNCTION: LEGO1 0x10003b50 -void Vector3Impl::DivScalarImpl(float* p_value) -{ - m_data[0] /= *p_value; - m_data[1] /= *p_value; - m_data[2] /= *p_value; -} - -// FUNCTION: LEGO1 0x10003b80 -float Vector3Impl::DotImpl(float* p_a, float* p_b) const -{ - return p_a[0] * p_b[0] + p_a[2] * p_b[2] + p_a[1] * p_b[1]; -} - -// FUNCTION: LEGO1 0x10003ba0 -void Vector3Impl::EqualsImpl(float* p_data) -{ - float* vec = m_data; - vec[0] = p_data[0]; - vec[1] = p_data[1]; - vec[2] = p_data[2]; -} - -// FUNCTION: LEGO1 0x10003bc0 -void Vector3Impl::Clear() -{ - float* vec = m_data; - vec[0] = 0.0f; - vec[1] = 0.0f; - vec[2] = 0.0f; -} - -// FUNCTION: LEGO1 0x10003bd0 -float Vector3Impl::LenSquared() const -{ - return m_data[1] * m_data[1] + m_data[0] * m_data[0] + m_data[2] * m_data[2]; -} - -// FUNCTION: LEGO1 0x10003bf0 -void Vector3Impl::EqualsScalar(float* p_value) -{ - m_data[0] = *p_value; - m_data[1] = *p_value; - m_data[2] = *p_value; -} diff --git a/LEGO1/realtime/vector.h b/LEGO1/realtime/vector.h index ded96918..ebbe35e4 100644 --- a/LEGO1/realtime/vector.h +++ b/LEGO1/realtime/vector.h @@ -64,54 +64,139 @@ struct Vector4 { // SIZE 0x8 class Vector2Impl { public: - inline Vector2Impl(float* p_data) { this->SetData(p_data); } + inline Vector2Impl(float* p_data) { m_data = p_data; } - // vtable + 0x00 (no virtual destructor) - virtual void AddScalarImpl(float p_value) = 0; - virtual void AddVectorImpl(float* p_value) = 0; - virtual void SubVectorImpl(float* p_value) = 0; - virtual void MullScalarImpl(float* p_value) = 0; + // FUNCTION: LEGO1 0x10001f80 + virtual void AddImpl(float* p_value) + { + m_data[0] += p_value[0]; + m_data[1] += p_value[1]; + } - // vtable + 0x10 - virtual void MullVectorImpl(float* p_value) = 0; - virtual void DivScalarImpl(float* p_value) = 0; - virtual float DotImpl(float* p_a, float* p_b) const = 0; + // FUNCTION: LEGO1 0x10001fa0 + virtual void AddImpl(float p_value) + { + m_data[0] += p_value; + m_data[1] += p_value; + } + + // FUNCTION: LEGO1 0x10001fc0 + virtual void SubImpl(float* p_value) + { + m_data[0] -= p_value[0]; + m_data[1] -= p_value[1]; + } + + // FUNCTION: LEGO1 0x10001fe0 + virtual void MulImpl(float* p_value) + { + m_data[0] *= p_value[0]; + m_data[1] *= p_value[1]; + } + + // FUNCTION: LEGO1 0x10002000 + virtual void MulImpl(float& p_value) + { + m_data[0] *= p_value; + m_data[1] *= p_value; + } + + // FUNCTION: LEGO1 0x10002020 + virtual void DivImpl(float* p_value) + { + m_data[0] /= *p_value; + m_data[1] /= *p_value; + } + + // FUNCTION: LEGO1 0x10002040 + virtual float DotImpl(float* p_a, float* p_b) const { return p_b[0] * p_a[0] + p_b[1] * p_a[1]; } + + // FUNCTION: LEGO1 0x10002060 virtual void SetData(float* p_data) { this->m_data = p_data; } - // vtable + 0x20 - virtual void EqualsImpl(float* p_data) = 0; - virtual float* GetData(); - virtual const float* GetData() const; - virtual void Clear() = 0; + // FUNCTION: LEGO1 0x10002070 + virtual void EqualsImpl(float* p_data) + { + float* vec = m_data; + vec[0] = p_data[0]; + vec[1] = p_data[1]; + } - // vtable + 0x30 - virtual float Dot(Vector2Impl* p_a, float* p_b) const; - virtual float Dot(float* p_a, Vector2Impl* p_b) const; - virtual float Dot(Vector2Impl* p_a, Vector2Impl* p_b) const; - virtual float Dot(float* p_a, float* p_b) const; + // FUNCTION: LEGO1 0x10002090 + virtual float* GetData() { return m_data; } - // vtable + 0x40 - virtual float LenSquared() const = 0; - virtual int Unitize(); + // FUNCTION: LEGO1 0x100020a0 + virtual const float* GetData() const { return m_data; } - // vtable + 0x48 - virtual void AddVector(Vector2Impl* p_other); - virtual void AddVector(float* p_other); - virtual void AddScalar(float p_value); + // FUNCTION: LEGO1 0x100020b0 + virtual void Clear() + { + float* vec = m_data; + vec[0] = 0.0f; + vec[1] = 0.0f; + } - // vtable + 0x54 - virtual void SubVector(Vector2Impl* p_other); - virtual void SubVector(float* p_other); + // FUNCTION: LEGO1 0x100020d0 + virtual float Dot(float* p_a, float* p_b) const { return DotImpl(p_a, p_b); } - // 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); + // FUNCTION: LEGO1 0x100020f0 + virtual float Dot(Vector2Impl* p_a, Vector2Impl* p_b) const { return DotImpl(p_a->m_data, p_b->m_data); } - // vtable + 0x6C - virtual void SetVector(Vector2Impl* p_other); - virtual void SetVector(float* p_other); + // FUNCTION: LEGO1 0x10002110 + virtual float Dot(float* p_a, Vector2Impl* p_b) const { return DotImpl(p_a, p_b->m_data); } + + // FUNCTION: LEGO1 0x10002130 + virtual float Dot(Vector2Impl* p_a, float* p_b) const { return DotImpl(p_a->m_data, p_b); } + + // FUNCTION: LEGO1 0x10002150 + virtual float LenSquared() { return NORMSQRD2(m_data); } + + // FUNCTION: LEGO1 0x10002160 + virtual int Normalize() + { + float sq = LenSquared(); + if (sq > 0.0f) { + float root = sqrt(sq); + if (root > 0) { + Div(&root); + return 0; + } + } + return -1; + } + + // FUNCTION: LEGO1 0x100021c0 + virtual void Add(float p_value) { AddImpl(p_value); } + + // FUNCTION: LEGO1 0x100021d0 + virtual void Add(float* p_other) { AddImpl(p_other); } + + // FUNCTION: LEGO1 0x100021e0 + virtual void Add(Vector2Impl* p_other) { AddImpl(p_other->m_data); } + + // FUNCTION: LEGO1 0x100021f0 + virtual void Sub(float* p_other) { SubImpl(p_other); } + + // FUNCTION: LEGO1 0x10002200 + virtual void Sub(Vector2Impl* p_other) { SubImpl(p_other->m_data); } + + // FUNCTION: LEGO1 0x10002210 + virtual void Mul(float* p_other) { MulImpl(p_other); } + + // FUNCTION: LEGO1 0x10002220 + virtual void Mul(Vector2Impl* p_other) { MulImpl(p_other->m_data); } + + // FUNCTION: LEGO1 0x10002230 + virtual void Mul(float& p_value) { MulImpl(p_value); } + + // FUNCTION: LEGO1 0x10002240 + virtual void Div(float* p_value) { DivImpl(p_value); } + + // FUNCTION: LEGO1 0x10002250 + virtual void SetVector(float* p_other) { EqualsImpl(p_other); } + + // FUNCTION: LEGO1 0x10002260 + virtual void SetVector(Vector2Impl* p_other) { EqualsImpl(p_other->m_data); } inline float& operator[](size_t idx) { return m_data[idx]; } inline const float& operator[](size_t idx) const { return m_data[idx]; } @@ -125,29 +210,103 @@ class Vector2Impl { class Vector3Impl : public Vector2Impl { public: inline Vector3Impl(float* p_data) : Vector2Impl(p_data) {} + // FUNCTION: LEGO1 0x10003a90 + virtual void AddImpl(float p_value) + { + m_data[0] += p_value; + m_data[1] += p_value; + m_data[2] += p_value; + } - void AddScalarImpl(float p_value); + // FUNCTION: LEGO1 0x10003a60 + virtual void AddImpl(float* p_value) + { + m_data[0] += p_value[0]; + m_data[1] += p_value[1]; + m_data[2] += p_value[2]; + } - void AddVectorImpl(float* p_value); + // FUNCTION: LEGO1 0x10003ac0 + virtual void SubImpl(float* p_value) + { + m_data[0] -= p_value[0]; + m_data[1] -= p_value[1]; + m_data[2] -= p_value[2]; + } - void SubVectorImpl(float* p_value); - void MullScalarImpl(float* p_value); - void MullVectorImpl(float* p_value); - void DivScalarImpl(float* p_value); - float DotImpl(float* p_a, float* p_b) const; + // FUNCTION: LEGO1 0x10003b20 + virtual void MulImpl(float& p_value) + { + m_data[0] *= p_value; + m_data[1] *= p_value; + m_data[2] *= p_value; + } - void EqualsImpl(float* p_data); + // FUNCTION: LEGO1 0x10003af0 + virtual void MulImpl(float* p_value) + { + m_data[0] *= p_value[0]; + m_data[1] *= p_value[1]; + m_data[2] *= p_value[2]; + } - void Clear(); + // FUNCTION: LEGO1 0x10003b50 + virtual void DivImpl(float* p_value) + { + m_data[0] /= *p_value; + m_data[1] /= *p_value; + m_data[2] /= *p_value; + } - float LenSquared() const; + // FUNCTION: LEGO1 0x10003b80 + virtual float DotImpl(float* p_a, float* p_b) const { return p_a[0] * p_b[0] + p_a[2] * p_b[2] + p_a[1] * p_b[1]; } + + // FUNCTION: LEGO1 0x10003ba0 + virtual void EqualsImpl(float* p_data) + { + float* vec = m_data; + vec[0] = p_data[0]; + vec[1] = p_data[1]; + vec[2] = p_data[2]; + } + + // FUNCTION: LEGO1 0x10003bc0 + virtual void Clear() + { + float* vec = m_data; + vec[0] = 0.0f; + vec[1] = 0.0f; + vec[2] = 0.0f; + } + + // FUNCTION: LEGO1 0x10003bd0 + virtual float LenSquared() const { return m_data[1] * m_data[1] + m_data[0] * m_data[0] + m_data[2] * m_data[2]; } + + // FUNCTION: LEGO1 0x10003bf0 + virtual void EqualsScalar(float* p_value) + { + m_data[0] = *p_value; + m_data[1] = *p_value; + m_data[2] = *p_value; + } // vtable + 0x74 - virtual void EqualsCrossImpl(float* p_a, float* p_b); - virtual void EqualsCross(float* p_a, Vector3Impl* p_b); - virtual void EqualsCross(Vector3Impl* p_a, float* p_b); - virtual void EqualsCross(Vector3Impl* p_a, Vector3Impl* p_b); - virtual void EqualsScalar(float* p_value); + // FUNCTION: LEGO1 0x10002270 + virtual void EqualsCrossImpl(float* p_a, float* p_b) + { + m_data[0] = p_a[1] * p_b[2] - p_a[2] * p_b[1]; + m_data[1] = p_a[2] * p_b[0] - p_a[0] * p_b[2]; + m_data[2] = p_a[0] * p_b[1] - p_a[1] * p_b[0]; + } + + // FUNCTION: LEGO1 0x10002300 + virtual void EqualsCross(float* p_a, Vector3Impl* p_b) { EqualsCrossImpl(p_a, p_b->m_data); } + + // FUNCTION: LEGO1 0x100022e0 + virtual void EqualsCross(Vector3Impl* p_a, float* p_b) { EqualsCrossImpl(p_a->m_data, p_b); } + + // FUNCTION: LEGO1 0x100022c0 + virtual void EqualsCross(Vector3Impl* p_a, Vector3Impl* p_b) { EqualsCrossImpl(p_a->m_data, p_b->m_data); } inline void Fill(float p_value) { EqualsScalar(&p_value); } }; @@ -158,29 +317,148 @@ class Vector4Impl : public Vector3Impl { public: inline Vector4Impl(float* p_data) : Vector3Impl(p_data) {} - void AddScalarImpl(float p_value); + // FUNCTION: LEGO1 0x10002870 + virtual void AddImpl(float* p_value) + { + m_data[0] += p_value[0]; + m_data[1] += p_value[1]; + m_data[2] += p_value[2]; + m_data[3] += p_value[3]; + } - void AddVectorImpl(float* p_value); + // FUNCTION: LEGO1 0x100028b0 + virtual void AddImpl(float p_value) + { + m_data[0] += p_value; + m_data[1] += p_value; + m_data[2] += p_value; + m_data[3] += p_value; + } - void SubVectorImpl(float* p_value); - void MullScalarImpl(float* p_value); - void MullVectorImpl(float* p_value); - void DivScalarImpl(float* p_value); - float DotImpl(float* p_a, float* p_b) const; + // FUNCTION: LEGO1 0x100028f0 + virtual void SubImpl(float* p_value) + { + m_data[0] -= p_value[0]; + m_data[1] -= p_value[1]; + m_data[2] -= p_value[2]; + m_data[3] -= p_value[3]; + } - void EqualsImpl(float* p_data); + // FUNCTION: LEGO1 0x10002930 + virtual void MulImpl(float* p_value) + { + m_data[0] *= p_value[0]; + m_data[1] *= p_value[1]; + m_data[2] *= p_value[2]; + m_data[3] *= p_value[3]; + } - void Clear(); + // FUNCTION: LEGO1 0x10002970 + virtual void MulImpl(float& p_value) + { + m_data[0] *= p_value; + m_data[1] *= p_value; + m_data[2] *= p_value; + m_data[3] *= p_value; + } - float LenSquared() const; + // FUNCTION: LEGO1 0x100029b0 + virtual void DivImpl(float* p_value) + { + m_data[0] /= *p_value; + m_data[1] /= *p_value; + m_data[2] /= *p_value; + m_data[3] /= *p_value; + } - void EqualsScalar(float* p_value); + // FUNCTION: LEGO1 0x100029f0 + virtual float DotImpl(float* p_a, float* p_b) const + { + return p_a[0] * p_b[0] + p_a[2] * p_b[2] + (p_a[1] * p_b[1] + p_a[3] * p_b[3]); + } - // vtable + 0x84 - virtual void SetMatrixProduct(Vector4Impl* p_a, float* p_b); - virtual void SetMatrixProductImpl(float* p_vec, float* p_mat); - virtual int NormalizeQuaternion(); - virtual void UnknownQuaternionOp(Vector4Impl* p_a, Vector4Impl* p_b); + // FUNCTION: LEGO1 0x10002a20 + virtual void EqualsImpl(float* p_data) + { + float* vec = m_data; + vec[0] = p_data[0]; + vec[1] = p_data[1]; + vec[2] = p_data[2]; + vec[3] = p_data[3]; + } + + // FUNCTION: LEGO1 0x10002a40 + virtual void SetMatrixProductImpl(float* p_vec, float* p_mat) + { + m_data[0] = p_vec[0] * p_mat[0] + p_vec[1] * p_mat[4] + p_vec[2] * p_mat[8] + p_vec[3] * p_mat[12]; + m_data[1] = p_vec[0] * p_mat[1] + p_vec[1] * p_mat[5] + p_vec[2] * p_mat[9] + p_vec[4] * p_mat[13]; + m_data[2] = p_vec[0] * p_mat[2] + p_vec[1] * p_mat[6] + p_vec[2] * p_mat[10] + p_vec[4] * p_mat[14]; + m_data[3] = p_vec[0] * p_mat[3] + p_vec[1] * p_mat[7] + p_vec[2] * p_mat[11] + p_vec[4] * p_mat[15]; + } + + // FUNCTION: LEGO1 0x10002ae0 + virtual void SetMatrixProduct(Vector4Impl* p_a, float* p_b) { SetMatrixProductImpl(p_a->m_data, p_b); } + + // FUNCTION: LEGO1 0x10002b00 + virtual void Clear() + { + float* vec = m_data; + vec[0] = 0.0f; + vec[1] = 0.0f; + vec[2] = 0.0f; + vec[3] = 0.0f; + } + + // FUNCTION: LEGO1 0x10002b20 + virtual float LenSquared() const + { + return m_data[1] * m_data[1] + m_data[0] * m_data[0] + m_data[2] * m_data[2] + m_data[3] * m_data[3]; + } + + // FUNCTION: LEGO1 0x10002b40 + virtual void EqualsScalar(float* p_value) + { + m_data[0] = *p_value; + m_data[1] = *p_value; + m_data[2] = *p_value; + m_data[3] = *p_value; + } + + // Note close yet, included because I'm at least confident I know what operation + // it's trying to do. + // STUB: LEGO1 0x10002b70 + virtual int NormalizeQuaternion() + { + float* v = m_data; + float magnitude = v[1] * v[1] + v[2] * v[2] + v[0] * v[0]; + if (magnitude > 0.0f) { + float theta = v[3] * 0.5f; + v[3] = cos(theta); + float frac = sin(theta); + magnitude = frac / sqrt(magnitude); + v[0] *= magnitude; + v[1] *= magnitude; + v[2] *= magnitude; + return 0; + } + return -1; + } + + // FUNCTION: LEGO1 0x10002bf0 + virtual void UnknownQuaternionOp(Vector4Impl* p_a, Vector4Impl* p_b) + { + float* bDat = p_b->m_data; + float* aDat = p_a->m_data; + + this->m_data[3] = aDat[3] * bDat[3] - (bDat[0] * aDat[0] + aDat[2] * bDat[2] + aDat[1] * aDat[1]); + this->m_data[0] = bDat[2] * aDat[1] - bDat[1] * aDat[2]; + this->m_data[1] = aDat[2] * bDat[0] - bDat[2] * aDat[0]; + this->m_data[2] = bDat[1] * aDat[0] - aDat[1] * bDat[0]; + + m_data[0] = p_b->m_data[3] * p_a->m_data[0] + p_a->m_data[3] * p_b->m_data[0] + m_data[0]; + m_data[1] = p_b->m_data[1] * p_a->m_data[3] + p_a->m_data[1] * p_b->m_data[3] + m_data[1]; + m_data[2] = p_b->m_data[2] * p_a->m_data[3] + p_a->m_data[2] * p_b->m_data[3] + m_data[2]; + } }; // VTABLE: LEGO1 0x100d4488 @@ -189,17 +467,25 @@ class Vector3Data : public Vector3Impl { public: inline Vector3Data() : Vector3Impl(m_vector.elements) {} inline Vector3Data(float p_x, float p_y, float p_z) : Vector3Impl(m_vector.elements), m_vector(p_x, p_y, p_z) {} + inline Vector3Data& operator=(Vector3Data& p_other) + { + EqualsImpl(p_other.m_data); + SET3(m_vector, p_other.m_vector); + return *this; + } - void CopyFrom(Vector3Data& p_other) + inline void CopyFrom(Vector3Data& p_other) { EqualsImpl(p_other.m_data); float* dest = m_vector.elements; float* src = p_other.m_vector.elements; - for (size_t i = sizeof(m_vector) / sizeof(float); i > 0; --i) + for (; dest < (m_vector.elements + 3);) *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/score.cpp b/LEGO1/score.cpp index 62502e60..77663224 100644 --- a/LEGO1/score.cpp +++ b/LEGO1/score.cpp @@ -22,12 +22,6 @@ Score::Score() NotificationManager()->Register(this); } -// FUNCTION: LEGO1 0x100010b0 -MxBool Score::VTable0x5c() -{ - return TRUE; -} - // FUNCTION: LEGO1 0x10001200 Score::~Score() { diff --git a/LEGO1/score.h b/LEGO1/score.h index 3b4e99de..52994be8 100644 --- a/LEGO1/score.h +++ b/LEGO1/score.h @@ -15,6 +15,9 @@ class Score : public LegoWorld { virtual ~Score() override; // vtable+0x0 virtual MxLong Notify(MxParam& p) override; // vtable+0x4 + // FUNCTION: LEGO1 0x100010b0 + MxBool VTable0x5c() { return TRUE; } + // FUNCTION: LEGO1 0x100010c0 inline virtual const char* ClassName() const override // vtable+0x0c { @@ -33,7 +36,6 @@ class Score : public LegoWorld { virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+18 virtual void Stop() override; // vtable+50 - virtual MxBool VTable0x5c() override; // vtable+5c virtual MxBool VTable0x64() override; // vtable+64 virtual void VTable0x68(MxBool p_add) override; // vtable+68 diff --git a/LEGO1/viewmanager/viewlodlist.h b/LEGO1/viewmanager/viewlodlist.h index 12817ff9..9e7c778c 100644 --- a/LEGO1/viewmanager/viewlodlist.h +++ b/LEGO1/viewmanager/viewlodlist.h @@ -44,7 +44,7 @@ class ViewLODList : public LODList { // ??? for now, until we have symbol management typedef const char* ROIName; struct ROINameComparator { - bool operator()(const ROIName& rName1, const ROIName& rName2) const + int operator()(const ROIName& rName1, const ROIName& rName2) const { return strcmp((const char*) rName1, (const char*) rName2) > 0; }