Clear unknowns in LegoAct2 (#1679)

This commit is contained in:
Fabian Neundorf
2025-09-07 22:54:22 +02:00
committed by GitHub
parent 48febaf5c5
commit e3b77fb50b
3 changed files with 211 additions and 193 deletions

View File

@@ -80,10 +80,10 @@ public:
void SetUnknown0x1138(Act2Actor* p_unk0x1138) { m_unk0x1138 = p_unk0x1138; }
void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; }
MxResult FUN_100516b0();
MxResult CreateBrick();
void FUN_100517b0();
MxResult BadEnding();
MxResult FUN_10052560(
MxResult StartAction(
Act2mainScript::Script p_objectId,
MxBool p_param2,
MxBool p_param3,
@@ -96,48 +96,65 @@ public:
// LegoAct2::`scalar deleting destructor'
private:
enum {
e_initial = 0,
e_startSpeech = 1,
e_holdingSpeech = 2,
e_startDescription = 3,
e_explaining = 4,
e_goingToResidentialArea = 5,
e_atResidentialArea = 6,
e_chase = 7,
e_droppingBrick = 9,
e_goingToHide = 10,
e_hidden = 11,
e_distributeRemainingBricks = 12,
e_brickHunt = 13,
e_allPiecesCollected = 14,
};
MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
MxLong HandleTransitionEnd();
MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param);
void PlayMusic(JukeboxScript::Script p_objectId);
void FUN_10051900();
void FUN_10051960();
void HideMaPaInfo();
void InitBricks();
void UninitBricks();
void SpawnBricks();
void FUN_10051fa0(MxS32 p_param1);
void FUN_100521f0(MxS32 p_param1);
MxResult FUN_10052800();
void CheckBricksterDestroying(MxS32 p_pathData);
void CheckBricksterIsLoose(MxS32 p_pathData);
MxResult InitializeShooting();
Act2Brick m_bricks[10]; // 0x00f8
MxU8 m_nextBrick; // 0x10c0
undefined m_unk0x10c1; // 0x10c1
MxU8 m_removedBricks; // 0x10c1
MxBool m_ready; // 0x10c2
undefined4 m_unk0x10c4; // 0x10c4
undefined4 m_state; // 0x10c4
JukeboxScript::Script m_music; // 0x10c8
LegoAct2State* m_gameState; // 0x10cc
MxS32 m_unk0x10d0; // 0x10d0
MxS32 m_timeSinceLastStage; // 0x10d0
// variable name verified by BETA10 0x10014633
const char* m_siFile; // 0x10d4
LegoROI* m_pepper; // 0x10d8
MxMatrix m_unk0x10dc; // 0x10dc
LegoPathBoundary* m_unk0x1124; // 0x1124
LegoROI* m_ambulance; // 0x1128
undefined4 m_unk0x112c; // 0x112c
undefined4 m_unk0x1130; // 0x1130
undefined4 m_unk0x1134; // 0x1134
Act2Actor* m_unk0x1138; // 0x1138
undefined m_unk0x113c; // 0x113c
Act2mainScript::Script m_unk0x1140; // 0x1140
Act2mainScript::Script m_unk0x1144; // 0x1144
undefined4 m_unk0x1148; // 0x1148
undefined m_firstBrick; // 0x114c
undefined m_secondBrick; // 0x114d
undefined m_thirdBrick; // 0x114e
undefined m_fourthBrick; // 0x114e
LegoGameState::Area m_destLocation; // 0x1150
LegoROI* m_pepper; // 0x10d8
MxMatrix m_transformOnDisable; // 0x10dc
LegoPathBoundary* m_boundaryOnDisable; // 0x1124
LegoROI* m_ambulance; // 0x1128
undefined4 m_unk0x112c; // 0x112c
undefined4 m_unk0x1130; // 0x1130
undefined4 m_unk0x1134; // 0x1134
Act2Actor* m_unk0x1138; // 0x1138
undefined m_unk0x113c; // 0x113c
Act2mainScript::Script m_currentAction; // 0x1140
Act2mainScript::Script m_infomanDirecting; // 0x1144
undefined4 m_unk0x1148; // 0x1148
undefined m_firstBrick; // 0x114c
undefined m_secondBrick; // 0x114d
undefined m_thirdBrick; // 0x114e
undefined m_fourthBrick; // 0x114e
LegoGameState::Area m_destLocation; // 0x1150
};
#endif // LEGOACT2_H

