diff options
author | Paul Gilbert | 2016-07-16 18:23:25 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-17 13:09:54 -0400 |
commit | 1b06a9294ac40dbba1437806e222e4cbdd32c016 (patch) | |
tree | 62843453cb5d23c67f036e94f9ee78579d8d5d16 | |
parent | e674116edbd61054dae994033c0b0c10259b8aed (diff) | |
download | scummvm-rg350-1b06a9294ac40dbba1437806e222e4cbdd32c016.tar.gz scummvm-rg350-1b06a9294ac40dbba1437806e222e4cbdd32c016.tar.bz2 scummvm-rg350-1b06a9294ac40dbba1437806e222e4cbdd32c016.zip |
TITANIC: Setup of CStarControlSub6 class
-rw-r--r-- | engines/titanic/star_control/fmatrix.h | 8 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control.h | 1 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub6.cpp | 65 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub6.h | 14 |
5 files changed, 90 insertions, 4 deletions
diff --git a/engines/titanic/star_control/fmatrix.h b/engines/titanic/star_control/fmatrix.h index 391e117472..5dbbe99253 100644 --- a/engines/titanic/star_control/fmatrix.h +++ b/engines/titanic/star_control/fmatrix.h @@ -36,15 +36,15 @@ class DMatrix; */ class FMatrix { private: - FVector _row1; - FVector _row2; - FVector _row3; -private: /** * Copys data from a given source */ void copyFrom(const DMatrix *src); public: + FVector _row1; + FVector _row2; + FVector _row3; +public: FMatrix(); FMatrix(DMatrix *src); diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index 8ab247e2aa..0e54cf5399 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -23,6 +23,7 @@ #include "titanic/support/screen_manager.h" #include "titanic/star_control/star_control.h" #include "titanic/star_control/error_code.h" +#include "titanic/star_control/star_control_sub6.h" namespace Titanic { @@ -35,6 +36,11 @@ END_MESSAGE_MAP() CStarControl::CStarControl() : _fieldBC(0), _field80B0(0), _starRect(20, 10, 620, 350) { + CStarControlSub6::init(); +} + +CStarControl::~CStarControl() { + CStarControlSub6::deinit(); } void CStarControl::save(SimpleFile *file, int indent) { diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h index 0c1fab73e0..c771373135 100644 --- a/engines/titanic/star_control/star_control.h +++ b/engines/titanic/star_control/star_control.h @@ -49,6 +49,7 @@ private: public: CLASSDEF CStarControl(); + virtual ~CStarControl(); /** * Save the data for the class to file diff --git a/engines/titanic/star_control/star_control_sub6.cpp b/engines/titanic/star_control/star_control_sub6.cpp index dfa23d65b6..2022ab8aa6 100644 --- a/engines/titanic/star_control/star_control_sub6.cpp +++ b/engines/titanic/star_control/star_control_sub6.cpp @@ -24,10 +24,24 @@ namespace Titanic { +CStarControlSub6 *CStarControlSub6::_static; + CStarControlSub6::CStarControlSub6() { clear(); } +CStarControlSub6::CStarControlSub6(int mode, double val) { + set(mode, val); +} + +void CStarControlSub6::init() { + _static = nullptr; +} + +void CStarControlSub6::deinit() { + delete _static; +} + void CStarControlSub6::clear() { _matrix.clear(); _field24 = 0; @@ -35,4 +49,55 @@ void CStarControlSub6::clear() { _field2C = 0; } +void CStarControlSub6::set(int mode, double amount) { + const double ROTATION = 3.1415927 * 0.0055555557; + double sinVal = sin(amount * ROTATION); + double cosVal = cos(amount * ROTATION); + + switch (mode) { + case 0: + _matrix._row1._x = 1.0; + _matrix._row1._y = 0.0; + _matrix._row1._z = 0.0; + _matrix._row2._x = 0.0; + _matrix._row2._y = cosVal; + _matrix._row2._z = sinVal; + _matrix._row3._x = 0.0; + _matrix._row3._y = -sinVal; + _matrix._row3._z = cosVal; + break; + + case 1: + _matrix._row1._x = cosVal; + _matrix._row1._y = 0.0; + _matrix._row1._z = sinVal; + _matrix._row2._x = 0.0; + _matrix._row2._y = 1.0; + _matrix._row2._z = 0.0; + _matrix._row3._x = -sinVal; + _matrix._row3._y = 0.0; + _matrix._row3._z = sinVal; + break; + + case 2: + _matrix._row1._x = cosVal; + _matrix._row1._y = sinVal; + _matrix._row1._z = 0.0; + _matrix._row2._x = -sinVal; + _matrix._row2._y = cosVal; + _matrix._row2._z = 0.0; + _matrix._row3._x = 0.0; + _matrix._row3._y = 0.0; + _matrix._row3._z = 1.0; + break; + + default: + break; + } + + _field24 = 0.0; + _field28 = 0.0; + _field2C = 0.0; +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub6.h b/engines/titanic/star_control/star_control_sub6.h index 0c477ee345..10058f5888 100644 --- a/engines/titanic/star_control/star_control_sub6.h +++ b/engines/titanic/star_control/star_control_sub6.h @@ -33,10 +33,24 @@ private: int _field24; int _field28; int _field2C; +private: + static CStarControlSub6 *_static; +public: + static void init(); + static void deinit(); public: CStarControlSub6(); + CStarControlSub6(int mode, double amount); + /** + * Clear the item + */ void clear(); + + /** + * Sets the default data + */ + void set(int mode, double val); }; } // End of namespace Titanic |