Implement/match LegoEntity::SetROI (#628)

This commit is contained in:
Christian Semmler 2024-03-05 13:35:28 -05:00 committed by GitHub
parent f6e44b1c1b
commit 3b2bd0e9d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 34 additions and 9 deletions

View file

@ -63,6 +63,7 @@ class LegoEntity : public MxEntity {
inline MxU8 GetFlags() { return m_flags; } inline MxU8 GetFlags() { return m_flags; }
inline void SetFlags(MxU8 p_flags) { m_flags = p_flags; } inline void SetFlags(MxU8 p_flags) { m_flags = p_flags; }
inline void SetFlag(MxU8 p_flag) { m_flags |= p_flag; }
inline void ClearFlag(MxU8 p_flag) { m_flags &= ~p_flag; } inline void ClearFlag(MxU8 p_flag) { m_flags &= ~p_flag; }
protected: protected:

View file

@ -52,7 +52,7 @@ void LegoEntity::Destroy(MxBool p_fromDestructor)
if (m_roi) { if (m_roi) {
if (m_flags & c_bit1) { if (m_flags & c_bit1) {
if (m_roi->GetUnknown0x104() == this) { if (m_roi->GetUnknown0x104() == this) {
m_roi->SetUnknown0x104(NULL); m_roi->SetEntity(NULL);
} }
UnkSaveDataWriter()->FUN_10083db0(m_roi); UnkSaveDataWriter()->FUN_10083db0(m_roi);
@ -76,10 +76,34 @@ void LegoEntity::SetWorld()
} }
} }
// STUB: LEGO1 0x100108a0 // FUNCTION: LEGO1 0x100108a0
void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
{ {
// TODO m_roi = p_roi;
if (m_roi != NULL) {
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()),
mat
);
m_roi->FUN_100a46b0(mat);
}
m_roi->SetEntity(this);
VideoManager()->Get3DManager()->GetLego3DView()->Moved(*m_roi);
if (p_bool1) {
ClearFlag(c_bit1);
}
else {
SetFlag(c_bit1);
}
}
} }
// STUB: LEGO1 0x100109b0 // STUB: LEGO1 0x100109b0

View file

@ -546,7 +546,7 @@ void LegoWorld::Enable(MxBool p_enable)
while (cursor.Next(entity)) { while (cursor.Next(entity)) {
if (entity->GetROI()) { if (entity->GetROI()) {
entity->GetROI()->SetUnknown0x104(entity); entity->GetROI()->SetEntity(entity);
GetViewManager()->Add(entity->GetROI()); GetViewManager()->Add(entity->GetROI());
} }
} }

View file

@ -73,7 +73,7 @@ LegoROI::LegoROI(Tgl::Renderer* p_renderer) : ViewROI(p_renderer, NULL)
{ {
m_unk0xd4 = NULL; m_unk0xd4 = NULL;
m_name = NULL; m_name = NULL;
m_unk0x104 = NULL; m_entity = NULL;
} }
// FUNCTION: LEGO1 0x100a82d0 // FUNCTION: LEGO1 0x100a82d0
@ -81,7 +81,7 @@ LegoROI::LegoROI(Tgl::Renderer* p_renderer, ViewLODList* p_lodList) : ViewROI(p_
{ {
m_unk0xd4 = NULL; m_unk0xd4 = NULL;
m_name = NULL; m_name = NULL;
m_unk0x104 = NULL; m_entity = NULL;
} }
// FUNCTION: LEGO1 0x100a83c0 // FUNCTION: LEGO1 0x100a83c0

View file

@ -76,9 +76,9 @@ class LegoROI : public ViewROI {
); );
inline const LegoChar* GetName() const { return m_name; } inline const LegoChar* GetName() const { return m_name; }
inline LegoEntity* GetUnknown0x104() { return m_unk0x104; } inline LegoEntity* GetUnknown0x104() { return m_entity; }
inline void SetUnknown0x104(LegoEntity* p_unk0x104) { m_unk0x104 = p_unk0x104; } inline void SetEntity(LegoEntity* p_entity) { m_entity = p_entity; }
// SYNTHETIC: LEGO1 0x100a82b0 // SYNTHETIC: LEGO1 0x100a82b0
// LegoROI::`scalar deleting destructor' // LegoROI::`scalar deleting destructor'
@ -87,7 +87,7 @@ class LegoROI : public ViewROI {
LegoChar* m_name; // 0xe4 LegoChar* m_name; // 0xe4
BoundingSphere m_sphere; // 0xe8 BoundingSphere m_sphere; // 0xe8
undefined m_unk0x100; // 0x100 undefined m_unk0x100; // 0x100
LegoEntity* m_unk0x104; // 0x104 LegoEntity* m_entity; // 0x104
}; };
// VTABLE: LEGO1 0x100dbea8 // VTABLE: LEGO1 0x100dbea8