From 0f2aee1849ada7742231e717d380be5ed7706480 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 13 Mar 2024 14:03:30 -0400 Subject: [PATCH] Implement/match LegoPointOfViewController::SetEntity (#668) * Implement/match LegoPointOfViewController::SetEntity * Fix order --- LEGO1/lego/legoomni/include/legoentity.h | 3 ++ LEGO1/lego/legoomni/src/entity/legoentity.cpp | 18 ++++++++++++ .../legoomni/src/entity/legopovcontroller.cpp | 28 +++++++++++++++++-- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoentity.h b/LEGO1/lego/legoomni/include/legoentity.h index a3764eb0..4580405c 100644 --- a/LEGO1/lego/legoomni/include/legoentity.h +++ b/LEGO1/lego/legoomni/include/legoentity.h @@ -66,6 +66,9 @@ public: void FUN_10010c30(); void FUN_100114e0(MxU8 p_unk0x59); void SetLocation(const Vector3& p_location, const Vector3& p_direction, const Vector3& p_up, MxBool p_und); + Mx3DPointFloat GetEntitydDirection(); + Mx3DPointFloat GetEntityUp(); + Mx3DPointFloat GetEntityLocation(); inline LegoROI* GetROI() { return m_roi; } inline MxU8 GetFlags() { return m_flags; } diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index 5b8aff77..4bc066ee 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -184,6 +184,24 @@ void LegoEntity::FUN_10010c30() } } +// STUB: LEGO1 0x10010c60 +Mx3DPointFloat LegoEntity::GetEntitydDirection() +{ + return Mx3DPointFloat(0, 0, 0); +} + +// STUB: LEGO1 0x10010cf0 +Mx3DPointFloat LegoEntity::GetEntityUp() +{ + return Mx3DPointFloat(0, 0, 0); +} + +// STUB: LEGO1 0x10010d80 +Mx3DPointFloat LegoEntity::GetEntityLocation() +{ + return Mx3DPointFloat(0, 0, 0); +} + // FUNCTION: LEGO1 0x10010e10 void LegoEntity::ParseAction(char* p_extra) { diff --git a/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp index e155df3a..ea13fe00 100644 --- a/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp @@ -1,4 +1,5 @@ #include "3dmanager/lego3dview.h" +#include "legoentity.h" #include "legonavcontroller.h" #include "legoomni.h" #include "legopointofviewcontroller.h" @@ -185,8 +186,31 @@ MxResult LegoPointOfViewController::Tickle() return SUCCESS; } -// STUB: LEGO1 0x10065ae0 +// FUNCTION: LEGO1 0x10065ae0 void LegoPointOfViewController::SetEntity(LegoEntity* p_entity) { - // TODO + TickleManager()->UnregisterClient(this); + m_entity = p_entity; + + ViewROI* pov = m_lego3DView->GetPointOfView(); + + if (m_entity != NULL && pov != NULL) { + MxMatrix mat; + + CalcLocalTransform( + Mx3DPointFloat( + m_entity->GetEntityLocation()[0], + m_entity->GetEntityLocation()[1] + m_entityOffsetUp, + m_entity->GetEntityLocation()[2] + ), + m_entity->GetEntitydDirection(), + m_entity->GetEntityUp(), + mat + ); + + pov->WrappedSetLocalTransform(mat); + } + else { + TickleManager()->RegisterClient(this, 10); + } }