Clear unknowns in LegoAct2

This commit is contained in:
Fabian Neundorf 2025-08-08 22:53:17 +02:00
parent 2740065895
commit c72a0789e1
4 changed files with 62 additions and 62 deletions

View File

@ -77,19 +77,19 @@ class LegoAct2 : public LegoWorld {
MxBool Escape() override; // vtable+0x64 MxBool Escape() override; // vtable+0x64
void Enable(MxBool p_enable) override; // vtable+0x68 void Enable(MxBool p_enable) override; // vtable+0x68
void SetUnknown0x1138(Act2Actor* p_unk0x1138) { m_unk0x1138 = p_unk0x1138; } void SetAmbulanceActor(Act2Actor* p_ambulanceActor) { m_ambulanceActor = p_ambulanceActor; }
void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; } void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; }
MxResult CreateBrick(); MxResult CreateDroppingBrick();
void FUN_100517b0(); void CreateBrick();
MxResult BadEnding(); MxResult BadEnding();
MxResult StartAction( MxResult 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_up
); );
// SYNTHETIC: LEGO1 0x1004fe20 // SYNTHETIC: LEGO1 0x1004fe20
@ -117,7 +117,7 @@ class LegoAct2 : public LegoWorld {
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 DisableAnimations();
void HideMaPaInfo(); void HideMaPaInfo();
void InitBricks(); void InitBricks();
void UninitBricks(); void UninitBricks();
@ -145,7 +145,7 @@ class LegoAct2 : public LegoWorld {
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_ambulanceActor; // 0x1138
undefined m_unk0x113c; // 0x113c undefined m_unk0x113c; // 0x113c
Act2mainScript::Script m_currentAction; // 0x1140 Act2mainScript::Script m_currentAction; // 0x1140
Act2mainScript::Script m_infomanDirecting; // 0x1144 Act2mainScript::Script m_infomanDirecting; // 0x1144

View File

@ -287,7 +287,7 @@ void Act2Actor::Animate(float p_time)
} }
SetWorldSpeed(0.0f); SetWorldSpeed(0.0f);
((LegoAct2*) CurrentWorld())->FUN_100517b0(); ((LegoAct2*) CurrentWorld())->CreateBrick();
return; return;
} }
#endif #endif
@ -355,7 +355,7 @@ void Act2Actor::Animate(float p_time)
m_state = e_createdBrick; m_state = e_createdBrick;
m_createBrickTime = p_time; m_createBrickTime = p_time;
if (((LegoAct2*) CurrentWorld())->CreateBrick() == SUCCESS) { if (((LegoAct2*) CurrentWorld())->CreateDroppingBrick() == SUCCESS) {
PlayNextVoiceOver(VoiceOver::e_behind); PlayNextVoiceOver(VoiceOver::e_behind);
} }
#ifndef BETA10 #ifndef BETA10

View File

