diff options
author | Paul Gilbert | 2017-05-23 22:31:55 -0400 |
---|---|---|
committer | Paul Gilbert | 2017-05-23 22:31:55 -0400 |
commit | 31c2aa8d246d7b5792007422f8cc17d97e78371b (patch) | |
tree | 4f0a2a66c7721889192d2aed723d3ea2c868b389 /engines | |
parent | bf3d66d46b3d01a738f73caf88c070dacca9c3c9 (diff) | |
download | scummvm-rg350-31c2aa8d246d7b5792007422f8cc17d97e78371b.tar.gz scummvm-rg350-31c2aa8d246d7b5792007422f8cc17d97e78371b.tar.bz2 scummvm-rg350-31c2aa8d246d7b5792007422f8cc17d97e78371b.zip |
TITANIC: Rename DMatrix fn3 to loadTransform
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/star_control/dmatrix.cpp | 65 | ||||
-rw-r--r-- | engines/titanic/star_control/dmatrix.h | 3 | ||||
-rw-r--r-- | engines/titanic/star_control/dvector.h | 4 | ||||
-rw-r--r-- | engines/titanic/star_control/orientation_changer.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub24.cpp | 3 |
5 files changed, 38 insertions, 39 deletions
diff --git a/engines/titanic/star_control/dmatrix.cpp b/engines/titanic/star_control/dmatrix.cpp index 547758a4b7..93268d1187 100644 --- a/engines/titanic/star_control/dmatrix.cpp +++ b/engines/titanic/star_control/dmatrix.cpp @@ -174,43 +174,34 @@ DMatrix DMatrix::fn1() const { return m; } -void DMatrix::fn3(const CMatrixTransform &src) { - double v3, v4, v5, v6, v7, v8, v9, v10; - double v11, v12, v13, v14, v15, v16, v17, v18, v19, v20; - - v3 = src.fn1(); - if (v3 <= 0.0) - v20 = 0.0; - else - v20 = 2.0 / v3; - v4 = v20 * src._vector._x; - v5 = v20 * src._vector._y; - v6 = v20 * src._vector._z; - v7 = v4 * src._vector._x; - v8 = v4; - v9 = v5; - v10 = v5 * src._vector._x; - v11 = v5 * src._vector._y; - v12 = v6; - v13 = v8 * src._field0; - v14 = v12 + v11; - v15 = v6 * src._vector._y; - v16 = v6 * src._field0; - v17 = v11 + v7; - v18 = v6 * src._vector._x; - v19 = v9 * src._field0; - _row1._x = 1.0 - v14; - _row1._y = v10 + v16; - _row1._z = v18 - v19; - _row2._x = v10 - v16; - _row2._y = 1.0 - (v12 + v7); - _row2._z = v15 + v13; - _row3._x = v18 + v19; - _row3._y = v15 - v13; - _row3._z = 1.0 - v17; - _row4._x = 0.0; - _row4._y = 0.0; - _row4._z = 0.0; +void DMatrix::loadTransform(const CMatrixTransform &src) { + double total = src.fn1(); + double factor = (total <= 0.0) ? 0.0 : 2.0 / total; + DVector tempV = src._vector * factor; + + double val1 = tempV._x * src._vector._x; + double val2 = tempV._y * src._vector._x; + double val3 = tempV._y * src._vector._y; + double val4 = tempV._x * src._field0; + double val5 = tempV._z + val3; + double val6 = tempV._z * src._vector._y; + double val7 = tempV._z * src._field0; + double val8 = val3 + val1; + double val9 = tempV._z * src._vector._x; + double val10 = tempV._y * src._field0; + + _row1._x = 1.0 - val5; + _row1._y = val2 + val7; + _row1._z = val9 - val10; + _row2._x = val2 - val7; + _row2._y = 1.0 - (tempV._z + val1); + _row2._z = val6 + val4; + _row3._x = val9 + val10; + _row3._y = val6 - val4; + _row3._z = 1.0 - val8; + _row4._x = 0; + _row4._y = 0; + _row4._z = 0; } DMatrix DMatrix::fn4(const DMatrix &m) { diff --git a/engines/titanic/star_control/dmatrix.h b/engines/titanic/star_control/dmatrix.h index a41fc86ce7..1cc36167df 100644 --- a/engines/titanic/star_control/dmatrix.h +++ b/engines/titanic/star_control/dmatrix.h @@ -58,7 +58,8 @@ public: void setRotationMatrix(Axis axis, double amount); DMatrix fn1() const; - void fn3(const CMatrixTransform &src); + + void loadTransform(const CMatrixTransform &src); DMatrix fn4(const DMatrix &m); }; diff --git a/engines/titanic/star_control/dvector.h b/engines/titanic/star_control/dvector.h index d3638cfeac..e64933ad3b 100644 --- a/engines/titanic/star_control/dvector.h +++ b/engines/titanic/star_control/dvector.h @@ -87,6 +87,10 @@ public: _y -= delta._y; _z -= delta._z; } + + const DVector operator*(double right) const { + return DVector(_x * right, _y * right, _z * right); + } }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/orientation_changer.cpp b/engines/titanic/star_control/orientation_changer.cpp index b71ad07b8e..1aff475cf0 100644 --- a/engines/titanic/star_control/orientation_changer.cpp +++ b/engines/titanic/star_control/orientation_changer.cpp @@ -42,7 +42,7 @@ FMatrix COrientationChanger::getOrientation(double percent) { CMatrixTransform tfm = _sub1.fn5(percent, _sub2); DMatrix m1; - m1.fn3(tfm); + m1.loadTransform(tfm); return m1; } } diff --git a/engines/titanic/star_control/star_control_sub24.cpp b/engines/titanic/star_control/star_control_sub24.cpp index 48ed807c88..d7f6b7e871 100644 --- a/engines/titanic/star_control/star_control_sub24.cpp +++ b/engines/titanic/star_control/star_control_sub24.cpp @@ -86,6 +86,8 @@ int CStarControlSub24::proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orien if (!_active) return 0; + // Firstly we have to do a transition of the camera orientation from + // it's current position to one where the destination star is centered if (_transitionPercent < 1.0) { _transitionPercent += _transitionPercentInc; orientation = _orientationChanger.getOrientation(_transitionPercent); @@ -93,6 +95,7 @@ int CStarControlSub24::proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orien return 1; } + // From here on, we handle the movement to the given destination if (!_field34) { _active = false; return 2; |