diff options
Diffstat (limited to 'engines/titanic/star_control/star_control_sub12.cpp')
-rw-r--r-- | engines/titanic/star_control/star_control_sub12.cpp | 54 |
1 files changed, 50 insertions, 4 deletions
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); } |