Compare commits

...

2 Commits

Author SHA1 Message Date
Fabian Neundorf
ef2d438a7d Clear unknowns in LegoCarBuildAnimPresenter (#1683) 2025-09-07 15:07:39 -07:00
Fabian Neundorf
e3b77fb50b Clear unknowns in LegoAct2 (#1679) 2025-09-07 22:54:22 +02:00
6 changed files with 251 additions and 233 deletions

View File

@@ -80,10 +80,10 @@ public:
void SetUnknown0x1138(Act2Actor* p_unk0x1138) { m_unk0x1138 = p_unk0x1138; } void SetUnknown0x1138(Act2Actor* p_unk0x1138) { m_unk0x1138 = p_unk0x1138; }
void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; } void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; }
MxResult FUN_100516b0(); MxResult CreateBrick();
void FUN_100517b0(); void FUN_100517b0();
MxResult BadEnding(); MxResult BadEnding();
MxResult FUN_10052560( MxResult StartAction(
Act2mainScript::Script p_objectId, Act2mainScript::Script p_objectId,
MxBool p_param2, MxBool p_param2,
MxBool p_param3, MxBool p_param3,
@@ -96,42 +96,59 @@ public:
// LegoAct2::`scalar deleting destructor' // LegoAct2::`scalar deleting destructor'
private: 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 HandleEndAction(MxEndActionNotificationParam& p_param);
MxLong HandleTransitionEnd(); MxLong HandleTransitionEnd();
MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param); MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param);
void PlayMusic(JukeboxScript::Script p_objectId); void PlayMusic(JukeboxScript::Script p_objectId);
void FUN_10051900(); void FUN_10051900();
void FUN_10051960(); void HideMaPaInfo();
void InitBricks(); void InitBricks();
void UninitBricks(); void UninitBricks();
void SpawnBricks(); void SpawnBricks();
void FUN_10051fa0(MxS32 p_param1); void CheckBricksterDestroying(MxS32 p_pathData);
void FUN_100521f0(MxS32 p_param1); void CheckBricksterIsLoose(MxS32 p_pathData);
MxResult FUN_10052800(); MxResult InitializeShooting();
Act2Brick m_bricks[10]; // 0x00f8 Act2Brick m_bricks[10]; // 0x00f8
MxU8 m_nextBrick; // 0x10c0 MxU8 m_nextBrick; // 0x10c0
undefined m_unk0x10c1; // 0x10c1 MxU8 m_removedBricks; // 0x10c1
MxBool m_ready; // 0x10c2 MxBool m_ready; // 0x10c2
undefined4 m_unk0x10c4; // 0x10c4 undefined4 m_state; // 0x10c4
JukeboxScript::Script m_music; // 0x10c8 JukeboxScript::Script m_music; // 0x10c8
LegoAct2State* m_gameState; // 0x10cc LegoAct2State* m_gameState; // 0x10cc
MxS32 m_unk0x10d0; // 0x10d0 MxS32 m_timeSinceLastStage; // 0x10d0
// variable name verified by BETA10 0x10014633 // variable name verified by BETA10 0x10014633
const char* m_siFile; // 0x10d4 const char* m_siFile; // 0x10d4
LegoROI* m_pepper; // 0x10d8 LegoROI* m_pepper; // 0x10d8
MxMatrix m_unk0x10dc; // 0x10dc MxMatrix m_transformOnDisable; // 0x10dc
LegoPathBoundary* m_unk0x1124; // 0x1124 LegoPathBoundary* m_boundaryOnDisable; // 0x1124
LegoROI* m_ambulance; // 0x1128 LegoROI* m_ambulance; // 0x1128
undefined4 m_unk0x112c; // 0x112c undefined4 m_unk0x112c; // 0x112c
undefined4 m_unk0x1130; // 0x1130 undefined4 m_unk0x1130; // 0x1130
undefined4 m_unk0x1134; // 0x1134 undefined4 m_unk0x1134; // 0x1134
Act2Actor* m_unk0x1138; // 0x1138 Act2Actor* m_unk0x1138; // 0x1138
undefined m_unk0x113c; // 0x113c undefined m_unk0x113c; // 0x113c
Act2mainScript::Script m_unk0x1140; // 0x1140 Act2mainScript::Script m_currentAction; // 0x1140
Act2mainScript::Script m_unk0x1144; // 0x1144 Act2mainScript::Script m_infomanDirecting; // 0x1144
undefined4 m_unk0x1148; // 0x1148 undefined4 m_unk0x1148; // 0x1148
undefined m_firstBrick; // 0x114c undefined m_firstBrick; // 0x114c
undefined m_secondBrick; // 0x114d undefined m_secondBrick; // 0x114d

