diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index b1db65ea..42f333e1 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -67,11 +67,11 @@ class LegoAct2 : public LegoWorld { void SetUnknown0x1150(undefined4 p_unk0x1150) { m_unk0x1150 = p_unk0x1150; } undefined4 FUN_10052560( - undefined4 p_param1, + MxS32 p_param1, MxBool p_param2, MxBool p_param3, - Mx3DPointFloat* p_param4, - Mx3DPointFloat* p_param5, + Mx3DPointFloat* p_location, + Mx3DPointFloat* p_direction, Mx3DPointFloat* p_param6 ); @@ -81,15 +81,18 @@ class LegoAct2 : public LegoWorld { private: void FUN_10051900(); - Act2Brick m_bricks[10]; // 0x00f8 - undefined m_unk0x10c0; // 0x10c0 - undefined m_unk0x10c1; // 0x10c1 - undefined m_unk0x10c2; // 0x10c2 - undefined4 m_unk0x10c4; // 0x10c4 - undefined4 m_unk0x10c8; // 0x10c8 - LegoAct2State* m_gameState; // 0x10cc - MxS32 m_unk0x10d0; // 0x10d0 - char* m_unk0x10d4; // 0x10d4 + Act2Brick m_bricks[10]; // 0x00f8 + undefined m_unk0x10c0; // 0x10c0 + undefined m_unk0x10c1; // 0x10c1 + undefined m_unk0x10c2; // 0x10c2 + undefined4 m_unk0x10c4; // 0x10c4 + undefined4 m_unk0x10c8; // 0x10c8 + LegoAct2State* m_gameState; // 0x10cc + MxS32 m_unk0x10d0; // 0x10d0 + + // variable name verified by BETA10 0x10014633 + char* m_siFile; // 0x10d4 + LegoROI* m_unk0x10d8; // 0x10d8 MxMatrix m_unk0x10dc; // 0x10dc undefined4 m_unk0x1124; // 0x1124 diff --git a/LEGO1/lego/legoomni/src/main/legomain.cpp b/LEGO1/lego/legoomni/src/main/legomain.cpp index 4641d548..7fc35185 100644 --- a/LEGO1/lego/legoomni/src/main/legomain.cpp +++ b/LEGO1/lego/legoomni/src/main/legomain.cpp @@ -488,6 +488,7 @@ const char* LegoOmni::GetWorldName(MxU32 p_id) } // FUNCTION: LEGO1 0x1005b460 +// FUNCTION: BETA10 0x1008edd8 MxAtomId* LegoOmni::GetWorldAtom(MxU32 p_id) { for (MxS32 i = 0; i < 19; i++) { @@ -496,6 +497,8 @@ MxAtomId* LegoOmni::GetWorldAtom(MxU32 p_id) } } + // A gem from BETA10 + assert("Hey, check your code. We do not have this world." == NULL); return NULL; } diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index 65f9cf22..0038928c 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -3,6 +3,7 @@ #include "act2actor.h" #include "act2main_actions.h" #include "actions/act2main_actions.h" +#include "actions/infomain_actions.h" #include "islepathactor.h" #include "legoanimationmanager.h" #include "legogamestate.h" @@ -55,7 +56,7 @@ LegoAct2::LegoAct2() m_unk0x1144 = 0; m_unk0x1150 = 0; m_unk0x10c8 = 0; - m_unk0x10d4 = ""; + m_siFile = ""; m_unk0x113c = 5; NotificationManager()->Register(this); } @@ -299,17 +300,94 @@ MxBool LegoAct2::Escape() return TRUE; } -// STUB: LEGO1 0x10052560 -// STUB: BETA10 0x100145c6 +// FUNCTION: LEGO1 0x10052560 +// FUNCTION: BETA10 0x100145c6 undefined4 LegoAct2::FUN_10052560( - undefined4 p_param1, + MxS32 p_param1, MxBool p_param2, MxBool p_param3, - Mx3DPointFloat* p_param4, - Mx3DPointFloat* p_param5, + Mx3DPointFloat* p_location, + Mx3DPointFloat* p_direction, Mx3DPointFloat* p_param6 ) { - // TODO + + if (m_unk0x1140 == 0 || p_param3) { + assert(strlen(m_siFile)); + + if (!p_param2) { + MxDSAction action; + + action.SetObjectId(p_param1); + // not entirely sure about the constant + action.SetAtomId(*Lego()->GetWorldAtom(InfomainScript::c_Cop_Ctl)); + + if (p_location) { + action.SetUp(Mx3DPointFloat(0.0f, 1.0f, 0.0f)); + action.SetLocation(*p_location); + } + + if (p_direction) { + action.SetDirection(*p_direction); + } + + StartActionIfUnknown0x13c(action); + } + else { + MxMatrix matrix; + + matrix.SetIdentity(); + MxBool oneVectorNotNull = FALSE; + + if (p_location) { + matrix[3][0] = (*p_location)[0]; + matrix[3][1] = (*p_location)[1]; + matrix[3][2] = (*p_location)[2]; + oneVectorNotNull = TRUE; + } + + if (p_direction) { + matrix[2][0] = (*p_direction)[0]; + matrix[2][1] = (*p_direction)[1]; + matrix[2][2] = (*p_direction)[2]; + oneVectorNotNull = TRUE; + } + + if (p_param6) { + matrix[1][0] = (*p_param6)[0]; + matrix[1][1] = (*p_param6)[1]; + matrix[1][2] = (*p_param6)[2]; + oneVectorNotNull = TRUE; + } + + Vector3 firstColumn(matrix[0]); + Vector3 secondColumn(matrix[1]); + Vector3 thirdColumn(matrix[2]); + + firstColumn.EqualsCross(&secondColumn, &thirdColumn); + firstColumn.Unitize(); + + MxMatrix* pmatrix = NULL; + + if (oneVectorNotNull) { + pmatrix = &matrix; + } + + MxResult result; + + if (p_param1 == Act2mainScript::c_tja009ni_RunAnim) { + result = AnimationManager()->FUN_10060dc0(p_param1, pmatrix, TRUE, FALSE, NULL, TRUE, TRUE, TRUE, TRUE); + } + else { + result = + AnimationManager()->FUN_10060dc0(p_param1, pmatrix, TRUE, FALSE, NULL, TRUE, TRUE, TRUE, FALSE); + } + + if (result == SUCCESS) { + m_unk0x1140 = p_param1; + } + } + } + return 0; } diff --git a/LEGO1/omni/include/mxdsaction.h b/LEGO1/omni/include/mxdsaction.h index a68dbc51..b678289a 100644 --- a/LEGO1/omni/include/mxdsaction.h +++ b/LEGO1/omni/include/mxdsaction.h @@ -94,9 +94,15 @@ class MxDSAction : public MxDSObject { // FUNCTION: BETA10 0x1003dbb0 Vector3& GetUp() { return m_up; } + // FUNCTION: BETA10 0x100153b0 void SetLocation(const Vector3& p_location) { m_location = p_location; } + + // FUNCTION: BETA10 0x100153f0 void SetDirection(const Vector3& p_direction) { m_direction = p_direction; } + + // FUNCTION: BETA10 0x10015430 void SetUp(const Vector3& p_up) { m_up = p_up; } + MxCore* GetUnknown84() { return m_unk0x84; } void SetUnknown84(MxCore* p_unk0x84) { m_unk0x84 = p_unk0x84; } MxCore* GetOrigin() { return m_origin; }