@ -389,7 +389,7 @@ MxCore* LegoObjectFactory::Create(const char* p_name)
} }
else if (m_idAct2Actor == atom) { else if (m_idAct2Actor == atom) {
Act2Actor* actor = new Act2Actor(); Act2Actor* actor = new Act2Actor();
((LegoAct2*) CurrentWorld())->SetUnknown0x1138(actor); ((LegoAct2*) CurrentWorld())->SetAmbulanceActor(actor);
object = actor; object = actor;
} }
else if (m_idAct2Brick == atom) { else if (m_idAct2Brick == atom) {

View File

@ -52,7 +52,7 @@ MxS32 g_animationsBricksterIsLoose[] = {
const LegoChar* g_charactersBricksterIsLoose[] = {"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_animationsAfterChase[] = {
Act2mainScript::c_snsx07pa_RunAnim, Act2mainScript::c_snsx07pa_RunAnim,
Act2mainScript::c_snsx12ni_RunAnim, Act2mainScript::c_snsx12ni_RunAnim,
Act2mainScript::c_snsx15la_RunAnim, Act2mainScript::c_snsx15la_RunAnim,
@ -68,7 +68,7 @@ MxS32 g_unk0x100f4428[] = {
}; };
// GLOBAL: LEGO1 0x100f4458 // GLOBAL: LEGO1 0x100f4458
const LegoChar* g_unk0x100f4458[] = {"papa", "nick", "laura", "cl", "pg", "rd", "sy"}; const LegoChar* g_charactersAfterChase[] = {"papa", "nick", "laura", "cl", "pg", "rd", "sy"};
// FUNCTION: LEGO1 0x1004fce0 // FUNCTION: LEGO1 0x1004fce0
// FUNCTION: BETA10 0x1003a5a0 // FUNCTION: BETA10 0x1003a5a0
@ -82,7 +82,7 @@ LegoAct2::LegoAct2()
m_unk0x1130 = 0; m_unk0x1130 = 0;
m_nextBrick = 0; m_nextBrick = 0;
m_removedBricks = 0; m_removedBricks = 0;
m_unk0x1138 = NULL; m_ambulanceActor = NULL;
m_currentAction = (Act2mainScript::Script) 0; m_currentAction = (Act2mainScript::Script) 0;
m_infomanDirecting = (Act2mainScript::Script) 0; m_infomanDirecting = (Act2mainScript::Script) 0;
m_destLocation = LegoGameState::e_undefined; m_destLocation = LegoGameState::e_undefined;
@ -100,7 +100,7 @@ LegoAct2::~LegoAct2()
TickleManager()->UnregisterClient(this); TickleManager()->UnregisterClient(this);
} }
FUN_10051900(); DisableAnimations();
InputManager()->UnRegister(this); InputManager()->UnRegister(this);
if (UserActor()) { if (UserActor()) {
Remove(UserActor()); Remove(UserActor());
@ -246,7 +246,7 @@ MxResult LegoAct2::Tickle()
else { else {
m_state = LegoAct2::e_goingToHide; m_state = LegoAct2::e_goingToHide;
m_timeSinceLastStage = 0; m_timeSinceLastStage = 0;
m_unk0x1138->GoingToHide(); m_ambulanceActor->GoingToHide();
} }
} }
@ -303,30 +303,30 @@ MxLong LegoAct2::Notify(MxParam& p_param)
LegoEntity* entity = (LegoEntity*) param.GetSender(); LegoEntity* entity = (LegoEntity*) param.GetSender();
Mx3DPointFloat local20(entity->GetROI()->GetWorldPosition()); Mx3DPointFloat pepperToBrick(entity->GetROI()->GetWorldPosition());
Mx3DPointFloat locale8(m_pepper->GetWorldPosition()); Mx3DPointFloat pepperPosition(m_pepper->GetWorldPosition());
Mx3DPointFloat locala4(locale8); Mx3DPointFloat position(pepperPosition);
local20 -= locale8; pepperToBrick -= pepperPosition;
MxMatrix local2world(m_pepper->GetLocal2World()); MxMatrix local2world(m_pepper->GetLocal2World());
Vector3 local30(local2world[0]); Vector3 right(local2world[0]);
Vector3 localac(local2world[1]); Vector3 up(local2world[1]);
Vector3 local28(local2world[2]); Vector3 dir(local2world[2]);
local28 = local20; dir = pepperToBrick;
local28.Unitize(); dir.Unitize();
Mx3DPointFloat local90(local28); Mx3DPointFloat positionOffset(dir);
local90 *= 1.25f; positionOffset *= 1.25f;
locala4 += local90; position += positionOffset;
locala4[1] += 0.25; position[1] += 0.25;
local30.EqualsCross(localac, local28); right.EqualsCross(up, dir);
local30.Unitize(); right.Unitize();
Mx3DPointFloat locald4(local2world[2]); Mx3DPointFloat direction(local2world[2]);
Mx3DPointFloat localc0(local2world[1]); Mx3DPointFloat localc0(local2world[1]);
StartAction(Act2mainScript::c_tns051in_RunAnim, TRUE, TRUE, &locala4, &locald4, NULL); StartAction(Act2mainScript::c_tns051in_RunAnim, TRUE, TRUE, &position, &direction, NULL);
m_state = LegoAct2::e_allPiecesCollected; m_state = LegoAct2::e_allPiecesCollected;
m_timeSinceLastStage = 0; m_timeSinceLastStage = 0;
@ -414,8 +414,8 @@ MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param)
((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_animationsAfterChase, sizeOfArray(g_animationsAfterChase));
AnimationManager()->FUN_10060480(g_unk0x100f4458, sizeOfArray(g_unk0x100f4458)); AnimationManager()->FUN_10060480(g_charactersAfterChase, sizeOfArray(g_charactersAfterChase));
break; break;
case LegoAct2::e_distributeRemainingBricks: { case LegoAct2::e_distributeRemainingBricks: {
LegoROI* roi; LegoROI* roi;
@ -452,7 +452,7 @@ MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param)
m_bricks[i].Remove(); m_bricks[i].Remove();
} }
FUN_10051900(); DisableAnimations();
m_destLocation = LegoGameState::e_copterbuild; m_destLocation = LegoGameState::e_copterbuild;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
break; break;
@ -513,7 +513,7 @@ void LegoAct2::ReadyWorld()
PlaceActor(actor, "EDG00_149", 0, 0.5f, 2, 0.5f); PlaceActor(actor, "EDG00_149", 0, 0.5f, 2, 0.5f);
PlayMusic(JukeboxScript::c_Jail_Music); PlayMusic(JukeboxScript::c_Jail_Music);
FUN_10051900(); DisableAnimations();
VideoManager()->Get3DManager()->SetFrustrum(90.0f, 0.1f, 250.f); VideoManager()->Get3DManager()->SetFrustrum(90.0f, 0.1f, 250.f);
m_gameState->m_enabled = TRUE; m_gameState->m_enabled = TRUE;
} }
@ -573,7 +573,7 @@ void LegoAct2::Enable(MxBool p_enable)
m_transformOnDisable = m_pepper->GetLocal2World(); m_transformOnDisable = m_pepper->GetLocal2World();
m_boundaryOnDisable = ((LegoPathActor*) m_pepper->GetEntity())->GetBoundary(); m_boundaryOnDisable = ((LegoPathActor*) m_pepper->GetEntity())->GetBoundary();
FUN_10051900(); DisableAnimations();
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);
@ -599,7 +599,7 @@ MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param)
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(); DisableAnimations();
if (m_timeSinceLastStage < 90000) { if (m_timeSinceLastStage < 90000) {
StartAction(Act2mainScript::c_tra031ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL); StartAction(Act2mainScript::c_tra031ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
@ -631,7 +631,7 @@ MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param)
m_currentAction = Act2mainScript::c_VOhide_PlayWav; m_currentAction = Act2mainScript::c_VOhide_PlayWav;
} }
m_unk0x1138->Hide(); m_ambulanceActor->Hide();
m_state = LegoAct2::e_hidden; m_state = LegoAct2::e_hidden;
m_timeSinceLastStage = 0; m_timeSinceLastStage = 0;
@ -644,7 +644,7 @@ MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param)
MxMatrix local2world = m_ambulance->GetLocal2World(); MxMatrix local2world = m_ambulance->GetLocal2World();
MxMatrix local2world2 = local2world; MxMatrix local2world2 = local2world;
LegoPathBoundary* boundary = m_unk0x1138->GetBoundary(); LegoPathBoundary* boundary = m_ambulanceActor->GetBoundary();
local2world[3][1] += 1.5; local2world[3][1] += 1.5;
local2world2[3][1] -= 0.1; local2world2[3][1] -= 0.1;
@ -656,7 +656,7 @@ MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param)
// FUNCTION: LEGO1 0x100516b0 // FUNCTION: LEGO1 0x100516b0
// FUNCTION: BETA10 0x1003bcbc // FUNCTION: BETA10 0x1003bcbc
MxResult LegoAct2::CreateBrick() MxResult LegoAct2::CreateDroppingBrick()
{ {
if (m_nextBrick > 4) { if (m_nextBrick > 4) {
return FAILURE; return FAILURE;
@ -668,7 +668,7 @@ MxResult LegoAct2::CreateBrick()
MxMatrix local2world = m_ambulance->GetLocal2World(); MxMatrix local2world = m_ambulance->GetLocal2World();
MxMatrix local2world2 = local2world; MxMatrix local2world2 = local2world;
LegoPathBoundary* boundary = m_unk0x1138->GetBoundary(); LegoPathBoundary* boundary = m_ambulanceActor->GetBoundary();
local2world[3][1] += 1.3; local2world[3][1] += 1.3;
local2world2[3][1] -= 0.1; local2world2[3][1] -= 0.1;
@ -680,7 +680,7 @@ MxResult LegoAct2::CreateBrick()
} }
// FUNCTION: LEGO1 0x100517b0 // FUNCTION: LEGO1 0x100517b0
void LegoAct2::FUN_100517b0() void LegoAct2::CreateBrick()
{ {
Act2Brick& brick = m_bricks[m_nextBrick]; Act2Brick& brick = m_bricks[m_nextBrick];
brick.Create(m_nextBrick); brick.Create(m_nextBrick);
@ -708,7 +708,7 @@ void LegoAct2::PlayMusic(JukeboxScript::Script p_objectId)
// FUNCTION: LEGO1 0x10051900 // FUNCTION: LEGO1 0x10051900
// FUNCTION: BETA10 0x1003bed1 // FUNCTION: BETA10 0x1003bed1
void LegoAct2::FUN_10051900() void LegoAct2::DisableAnimations()
{ {
if (AnimationManager()) { if (AnimationManager()) {
AnimationManager()->Suspend(); AnimationManager()->Suspend();
@ -931,7 +931,7 @@ MxResult LegoAct2::BadEnding()
m_bricks[i].Remove(); m_bricks[i].Remove();
} }
LegoPathActor* actor = m_unk0x1138; LegoPathActor* actor = m_ambulanceActor;
actor->SetActorState(LegoPathActor::c_disabled); actor->SetActorState(LegoPathActor::c_disabled);
m_gameState->SetState(LegoAct2State::c_badEnding); m_gameState->SetState(LegoAct2State::c_badEnding);
@ -1095,7 +1095,7 @@ MxResult LegoAct2::StartAction(
MxBool p_ignoreCurrentAction, MxBool p_ignoreCurrentAction,
Mx3DPointFloat* p_location, Mx3DPointFloat* p_location,
Mx3DPointFloat* p_direction, Mx3DPointFloat* p_direction,
Mx3DPointFloat* p_param6 Mx3DPointFloat* p_up
) )
{ {
if (m_currentAction == (Act2mainScript::Script) 0 || p_ignoreCurrentAction) { if (m_currentAction == (Act2mainScript::Script) 0 || p_ignoreCurrentAction) {
@ -1139,19 +1139,19 @@ MxResult LegoAct2::StartAction(
oneVectorNotNull = TRUE; oneVectorNotNull = TRUE;
} }
if (p_param6) { if (p_up) {
matrix[1][0] = (*p_param6)[0]; matrix[1][0] = (*p_up)[0];
matrix[1][1] = (*p_param6)[1]; matrix[1][1] = (*p_up)[1];
matrix[1][2] = (*p_param6)[2]; matrix[1][2] = (*p_up)[2];
oneVectorNotNull = TRUE; oneVectorNotNull = TRUE;
} }
Vector3 firstColumn(matrix[0]); Vector3 right(matrix[0]);
Vector3 secondColumn(matrix[1]); Vector3 up(matrix[1]);
Vector3 thirdColumn(matrix[2]); Vector3 dir(matrix[2]);
firstColumn.EqualsCross(secondColumn, thirdColumn); right.EqualsCross(up, dir);
firstColumn.Unitize(); right.Unitize();
MxMatrix* pmatrix = NULL; MxMatrix* pmatrix = NULL;
@ -1201,28 +1201,28 @@ MxResult LegoAct2::StartAction(
// FUNCTION: BETA10 0x10014aa8 // FUNCTION: BETA10 0x10014aa8
MxResult LegoAct2::InitializeShooting() MxResult LegoAct2::InitializeShooting()
{ {
LegoPathActor* actor = m_unk0x1138; LegoPathActor* actor = m_ambulanceActor;
LegoLocomotionAnimPresenter* ap; LegoLocomotionAnimPresenter* ap;
PlaceActor(actor, "EDG01_27", 2, 0.5f, 0, 0.5f); PlaceActor(actor, "EDG01_27", 2, 0.5f, 0, 0.5f);
ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "Ambul_Anim0"); ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "Ambul_Anim0");
assert(ap); assert(ap);
ap->CreateROIAndBuildMap(m_unk0x1138, 0.0f); ap->CreateROIAndBuildMap(m_ambulanceActor, 0.0f);
ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "Ambul_Anim2"); ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "Ambul_Anim2");
assert(ap); assert(ap);
ap->CreateROIAndBuildMap(m_unk0x1138, 6.0f); ap->CreateROIAndBuildMap(m_ambulanceActor, 6.0f);
ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "Ambul_Anim3"); ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "Ambul_Anim3");
assert(ap); assert(ap);
ap->CreateROIAndBuildMap(m_unk0x1138, 3.0f); ap->CreateROIAndBuildMap(m_ambulanceActor, 3.0f);
ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "BrShoot"); ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "BrShoot");
assert(ap); assert(ap);
ap->CreateROIAndBuildMap(m_unk0x1138, -1.0f); ap->CreateROIAndBuildMap(m_ambulanceActor, -1.0f);
actor->SetWorldSpeed(0.0f); actor->SetWorldSpeed(0.0f);
m_unk0x1138->InitializeNextShot(); m_ambulanceActor->InitializeNextShot();
return SUCCESS; return SUCCESS;
} }