Define LegoEntity::Type enum (#854)

* Define LegoEntity::Type enum

* Use enum constant
This commit is contained in:
Christian Semmler 2024-04-26 10:03:13 -04:00 committed by GitHub
parent a9d67e4dd7
commit 180a1e6360
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 37 additions and 27 deletions

View file

@ -12,6 +12,14 @@
// SIZE 0x68 // SIZE 0x68
class LegoEntity : public MxEntity { class LegoEntity : public MxEntity {
public: public:
enum Type {
e_character = 0,
e_unk1,
e_plant,
e_building,
e_unk4
};
enum { enum {
c_bit1 = 0x01, c_bit1 = 0x01,
c_bit2 = 0x02 c_bit2 = 0x02
@ -64,7 +72,7 @@ class LegoEntity : public MxEntity {
virtual void VTable0x4c(); // vtable+0x4c virtual void VTable0x4c(); // vtable+0x4c
void FUN_10010c30(); void FUN_10010c30();
void FUN_100114e0(MxU8 p_unk0x59); void SetType(MxU8 p_type);
void SetLocation(const Vector3& p_location, const Vector3& p_direction, const Vector3& p_up, MxBool p_und); void SetLocation(const Vector3& p_location, const Vector3& p_direction, const Vector3& p_up, MxBool p_und);
Mx3DPointFloat GetWorldDirection(); Mx3DPointFloat GetWorldDirection();
Mx3DPointFloat GetWorldUp(); Mx3DPointFloat GetWorldUp();
@ -75,7 +83,7 @@ class LegoEntity : public MxEntity {
inline MxU8 GetFlags() { return m_flags; } inline MxU8 GetFlags() { return m_flags; }
inline MxFloat GetWorldSpeed() { return m_worldSpeed; } inline MxFloat GetWorldSpeed() { return m_worldSpeed; }
inline LegoROI* GetROI() { return m_roi; } inline LegoROI* GetROI() { return m_roi; }
inline MxU8 GetUnknown0x59() { return m_unk0x59; } inline MxU8 GetType() { return m_type; }
inline MxBool GetCameraFlag() { return m_cameraFlag; } inline MxBool GetCameraFlag() { return m_cameraFlag; }
inline void SetFlags(MxU8 p_flags) { m_flags = p_flags; } inline void SetFlags(MxU8 p_flags) { m_flags = p_flags; }
@ -96,7 +104,7 @@ class LegoEntity : public MxEntity {
MxFloat m_worldSpeed; // 0x50 MxFloat m_worldSpeed; // 0x50
LegoROI* m_roi; // 0x54 LegoROI* m_roi; // 0x54
MxBool m_cameraFlag; // 0x58 MxBool m_cameraFlag; // 0x58
MxU8 m_unk0x59; // 0x59 MxU8 m_type; // 0x59
// For tokens from the extra string that look like this: // For tokens from the extra string that look like this:
// "Action:openram;\lego\scripts\Race\CarRaceR;0" // "Action:openram;\lego\scripts\Race\CarRaceR;0"
Extra::ActionType m_actionType; // 0x5c Extra::ActionType m_actionType; // 0x5c

View file

@ -165,7 +165,7 @@ class LegoGameState {
inline Area GetUnknown0x42c() { return m_unk0x42c; } inline Area GetUnknown0x42c() { return m_unk0x42c; }
inline History* GetHistory() { return &m_history; } inline History* GetHistory() { return &m_history; }
inline void SetDirty(MxBool p_dirty) { m_isDirty = p_dirty; } inline void SetDirty(MxBool p_isDirty) { m_isDirty = p_isDirty; }
inline void SetCurrentArea(Area p_currentArea) { m_currentArea = p_currentArea; } inline void SetCurrentArea(Area p_currentArea) { m_currentArea = p_currentArea; }
inline void SetPreviousArea(Area p_previousArea) { m_previousArea = p_previousArea; } inline void SetPreviousArea(Area p_previousArea) { m_previousArea = p_previousArea; }
inline void SetActorId(MxU8 p_actorId) { m_actorId = p_actorId; } inline void SetActorId(MxU8 p_actorId) { m_actorId = p_actorId; }

View file

@ -502,7 +502,7 @@ MxResult LegoAnimationManager::StartEntityAction(MxDSAction& p_dsAction, LegoEnt
MxResult result = FAILURE; MxResult result = FAILURE;
LegoROI* roi = p_entity->GetROI(); LegoROI* roi = p_entity->GetROI();
if (p_entity->GetUnknown0x59() == 0) { if (p_entity->GetType() == LegoEntity::e_character) {
LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName());
if (actor) { if (actor) {

View file

@ -211,7 +211,7 @@ LegoROI* LegoCharacterManager::GetROI(const char* p_key, MxBool p_createEntity)
LegoExtraActor* actor = new LegoExtraActor(); LegoExtraActor* actor = new LegoExtraActor();
actor->SetROI(character->m_roi, FALSE, FALSE); actor->SetROI(character->m_roi, FALSE, FALSE);
actor->FUN_100114e0(0); actor->SetType(LegoEntity::e_character);
actor->SetFlag(LegoActor::c_bit2); actor->SetFlag(LegoActor::c_bit2);
GetData(p_key)->m_actor = actor; GetData(p_key)->m_actor = actor;
} }
@ -783,7 +783,7 @@ LegoROI* LegoCharacterManager::FUN_10085210(const char* p_name, const char* p_lo
LegoEntity* entity = new LegoEntity(); LegoEntity* entity = new LegoEntity();
entity->SetROI(roi, FALSE, FALSE); entity->SetROI(roi, FALSE, FALSE);
entity->FUN_100114e0(4); entity->SetType(LegoEntity::e_unk4);
entity->SetFlag(LegoActor::c_bit2); entity->SetFlag(LegoActor::c_bit2);
} }
} }

View file

@ -127,7 +127,7 @@ void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
for (MxU32 i = 1; i <= _countof(g_actorNames) - 1; i++) { for (MxU32 i = 1; i <= _countof(g_actorNames) - 1; i++) {
if (!strcmpi(name, g_actorNames[i])) { if (!strcmpi(name, g_actorNames[i])) {
m_unk0x59 = 0; m_type = e_character;
m_actorId = i; m_actorId = i;
break; break;
} }

View file

@ -27,7 +27,7 @@ void LegoEntity::Init()
m_flags = 0; m_flags = 0;
m_actionType = Extra::ActionType::e_unknown; m_actionType = Extra::ActionType::e_unknown;
m_targetEntityId = -1; m_targetEntityId = -1;
m_unk0x59 = 4; m_type = e_unk4;
} }
// FUNCTION: LEGO1 0x10010650 // FUNCTION: LEGO1 0x10010650
@ -247,16 +247,16 @@ void LegoEntity::VTable0x34(MxBool p_und)
MxU32 objectId = 0; MxU32 objectId = 0;
const LegoChar* roiName = m_roi->GetName(); const LegoChar* roiName = m_roi->GetName();
switch (m_unk0x59) { switch (m_type) {
case 0: case e_character:
objectId = CharacterManager()->FUN_10085140(m_roi, p_und); objectId = CharacterManager()->FUN_10085140(m_roi, p_und);
break; break;
case 1: case e_unk1:
break; break;
case 2: case e_plant:
objectId = PlantManager()->FUN_10026ba0(this, p_und); objectId = PlantManager()->FUN_10026ba0(this, p_und);
break; break;
case 3: case e_building:
objectId = BuildingManager()->FUN_1002ff40(this, p_und); objectId = BuildingManager()->FUN_1002ff40(this, p_und);
break; break;
} }
@ -280,14 +280,16 @@ void LegoEntity::VTable0x38()
// FUNCTION: LEGO1 0x10011300 // FUNCTION: LEGO1 0x10011300
void LegoEntity::VTable0x3c() void LegoEntity::VTable0x3c()
{ {
switch (m_unk0x59) { switch (m_type) {
case 0: case e_character:
CharacterManager()->SwitchHat(m_roi); CharacterManager()->SwitchHat(m_roi);
break; break;
case 2: case e_unk1:
break;
case e_plant:
PlantManager()->FUN_100269e0(this); PlantManager()->FUN_100269e0(this);
break; break;
case 3: case e_building:
BuildingManager()->FUN_1002fdb0(this); BuildingManager()->FUN_1002fdb0(this);
break; break;
} }
@ -321,9 +323,9 @@ void LegoEntity::VTable0x4c()
} }
// FUNCTION: LEGO1 0x100114e0 // FUNCTION: LEGO1 0x100114e0
void LegoEntity::FUN_100114e0(MxU8 p_unk0x59) void LegoEntity::SetType(MxU8 p_type)
{ {
m_unk0x59 = p_unk0x59; m_type = p_type;
} }
// FUNCTION: LEGO1 0x100114f0 // FUNCTION: LEGO1 0x100114f0
@ -359,17 +361,17 @@ MxLong LegoEntity::Notify(MxParam& p_param)
VTable0x4c(); VTable0x4c();
break; break;
case 6: case 6:
switch (m_unk0x59) { switch (m_type) {
case 0: case e_character:
case 1: case e_unk1:
break; break;
case 2: case e_plant:
PlantManager()->FUN_10026c50(this); PlantManager()->FUN_10026c50(this);
break; break;
case 3: case e_building:
BuildingManager()->FUN_10030000(this); BuildingManager()->FUN_10030000(this);
break; break;
case 4: case e_unk4:
break; break;
} }
} }

View file

@ -256,7 +256,7 @@ void LegoModelPresenter::ReadyTickle()
->SetFlags( ->SetFlags(
((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->GetFlags() & ~LegoEntity::c_bit2 ((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->GetFlags() & ~LegoEntity::c_bit2
); );
((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->FUN_100114e0(0); ((LegoEntityPresenter*) m_compositePresenter)->GetInternalEntity()->SetType(LegoEntity::e_character);
} }
ParseExtra(); ParseExtra();