Use enum in Helicopter

This commit is contained in:
Christian Semmler 2024-02-10 11:16:02 -05:00
parent c64979578d
commit 3e39833793

View File

@ -59,11 +59,13 @@ void Helicopter::GetState()
// FUNCTION: LEGO1 0x10003360 // FUNCTION: LEGO1 0x10003360
void Helicopter::VTable0xe4() void Helicopter::VTable0xe4()
{ {
if (!GameState()->GetCurrentAct()) { if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
VTable0xe8(0x28, TRUE, 7); VTable0xe8(0x28, TRUE, 7);
} }
IslePathActor::VTable0xe4(); IslePathActor::VTable0xe4();
if (!GameState()->GetCurrentAct()) {
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
GameState()->SetCurrentArea(0x3c); GameState()->SetCurrentArea(0x3c);
if (CurrentVehicle()) { if (CurrentVehicle()) {
if (CurrentVehicle()->IsA("IslePathActor")) { if (CurrentVehicle()->IsA("IslePathActor")) {
@ -71,6 +73,7 @@ void Helicopter::VTable0xe4()
} }
} }
} }
m_state->SetUnknown8(0); m_state->SetUnknown8(0);
FUN_1003ee00(m_script, 0x16); FUN_1003ee00(m_script, 0x16);
FUN_1003ee00(m_script, 0x17); FUN_1003ee00(m_script, 0x17);
@ -92,17 +95,21 @@ MxU32 Helicopter::VTable0xcc()
if (!FUN_1003ef60()) { if (!FUN_1003ef60()) {
return 1; return 1;
} }
if (!m_world) { if (!m_world) {
m_world = CurrentWorld(); m_world = CurrentWorld();
} }
AnimationManager()->FUN_1005f6d0(FALSE); AnimationManager()->FUN_1005f6d0(FALSE);
if (CurrentVehicle()) { if (CurrentVehicle()) {
if (CurrentVehicle()->VTable0x60() != GameState()->GetUnknownC()) { if (CurrentVehicle()->VTable0x60() != GameState()->GetUnknownC()) {
CurrentVehicle()->VTable0xe4(); CurrentVehicle()->VTable0xe4();
} }
} }
switch (GameState()->GetCurrentAct()) { switch (GameState()->GetCurrentAct()) {
case 0: case LegoGameState::e_act1:
m_script = *g_isleScript; m_script = *g_isleScript;
AnimationManager()->FUN_10064670(FALSE); AnimationManager()->FUN_10064670(FALSE);
VTable0xe8(0x29, TRUE, 7); VTable0xe8(0x29, TRUE, 7);
@ -112,13 +119,14 @@ MxU32 Helicopter::VTable0xcc()
SetUnknownDC(4); SetUnknownDC(4);
PlayMusic(JukeBox::e_jail); PlayMusic(JukeBox::e_jail);
break; break;
case 1: case LegoGameState::e_act2:
m_script = *g_act2mainScript; m_script = *g_act2mainScript;
break; break;
case 2: case LegoGameState::e_act3:
m_script = *g_act3Script; m_script = *g_act3Script;
break; break;
} }
VTable0xe0(); VTable0xe0();
InvokeAction(Extra::ActionType::e_start, m_script, 0x15, NULL); InvokeAction(Extra::ActionType::e_start, m_script, 0x15, NULL);
GetCurrentAction().SetObjectId(-1); GetCurrentAction().SetObjectId(-1);
@ -131,17 +139,19 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param)
{ {
MxU32 ret = 0; MxU32 ret = 0;
MxAtomId script; MxAtomId script;
switch (GameState()->GetCurrentAct()) { switch (GameState()->GetCurrentAct()) {
case 0: case LegoGameState::e_act1:
script = *g_isleScript; script = *g_isleScript;
break; break;
case 1: case LegoGameState::e_act2:
script = *g_act2mainScript; script = *g_act2mainScript;
break; break;
case 2: case LegoGameState::e_act3:
script = *g_act3Script; script = *g_act3Script;
break; break;
} }
if (p_param.GetUnknown0x28() == 1) { if (p_param.GetUnknown0x28() == 1) {
switch (p_param.GetClickedObjectId()) { switch (p_param.GetClickedObjectId()) {
case 0x17: case 0x17:
@ -217,7 +227,7 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param)
ret = 1; ret = 1;
break; break;
case 0x1c: case 0x1c:
if (GameState()->GetCurrentAct() == 0) { if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
((Isle*) CurrentWorld())->SetUnknown13c(2); ((Isle*) CurrentWorld())->SetUnknown13c(2);
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
VTable0xe4(); VTable0xe4();
@ -239,7 +249,7 @@ MxU32 Helicopter::VTable0xd8(MxType18NotificationParam& p_param)
switch (m_state->GetUnkown8()) { switch (m_state->GetUnkown8()) {
case 1: { case 1: {
if (GameState()->GetCurrentAct() == 0) { if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(4); ((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(4);
VTable0xe8(0x2a, TRUE, 7); VTable0xe8(0x2a, TRUE, 7);
} }
@ -276,7 +286,7 @@ MxU32 Helicopter::VTable0xd8(MxType18NotificationParam& p_param)
at[1] = 1.25; at[1] = 1.25;
m_world->GetCamera()->SetWorldTransform(at, dir, up); m_world->GetCamera()->SetWorldTransform(at, dir, up);
if (GameState()->GetCurrentAct() == 0) { if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(0); ((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(0);
VTable0xe8(0x29, TRUE, 7); VTable0xe8(0x29, TRUE, 7);
} }