diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 30d72d41..ac85dd89 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -188,7 +188,8 @@ class LegoAnimationManager : public MxCore { MxBool m_suspended; // 0x42b LegoTranInfo* m_unk0x42c; // 0x42c MxBool m_unk0x430; // 0x430 - undefined4 m_unk0x434[2]; // 0x434 + MxLong m_unk0x434; // 0x434 + MxLong m_unk0x438; // 0x438 MxMatrix m_unk0x43c; // 0x43c MxMatrix m_unk0x484; // 0x484 UnknownMx4DPointFloat m_unk0x4cc; // 0x4cc diff --git a/LEGO1/lego/legoomni/include/legotraninfo.h b/LEGO1/lego/legoomni/include/legotraninfo.h index 3ded0903..aa35f31c 100644 --- a/LEGO1/lego/legoomni/include/legotraninfo.h +++ b/LEGO1/lego/legoomni/include/legotraninfo.h @@ -13,6 +13,7 @@ class MxPresenter; // SIZE 0x78 struct LegoTranInfo { enum { + c_bit1 = 0x01, c_bit2 = 0x02 }; diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 812d9d93..c82a12e5 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1,5 +1,6 @@ #include "legoanimationmanager.h" +#include "3dmanager/lego3dmanager.h" #include "anim/legoanim.h" #include "animstate.h" #include "define.h" @@ -13,6 +14,7 @@ #include "legomain.h" #include "legonavcontroller.h" #include "legoroilist.h" +#include "legosoundmanager.h" #include "legovideomanager.h" #include "legoworld.h" #include "misc.h" @@ -25,6 +27,7 @@ #include "viewmanager/viewmanager.h" #include +#include DECOMP_SIZE_ASSERT(LegoAnimationManager, 0x500) DECOMP_SIZE_ASSERT(LegoAnimationManager::Character, 0x18) @@ -1863,9 +1866,42 @@ void LegoAnimationManager::FUN_100648f0(LegoTranInfo*, MxLong) // TODO } -// STUB: LEGO1 0x10064b50 +// FUNCTION: LEGO1 0x10064b50 // FUNCTION: BETA10 0x10045f14 void LegoAnimationManager::FUN_10064b50(MxLong p_time) { - // TODO + if (m_unk0x430 && m_unk0x42c != NULL) { + MxMatrix mat; + + if (p_time < 0 || p_time <= m_unk0x438) { + m_unk0x430 = FALSE; + m_unk0x42c->m_flags &= ~LegoTranInfo::c_bit1; + m_unk0x42c = NULL; + mat = m_unk0x484; + } + else { + float und = (float) (p_time - m_unk0x434) / (float) (m_unk0x438 - m_unk0x434); + + float sub[3]; + sub[0] = (m_unk0x484[3][0] - m_unk0x43c[3][0]) * und; + sub[1] = (m_unk0x484[3][1] - m_unk0x43c[3][1]) * und; + sub[2] = (m_unk0x484[3][2] - m_unk0x43c[3][2]) * und; + + m_unk0x4cc.Unknown_100040a0(mat, (float) (p_time - m_unk0x434) / 1000.0f); + + VPV3(mat[3], m_unk0x43c[3], sub); + mat[3][4] = 1.0f; + } + + LegoROI* viewROI = VideoManager()->GetViewROI(); + + viewROI->WrappedSetLocalTransform(mat); + VideoManager()->Get3DManager()->Moved(*viewROI); + SoundManager()->FUN_1002a410( + viewROI->GetWorldPosition(), + viewROI->GetWorldDirection(), + viewROI->GetWorldUp(), + viewROI->GetWorldVelocity() + ); + } } diff --git a/LEGO1/mxgeometry/mxgeometry3d.h b/LEGO1/mxgeometry/mxgeometry3d.h index a214e25a..bd4cc24a 100644 --- a/LEGO1/mxgeometry/mxgeometry3d.h +++ b/LEGO1/mxgeometry/mxgeometry3d.h @@ -100,6 +100,7 @@ class UnknownMx4DPointFloat { undefined4 m_unk0x30; // 0x30 }; +// FUNCTION: BETA10 0x1004aaa0 int UnknownMx4DPointFloat::Unknown_100040a0(Matrix4& p_matrix, float p_f) { float data[4]; @@ -114,6 +115,7 @@ int UnknownMx4DPointFloat::Unknown_100040a0(Matrix4& p_matrix, float p_f) } // FUNCTION: LEGO1 0x100040a0 +// FUNCTION: BETA10 0x1004ab10 inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f) { undefined4 state = m_unk0x30; @@ -136,7 +138,7 @@ inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f) if (1.0 - d1 > 0.00001) { double d = acos(d1); sin(d); - d1 = sin((1 - p_f) * d) / sin(d); + d1 = sin((1.0 - p_f) * d) / sin(d); d2 = sin(p_f * d) / sin(d); } else { @@ -150,7 +152,7 @@ inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f) } else { p_v[0] = -m_unk0x00[1]; - p_v[1] = m_unk0x00[1]; + p_v[1] = m_unk0x00[0]; p_v[2] = -m_unk0x00[3]; p_v[3] = m_unk0x00[2]; d1 = sin((1.0 - p_f) * 1.570796326794895); diff --git a/LEGO1/mxgeometry/mxmatrix.h b/LEGO1/mxgeometry/mxmatrix.h index f6d0cece..916abda7 100644 --- a/LEGO1/mxgeometry/mxmatrix.h +++ b/LEGO1/mxgeometry/mxmatrix.h @@ -21,8 +21,6 @@ class MxMatrix : public Matrix4 { // FUNCTION: LEGO1 0x10002850 void operator=(const Matrix4& p_matrix) override { Equals(p_matrix); } // vtable+0x28 - // No idea why there's another equals. Maybe to some other type like the - // DirectX Retained Mode Matrix type which is also a float* alias? // FUNCTION: LEGO1 0x10002860 virtual void operator=(const MxMatrix& p_matrix) { Equals(p_matrix); } // vtable+0x48