diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/star_control/dmatrix.cpp | 14 | ||||
-rw-r--r-- | engines/titanic/star_control/dmatrix.h | 8 |
2 files changed, 12 insertions, 10 deletions
diff --git a/engines/titanic/star_control/dmatrix.cpp b/engines/titanic/star_control/dmatrix.cpp index 2539352483..9fc7a85eb6 100644 --- a/engines/titanic/star_control/dmatrix.cpp +++ b/engines/titanic/star_control/dmatrix.cpp @@ -46,8 +46,8 @@ DMatrix::DMatrix(int mode, const FMatrix *src) { _frow2._z = src->_row2._z; } -DMatrix::DMatrix(int mode, double val) { - set(mode, val); +DMatrix::DMatrix(DAxis axis, double amount) { + setRotationMatrix(axis, amount); } DMatrix::DMatrix(const FMatrix &src) { @@ -65,13 +65,13 @@ void DMatrix::deinit() { _static = nullptr; } -void DMatrix::set(int mode, double amount) { +void DMatrix::setRotationMatrix(DAxis axis, double amount) { const double FACTOR = 0.0174532925199433; double sinVal = sin(amount * FACTOR); double cosVal = cos(amount * FACTOR); - switch (mode) { - case 0: + switch (axis) { + case X_AXIS: _row1._x = 1.0; _row2._y = cosVal; _row2._z = sinVal; @@ -79,7 +79,7 @@ void DMatrix::set(int mode, double amount) { _row3._z = cosVal; break; - case 1: + case Y_AXIS: _row1._x = cosVal; _row1._z = sinVal; _row2._y = 1.0; @@ -87,7 +87,7 @@ void DMatrix::set(int mode, double amount) { _row3._z = cosVal; break; - case 2: + case Z_AXIS: _row1._x = cosVal; _row1._y = sinVal; _row2._x = -sinVal; diff --git a/engines/titanic/star_control/dmatrix.h b/engines/titanic/star_control/dmatrix.h index b7fd8bf1c1..7d1f0e0f19 100644 --- a/engines/titanic/star_control/dmatrix.h +++ b/engines/titanic/star_control/dmatrix.h @@ -28,6 +28,8 @@ namespace Titanic { +enum DAxis { X_AXIS, Y_AXIS, Z_AXIS }; + class FMatrix; class CStarControlSub26; @@ -50,13 +52,13 @@ public: public: DMatrix(); DMatrix(int mode, const FMatrix *src); - DMatrix(int mode, double val); + DMatrix(DAxis axis, double amount); DMatrix(const FMatrix &src); /** - * Sets up data for the matrix + * Sets up a matrix for rotating on a given axis by a given amount */ - void set(int mode, double amount); + void setRotationMatrix(DAxis axis, double amount); void fn1(DMatrix &m); void fn3(CStarControlSub26 *sub26); |