summaryrefslogtreecommitdiffstats
path: root/src/math/Matrix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/Matrix.cpp')
-rw-r--r--src/math/Matrix.cpp29
1 files changed, 3 insertions, 26 deletions
diff --git a/src/math/Matrix.cpp b/src/math/Matrix.cpp
index a8b1b182..3ac3e2b9 100644
--- a/src/math/Matrix.cpp
+++ b/src/math/Matrix.cpp
@@ -458,62 +458,39 @@ CMatrix &
Invert(const CMatrix &src, CMatrix &dst)
{
// TODO: VU0 code
- // GTA handles this as a raw 4x4 orthonormal matrix
- // and trashes the RW flags, let's not do that
float (*scr_fm)[4] = (float (*)[4])&src.m_matrix;
float (*dst_fm)[4] = (float (*)[4])&dst.m_matrix;
dst_fm[3][0] = dst_fm[3][1] = dst_fm[3][2] = 0.0f;
-#ifndef FIX_BUGS
- dst_fm[3][3] = scr_fm[3][3];
-#endif
dst_fm[0][0] = scr_fm[0][0];
dst_fm[0][1] = scr_fm[1][0];
dst_fm[0][2] = scr_fm[2][0];
-#ifndef FIX_BUGS
- dst_fm[0][3] = scr_fm[3][0];
-#endif
+
dst_fm[1][0] = scr_fm[0][1];
dst_fm[1][1] = scr_fm[1][1];
dst_fm[1][2] = scr_fm[2][1];
-#ifndef FIX_BUGS
- dst_fm[1][3] = scr_fm[3][1];
-#endif
+
dst_fm[2][0] = scr_fm[0][2];
dst_fm[2][1] = scr_fm[1][2];
dst_fm[2][2] = scr_fm[2][2];
-#ifndef FIX_BUGS
- dst_fm[2][3] = scr_fm[3][2];
-#endif
+
dst_fm[3][0] += dst_fm[0][0] * scr_fm[3][0];
dst_fm[3][1] += dst_fm[0][1] * scr_fm[3][0];
dst_fm[3][2] += dst_fm[0][2] * scr_fm[3][0];
-#ifndef FIX_BUGS
- dst_fm[3][3] += dst_fm[0][3] * scr_fm[3][0];
-#endif
dst_fm[3][0] += dst_fm[1][0] * scr_fm[3][1];
dst_fm[3][1] += dst_fm[1][1] * scr_fm[3][1];
dst_fm[3][2] += dst_fm[1][2] * scr_fm[3][1];
-#ifndef FIX_BUGS
- dst_fm[3][3] += dst_fm[1][3] * scr_fm[3][1];
-#endif
dst_fm[3][0] += dst_fm[2][0] * scr_fm[3][2];
dst_fm[3][1] += dst_fm[2][1] * scr_fm[3][2];
dst_fm[3][2] += dst_fm[2][2] * scr_fm[3][2];
-#ifndef FIX_BUGS
- dst_fm[3][3] += dst_fm[2][3] * scr_fm[3][2];
-#endif
dst_fm[3][0] = -dst_fm[3][0];
dst_fm[3][1] = -dst_fm[3][1];
dst_fm[3][2] = -dst_fm[3][2];
-#ifndef FIX_BUGS
- dst_fm[3][3] = scr_fm[3][3] - dst_fm[3][3];
-#endif
return dst;
}