From dd1c11a9331541960c7774ca90bd340fa128658a Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 13 Jun 2024 16:09:14 -0400 Subject: [PATCH] Fix camera glitch (#1031) --- LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp | 4 ++-- LEGO1/lego/sources/roi/legoroi.cpp | 8 +++----- LEGO1/mxgeometry/mxgeometry3d.h | 6 +++--- LEGO1/realtime/vector.h | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 6037712e..dce362c3 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2790,7 +2790,7 @@ void LegoAnimationManager::FUN_10064b50(MxLong p_time) if (m_unk0x430 && m_unk0x42c != NULL) { MxMatrix mat; - if (p_time < 0 || p_time <= m_unk0x438) { + if (p_time < 0 || m_unk0x438 <= p_time) { m_unk0x430 = FALSE; m_unk0x42c->m_flags &= ~LegoTranInfo::c_bit1; m_unk0x42c = NULL; @@ -2807,7 +2807,7 @@ void LegoAnimationManager::FUN_10064b50(MxLong p_time) m_unk0x4cc.Unknown6(mat, (float) (p_time - m_unk0x434) / 1000.0f); VPV3(mat[3], m_unk0x43c[3], sub); - mat[3][4] = 1.0f; + mat[3][3] = 1.0f; } LegoROI* viewROI = VideoManager()->GetViewROI(); diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index c2f35dae..a11436f3 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -706,12 +706,10 @@ void TimeROI::FUN_100a9b40(Matrix4& p_matrix, LegoTime p_time) m_time = p_time; Mx3DPointFloat targetPosition(p_matrix[3]); + Vector3 vec(m_local2world[3]); - // TODO: Figure out how to get type right for the call - ((Vector3&) targetPosition).Sub(Vector3(m_local2world[3])); - - float division = time * 0.001; - ((Vector3&) targetPosition).Div(division); + ((Vector3&) targetPosition).Sub(vec); + ((Vector3&) targetPosition).Div(time * 0.001); FUN_100a5a30(targetPosition); } diff --git a/LEGO1/mxgeometry/mxgeometry3d.h b/LEGO1/mxgeometry/mxgeometry3d.h index 61fdac1d..3f52b2e2 100644 --- a/LEGO1/mxgeometry/mxgeometry3d.h +++ b/LEGO1/mxgeometry/mxgeometry3d.h @@ -183,9 +183,9 @@ inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f) if (d1 + 1.0 > 0.00001) { if (1.0 - d1 > 0.00001) { double d = acos(d1); - sin(d); - d1 = sin((1.0 - p_f) * d) / sin(d); - d2 = sin(p_f * d) / sin(d); + double s = sin(d); + d1 = sin((1.0 - p_f) * d) / s; + d2 = sin(p_f * d) / s; } else { d1 = 1.0 - p_f; diff --git a/LEGO1/realtime/vector.h b/LEGO1/realtime/vector.h index 3fd82220..cfccb6f4 100644 --- a/LEGO1/realtime/vector.h +++ b/LEGO1/realtime/vector.h @@ -138,7 +138,7 @@ public: virtual void Mul(const float& p_value) { MulScalarImpl((float*) &p_value); } // vtable+0x5c // FUNCTION: LEGO1 0x10002240 - virtual void Div(float& p_value) { DivScalarImpl(&p_value); } // vtable+0x68 + virtual void Div(const float& p_value) { DivScalarImpl((float*) &p_value); } // vtable+0x68 // FUNCTION: LEGO1 0x10002250 virtual void SetVector(float* p_other) { EqualsImpl(p_other); } // vtable+0x70