diff --git a/LEGO1/lego/legoomni/include/legoentity.h b/LEGO1/lego/legoomni/include/legoentity.h index 527c555d..783267bd 100644 --- a/LEGO1/lego/legoomni/include/legoentity.h +++ b/LEGO1/lego/legoomni/include/legoentity.h @@ -37,12 +37,16 @@ class LegoEntity : public MxEntity { return !strcmp(p_name, LegoEntity::ClassName()) || MxEntity::IsA(p_name); } - virtual MxResult Create(MxDSAction& p_dsAction); // vtable+0x18 - virtual void Destroy(MxBool p_fromDestructor); // vtable+0x1c - virtual void ParseAction(char*); // vtable+0x20 - virtual void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2); // vtable+0x24 - virtual void SetWorldTransform(const Vector3& p_loc, const Vector3& p_dir, const Vector3& p_up); // vtable+0x28 - virtual void ResetWorldTransform(MxBool p_inVehicle); // vtable+0x2c + virtual MxResult Create(MxDSAction& p_dsAction); // vtable+0x18 + virtual void Destroy(MxBool p_fromDestructor); // vtable+0x1c + virtual void ParseAction(char* p_extra); // vtable+0x20 + virtual void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2); // vtable+0x24 + virtual void SetWorldTransform( + const Vector3& p_location, + const Vector3& p_direction, + const Vector3& p_up + ); // vtable+0x28 + virtual void ResetWorldTransform(MxBool p_cameraFlag); // vtable+0x2c // FUNCTION: LEGO1 0x10001090 virtual void SetWorldSpeed(MxFloat p_worldSpeed) { m_worldSpeed = p_worldSpeed; } // vtable+0x30 diff --git a/LEGO1/lego/legoomni/include/legoobjectfactory.h b/LEGO1/lego/legoomni/include/legoobjectfactory.h index f05ab0d2..b119631b 100644 --- a/LEGO1/lego/legoomni/include/legoobjectfactory.h +++ b/LEGO1/lego/legoomni/include/legoobjectfactory.h @@ -105,8 +105,8 @@ class LegoObjectFactory : public MxObjectFactory { public: LegoObjectFactory(); - MxCore* Create(const char* p_name) override; // vtable 0x14 - void Destroy(MxCore* p_object) override; // vtable 0x18 + MxCore* Create(const char* p_name) override; // vtable+0x14 + void Destroy(MxCore* p_object) override; // vtable+0x18 // SYNTHETIC: LEGO1 0x10009000 // LegoObjectFactory::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index 0d4892a4..67d8deae 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -25,16 +25,45 @@ void LegoEntity::Init() m_unk0x59 = 4; } -// STUB: LEGO1 0x10010650 -void LegoEntity::ResetWorldTransform(MxBool p_inVehicle) +// FUNCTION: LEGO1 0x10010650 +void LegoEntity::ResetWorldTransform(MxBool p_cameraFlag) { - // TODO + LegoWorld* world = CurrentWorld(); + + if (world != NULL && world->GetCamera() != NULL) { + m_cameraFlag = p_cameraFlag; + + if (m_cameraFlag) { + world->GetCamera()->SetEntity(this); + world->GetCamera()->SetWorldTransform( + Mx3DPointFloat(0.0F, 1.25F, 0.0F), + Mx3DPointFloat(0.0F, 0.0F, 1.0F), + Mx3DPointFloat(0.0F, 1.0F, 0.0F) + ); + } + else { + if (world->GetCamera()->GetEntity() == this) { + world->GetCamera()->SetEntity(NULL); + world->GetCamera()->SetWorldTransform( + Mx3DPointFloat(0.0F, 0.0F, 0.0F), + Mx3DPointFloat(0.0F, 0.0F, 1.0F), + Mx3DPointFloat(0.0F, 1.0F, 0.0F) + ); + } + } + } } -// STUB: LEGO1 0x10010790 -void LegoEntity::SetWorldTransform(const Vector3& p_loc, const Vector3& p_dir, const Vector3& p_up) +// FUNCTION: LEGO1 0x10010790 +void LegoEntity::SetWorldTransform(const Vector3& p_location, const Vector3& p_direction, const Vector3& p_up) { - // TODO + LegoWorld* world = CurrentWorld(); + + if (world != NULL && world->GetCamera() != NULL) { + m_cameraFlag = TRUE; + world->GetCamera()->SetEntity(this); + world->GetCamera()->SetWorldTransform(p_location, p_direction, p_up); + } } // FUNCTION: LEGO1 0x100107e0 @@ -71,6 +100,7 @@ void LegoEntity::Destroy(MxBool p_fromDestructor) void LegoEntity::SetWorld() { LegoWorld* world = CurrentWorld(); + if (world != NULL && world != (LegoWorld*) this) { world->Add(this); } diff --git a/LEGO1/omni/include/mxobjectfactory.h b/LEGO1/omni/include/mxobjectfactory.h index aed354c4..28301715 100644 --- a/LEGO1/omni/include/mxobjectfactory.h +++ b/LEGO1/omni/include/mxobjectfactory.h @@ -36,8 +36,8 @@ class MxObjectFactory : public MxCore { return !strcmp(p_name, MxObjectFactory::ClassName()) || MxCore::IsA(p_name); } - virtual MxCore* Create(const char* p_name); // vtable 0x14 - virtual void Destroy(MxCore* p_object); // vtable 0x18 + virtual MxCore* Create(const char* p_name); // vtable+0x14 + virtual void Destroy(MxCore* p_object); // vtable+0x18 // SYNTHETIC: LEGO1 0x100b1160 // MxObjectFactory::`scalar deleting destructor'