Add enum for actor IDs (#993)

This commit is contained in:
Christian Semmler
2024-06-05 12:11:46 -04:00
committed by GitHub
parent 6e7e9a3f20
commit 6a9f68872b
10 changed files with 59 additions and 49 deletions

View File

@@ -10,6 +10,16 @@ class LegoCacheSound;
// SIZE 0x78 // SIZE 0x78
class LegoActor : public LegoEntity { class LegoActor : public LegoEntity {
public: public:
enum {
c_none = 0,
c_pepper,
c_mama,
c_papa,
c_nick,
c_laura,
c_brickster
};
LegoActor(); LegoActor();
~LegoActor() override; ~LegoActor() override;

View File

@@ -1496,7 +1496,7 @@ MxResult LegoAnimationManager::Tickle()
MxU8 unk0x0c = 0; MxU8 unk0x0c = 0;
MxU8 actorId = GameState()->GetActorId(); MxU8 actorId = GameState()->GetActorId();
if (actorId <= 5) { if (actorId <= LegoActor::c_laura) {
unk0x0c = g_unk0x100d8b28[actorId]; unk0x0c = g_unk0x100d8b28[actorId];
} }
@@ -1762,7 +1762,7 @@ MxBool LegoAnimationManager::FUN_10062710(AnimInfo& p_info)
MxU8 und = 0; MxU8 und = 0;
MxU8 actorId = GameState()->GetActorId(); MxU8 actorId = GameState()->GetActorId();
if (actorId <= 5) { if (actorId <= LegoActor::c_laura) {
und = g_unk0x100d8b28[actorId]; und = g_unk0x100d8b28[actorId];
} }
@@ -2712,11 +2712,11 @@ MxResult LegoAnimationManager::FUN_10064740(Vector3* p_position)
} }
if (success) { if (success) {
if (GameState()->GetActorId() != 2) { if (GameState()->GetActorId() != LegoActor::c_mama) {
FUN_10064380("mama", "USR00_47", 1, 0.43f, 3, 0.84f, rand() % 3 + 13, -1, rand() % 3, -1, 0.7f); FUN_10064380("mama", "USR00_47", 1, 0.43f, 3, 0.84f, rand() % 3 + 13, -1, rand() % 3, -1, 0.7f);
} }
if (GameState()->GetActorId() != 3) { if (GameState()->GetActorId() != LegoActor::c_papa) {
FUN_10064380("papa", "USR00_193", 3, 0.55f, 1, 0.4f, rand() % 3 + 13, -1, rand() % 3, -1, 0.9f); FUN_10064380("papa", "USR00_193", 3, 0.55f, 1, 0.4f, rand() % 3 + 13, -1, rand() % 3, -1, 0.9f);
} }

View File

@@ -346,25 +346,25 @@ MxLong LegoEntity::Notify(MxParam& p_param)
} }
else { else {
switch (GameState()->GetActorId()) { switch (GameState()->GetActorId()) {
case 1: case LegoActor::c_pepper:
if (GameState()->GetCurrentAct() != LegoGameState::e_act2 && if (GameState()->GetCurrentAct() != LegoGameState::e_act2 &&
GameState()->GetCurrentAct() != LegoGameState::e_act3) { GameState()->GetCurrentAct() != LegoGameState::e_act3) {
VTable0x3c(); VTable0x3c();
} }
break; break;
case 2: case LegoActor::c_mama:
VTable0x40(); VTable0x40();
break; break;
case 3: case LegoActor::c_papa:
VTable0x44(); VTable0x44();
break; break;
case 4: case LegoActor::c_nick:
VTable0x48(param.GetROI()); VTable0x48(param.GetROI());
break; break;
case 5: case LegoActor::c_laura:
VTable0x4c(); VTable0x4c();
break; break;
case 6: case LegoActor::c_brickster:
switch (m_type) { switch (m_type) {
case e_actor: case e_actor:
case e_unk1: case e_unk1:

View File

@@ -675,24 +675,24 @@ MxResult LegoPathActor::VTable0x9c()
void LegoPathActor::VTable0xa4(MxBool& p_und1, MxS32& p_und2) void LegoPathActor::VTable0xa4(MxBool& p_und1, MxS32& p_und2)
{ {
switch (GetActorId()) { switch (GetActorId()) {
case 1: case c_pepper:
p_und1 = TRUE; p_und1 = TRUE;
p_und2 = 2; p_und2 = 2;
break; break;
case 2: case c_mama:
p_und1 = FALSE; p_und1 = FALSE;
p_und2 = 1; p_und2 = 1;
break; break;
case 3: case c_papa:
p_und1 = TRUE; p_und1 = TRUE;
p_und2 = 1; p_und2 = 1;
break; break;
case 4: case c_nick:
case 6: case c_brickster:
p_und1 = TRUE; p_und1 = TRUE;
p_und2 = rand() % p_und2 + 1; p_und2 = rand() % p_und2 + 1;
break; break;
case 5: case c_laura:
p_und1 = FALSE; p_und1 = FALSE;
p_und2 = 2; p_und2 = 2;
break; break;

View File

@@ -31,7 +31,7 @@ MxBool g_trackLedEnabled = FALSE;
// FUNCTION: LEGO1 0x100046a0 // FUNCTION: LEGO1 0x100046a0
GasStation::GasStation() GasStation::GasStation()
{ {
m_currentActorId = 0; m_currentActorId = LegoActor::c_none;
m_state = NULL; m_state = NULL;
m_destLocation = LegoGameState::e_undefined; m_destLocation = LegoGameState::e_undefined;
m_trackLedBitmap = NULL; m_trackLedBitmap = NULL;
@@ -134,7 +134,7 @@ void GasStation::ReadyWorld()
m_currentActorId = CurrentActor()->GetActorId(); m_currentActorId = CurrentActor()->GetActorId();
switch (m_currentActorId) { switch (m_currentActorId) {
case 1: case LegoActor::c_pepper:
switch (m_state->m_unk0x18) { switch (m_state->m_unk0x18) {
case 0: case 0:
m_state->m_unk0x14.m_unk0x00 = 5; m_state->m_unk0x14.m_unk0x00 = 5;
@@ -165,7 +165,7 @@ void GasStation::ReadyWorld()
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
break; break;
case 2: case LegoActor::c_mama:
switch (m_state->m_unk0x1a) { switch (m_state->m_unk0x1a) {
case 0: case 0:
m_state->m_unk0x14.m_unk0x00 = 5; m_state->m_unk0x14.m_unk0x00 = 5;
@@ -191,7 +191,7 @@ void GasStation::ReadyWorld()
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
break; break;
case 3: case LegoActor::c_papa:
switch (m_state->m_unk0x1c) { switch (m_state->m_unk0x1c) {
case 0: case 0:
m_state->m_unk0x14.m_unk0x00 = 5; m_state->m_unk0x14.m_unk0x00 = 5;
@@ -217,7 +217,7 @@ void GasStation::ReadyWorld()
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
break; break;
case 4: case LegoActor::c_nick:
switch (m_state->m_unk0x1e) { switch (m_state->m_unk0x1e) {
case 0: case 0:
m_state->m_unk0x14.m_unk0x00 = 5; m_state->m_unk0x14.m_unk0x00 = 5;
@@ -243,7 +243,7 @@ void GasStation::ReadyWorld()
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
break; break;
case 5: case LegoActor::c_laura:
switch (m_state->m_unk0x20) { switch (m_state->m_unk0x20) {
case 0: case 0:
m_state->m_unk0x14.m_unk0x00 = 5; m_state->m_unk0x14.m_unk0x00 = 5;

View File

@@ -35,7 +35,7 @@ MxBool g_pizzaLedEnabled = FALSE;
// FUNCTION: LEGO1 0x100745e0 // FUNCTION: LEGO1 0x100745e0
Hospital::Hospital() Hospital::Hospital()
{ {
m_currentActorId = 0; m_currentActorId = LegoActor::c_none;
m_unk0x100 = 0; m_unk0x100 = 0;
m_hospitalState = NULL; m_hospitalState = NULL;
m_unk0x108 = 0; m_unk0x108 = 0;
@@ -145,14 +145,14 @@ void Hospital::ReadyWorld()
m_pizzaLedBitmap = (MxStillPresenter*) Find("MxStillPresenter", "PizzaLed_Bitmap"); m_pizzaLedBitmap = (MxStillPresenter*) Find("MxStillPresenter", "PizzaLed_Bitmap");
if (CurrentActor() == NULL) { if (CurrentActor() == NULL) {
m_currentActorId = 5; m_currentActorId = LegoActor::c_laura;
} }
else { else {
m_currentActorId = CurrentActor()->GetActorId(); m_currentActorId = CurrentActor()->GetActorId();
} }
switch (m_currentActorId) { switch (m_currentActorId) {
case 1: case LegoActor::c_pepper:
m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x0e; m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x0e;
if (m_hospitalState->m_unk0x0e < 5) { if (m_hospitalState->m_unk0x0e < 5) {
@@ -160,7 +160,7 @@ void Hospital::ReadyWorld()
} }
break; break;
case 2: case LegoActor::c_mama:
m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x10; m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x10;
if (m_hospitalState->m_unk0x10 < 5) { if (m_hospitalState->m_unk0x10 < 5) {
@@ -168,7 +168,7 @@ void Hospital::ReadyWorld()
} }
break; break;
case 3: case LegoActor::c_papa:
m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x12; m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x12;
if (m_hospitalState->m_unk0x12 < 5) { if (m_hospitalState->m_unk0x12 < 5) {
@@ -176,7 +176,7 @@ void Hospital::ReadyWorld()
} }
break; break;
case 4: case LegoActor::c_nick:
m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x14; m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x14;
if (m_hospitalState->m_unk0x14 < 5) { if (m_hospitalState->m_unk0x14 < 5) {
@@ -184,7 +184,7 @@ void Hospital::ReadyWorld()
} }
break; break;
case 5: case LegoActor::c_laura:
m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x16; m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x16;
if (m_hospitalState->m_unk0x16 < 5) { if (m_hospitalState->m_unk0x16 < 5) {
@@ -269,7 +269,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param)
break; break;
case 11: case 11:
switch (m_currentActorId) { switch (m_currentActorId) {
case 1: case LegoActor::c_pepper:
switch (m_hospitalState->m_unk0x0e) { switch (m_hospitalState->m_unk0x0e) {
case 0: case 0:
case 1: case 1:
@@ -288,7 +288,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param)
break; break;
} }
break; break;
case 2: case LegoActor::c_mama:
switch (m_hospitalState->m_unk0x10) { switch (m_hospitalState->m_unk0x10) {
case 0: case 0:
case 1: case 1:
@@ -307,7 +307,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param)
break; break;
} }
break; break;
case 3: case LegoActor::c_papa:
switch (m_hospitalState->m_unk0x12) { switch (m_hospitalState->m_unk0x12) {
case 0: case 0:
case 1: case 1:
@@ -326,7 +326,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param)
break; break;
} }
break; break;
case 4: case LegoActor::c_nick:
switch (m_hospitalState->m_unk0x14) { switch (m_hospitalState->m_unk0x14) {
case 0: case 0:
case 1: case 1:
@@ -345,7 +345,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param)
break; break;
} }
break; break;
case 5: case LegoActor::c_laura:
switch (m_hospitalState->m_unk0x16) { switch (m_hospitalState->m_unk0x16) {
case 0: case 0:
case 1: case 1:
@@ -438,7 +438,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param)
} }
else { else {
switch (m_currentActorId) { switch (m_currentActorId) {
case 1: case LegoActor::c_pepper:
switch (m_hospitalState->m_unk0x0e) { switch (m_hospitalState->m_unk0x0e) {
case 0: case 0:
case 1: case 1:
@@ -457,7 +457,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param)
break; break;
} }
break; break;
case 2: case LegoActor::c_mama:
switch (m_hospitalState->m_unk0x10) { switch (m_hospitalState->m_unk0x10) {
case 0: case 0:
case 1: case 1:
@@ -476,7 +476,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param)
break; break;
} }
break; break;
case 3: case LegoActor::c_papa:
switch (m_hospitalState->m_unk0x12) { switch (m_hospitalState->m_unk0x12) {
case 0: case 0:
case 1: case 1:
@@ -495,7 +495,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param)
break; break;
} }
break; break;
case 4: case LegoActor::c_nick:
switch (m_hospitalState->m_unk0x14) { switch (m_hospitalState->m_unk0x14) {
case 0: case 0:
case 1: case 1:
@@ -514,7 +514,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param)
break; break;
} }
break; break;
case 5: case LegoActor::c_laura:
switch (m_hospitalState->m_unk0x16) { switch (m_hospitalState->m_unk0x16) {
case 0: case 0:
case 1: case 1:

View File

@@ -1047,7 +1047,7 @@ MxU8 Infocenter::HandleControl(LegoControlManagerEvent& p_param)
InputManager()->SetUnknown336(TRUE); InputManager()->SetUnknown336(TRUE);
break; break;
case LegoGameState::e_unk4: case LegoGameState::e_unk4:
if (state->GetActorId()) { if (state->GetActorId() != LegoActor::c_none) {
if (m_infocenterState->HasRegistered()) { if (m_infocenterState->HasRegistered()) {
m_infocenterState->SetUnknown0x74(5); m_infocenterState->SetUnknown0x74(5);
m_destLocation = state->GetPreviousArea(); m_destLocation = state->GetPreviousArea();
@@ -1336,23 +1336,23 @@ void Infocenter::UpdateFrameHot(MxBool p_display)
MxS32 x, y; MxS32 x, y;
switch (GameState()->GetActorId()) { switch (GameState()->GetActorId()) {
case 1: case LegoActor::c_pepper:
x = 302; x = 302;
y = 81; y = 81;
break; break;
case 2: case LegoActor::c_mama:
x = 204; x = 204;
y = 81; y = 81;
break; break;
case 3: case LegoActor::c_papa:
x = 253; x = 253;
y = 81; y = 81;
break; break;
case 4: case LegoActor::c_nick:
x = 353; x = 353;
y = 81; y = 81;
break; break;
case 5: case LegoActor::c_laura:
x = 399; x = 399;
y = 81; y = 81;
break; break;

View File

@@ -114,7 +114,7 @@ MxLong InfocenterDoor::HandleControl(LegoControlManagerEvent& p_param)
result = 1; result = 1;
break; break;
case InfodoorScript::c_Door_Ctl: case InfodoorScript::c_Door_Ctl:
if (GameState()->GetActorId()) { if (GameState()->GetActorId() != LegoActor::c_none) {
InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState"); InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
if (state->HasRegistered()) { if (state->HasRegistered()) {
m_destLocation = LegoGameState::e_unk4; m_destLocation = LegoGameState::e_unk4;

View File

@@ -544,7 +544,7 @@ void Isle::Enable(MxBool p_enable)
VideoManager()->ResetPalette(FALSE); VideoManager()->ResetPalette(FALSE);
m_act1state->FUN_10034d00(); m_act1state->FUN_10034d00();
if (CurrentActor() != NULL && CurrentActor()->GetActorId() != 0) { if (CurrentActor() != NULL && CurrentActor()->GetActorId() != LegoActor::c_none) {
// TODO: Match, most likely an inline function // TODO: Match, most likely an inline function
MxS32 targetEntityId = (CurrentActor()->GetActorId() == 1) + 250; MxS32 targetEntityId = (CurrentActor()->GetActorId() == 1) + 250;

View File

@@ -231,11 +231,11 @@ void PoliceState::FUN_1005ea40()
} }
switch (CurrentActor()->GetActorId()) { switch (CurrentActor()->GetActorId()) {
case 4: case LegoActor::c_nick:
policeScript = PoliceScript::c_nps002la_RunAnim; policeScript = PoliceScript::c_nps002la_RunAnim;
m_policeScript = policeScript; m_policeScript = policeScript;
break; break;
case 5: case LegoActor::c_laura:
policeScript = PoliceScript::c_nps001ni_RunAnim; policeScript = PoliceScript::c_nps001ni_RunAnim;
m_policeScript = policeScript; m_policeScript = policeScript;
break; break;