From dc5645cb113bc88a5e07393b4adf251d0037acf1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 12 Jul 2017 19:20:11 -0400 Subject: TITANIC: Change rows to cols in DMatrix, thanks to wjp --- engines/titanic/star_control/star_camera.cpp | 80 ++++++++++++++-------------- 1 file changed, 40 insertions(+), 40 deletions(-) (limited to 'engines/titanic/star_control/star_camera.cpp') diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp index c715daf356..d3487e2f65 100644 --- a/engines/titanic/star_control/star_camera.cpp +++ b/engines/titanic/star_control/star_camera.cpp @@ -465,10 +465,10 @@ void CStarCamera::lockMarker2(CViewport *viewport, const FVector &v) { DVector tempV2 = _viewport._position; DMatrix m4; - m4._row1 = viewport->_position; - m4._row2 = DVector(0.0, 0.0, 0.0); - m4._row3 = DVector(0.0, 0.0, 0.0); - m4._row4 = DVector(0.0, 0.0, 0.0); + m4._col1 = viewport->_position; + m4._col2 = DVector(0.0, 0.0, 0.0); + m4._col3 = DVector(0.0, 0.0, 0.0); + m4._col4 = DVector(0.0, 0.0, 0.0); FMatrix m5 = viewport->getOrientation(); double yVal1 = m5._row1._y * 1000000.0; @@ -476,39 +476,39 @@ void CStarCamera::lockMarker2(CViewport *viewport, const FVector &v) { double xVal1 = m5._row2._x * 1000000.0; double yVal2 = m5._row2._y * 1000000.0; double zVal2 = m5._row2._z * 1000000.0; - double zVal3 = zVal1 + m4._row1._z; - double yVal3 = yVal1 + m4._row1._y; - double xVal2 = m5._row1._x * 1000000.0 + m4._row1._x; - double zVal4 = zVal2 + m4._row1._z; - double yVal4 = yVal2 + m4._row1._y; - double xVal3 = xVal1 + m4._row1._x; + double zVal3 = zVal1 + m4._col1._z; + double yVal3 = yVal1 + m4._col1._y; + double xVal2 = m5._row1._x * 1000000.0 + m4._col1._x; + double zVal4 = zVal2 + m4._col1._z; + double yVal4 = yVal2 + m4._col1._y; + double xVal3 = xVal1 + m4._col1._x; DVector tempV4(xVal2, yVal3, zVal3); DVector tempV3(xVal3, yVal4, zVal4); - m4._row3 = tempV4; + m4._col3 = tempV4; FVector tempV5; tempV5._x = m5._row3._x * 1000000.0; tempV5._y = m5._row3._y * 1000000.0; - m4._row2 = tempV3; + m4._col2 = tempV3; - tempV3._x = tempV5._x + m4._row1._x; - tempV3._y = tempV5._y + m4._row1._y; - tempV3._z = m5._row3._z * 1000000.0 + m4._row1._z; - m4._row4 = tempV3; + tempV3._x = tempV5._x + m4._col1._x; + tempV3._y = tempV5._y + m4._col1._y; + tempV3._z = m5._row3._z * 1000000.0 + m4._col1._z; + m4._col4 = tempV3; tempV2 = tempV2.fn1(m2); - m4._row1 = m4._row1.fn1(m2); - m4._row3 = m4._row3.fn1(m2); - m4._row2 = m4._row2.fn1(m2); - m4._row4 = m4._row4.fn1(m2); + m4._col1 = m4._col1.fn1(m2); + m4._col3 = m4._col3.fn1(m2); + m4._col2 = m4._col2.fn1(m2); + m4._col4 = m4._col4.fn1(m2); // Find the angle that gives the minimum distance DVector tempPos; double minDistance = 1.0e20; int minDegree = 0; for (int degree = 0; degree < 360; ++degree) { - tempPos = m4._row1; + tempPos = m4._col1; tempPos.fn2((double)degree); double distance = tempV2.getDistance(tempPos); @@ -518,25 +518,25 @@ void CStarCamera::lockMarker2(CViewport *viewport, const FVector &v) { } } - m4._row1.fn2((double)minDegree); - m4._row2.fn2((double)minDegree); - m4._row3.fn2((double)minDegree); - m4._row4.fn2((double)minDegree); - m4._row1 = m4._row1.fn1(m1); - m4._row2 = m4._row2.fn1(m1); - m4._row3 = m4._row3.fn1(m1); - m4._row4 = m4._row4.fn1(m1); - - m4._row3 -= m4._row1; - m4._row2 -= m4._row1; - m4._row4 -= m4._row1; - - m4._row3.normalize(); - m4._row2.normalize(); - m4._row4.normalize(); - m5.set(m4._row3, m4._row2, m4._row4); - - FVector newPos = m4._row1; + m4._col1.fn2((double)minDegree); + m4._col2.fn2((double)minDegree); + m4._col3.fn2((double)minDegree); + m4._col4.fn2((double)minDegree); + m4._col1 = m4._col1.fn1(m1); + m4._col2 = m4._col2.fn1(m1); + m4._col3 = m4._col3.fn1(m1); + m4._col4 = m4._col4.fn1(m1); + + m4._col3 -= m4._col1; + m4._col2 -= m4._col1; + m4._col4 -= m4._col1; + + m4._col3.normalize(); + m4._col2.normalize(); + m4._col4.normalize(); + m5.set(m4._col3, m4._col2, m4._col4); + + FVector newPos = m4._col1; FMatrix m6 = _viewport.getOrientation(); _mover->proc8(_viewport._position, newPos, m6, m5); -- cgit v1.2.3