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
7 changed files with 37 additions and 27 deletions

View File

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

View File

@@ -211,7 +211,7 @@ done:
LegoExtraActor* actor = new LegoExtraActor();
actor->SetROI(character->m_roi, FALSE, FALSE);
actor->FUN_100114e0(0);
actor->SetType(LegoEntity::e_character);
actor->SetFlag(LegoActor::c_bit2);
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();
entity->SetROI(roi, FALSE, FALSE);
entity->FUN_100114e0(4);
entity->SetType(LegoEntity::e_unk4);
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++) {
if (!strcmpi(name, g_actorNames[i])) {
m_unk0x59 = 0;
m_type = e_character;
m_actorId = i;
break;
}

View File

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

View File

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