View File

@@ -355,7 +355,7 @@ void Act2Actor::Animate(float p_time)
m_unk0x1e = 3;
m_unk0x24 = p_time;
if (((LegoAct2*) CurrentWorld())->FUN_100516b0() == SUCCESS) {
if (((LegoAct2*) CurrentWorld())->CreateBrick() == SUCCESS) {
FUN_100199f0(1);
}
#ifndef BETA10
@@ -648,13 +648,13 @@ void Act2Actor::FUN_100199f0(MxS8 p_param)
switch (g_nextHeadWavIndex) {
case 0:
((LegoAct2*) CurrentWorld())
->FUN_10052560(Act2mainScript::c_VOhead0_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
->StartAction(Act2mainScript::c_VOhead0_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
g_nextHeadWavIndex++;
break;
default:
((LegoAct2*) CurrentWorld())
->FUN_10052560(Act2mainScript::c_VOhead1_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
->StartAction(Act2mainScript::c_VOhead1_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
g_nextHeadWavIndex = 0;
break;
}
@@ -663,22 +663,22 @@ void Act2Actor::FUN_100199f0(MxS8 p_param)
switch (g_nextBehindWavIndex) {
case 0:
((LegoAct2*) CurrentWorld())
->FUN_10052560(Act2mainScript::c_VObehind0_PlayWav, FALSE, TRUE, NULL, NULL, NULL);
->StartAction(Act2mainScript::c_VObehind0_PlayWav, FALSE, TRUE, NULL, NULL, NULL);
g_nextBehindWavIndex++;
break;
case 1:
((LegoAct2*) CurrentWorld())
->FUN_10052560(Act2mainScript::c_VObehind1_PlayWav, FALSE, TRUE, NULL, NULL, NULL);
->StartAction(Act2mainScript::c_VObehind1_PlayWav, FALSE, TRUE, NULL, NULL, NULL);
g_nextBehindWavIndex++;
break;
case 2:
((LegoAct2*) CurrentWorld())
->FUN_10052560(Act2mainScript::c_VObehind2_PlayWav, FALSE, TRUE, NULL, NULL, NULL);
->StartAction(Act2mainScript::c_VObehind2_PlayWav, FALSE, TRUE, NULL, NULL, NULL);
g_nextBehindWavIndex++;
break;
default:
((LegoAct2*) CurrentWorld())
->FUN_10052560(Act2mainScript::c_VObehind3_PlayWav, FALSE, TRUE, NULL, NULL, NULL);
->StartAction(Act2mainScript::c_VObehind3_PlayWav, FALSE, TRUE, NULL, NULL, NULL);
g_nextBehindWavIndex = 0;
break;
}
@@ -687,22 +687,22 @@ void Act2Actor::FUN_100199f0(MxS8 p_param)
switch (g_nextInterruptWavIndex) {
case 0:
((LegoAct2*) CurrentWorld())
->FUN_10052560(Act2mainScript::c_VOinterrupt0_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
->StartAction(Act2mainScript::c_VOinterrupt0_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
g_nextInterruptWavIndex++;
break;
case 1:
((LegoAct2*) CurrentWorld())
->FUN_10052560(Act2mainScript::c_VOinterrupt1_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
->StartAction(Act2mainScript::c_VOinterrupt1_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
g_nextInterruptWavIndex++;
break;
case 2:
((LegoAct2*) CurrentWorld())
->FUN_10052560(Act2mainScript::c_VOinterrupt2_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
->StartAction(Act2mainScript::c_VOinterrupt2_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
g_nextInterruptWavIndex++;
break;
default:
((LegoAct2*) CurrentWorld())
->FUN_10052560(Act2mainScript::c_VOinterrupt3_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
->StartAction(Act2mainScript::c_VOinterrupt3_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
g_nextInterruptWavIndex = 0;
break;
}

View File

@@ -33,11 +33,11 @@ DECOMP_SIZE_ASSERT(LegoAct2, 0x1154)
DECOMP_SIZE_ASSERT(LegoAct2State, 0x10)
// GLOBAL: LEGO1 0x100f4474
Act2mainScript::Script g_unk0x100f4474 = (Act2mainScript::Script) 0;
Act2mainScript::Script g_bricksterSpeech = (Act2mainScript::Script) 0;
// GLOBAL: LEGO1 0x100f43f0
// GLOBAL: BETA10 0x101e14a8
MxS32 g_unk0x100f43f0[] = {
MxS32 g_animationsBricksterIsLoose[] = {
Act2mainScript::c_tns030bd_RunAnim,
Act2mainScript::c_tns030pg_RunAnim,
Act2mainScript::c_tns030rd_RunAnim,
@@ -49,7 +49,7 @@ MxS32 g_unk0x100f43f0[] = {
};
// GLOBAL: LEGO1 0x100f4410
const LegoChar* g_unk0x100f4410[] = {"bd", "pg", "rd", "sy", "ro", "cl"};
const LegoChar* g_charactersBricksterIsLoose[] = {"bd", "pg", "rd", "sy", "ro", "cl"};
// GLOBAL: LEGO1 0x100f4428
MxS32 g_unk0x100f4428[] = {
@@ -74,17 +74,17 @@ const LegoChar* g_unk0x100f4458[] = {"papa", "nick", "laura", "cl", "pg", "rd",
// FUNCTION: BETA10 0x1003a5a0
LegoAct2::LegoAct2()
{
m_unk0x10c4 = 0;
m_state = LegoAct2::e_initial;
m_gameState = NULL;
m_pepper = NULL;
m_ambulance = NULL;
m_ready = FALSE;
m_unk0x1130 = 0;
m_nextBrick = 0;
m_unk0x10c1 = 0;
m_removedBricks = 0;
m_unk0x1138 = NULL;
m_unk0x1140 = (Act2mainScript::Script) 0;
m_unk0x1144 = (Act2mainScript::Script) 0;
m_currentAction = (Act2mainScript::Script) 0;
m_infomanDirecting = (Act2mainScript::Script) 0;
m_destLocation = LegoGameState::e_undefined;
m_music = JukeboxScript::c_MusicTheme1;
m_siFile = "";
@@ -166,97 +166,97 @@ MxResult LegoAct2::Tickle()
return SUCCESS;
}
switch (m_unk0x10c4) {
case 0:
m_unk0x10c4 = 1;
switch (m_state) {
case LegoAct2::e_initial:
m_state = LegoAct2::e_startSpeech;
break;
case 1:
case LegoAct2::e_startSpeech:
((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled);
switch (rand() % 3) {
case 0:
g_unk0x100f4474 = Act2mainScript::c_tns002br_RunAnim;
g_bricksterSpeech = Act2mainScript::c_tns002br_RunAnim;
break;
case 1:
g_unk0x100f4474 = Act2mainScript::c_tns003br_RunAnim;
g_bricksterSpeech = Act2mainScript::c_tns003br_RunAnim;
break;
case 2:
g_unk0x100f4474 = Act2mainScript::c_tns004br_RunAnim;
g_bricksterSpeech = Act2mainScript::c_tns004br_RunAnim;
break;
}
FUN_10052560(g_unk0x100f4474, TRUE, TRUE, NULL, NULL, NULL);
m_unk0x10d0 = 0;
m_unk0x10c4 = 2;
StartAction(g_bricksterSpeech, TRUE, TRUE, NULL, NULL, NULL);
m_timeSinceLastStage = 0;
m_state = LegoAct2::e_holdingSpeech;
break;
case 2:
if (g_unk0x100f4474) {
if (AnimationManager()->FUN_10064ee0(g_unk0x100f4474)) {
case LegoAct2::e_holdingSpeech:
if (g_bricksterSpeech) {
if (AnimationManager()->FUN_10064ee0(g_bricksterSpeech)) {
Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
g_unk0x100f4474 = (Act2mainScript::Script) 0;
g_bricksterSpeech = (Act2mainScript::Script) 0;
}
}
m_unk0x10d0 += 50;
m_timeSinceLastStage += 50;
break;
case 3:
case LegoAct2::e_startDescription:
Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
m_unk0x10d0 = 0;
m_unk0x10c4 = 4;
FUN_10052560(Act2mainScript::c_tja009ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
m_timeSinceLastStage = 0;
m_state = LegoAct2::e_explaining;
StartAction(Act2mainScript::c_tja009ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
AnimationManager()->EnableCamAnims(TRUE);
AnimationManager()->FUN_1005f6d0(TRUE);
AnimationManager()->FUN_100604f0(g_unk0x100f43f0, sizeOfArray(g_unk0x100f43f0));
AnimationManager()->FUN_10060480(g_unk0x100f4410, sizeOfArray(g_unk0x100f4410));
AnimationManager()->FUN_100604f0(g_animationsBricksterIsLoose, sizeOfArray(g_animationsBricksterIsLoose));
AnimationManager()->FUN_10060480(g_charactersBricksterIsLoose, sizeOfArray(g_charactersBricksterIsLoose));
break;
case 4:
m_unk0x10d0 += 50;
case LegoAct2::e_explaining:
m_timeSinceLastStage += 50;
break;
case 5:
m_unk0x10d0 += 50;
case LegoAct2::e_goingToResidentialArea:
m_timeSinceLastStage += 50;
if (m_unk0x10d0 == 20000) {
if (m_timeSinceLastStage == 20000) {
const MxFloat* pepperPosition = FindROI("pepper")->GetWorldPosition();
MxFloat otherPoint[] = {-52.0f, 5.25f, -16.5f};
distance = DISTSQRD3(pepperPosition, otherPoint);
if (m_unk0x1144 == (Act2mainScript::Script) 0 && distance > 50.0f && pepperPosition[0] > -57.0f) {
FUN_10052560(Act2mainScript::c_Avo906In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
m_unk0x1144 = Act2mainScript::c_Avo906In_PlayWav;
if (m_infomanDirecting == (Act2mainScript::Script) 0 && distance > 50.0f && pepperPosition[0] > -57.0f) {
StartAction(Act2mainScript::c_Avo906In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
m_infomanDirecting = Act2mainScript::c_Avo906In_PlayWav;
}
}
else if (m_unk0x10d0 >= 90000 && m_unk0x10d0 % 90000 == 0 && m_unk0x1144 == (Act2mainScript::Script) 0) {
FUN_10052560(Act2mainScript::c_Avo908In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
m_unk0x1144 = Act2mainScript::c_Avo908In_PlayWav;
else if (m_timeSinceLastStage >= 90000 && m_timeSinceLastStage % 90000 == 0 && m_infomanDirecting == (Act2mainScript::Script) 0) {
StartAction(Act2mainScript::c_Avo908In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
m_infomanDirecting = Act2mainScript::c_Avo908In_PlayWav;
}
break;
case 6:
m_unk0x10d0 += 50;
case LegoAct2::e_atResidentialArea:
m_timeSinceLastStage += 50;
break;
case 9:
m_unk0x10d0 += 50;
case LegoAct2::e_droppingBrick:
m_timeSinceLastStage += 50;
if (m_unk0x10d0 >= 200) {
if (m_timeSinceLastStage >= 200) {
if (m_nextBrick < 5) {
m_unk0x10c4 = 7;
m_state = LegoAct2::e_chase;
}
else {
m_unk0x10c4 = 10;
m_unk0x10d0 = 0;
m_state = LegoAct2::e_goingToHide;
m_timeSinceLastStage = 0;
m_unk0x1138->FUN_10019520();
}
}
break;
case 10:
m_unk0x10d0 += 50;
case LegoAct2::e_goingToHide:
m_timeSinceLastStage += 50;
break;
case 11:
case LegoAct2::e_hidden:
break;
case 12:
case LegoAct2::e_distributeRemainingBricks:
break;
}
@@ -297,9 +297,9 @@ MxLong LegoAct2::Notify(MxParam& p_param)
case c_notificationAct2Brick:
SoundManager()->GetCacheSoundManager()->Play("28bng", NULL, FALSE);
m_unk0x10c1++;
if (m_unk0x10c1 == 10 && m_unk0x10c4 == 13) {
m_unk0x10c4 = 14;
m_removedBricks++;
if (m_removedBricks == 10 && m_state == LegoAct2::e_brickHunt) {
m_state = LegoAct2::e_allPiecesCollected;
LegoEntity* entity = (LegoEntity*) param.GetSender();
@@ -326,10 +326,10 @@ MxLong LegoAct2::Notify(MxParam& p_param)
Mx3DPointFloat locald4(local2world[2]);
Mx3DPointFloat localc0(local2world[1]);
FUN_10052560(Act2mainScript::c_tns051in_RunAnim, TRUE, TRUE, &locala4, &locald4, NULL);
StartAction(Act2mainScript::c_tns051in_RunAnim, TRUE, TRUE, &locala4, &locald4, NULL);
m_unk0x10c4 = 14;
m_unk0x10d0 = 0;
m_state = LegoAct2::e_allPiecesCollected;
m_timeSinceLastStage = 0;
((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled);
}
break;
@@ -348,27 +348,27 @@ MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param)
if (m_gameState->m_enabled && p_param.GetAction() != NULL) {
MxU32 objectId = p_param.GetAction()->GetObjectId();
if (m_unk0x10c4 == 5 && m_unk0x1144 == objectId) {
m_unk0x1144 = (Act2mainScript::Script) 0;
if (m_state == LegoAct2::e_goingToResidentialArea && m_infomanDirecting == objectId) {
m_infomanDirecting = (Act2mainScript::Script) 0;
return 0;
}
if (m_unk0x1140 != objectId) {
if (m_currentAction != objectId) {
return 0;
}
m_unk0x1140 = (Act2mainScript::Script) 0;
m_currentAction = (Act2mainScript::Script) 0;
switch (m_unk0x10c4) {
case 2:
m_unk0x10c4 = 3;
switch (m_state) {
case LegoAct2::e_holdingSpeech:
m_state = LegoAct2::e_startDescription;
break;
case 4:
FUN_10051960();
m_unk0x10c4 = 5;
m_unk0x10d0 = 0;
case LegoAct2::e_explaining:
HideMaPaInfo();
m_state = LegoAct2::e_goingToResidentialArea;
m_timeSinceLastStage = 0;
break;
case 6: {
case LegoAct2::e_atResidentialArea: {
LegoROI* roi;
roi = FindROI("nick");
@@ -400,24 +400,24 @@ MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param)
roi->SetVisibility(FALSE);
VariableTable()->SetVariable("ACTOR_01", "brickstr");
FUN_10052800();
m_unk0x10c4 = 7;
InitializeShooting();
m_state = LegoAct2::e_chase;
PlayMusic(JukeboxScript::c_BrickstrChase);
break;
}
case 11:
case LegoAct2::e_hidden:
m_bricks[m_nextBrick - 1].Mute(TRUE);
m_unk0x10c4 = 12;
m_unk0x10d0 = 0;
m_state = LegoAct2::e_distributeRemainingBricks;
m_timeSinceLastStage = 0;
FUN_10052560(Act2mainScript::c_tra045la_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_tra045la_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled);
AnimationManager()->EnableCamAnims(TRUE);
AnimationManager()->FUN_1005f6d0(TRUE);
AnimationManager()->FUN_100604f0(g_unk0x100f4428, sizeOfArray(g_unk0x100f4428));
AnimationManager()->FUN_10060480(g_unk0x100f4458, sizeOfArray(g_unk0x100f4458));
break;
case 12: {
case LegoAct2::e_distributeRemainingBricks: {
LegoROI* roi;
roi = FindROI("nick");
@@ -441,13 +441,13 @@ MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param)
}
m_bricks[m_nextBrick - 1].Mute(FALSE);
m_unk0x10c4 = 13;
m_state = LegoAct2::e_brickHunt;
SpawnBricks();
PlayMusic(JukeboxScript::c_BrickHunt);
((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_initial);
break;
}
case 14:
case LegoAct2::e_allPiecesCollected:
for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_bricks); i++) {
m_bricks[i].Remove();
}
@@ -534,7 +534,7 @@ void LegoAct2::Enable(MxBool p_enable)
GameState()->SetActor(LegoActor::c_pepper);
m_pepper = FindROI("pepper");
((IslePathActor*) m_pepper->GetEntity())->VTable0xec(m_unk0x10dc, m_unk0x1124, TRUE);
((IslePathActor*) m_pepper->GetEntity())->VTable0xec(m_transformOnDisable, m_boundaryOnDisable, TRUE);
if (GameState()->m_previousArea == LegoGameState::e_infomain) {
GameState()->StopArea(LegoGameState::e_infomain);
@@ -542,26 +542,27 @@ void LegoAct2::Enable(MxBool p_enable)
Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
if (m_unk0x10c4 != 6 && m_unk0x10c4 != 12) {
if (m_state != LegoAct2::e_atResidentialArea && m_state != LegoAct2::e_distributeRemainingBricks) {
PlayMusic(m_music);
}
if (m_unk0x10c4 == 10 && m_nextBrick == 6 && m_bricks[5].GetROI() != NULL) {
if (m_state == LegoAct2::e_goingToHide && m_nextBrick == 6 && m_bricks[5].GetROI() != NULL) {
m_bricks[5].PlayWhistleSound();
}
else if (m_unk0x10c4 == 13) {
else if (m_state == LegoAct2::e_brickHunt) {
InitBricks();
}
TickleManager()->RegisterClient(this, 20);
SetAppCursor(e_cursorArrow);
if (m_unk0x10c4 == 2 || m_unk0x10c4 == 4 || m_unk0x10c4 == 6 || m_unk0x10c4 == 11 || m_unk0x10c4 == 12 ||
m_unk0x10c4 == 14) {
if (m_state == LegoAct2::e_holdingSpeech || m_state == LegoAct2::e_explaining ||
m_state == LegoAct2::e_atResidentialArea || m_state == LegoAct2::e_hidden ||
m_state == LegoAct2::e_distributeRemainingBricks || m_state == LegoAct2::e_allPiecesCollected) {
MxDSAction action;
MxEndActionNotificationParam param(c_notificationEndAction, NULL, &action, FALSE);
m_unk0x1140 = (Act2mainScript::Script) 0;
m_currentAction = (Act2mainScript::Script) 0;
action.SetObjectId(0);
HandleEndAction(param);
}
@@ -569,21 +570,21 @@ void LegoAct2::Enable(MxBool p_enable)
GameState()->m_isDirty = TRUE;
}
else {
m_unk0x10dc = m_pepper->GetLocal2World();
m_unk0x1124 = ((LegoPathActor*) m_pepper->GetEntity())->GetBoundary();
m_transformOnDisable = m_pepper->GetLocal2World();
m_boundaryOnDisable = ((LegoPathActor*) m_pepper->GetEntity())->GetBoundary();
FUN_10051900();
BackgroundAudioManager()->Stop();
UninitBricks();
DeleteObjects(&m_atomId, Act2mainScript::c_VOhead0_PlayWav, Act2mainScript::c_VOhide_PlayWav);
if (m_unk0x1144 != (Act2mainScript::Script) 0) {
if (m_infomanDirecting != (Act2mainScript::Script) 0) {
MxDSAction action;
action.SetAtomId(m_atomId);
action.SetUnknown24(-2);
action.SetObjectId(m_unk0x1144);
action.SetObjectId(m_infomanDirecting);
DeleteObject(action);
m_unk0x1144 = (Act2mainScript::Script) 0;
m_infomanDirecting = (Act2mainScript::Script) 0;
}
TickleManager()->UnregisterClient(this);
@@ -594,46 +595,46 @@ void LegoAct2::Enable(MxBool p_enable)
// FUNCTION: BETA10 0x1003bb72
MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param)
{
if (m_unk0x10c4 == 5 && p_param.GetData() == 0x32) {
if (m_state == LegoAct2::e_goingToResidentialArea && p_param.GetData() == 0x32) {
LegoPathActor* actor = (LegoPathActor*) m_pepper->GetEntity();
actor->SetActorState(LegoPathActor::c_disabled);
actor->SetWorldSpeed(0.0f);
FUN_10051900();
if (m_unk0x10d0 < 90000) {
FUN_10052560(Act2mainScript::c_tra031ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
if (m_timeSinceLastStage < 90000) {
StartAction(Act2mainScript::c_tra031ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_tra032ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_tra032ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
}
m_unk0x112c = 50;
m_unk0x10c4 = 6;
m_unk0x10d0 = 0;
m_state = LegoAct2::e_atResidentialArea;
m_timeSinceLastStage = 0;
}
else if (m_unk0x10c4 == 5 && p_param.GetData() == 0x2a) {
if (m_unk0x1144 == (Act2mainScript::Script) 0) {
FUN_10052560(Act2mainScript::c_Avo907In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
m_unk0x1144 = Act2mainScript::c_Avo907In_PlayWav;
else if (m_state == LegoAct2::e_goingToResidentialArea && p_param.GetData() == 0x2a) {
if (m_infomanDirecting == (Act2mainScript::Script) 0) {
StartAction(Act2mainScript::c_Avo907In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
m_infomanDirecting = Act2mainScript::c_Avo907In_PlayWav;
}
}
else if (m_unk0x10c4 == 5) {
FUN_100521f0(p_param.GetData());
else if (m_state == LegoAct2::e_goingToResidentialArea) {
CheckBricksterIsLoose(p_param.GetData());
}
else if (m_unk0x10c4 == 7) {
FUN_10051fa0(p_param.GetData());
else if (m_state == LegoAct2::e_chase) {
CheckBricksterDestroying(p_param.GetData());
}
else if (m_unk0x10c4 == 10 && p_param.GetData() == 0x165) {
else if (m_state == LegoAct2::e_goingToHide && p_param.GetData() == 0x165) {
((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled);
if (FUN_10052560(Act2mainScript::c_VOhide_PlayWav, FALSE, TRUE, NULL, NULL, NULL) == SUCCESS) {
m_unk0x1140 = Act2mainScript::c_VOhide_PlayWav;
if (StartAction(Act2mainScript::c_VOhide_PlayWav, FALSE, TRUE, NULL, NULL, NULL) == SUCCESS) {
m_currentAction = Act2mainScript::c_VOhide_PlayWav;
}
m_unk0x1138->FUN_10019560();
m_unk0x10c4 = 11;
m_unk0x10d0 = 0;
m_state = LegoAct2::e_hidden;
m_timeSinceLastStage = 0;
if (m_nextBrick < 6) {
m_bricks[m_nextBrick].Create(m_nextBrick);
@@ -655,7 +656,7 @@ MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param)
// FUNCTION: LEGO1 0x100516b0
// FUNCTION: BETA10 0x1003bcbc
MxResult LegoAct2::FUN_100516b0()
MxResult LegoAct2::CreateBrick()
{
if (m_nextBrick > 4) {
return FAILURE;
@@ -673,8 +674,8 @@ MxResult LegoAct2::FUN_100516b0()
brick.Place(local2world, local2world2, boundary);
m_nextBrick++;
m_unk0x10c4 = 9;
m_unk0x10d0 = 0;
m_state = LegoAct2::e_droppingBrick;
m_timeSinceLastStage = 0;
return SUCCESS;
}
@@ -721,7 +722,7 @@ void LegoAct2::FUN_10051900()
// FUNCTION: LEGO1 0x10051960
// FUNCTION: BETA10 0x1003bf2c
void LegoAct2::FUN_10051960()
void LegoAct2::HideMaPaInfo()
{
LegoROI* roi;
@@ -938,93 +939,93 @@ MxResult LegoAct2::BadEnding()
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
MxTrace("Bad End of Act2\n");
m_unk0x10c4 = 14;
m_state = LegoAct2::e_allPiecesCollected;
return SUCCESS;
}
// FUNCTION: LEGO1 0x10051fa0
// FUNCTION: BETA10 0x10013fd3
void LegoAct2::FUN_10051fa0(MxS32 p_param1)
void LegoAct2::CheckBricksterDestroying(MxS32 p_pathData)
{
MxU8 randN = rand() / (RAND_MAX / 3);
randN++;
switch (p_param1) {
switch (p_pathData) {
case 2:
if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx50bu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx50bu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_snsx51bu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx51bu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
break;
case 8:
if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx29nu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx29nu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_snsx30nu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx30nu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
break;
case 9:
if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx33na_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx33na_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_snsx34na_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx34na_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
break;
case 14:
if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx46cl_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx46cl_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_snsx48cl_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx48cl_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
break;
case 23:
if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx58va_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx58va_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_snsx60va_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx60va_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
break;
case 24:
case 25:
FUN_10052560(Act2mainScript::c_snsx31sh_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx31sh_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
break;
case 26:
if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx52sn_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx52sn_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_snsx53sn_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx53sn_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
break;
case 34:
if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx15la_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx15la_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_snsx16la_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx16la_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
break;
case 36:
if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx10ni_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx10ni_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_snsx11ni_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx11ni_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
break;
case 38:
case 42:
if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx03ma_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx03ma_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_snsx04ma_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
StartAction(Act2mainScript::c_snsx04ma_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
break;
}
@@ -1032,44 +1033,44 @@ void LegoAct2::FUN_10051fa0(MxS32 p_param1)
// FUNCTION: LEGO1 0x100521f0
// FUNCTION: BETA10 0x100142f1
void LegoAct2::FUN_100521f0(MxS32 p_param1)
void LegoAct2::CheckBricksterIsLoose(MxS32 p_pathData)
{
Act2mainScript::Script objectId = (Act2mainScript::Script) 0;
Mx3DPointFloat vec;
Mx3DPointFloat actorPosition;
switch (p_param1) {
switch (p_pathData) {
case 0x02: {
vec = Mx3DPointFloat(-9.1f, 0.0f, -16.5f);
actorPosition = Mx3DPointFloat(-9.1f, 0.0f, -16.5f);
VariableTable()->SetVariable("ACTOR_01", "bd");
objectId = Act2mainScript::c_tns030bd_RunAnim;
break;
}
case 0x2a: {
vec = Mx3DPointFloat(-9.67f, 0.0f, -44.3f);
actorPosition = Mx3DPointFloat(-9.67f, 0.0f, -44.3f);
VariableTable()->SetVariable("ACTOR_01", "rd");
objectId = Act2mainScript::c_tns030rd_RunAnim;
break;
}
case 0x133: {
vec = Mx3DPointFloat(25.75f, 0.0f, -13.0f);
actorPosition = Mx3DPointFloat(25.75f, 0.0f, -13.0f);
VariableTable()->SetVariable("ACTOR_01", "pg");
objectId = Act2mainScript::c_tns030pg_RunAnim;
break;
}
case 0x134: {
vec = Mx3DPointFloat(43.63f, 0.0f, -46.33f);
actorPosition = Mx3DPointFloat(43.63f, 0.0f, -46.33f);
VariableTable()->SetVariable("ACTOR_01", "sy");
objectId = Act2mainScript::c_tns030sy_RunAnim;
break;
}
case 0x135: {
vec = Mx3DPointFloat(50.0f, 0.0f, -34.6f);
actorPosition = Mx3DPointFloat(50.0f, 0.0f, -34.6f);
VariableTable()->SetVariable("ACTOR_01", "rd");
objectId = Act2mainScript::c_tns030rd_RunAnim;
break;
}
case 0x138: {
vec = Mx3DPointFloat(-41.15f, 4.0f, 31.0f);
actorPosition = Mx3DPointFloat(-41.15f, 4.0f, 31.0f);
VariableTable()->SetVariable("ACTOR_01", "sy");
objectId = Act2mainScript::c_tns030sy_RunAnim;
break;
@@ -1077,30 +1078,30 @@ void LegoAct2::FUN_100521f0(MxS32 p_param1)
}
if (objectId != (Act2mainScript::Script) 0) {
Mx3DPointFloat local30(vec);
Mx3DPointFloat lookingAtPepper(actorPosition);
Mx3DPointFloat position(m_pepper->GetWorldPosition());
local30 -= position;
Mx3DPointFloat local44 = local30;
local30.Unitize();
FUN_10052560(objectId, TRUE, TRUE, &vec, &local30, NULL);
lookingAtPepper -= position;
Mx3DPointFloat local44 = lookingAtPepper;
lookingAtPepper.Unitize();
StartAction(objectId, TRUE, TRUE, &actorPosition, &lookingAtPepper, NULL);
}
}
// FUNCTION: LEGO1 0x10052560
// FUNCTION: BETA10 0x100145c6
MxResult LegoAct2::FUN_10052560(
MxResult LegoAct2::StartAction(
Act2mainScript::Script p_objectId,
MxBool p_param2,
MxBool p_param3,
MxBool p_isAnimation,
MxBool p_ignoreCurrentAction,
Mx3DPointFloat* p_location,
Mx3DPointFloat* p_direction,
Mx3DPointFloat* p_param6
)
{
if (m_unk0x1140 == (Act2mainScript::Script) 0 || p_param3) {
if (m_currentAction == (Act2mainScript::Script) 0 || p_ignoreCurrentAction) {
assert(strlen(m_siFile));
if (!p_param2) {
if (!p_isAnimation) {
MxDSAction action;
action.SetObjectId(p_objectId);
@@ -1188,7 +1189,7 @@ MxResult LegoAct2::FUN_10052560(
}
if (result == SUCCESS) {
m_unk0x1140 = p_objectId;
m_currentAction = p_objectId;
}
}
}
@@ -1198,7 +1199,7 @@ MxResult LegoAct2::FUN_10052560(
// FUNCTION: LEGO1 0x10052800
// FUNCTION: BETA10 0x10014aa8
MxResult LegoAct2::FUN_10052800()
MxResult LegoAct2::InitializeShooting()
{
LegoPathActor* actor = m_unk0x1138;
LegoLocomotionAnimPresenter* ap;