Implement/match LegoEntity::SetLocation (#629)

* Implement/match LegoEntity::SetLocation

* Remove comment
This commit is contained in:
Christian Semmler
2024-03-05 14:31:57 -05:00
committed by GitHub
parent 3b2bd0e9d4
commit a93e2ae0d3
6 changed files with 57 additions and 23 deletions

View File

@@ -57,7 +57,7 @@ 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);
void SetLocation(const Vector3& p_location, const Vector3& p_direction, const Vector3& p_up, MxBool p_und);
inline LegoROI* GetROI() { return m_roi; }
inline MxU8 GetFlags() { return m_flags; }

View File

@@ -205,14 +205,14 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param)
}
if (m_world && m_world->GetCamera()) {
Mx3DPointFloat loc, dir, lookat;
loc.CopyFrom(m_world->GetCamera()->GetWorldLocation());
dir.CopyFrom(m_world->GetCamera()->GetWorldDirection());
loc = m_world->GetCamera()->GetWorldLocation();
dir = m_world->GetCamera()->GetWorldDirection();
lookat = dir;
float scale = 3;
lookat.Mul(scale);
lookat.Add(&loc);
Mx3DPointFloat v68, v7c, v90(0, 1, 0), va4;
v68.CopyFrom(m_world->GetCamera()->GetWorldUp());
v68 = m_world->GetCamera()->GetWorldUp();
va4.EqualsCross(v68, dir);
v7c.EqualsCross(va4, v90);
if (ret) {

View File

@@ -85,9 +85,9 @@ void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
if (p_bool2) {
MxMatrix mat;
CalcLocalTransform(
Mx3DPointFloat(m_worldLocation.GetX(), m_worldLocation.GetY(), m_worldLocation.GetZ()),
Mx3DPointFloat(m_worldDirection.GetX(), m_worldDirection.GetY(), m_worldDirection.GetZ()),
Mx3DPointFloat(m_worldUp.GetX(), m_worldUp.GetY(), m_worldUp.GetZ()),
Mx3DPointFloat(m_worldLocation[0], m_worldLocation[1], m_worldLocation[2]),
Mx3DPointFloat(m_worldDirection[0], m_worldDirection[1], m_worldDirection[2]),
Mx3DPointFloat(m_worldUp[0], m_worldUp[1], m_worldUp[2]),
mat
);
@@ -106,10 +106,38 @@ void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
}
}
// STUB: LEGO1 0x100109b0
void LegoEntity::SetLocation(const Vector3& p_location, const Vector3& p_direction, const Vector3& p_up, MxBool)
// FUNCTION: LEGO1 0x100109b0
void LegoEntity::SetLocation(const Vector3& p_location, const Vector3& p_direction, const Vector3& p_up, MxBool p_und)
{
// TODO
Mx3DPointFloat direction;
Mx3DPointFloat up;
direction = p_direction;
direction.Unitize();
up = p_up;
up.Unitize();
m_worldLocation = p_location;
m_worldDirection = direction;
m_worldUp = up;
if (m_roi != NULL) {
MxMatrix mat;
CalcLocalTransform(
Mx3DPointFloat(p_location[0], p_location[1], p_location[2]),
Mx3DPointFloat(direction[0], direction[1], direction[2]),
Mx3DPointFloat(up[0], up[1], up[2]),
mat
);
m_roi->FUN_100a46b0(mat);
VideoManager()->Get3DManager()->GetLego3DView()->Moved(*m_roi);
if (p_und) {
FUN_10010c30();
}
}
}
// FUNCTION: LEGO1 0x10010c30