diff options
author | Paul Gilbert | 2016-07-17 21:26:03 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-17 21:26:03 -0400 |
commit | 020655a6f3925a7a5e919274a96451bd434c2120 (patch) | |
tree | 483539bd16ca20f9bb4a8785488714a2f42bb4b4 /engines | |
parent | 87db74d771d86281def59c12ba8359abeaa03585 (diff) | |
download | scummvm-rg350-020655a6f3925a7a5e919274a96451bd434c2120.tar.gz scummvm-rg350-020655a6f3925a7a5e919274a96451bd434c2120.tar.bz2 scummvm-rg350-020655a6f3925a7a5e919274a96451bd434c2120.zip |
TITANIC: Adding CStarControlSub12 methods
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/star_control/star_control.cpp | 3 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub12.cpp | 54 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub12.h | 13 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub13.cpp | 37 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub13.h | 23 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub20.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub20.h | 5 |
7 files changed, 108 insertions, 29 deletions
diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index 3e0ff16c55..3324d177ba 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -25,6 +25,7 @@ #include "titanic/star_control/dmatrix.h" #include "titanic/star_control/error_code.h" #include "titanic/star_control/star_control_sub6.h" +#include "titanic/star_control/star_control_sub12.h" namespace Titanic { @@ -38,11 +39,13 @@ END_MESSAGE_MAP() CStarControl::CStarControl() : _fieldBC(0), _field80B0(0), _starRect(20, 10, 620, 350) { CStarControlSub6::init(); + CStarControlSub12::init(); DMatrix::init(); } CStarControl::~CStarControl() { CStarControlSub6::deinit(); + CStarControlSub12::deinit(); DMatrix::deinit(); } diff --git a/engines/titanic/star_control/star_control_sub12.cpp b/engines/titanic/star_control/star_control_sub12.cpp index f968559a2f..967327014e 100644 --- a/engines/titanic/star_control/star_control_sub12.cpp +++ b/engines/titanic/star_control/star_control_sub12.cpp @@ -26,6 +26,9 @@ namespace Titanic { +FMatrix *CStarControlSub12::_matrix1; +FMatrix *CStarControlSub12::_matrix2; + CStarControlSub12::CStarControlSub12(void *val1, void *val2) : _field4(-1), _handlerP(nullptr), _field108(0), _sub13(val1) { @@ -34,7 +37,18 @@ CStarControlSub12::CStarControlSub12(void *val1, void *val2) : CStarControlSub12::CStarControlSub12(CStarControlSub13 *src) : _field4(-1), _handlerP(nullptr), _field108(0), _sub13(src) { +} + +void CStarControlSub12::init() { + _matrix1 = nullptr; + _matrix2 = nullptr; +} +void CStarControlSub12::deinit() { + delete _matrix1; + delete _matrix2; + _matrix1 = nullptr; + _matrix2 = nullptr; } CStarControlSub12::~CStarControlSub12() { @@ -49,16 +63,16 @@ void CStarControlSub12::proc3(const void *src) { _handlerP->copyFrom1(src); } -void CStarControlSub12::proc4(const void *src) { +void CStarControlSub12::setPosition(const FVector &v) { if (!isLocked()) { - _sub13.fn10(src); + _sub13.setPosition(v); set108(); } } -void CStarControlSub12::proc5(const FVector *src) { +void CStarControlSub12::proc5(const FVector &v) { if (!isLocked()) - _sub13.fn11(src); + _sub13.fn11(v); } void CStarControlSub12::proc6(int v) { @@ -100,6 +114,38 @@ void CStarControlSub12::proc13(CStarControlSub13 *dest) { *dest = _sub13; } +void CStarControlSub12::proc14(int v) { + FMatrix matrix; + _sub13.getMatrix(&matrix); + FVector vector = _sub13._position; + + _handlerP->proc9(&vector, v, &matrix); +} + +void CStarControlSub12::proc15(int v) { + if (!_matrix1) + _matrix1 = new FMatrix(); + if (!_matrix2) + _matrix2 = new FMatrix(); + + _sub13.getMatrix(_matrix1); + *_matrix2 = *_matrix1; + + FVector v1 = _sub13._position; + FVector v2 = _sub13._position; + CErrorCode errorCode; + _handlerP->proc11(errorCode, v2, _matrix2); + + if (v1 != v2) { + _sub13.setPosition(v2); + set108(); + } + + if (_matrix1 != _matrix2) { + _sub13.setMatrix(_matrix2); + } +} + void CStarControlSub12::load(SimpleFile *file, int param) { _sub13.load(file, param); } diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h index 1262aa8bf3..643e3dfb67 100644 --- a/engines/titanic/star_control/star_control_sub12.h +++ b/engines/titanic/star_control/star_control_sub12.h @@ -24,6 +24,7 @@ #define TITANIC_STAR_CONTROL_SUB12_H #include "titanic/support/simple_file.h" +#include "titanic/star_control/fmatrix.h" #include "titanic/star_control/star_control_sub13.h" #include "titanic/star_control/star_control_sub20.h" @@ -37,6 +38,9 @@ class CStarControlSub12 { ArrayEntry() : _field0(0), _field4(0), _field8(0) {} }; private: + static FMatrix *_matrix1; + static FMatrix *_matrix2; +private: int _field4; ArrayEntry _array[3]; CStarControlSub20 *_handlerP; @@ -58,14 +62,17 @@ private: */ bool isLocked() { return _handlerP->isLocked(); } public: + static void init(); + static void deinit(); +public: CStarControlSub12(void *val1, void *val2); CStarControlSub12(CStarControlSub13 *src); virtual ~CStarControlSub12(); virtual void proc2(const void *src); virtual void proc3(const void *src); - virtual void proc4(const void *src); - virtual void proc5(const FVector *src); + virtual void setPosition(const FVector &v); + virtual void proc5(const FVector &v); virtual void proc6(int v); virtual void proc7(int v); virtual void proc8(int v); @@ -74,6 +81,8 @@ public: virtual void proc11(); virtual void proc12(double v1, double v2); virtual void proc13(CStarControlSub13 *dest); + virtual void proc14(int v); + virtual void proc15(int v); /** * Load the data for the class from file diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/star_control_sub13.cpp index a8599a7654..a69937bfb8 100644 --- a/engines/titanic/star_control/star_control_sub13.cpp +++ b/engines/titanic/star_control/star_control_sub13.cpp @@ -26,8 +26,7 @@ namespace Titanic { CStarControlSub13::CStarControlSub13(void *src) : - _field0(0), _field4(0), _field8(0), _fieldC0(0), - _fieldC4(0), _fieldC8(0), _fieldCC(0), _fieldD0(0) { + _fieldC0(0), _fieldC4(0), _fieldC8(0), _fieldCC(0), _fieldD0(0) { if (src) { setup(src); } else { @@ -46,9 +45,7 @@ CStarControlSub13::CStarControlSub13(void *src) : CStarControlSub13::CStarControlSub13(CStarControlSub13 *src) : _matrix(&src->_matrix), _sub1(&src->_sub1), _sub2(&src->_sub2) { - _field0 = src->_field0; - _field4 = src->_field4; - _field8 = src->_field8; + _position = src->_position; _fieldC = src->_fieldC; _field10 = src->_field10; _field14 = src->_field14; @@ -87,9 +84,9 @@ void CStarControlSub13::copyFrom(const void *src) { } void CStarControlSub13::load(SimpleFile *file, int param) { - _field0 = file->readFloat(); - _field4 = file->readFloat(); - _field8 = file->readFloat(); + _position._x = file->readFloat(); + _position._y = file->readFloat(); + _position._z = file->readFloat(); _fieldC = file->readFloat(); _field10 = file->readFloat(); _field14 = file->readFloat(); @@ -109,9 +106,9 @@ void CStarControlSub13::load(SimpleFile *file, int param) { } void CStarControlSub13::save(SimpleFile *file, int indent) { - file->writeFloatLine(_field0, indent); - file->writeFloatLine(_field4, indent); - file->writeFloatLine(_field8, indent); + file->writeFloatLine(_position._x, indent); + file->writeFloatLine(_position._y, indent); + file->writeFloatLine(_position._z, indent); file->writeFloatLine(_fieldC, indent); file->writeFloatLine(_field10, indent); file->writeFloatLine(_field14, indent); @@ -125,12 +122,18 @@ void CStarControlSub13::save(SimpleFile *file, int indent) { _matrix.save(file, indent); } -void CStarControlSub13::fn10(const void *src) { - error("TODO: CStarControlSub13::fn10"); +void CStarControlSub13::setPosition(const FVector &v) { + _position = v; + _fieldD4 = 0; } -void CStarControlSub13::fn11(const FVector *v) { - _matrix.fn1(v); +void CStarControlSub13::setMatrix(const FMatrix &m) { + _matrix = m; + _fieldD4 = 0; +} + +void CStarControlSub13::fn11(const FVector &v) { + _matrix.fn1(&v); _fieldD4 = 0; } @@ -176,4 +179,8 @@ void CStarControlSub13::fn13(double v1, double v2) { _field24 = v2 ? 2 : 0; } +void CStarControlSub13::getMatrix(FMatrix *matrix) { + *matrix = _matrix; +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub13.h b/engines/titanic/star_control/star_control_sub13.h index eb4a07cb32..eacdce3447 100644 --- a/engines/titanic/star_control/star_control_sub13.h +++ b/engines/titanic/star_control/star_control_sub13.h @@ -31,9 +31,6 @@ namespace Titanic { class CStarControlSub13 { private: - double _field0; - double _field4; - double _field8; double _fieldC; double _field10; double _field14; @@ -55,6 +52,8 @@ private: private: void setup(void *ptr); public: + FVector _position; +public: CStarControlSub13(void *ptr); CStarControlSub13(CStarControlSub13 *src); @@ -70,11 +69,25 @@ public: */ void save(SimpleFile *file, int indent); - void fn10(const void *src); - void fn11(const FVector *v); + /** + * Sets the position + */ + void setPosition(const FVector &v); + + /** + * Sets the matrix + */ + void setMatrix(const FMatrix &m); + + void fn11(const FVector &v); void fn12(); void fn13(double v1, double v2); + /** + * Makes a copy of the instance's matrix into the passed matrix + */ + void getMatrix(FMatrix *matrix); + void setC(int v); void set10(int v); void set14(int v); diff --git a/engines/titanic/star_control/star_control_sub20.cpp b/engines/titanic/star_control/star_control_sub20.cpp index 82b6b0d7dd..3611478100 100644 --- a/engines/titanic/star_control/star_control_sub20.cpp +++ b/engines/titanic/star_control/star_control_sub20.cpp @@ -90,7 +90,7 @@ void CStarControlSub20::proc7() { } } -void CStarControlSub20::proc11(CErrorCode *errorCode, void *v2, void *v3) { +void CStarControlSub20::proc11(CErrorCode &errorCode, FVector &v, const FMatrix &m) { if (_field4 > 0.0) { warning("TODO: CStarControlSub20::proc11"); } diff --git a/engines/titanic/star_control/star_control_sub20.h b/engines/titanic/star_control/star_control_sub20.h index 9d90b80d26..eaa9d4fecd 100644 --- a/engines/titanic/star_control/star_control_sub20.h +++ b/engines/titanic/star_control/star_control_sub20.h @@ -25,6 +25,7 @@ #include "titanic/support/simple_file.h" #include "titanic/star_control/error_code.h" +#include "titanic/star_control/fmatrix.h" namespace Titanic { @@ -51,9 +52,9 @@ public: virtual void proc6(); virtual void proc7(); virtual void proc8() {} - virtual void proc9() {} + virtual void proc9(FVector *v, int v2, FMatrix *matrix) {} virtual void proc10() {} - virtual void proc11(CErrorCode *errorCode, void *v2, void *v3); + virtual void proc11(CErrorCode &errorCode, FVector &v, const FMatrix &m); /** * Set the data |