View File

@@ -21,10 +21,10 @@ public:
}; };
// SIZE 0x0c // SIZE 0x0c
struct UnknownListEntry { struct CarBuildPart {
// FUNCTION: LEGO1 0x100795c0 // FUNCTION: LEGO1 0x100795c0
// FUNCTION: BETA10 0x10073850 // FUNCTION: BETA10 0x10073850
UnknownListEntry() CarBuildPart()
{ {
m_name = NULL; m_name = NULL;
m_wiredName = NULL; m_wiredName = NULL;
@@ -74,7 +74,7 @@ public:
virtual MxResult Serialize(LegoStorage* p_storage); virtual MxResult Serialize(LegoStorage* p_storage);
void FUN_10079050(MxS16 p_index); void MakePartPlaced(MxS16 p_index);
void SwapNodesByName(LegoChar* p_param1, LegoChar* p_param2); void SwapNodesByName(LegoChar* p_param1, LegoChar* p_param2);
void InitBuildPlatform(); void InitBuildPlatform();
void HideBuildPartByName(LegoChar* p_param); void HideBuildPartByName(LegoChar* p_param);
@@ -83,7 +83,7 @@ public:
LegoTreeNode* FindNodeByName(LegoTreeNode* p_treeNode, const LegoChar* p_name); LegoTreeNode* FindNodeByName(LegoTreeNode* p_treeNode, const LegoChar* p_name);
void AddPartToBuildByName(const LegoChar* p_name); void AddPartToBuildByName(const LegoChar* p_name);
void RotateAroundYAxis(MxFloat p_angle); void RotateAroundYAxis(MxFloat p_angle);
MxBool FUN_10079c30(const LegoChar* p_name); MxBool IsNextPartToPlace(const LegoChar* p_name);
MxBool PartIsPlaced(const LegoChar* p_name); MxBool PartIsPlaced(const LegoChar* p_name);
void MoveShelfForward(); void MoveShelfForward();
MxBool StringEqualsPlatform(const LegoChar* p_string); MxBool StringEqualsPlatform(const LegoChar* p_string);
@@ -102,7 +102,7 @@ public:
MxBool StringEndsOnW(LegoChar* p_param); MxBool StringEndsOnW(LegoChar* p_param);
MxBool StringEndsOnYOrN(const LegoChar* p_string); MxBool StringEndsOnYOrN(const LegoChar* p_string);
const BoundingSphere& FUN_10079e20(); const BoundingSphere& GetTargetBoundingSphere();
// FUNCTION: BETA10 0x100703e0 // FUNCTION: BETA10 0x100703e0
const LegoChar* GetWiredNameOfLastPlacedPart() { return m_parts[m_placedPartCount].m_wiredName; } const LegoChar* GetWiredNameOfLastPlacedPart() { return m_parts[m_placedPartCount].m_wiredName; }
@@ -121,7 +121,7 @@ public:
// LegoCarBuildAnimPresenter::`scalar deleting destructor' // LegoCarBuildAnimPresenter::`scalar deleting destructor'
private: private:
void Beta10Inline0x100733d0(); void UpdateFlashingPartVisibility();
MxU16 m_shelfState; // 0xbc MxU16 m_shelfState; // 0xbc
@@ -136,13 +136,13 @@ private:
MxMatrix m_buildViewMatrix; // 0xe0 MxMatrix m_buildViewMatrix; // 0xe0
// variable name verified by BETA10 0x100719f0 // variable name verified by BETA10 0x100719f0
UnknownListEntry* m_parts; // 0x128 CarBuildPart* m_parts; // 0x128
MxFloat m_shelfFrameBuffer; // 0x12c MxFloat m_shelfFrameBuffer; // 0x12c
MxFloat m_shelfFrame; // 0x130 MxFloat m_shelfFrame; // 0x130
MxFloat m_shelfFrameMax; // 0x134 MxFloat m_shelfFrameMax; // 0x134
MxFloat m_shelfFrameInterval; // 0x138 MxFloat m_shelfFrameInterval; // 0x138
MxULong m_unk0x13c; // 0x13c MxULong m_flashingPartTimeState; // 0x13c
LegoEntity* m_carBuildEntity; // 0x140 LegoEntity* m_carBuildEntity; // 0x140
MxS32 m_unk0x144; // 0x144 MxS32 m_unk0x144; // 0x144
MxS32 m_unk0x148; // 0x148 MxS32 m_unk0x148; // 0x148

View File

@@ -355,7 +355,7 @@ void Act2Actor::Animate(float p_time)
m_unk0x1e = 3; m_unk0x1e = 3;
m_unk0x24 = p_time; m_unk0x24 = p_time;
if (((LegoAct2*) CurrentWorld())->FUN_100516b0() == SUCCESS) { if (((LegoAct2*) CurrentWorld())->CreateBrick() == SUCCESS) {
FUN_100199f0(1); FUN_100199f0(1);
} }
#ifndef BETA10 #ifndef BETA10
@@ -648,13 +648,13 @@ void Act2Actor::FUN_100199f0(MxS8 p_param)
switch (g_nextHeadWavIndex) { switch (g_nextHeadWavIndex) {
case 0: case 0:
((LegoAct2*) CurrentWorld()) ((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++; g_nextHeadWavIndex++;
break; break;
default: default:
((LegoAct2*) CurrentWorld()) ((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; g_nextHeadWavIndex = 0;
break; break;
} }
@@ -663,22 +663,22 @@ void Act2Actor::FUN_100199f0(MxS8 p_param)
switch (g_nextBehindWavIndex) { switch (g_nextBehindWavIndex) {
case 0: case 0:
((LegoAct2*) CurrentWorld()) ((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++; g_nextBehindWavIndex++;
break; break;
case 1: case 1:
((LegoAct2*) CurrentWorld()) ((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++; g_nextBehindWavIndex++;
break; break;
case 2: case 2:
((LegoAct2*) CurrentWorld()) ((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++; g_nextBehindWavIndex++;
break; break;
default: default:
((LegoAct2*) CurrentWorld()) ((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; g_nextBehindWavIndex = 0;
break; break;
} }
@@ -687,22 +687,22 @@ void Act2Actor::FUN_100199f0(MxS8 p_param)
switch (g_nextInterruptWavIndex) { switch (g_nextInterruptWavIndex) {
case 0: case 0:
((LegoAct2*) CurrentWorld()) ((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++; g_nextInterruptWavIndex++;
break; break;
case 1: case 1:
((LegoAct2*) CurrentWorld()) ((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++; g_nextInterruptWavIndex++;
break; break;
case 2: case 2:
((LegoAct2*) CurrentWorld()) ((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++; g_nextInterruptWavIndex++;
break; break;
default: default:
((LegoAct2*) CurrentWorld()) ((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; g_nextInterruptWavIndex = 0;
break; break;
} }

View File

@@ -855,8 +855,8 @@ undefined4 LegoCarBuild::SelectPartFromMousePosition(MxLong p_x, MxLong p_y)
} }
} }
else { else {
if (m_animPresenter->FUN_10079c30(m_selectedPart->GetName())) { if (m_animPresenter->IsNextPartToPlace(m_selectedPart->GetName())) {
m_unk0x114 = m_animPresenter->FUN_10079e20(); m_unk0x114 = m_animPresenter->GetTargetBoundingSphere();
} }
} }
@@ -902,7 +902,7 @@ undefined4 LegoCarBuild::FUN_100246e0(MxLong p_x, MxLong p_y)
m_PlaceBrick_Sound->Enable(TRUE); m_PlaceBrick_Sound->Enable(TRUE);
m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_stopped); m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_stopped);
} }
else if (m_animPresenter->FUN_10079c30(m_selectedPart->GetName())) { else if (m_animPresenter->IsNextPartToPlace(m_selectedPart->GetName())) {
if (SpheresIntersect(m_unk0x114, m_selectedPart->GetWorldBoundingSphere())) { if (SpheresIntersect(m_unk0x114, m_selectedPart->GetWorldBoundingSphere())) {
m_PlaceBrick_Sound->Enable(FALSE); m_PlaceBrick_Sound->Enable(FALSE);
m_PlaceBrick_Sound->Enable(TRUE); m_PlaceBrick_Sound->Enable(TRUE);
@@ -1418,7 +1418,7 @@ void LegoCarBuild::FUN_10025450()
else { else {
const LegoChar* wiredName; const LegoChar* wiredName;
if (!m_animPresenter->FUN_10079c30(m_selectedPart->GetName())) { if (!m_animPresenter->IsNextPartToPlace(m_selectedPart->GetName())) {
wiredName = m_animPresenter->GetWiredNameByPartName(m_selectedPart->GetName()); wiredName = m_animPresenter->GetWiredNameByPartName(m_selectedPart->GetName());
} }
else { else {

View File

@@ -16,7 +16,7 @@
#include "mxtimer.h" #include "mxtimer.h"
#include "realtime/realtime.h" #include "realtime/realtime.h"
DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter::UnknownListEntry, 0x0c) DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter::CarBuildPart, 0x0c)
DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter, 0x150) DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter, 0x150)
// FUNCTION: LEGO1 0x10078400 // FUNCTION: LEGO1 0x10078400
@@ -32,7 +32,7 @@ LegoCarBuildAnimPresenter::LegoCarBuildAnimPresenter()
m_shelfFrameBuffer = 0; m_shelfFrameBuffer = 0;
m_shelfFrameMax = 0; m_shelfFrameMax = 0;
m_shelfFrameInterval = 0; m_shelfFrameInterval = 0;
m_unk0x13c = 0; m_flashingPartTimeState = 0;
m_carBuildEntity = NULL; m_carBuildEntity = NULL;
m_unk0x144 = -1; m_unk0x144 = -1;
m_unk0x148 = -1; m_unk0x148 = -1;
@@ -60,28 +60,28 @@ LegoCarBuildAnimPresenter::~LegoCarBuildAnimPresenter()
} }
// FUNCTION: BETA10 0x100733d0 // FUNCTION: BETA10 0x100733d0
inline void LegoCarBuildAnimPresenter::Beta10Inline0x100733d0() inline void LegoCarBuildAnimPresenter::UpdateFlashingPartVisibility()
{ {
MxLong time = Timer()->GetTime(); MxLong time = Timer()->GetTime();
MxLong bvar5; MxLong showFlashingPart;
if (m_unk0x13c < time) { if (m_flashingPartTimeState < time) {
bvar5 = FALSE; showFlashingPart = FALSE;
// I have no idea why this conditional is so convoluted // I have no idea why this conditional is so convoluted
if (m_unk0x13c & c_bit1) { if (m_flashingPartTimeState & c_bit1) {
bvar5 = TRUE; showFlashingPart = TRUE;
m_unk0x13c = time + 400; m_flashingPartTimeState = time + 400;
} }
else { else {
m_unk0x13c = time + 200; m_flashingPartTimeState = time + 200;
} }
if (bvar5) { if (showFlashingPart) {
m_unk0x13c &= ~c_bit1; m_flashingPartTimeState &= ~c_bit1;
} }
else { else {
m_unk0x13c |= c_bit1; m_flashingPartTimeState |= c_bit1;
} }
if (m_placedPartCount < m_numberOfParts) { if (m_placedPartCount < m_numberOfParts) {
@@ -96,7 +96,7 @@ inline void LegoCarBuildAnimPresenter::Beta10Inline0x100733d0()
const LegoChar* name = roi->GetName(); const LegoChar* name = roi->GetName();
if (name && stricmp(wiredName, name) == 0) { if (name && stricmp(wiredName, name) == 0) {
if (bvar5) { if (showFlashingPart) {
roi->SetVisibility(TRUE); roi->SetVisibility(TRUE);
} }
else { else {
@@ -127,7 +127,7 @@ void LegoCarBuildAnimPresenter::PutFrame()
break; break;
} }
Beta10Inline0x100733d0(); UpdateFlashingPartVisibility();
} }
// FUNCTION: LEGO1 0x100788c0 // FUNCTION: LEGO1 0x100788c0
@@ -209,7 +209,7 @@ void LegoCarBuildAnimPresenter::StreamingTickle()
} }
if (i < m_placedPartCount) { if (i < m_placedPartCount) {
FUN_10079050(i); MakePartPlaced(i);
ShowBuildPartByName(m_parts[i].m_name); ShowBuildPartByName(m_parts[i].m_name);
} }
@@ -316,7 +316,7 @@ MxResult LegoCarBuildAnimPresenter::Serialize(LegoStorage* p_storage)
// FUNCTION: LEGO1 0x10079050 // FUNCTION: LEGO1 0x10079050
// FUNCTION: BETA10 0x1007151e // FUNCTION: BETA10 0x1007151e
void LegoCarBuildAnimPresenter::FUN_10079050(MxS16 p_index) void LegoCarBuildAnimPresenter::MakePartPlaced(MxS16 p_index)
{ {
SwapNodesByName(m_parts[p_index].m_wiredName, m_parts[p_index].m_name); SwapNodesByName(m_parts[p_index].m_wiredName, m_parts[p_index].m_name);
HideBuildPartByName(m_parts[p_index].m_wiredName); HideBuildPartByName(m_parts[p_index].m_wiredName);
@@ -382,7 +382,7 @@ void LegoCarBuildAnimPresenter::InitBuildPlatform()
} }
assert(m_numberOfParts); assert(m_numberOfParts);
m_parts = new UnknownListEntry[m_numberOfParts]; m_parts = new CarBuildPart[m_numberOfParts];
assert(m_parts); assert(m_parts);
// Go through and add the wired name of each part // Go through and add the wired name of each part
@@ -551,7 +551,7 @@ void LegoCarBuildAnimPresenter::AddPartToBuildByName(const LegoChar* p_name)
strcpy(m_parts[i].m_name, buffer); strcpy(m_parts[i].m_name, buffer);
Swap(m_parts[m_placedPartCount].m_objectId, m_parts[i].m_objectId); Swap(m_parts[m_placedPartCount].m_objectId, m_parts[i].m_objectId);
} }
FUN_10079050(m_placedPartCount); MakePartPlaced(m_placedPartCount);
m_placedPartCount++; m_placedPartCount++;
((LegoCarBuild*) m_currentWorld)->SetPlacedPartCount(m_placedPartCount); ((LegoCarBuild*) m_currentWorld)->SetPlacedPartCount(m_placedPartCount);
@@ -644,7 +644,7 @@ MxBool LegoCarBuildAnimPresenter::StringEqualsShelf(const LegoChar* p_string)
// FUNCTION: LEGO1 0x10079c30 // FUNCTION: LEGO1 0x10079c30
// FUNCTION: BETA10 0x100726a6 // FUNCTION: BETA10 0x100726a6
MxBool LegoCarBuildAnimPresenter::FUN_10079c30(const LegoChar* p_name) MxBool LegoCarBuildAnimPresenter::IsNextPartToPlace(const LegoChar* p_name)
{ {
if (PartIsPlaced(p_name)) { if (PartIsPlaced(p_name)) {
return FALSE; return FALSE;
@@ -708,7 +708,7 @@ void LegoCarBuildAnimPresenter::SetPartObjectIdByName(const LegoChar* p_name, Mx
// FUNCTION: LEGO1 0x10079e20 // FUNCTION: LEGO1 0x10079e20
// FUNCTION: BETA10 0x10072959 // FUNCTION: BETA10 0x10072959
const BoundingSphere& LegoCarBuildAnimPresenter::FUN_10079e20() const BoundingSphere& LegoCarBuildAnimPresenter::GetTargetBoundingSphere()
{ {
LegoROI* roi = m_carBuildEntity->GetROI(); LegoROI* roi = m_carBuildEntity->GetROI();
return roi->FindChildROI(m_parts[m_placedPartCount].m_wiredName, roi)->GetWorldBoundingSphere(); return roi->FindChildROI(m_parts[m_placedPartCount].m_wiredName, roi)->GetWorldBoundingSphere();

View File

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