Implement/match LegoEntity::SetWorldTransform and ResetWorldTransform (#632)

* Implement/match LegoEntity::SetWorldTransform and ResetWorldTransform

* Add param name
This commit is contained in:
Christian Semmler 2024-03-06 13:25:45 -05:00 committed by GitHub
parent 8ecae549df
commit 71bcd4c771
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 50 additions and 16 deletions

View file

@ -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

View file

@ -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'

View file

@ -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);
}

View file

@ -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'