diff options
author | Paul Gilbert | 2017-03-12 20:18:53 -0400 |
---|---|---|
committer | Paul Gilbert | 2017-03-12 20:18:53 -0400 |
commit | a5e00ad98796c5a7d2f8ddaca817e0ec3a444290 (patch) | |
tree | 533c357be3ce76f2eaaa881dffab6018314386b8 /engines | |
parent | 3bfc3f77dc7f47a5cc6ee8b615a9e87e8f3db51a (diff) | |
download | scummvm-rg350-a5e00ad98796c5a7d2f8ddaca817e0ec3a444290.tar.gz scummvm-rg350-a5e00ad98796c5a7d2f8ddaca817e0ec3a444290.tar.bz2 scummvm-rg350-a5e00ad98796c5a7d2f8ddaca817e0ec3a444290.zip |
TITANIC: More matrix renamings
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/star_control/dmatrix.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/star_control/dmatrix.h | 6 | ||||
-rw-r--r-- | engines/titanic/star_control/fvector.h | 2 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub13.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub6.cpp | 14 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub6.h | 6 | ||||
-rw-r--r-- | engines/titanic/star_control/star_view.cpp | 6 |
7 files changed, 22 insertions, 22 deletions
diff --git a/engines/titanic/star_control/dmatrix.cpp b/engines/titanic/star_control/dmatrix.cpp index 9fc7a85eb6..1405f4f693 100644 --- a/engines/titanic/star_control/dmatrix.cpp +++ b/engines/titanic/star_control/dmatrix.cpp @@ -46,7 +46,7 @@ DMatrix::DMatrix(int mode, const FMatrix *src) { _frow2._z = src->_row2._z; } -DMatrix::DMatrix(DAxis axis, double amount) { +DMatrix::DMatrix(Axis axis, double amount) { setRotationMatrix(axis, amount); } @@ -65,7 +65,7 @@ void DMatrix::deinit() { _static = nullptr; } -void DMatrix::setRotationMatrix(DAxis axis, double amount) { +void DMatrix::setRotationMatrix(Axis axis, double amount) { const double FACTOR = 0.0174532925199433; double sinVal = sin(amount * FACTOR); double cosVal = cos(amount * FACTOR); diff --git a/engines/titanic/star_control/dmatrix.h b/engines/titanic/star_control/dmatrix.h index 7d1f0e0f19..a015ebdb1d 100644 --- a/engines/titanic/star_control/dmatrix.h +++ b/engines/titanic/star_control/dmatrix.h @@ -28,8 +28,6 @@ namespace Titanic { -enum DAxis { X_AXIS, Y_AXIS, Z_AXIS }; - class FMatrix; class CStarControlSub26; @@ -52,13 +50,13 @@ public: public: DMatrix(); DMatrix(int mode, const FMatrix *src); - DMatrix(DAxis axis, double amount); + DMatrix(Axis axis, double amount); DMatrix(const FMatrix &src); /** * Sets up a matrix for rotating on a given axis by a given amount */ - void setRotationMatrix(DAxis axis, double amount); + void setRotationMatrix(Axis axis, double amount); void fn1(DMatrix &m); void fn3(CStarControlSub26 *sub26); diff --git a/engines/titanic/star_control/fvector.h b/engines/titanic/star_control/fvector.h index 83f0039aaa..bf446fc640 100644 --- a/engines/titanic/star_control/fvector.h +++ b/engines/titanic/star_control/fvector.h @@ -27,6 +27,8 @@ namespace Titanic { +enum Axis { X_AXIS, Y_AXIS, Z_AXIS }; + class CStarControlSub6; /** diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/star_control_sub13.cpp index cd7f0bb5d6..1cd55382fc 100644 --- a/engines/titanic/star_control/star_control_sub13.cpp +++ b/engines/titanic/star_control/star_control_sub13.cpp @@ -158,9 +158,9 @@ void CStarControlSub13::set1C(double v) { void CStarControlSub13::fn12() { _matrix.identity(); - CStarControlSub6 m1(0, g_vm->getRandomNumber(359)); - CStarControlSub6 m2(1, g_vm->getRandomNumber(359)); - CStarControlSub6 m3(2, g_vm->getRandomNumber(359)); + CStarControlSub6 m1(X_AXIS, g_vm->getRandomNumber(359)); + CStarControlSub6 m2(Y_AXIS, g_vm->getRandomNumber(359)); + CStarControlSub6 m3(Z_AXIS, g_vm->getRandomNumber(359)); CStarControlSub6 s1, s2; CStarControlSub6 *s; diff --git a/engines/titanic/star_control/star_control_sub6.cpp b/engines/titanic/star_control/star_control_sub6.cpp index f0ec68e86e..e45d6d2c57 100644 --- a/engines/titanic/star_control/star_control_sub6.cpp +++ b/engines/titanic/star_control/star_control_sub6.cpp @@ -30,8 +30,8 @@ CStarControlSub6::CStarControlSub6() { clear(); } -CStarControlSub6::CStarControlSub6(int mode, double val) { - set(mode, val); +CStarControlSub6::CStarControlSub6(Axis axis, double amount) { + setRotationMatrix(axis, amount); } CStarControlSub6::CStarControlSub6(const CStarControlSub6 *src) { @@ -52,13 +52,13 @@ void CStarControlSub6::identity() { _vector.clear(); } -void CStarControlSub6::set(int mode, double amount) { +void CStarControlSub6::setRotationMatrix(Axis axis, double amount) { const double ROTATION = 3.1415927 * 0.0055555557; double sinVal = sin(amount * ROTATION); double cosVal = cos(amount * ROTATION); - switch (mode) { - case 0: + switch (axis) { + case X_AXIS: _row1._x = 1.0; _row1._y = 0.0; _row1._z = 0.0; @@ -70,7 +70,7 @@ void CStarControlSub6::set(int mode, double amount) { _row3._z = cosVal; break; - case 1: + case Y_AXIS: _row1._x = cosVal; _row1._y = 0.0; _row1._z = sinVal; @@ -82,7 +82,7 @@ void CStarControlSub6::set(int mode, double amount) { _row3._z = sinVal; break; - case 2: + case Z_AXIS: _row1._x = cosVal; _row1._y = sinVal; _row1._z = 0.0; diff --git a/engines/titanic/star_control/star_control_sub6.h b/engines/titanic/star_control/star_control_sub6.h index d63868027a..27b91628ba 100644 --- a/engines/titanic/star_control/star_control_sub6.h +++ b/engines/titanic/star_control/star_control_sub6.h @@ -37,7 +37,7 @@ public: FVector _vector; public: CStarControlSub6(); - CStarControlSub6(int mode, double amount); + CStarControlSub6(Axis axis, double amount); CStarControlSub6(const CStarControlSub6 *src); /** @@ -51,9 +51,9 @@ public: static CStarControlSub6 *setup(CStarControlSub6 *dest, const CStarControlSub6 *s2, const CStarControlSub6 *s3); /** - * Sets the default data + * Sets a rotation matrix for the given axis for the given amount */ - void set(int mode, double val); + void setRotationMatrix(Axis axis, double val); void copyFrom(const CStarControlSub6 *src); diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp index 540d2c7666..34fd371bac 100644 --- a/engines/titanic/star_control/star_view.cpp +++ b/engines/titanic/star_control/star_view.cpp @@ -177,7 +177,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) { case Common::KEYCODE_z: case Common::KEYCODE_c: if (v == -1) { - sub6.set(key == Common::KEYCODE_z ? MODE_PHOTO : MODE_STARFIELD, 1.0); + sub6.setRotationMatrix(key == Common::KEYCODE_z ? Y_AXIS : X_AXIS, 1.0); _sub12.proc22(sub6); _sub12.proc15(errorCode); return true; @@ -210,7 +210,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) { case Common::KEYCODE_x: if (v == -1) { - sub6.set(MODE_PHOTO, -1.0); + sub6.setRotationMatrix(Y_AXIS, -1.0); _sub12.proc22(sub6); _sub12.proc15(errorCode); return true; @@ -219,7 +219,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) { case Common::KEYCODE_QUOTE: if (v == -1) { - sub6.set(MODE_STARFIELD, -1.0); + sub6.setRotationMatrix(X_AXIS, -1.0); _sub12.proc22(sub6); _sub12.proc15(errorCode); return true; |