Implement/match LegoEntity::VTable0x34 (#633)

* Implement/match LegoEntity::VTable0x34

* Change parameter name

* Fix order
This commit is contained in:
Christian Semmler
2024-03-06 14:12:20 -05:00
committed by GitHub
parent 71bcd4c771
commit a12146f52f
10 changed files with 76 additions and 14 deletions

View File

@@ -5,6 +5,8 @@
#include "misc/legostorage.h" #include "misc/legostorage.h"
#include "mxcore.h" #include "mxcore.h"
class LegoROI;
// VTABLE: LEGO1 0x100d6f50 // VTABLE: LEGO1 0x100d6f50
// SIZE 0x30 // SIZE 0x30
class LegoBuildingManager : public MxCore { class LegoBuildingManager : public MxCore {
@@ -29,6 +31,7 @@ public:
void FUN_1002fb30(); void FUN_1002fb30();
MxResult Save(LegoStorage* p_storage); MxResult Save(LegoStorage* p_storage);
MxResult Load(LegoStorage* p_storage); MxResult Load(LegoStorage* p_storage);
MxU32 FUN_1002ff40(LegoROI*, MxBool);
void FUN_10030590(); void FUN_10030590();
// SYNTHETIC: LEGO1 0x1002f940 // SYNTHETIC: LEGO1 0x1002f940

View File

@@ -17,6 +17,10 @@ public:
c_bit2 = 0x02 c_bit2 = 0x02
}; };
enum {
c_altBit1 = 0x01
};
inline LegoEntity() { Init(); } inline LegoEntity() { Init(); }
// FUNCTION: LEGO1 0x1000c290 // FUNCTION: LEGO1 0x1000c290
@@ -51,13 +55,13 @@ public:
// FUNCTION: LEGO1 0x10001090 // FUNCTION: LEGO1 0x10001090
virtual void SetWorldSpeed(MxFloat p_worldSpeed) { m_worldSpeed = p_worldSpeed; } // vtable+0x30 virtual void SetWorldSpeed(MxFloat p_worldSpeed) { m_worldSpeed = p_worldSpeed; } // vtable+0x30
virtual void VTable0x34(); // vtable+0x34 virtual void VTable0x34(MxBool p_und); // vtable+0x34
virtual void VTable0x38(); // vtable+0x38 virtual void VTable0x38(); // vtable+0x38
virtual void VTable0x3c(); // vtable+0x3c virtual void VTable0x3c(); // vtable+0x3c
virtual void VTable0x40(); // vtable+0x40 virtual void VTable0x40(); // vtable+0x40
virtual void VTable0x44(); // vtable+0x44 virtual void VTable0x44(); // vtable+0x44
virtual void VTable0x48(); // vtable+0x48 virtual void VTable0x48(); // vtable+0x48
virtual void VTable0x4c(); // vtable+0x4c virtual void VTable0x4c(); // vtable+0x4c
void FUN_10010c30(); void FUN_10010c30();
void FUN_100114e0(MxU8 p_unk0x59); void FUN_100114e0(MxU8 p_unk0x59);
@@ -65,6 +69,7 @@ public:
inline LegoROI* GetROI() { return m_roi; } inline LegoROI* GetROI() { return m_roi; }
inline MxU8 GetFlags() { return m_flags; } inline MxU8 GetFlags() { return m_flags; }
inline MxBool GetUnknown0x10IsSet(MxU8 p_flag) { return m_unk0x10 & p_flag; }
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 SetFlag(MxU8 p_flag) { m_flags |= p_flag; }
@@ -74,7 +79,7 @@ protected:
void Init(); void Init();
void SetWorld(); void SetWorld();
undefined m_unk0x10; // 0x10 MxU8 m_unk0x10; // 0x10
MxU8 m_flags; // 0x11 MxU8 m_flags; // 0x11
Mx3DPointFloat m_worldLocation; // 0x14 Mx3DPointFloat m_worldLocation; // 0x14
Mx3DPointFloat m_worldDirection; // 0x28 Mx3DPointFloat m_worldDirection; // 0x28

View File

@@ -5,6 +5,8 @@
#include "misc/legostorage.h" #include "misc/legostorage.h"
#include "mxcore.h" #include "mxcore.h"
class LegoROI;
// VTABLE: LEGO1 0x100d6758 // VTABLE: LEGO1 0x100d6758
// SIZE 0x2c // SIZE 0x2c
class LegoPlantManager : public MxCore { class LegoPlantManager : public MxCore {
@@ -26,6 +28,7 @@ public:
void FUN_100263a0(undefined4 p_und); void FUN_100263a0(undefined4 p_und);
void Save(LegoStorage* p_storage); void Save(LegoStorage* p_storage);
MxResult Load(LegoStorage* p_storage); MxResult Load(LegoStorage* p_storage);
MxU32 FUN_10026ba0(LegoROI*, MxBool);
void FUN_10027120(); void FUN_10027120();
static void SetCustomizeAnimFile(const char* p_value); static void SetCustomizeAnimFile(const char* p_value);

View File

@@ -66,9 +66,12 @@ public:
void FUN_100832a0(); void FUN_100832a0();
void FUN_10083db0(LegoROI* p_roi); void FUN_10083db0(LegoROI* p_roi);
void FUN_10083f10(LegoROI* p_roi); void FUN_10083f10(LegoROI* p_roi);
MxU32 FUN_10085140(LegoROI*, MxBool);
LegoROI* FUN_10085210(const LegoChar*, LegoChar*, undefined); LegoROI* FUN_10085210(const LegoChar*, LegoChar*, undefined);
LegoROI* FUN_10085a80(LegoChar* p_und1, LegoChar* p_und2, undefined p_und3); LegoROI* FUN_10085a80(LegoChar* p_und1, LegoChar* p_und2, undefined p_und3);
static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; }
private: private:
static char* g_customizeAnimFile; static char* g_customizeAnimFile;

View File

@@ -56,6 +56,13 @@ MxResult LegoBuildingManager::Load(LegoStorage* p_storage)
return SUCCESS; return SUCCESS;
} }
// STUB: LEGO1 0x1002ff40
MxU32 LegoBuildingManager::FUN_1002ff40(LegoROI*, MxBool)
{
// TODO
return 0;
}
// FUNCTION: LEGO1 0x1002ff90 // FUNCTION: LEGO1 0x1002ff90
void LegoBuildingManager::SetCustomizeAnimFile(const char* p_value) void LegoBuildingManager::SetCustomizeAnimFile(const char* p_value)
{ {

View File

@@ -47,6 +47,13 @@ MxResult LegoPlantManager::Load(LegoStorage* p_storage)
return SUCCESS; return SUCCESS;
} }
// STUB: LEGO1 0x10026ba0
MxU32 LegoPlantManager::FUN_10026ba0(LegoROI*, MxBool)
{
// TODO
return 0;
}
// FUNCTION: LEGO1 0x10026be0 // FUNCTION: LEGO1 0x10026be0
void LegoPlantManager::SetCustomizeAnimFile(const char* p_value) void LegoPlantManager::SetCustomizeAnimFile(const char* p_value)
{ {

View File

@@ -123,6 +123,13 @@ MxBool LegoUnkSaveDataWriter::FUN_10084c00(const LegoChar*)
return FALSE; return FALSE;
} }
// STUB: LEGO1 0x10085140
MxU32 LegoUnkSaveDataWriter::FUN_10085140(LegoROI*, MxBool)
{
// TODO
return 0;
}
// FUNCTION: LEGO1 0x100851a0 // FUNCTION: LEGO1 0x100851a0
void LegoUnkSaveDataWriter::SetCustomizeAnimFile(const char* p_value) void LegoUnkSaveDataWriter::SetCustomizeAnimFile(const char* p_value)
{ {

View File

@@ -1,7 +1,9 @@
#include "legoentity.h" #include "legoentity.h"
#include "define.h" #include "define.h"
#include "legobuildingmanager.h"
#include "legoomni.h" #include "legoomni.h"
#include "legoplantmanager.h"
#include "legounksavedatawriter.h" #include "legounksavedatawriter.h"
#include "legoutil.h" #include "legoutil.h"
#include "legovideomanager.h" #include "legovideomanager.h"
@@ -80,7 +82,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->GetEntity() == this) {
m_roi->SetEntity(NULL); m_roi->SetEntity(NULL);
} }
@@ -203,10 +205,35 @@ void LegoEntity::ParseAction(char* p_extra)
} }
} }
// STUB: LEGO1 0x10010f10 // FUNCTION: LEGO1 0x10010f10
void LegoEntity::VTable0x34() void LegoEntity::VTable0x34(MxBool p_und)
{ {
// TODO if (!GetUnknown0x10IsSet(c_altBit1)) {
MxU32 objectId = 0;
const LegoChar* roiName = m_roi->GetName();
switch (m_unk0x59) {
case 0:
objectId = UnkSaveDataWriter()->FUN_10085140(m_roi, p_und);
break;
case 1:
break;
case 2:
objectId = PlantManager()->FUN_10026ba0(m_roi, p_und);
break;
case 3:
objectId = BuildingManager()->FUN_1002ff40(m_roi, p_und);
break;
}
if (objectId) {
MxDSAction action;
action.SetAtomId(MxAtomId(UnkSaveDataWriter()->GetCustomizeAnimFile(), e_lowerCase2));
action.SetObjectId(objectId);
action.AppendData(strlen(roiName) + 1, roiName);
Start(&action);
}
}
} }
// STUB: LEGO1 0x10011070 // STUB: LEGO1 0x10011070

View File

@@ -392,7 +392,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
roi = (LegoROI*) oroi; roi = (LegoROI*) oroi;
} }
LegoEntity* entity = roi->GetUnknown0x104(); LegoEntity* entity = roi->GetEntity();
if (entity && entity->Notify(p_param) != 0) { if (entity && entity->Notify(p_param) != 0) {
return TRUE; return TRUE;
} }

View File

@@ -76,7 +76,7 @@ public:
); );
inline const LegoChar* GetName() const { return m_name; } inline const LegoChar* GetName() const { return m_name; }
inline LegoEntity* GetUnknown0x104() { return m_entity; } inline LegoEntity* GetEntity() { return m_entity; }
inline void SetEntity(LegoEntity* p_entity) { m_entity = p_entity; } inline void SetEntity(LegoEntity* p_entity) { m_entity = p_entity; }