diff options
author | Paul Gilbert | 2017-03-20 20:19:41 -0400 |
---|---|---|
committer | Paul Gilbert | 2017-03-20 20:19:41 -0400 |
commit | 0aaa6c415fc14229d0bd82fa3cfb175444a5c47a (patch) | |
tree | 4838160b6cd323e2d61383a2562f5620b34c9ebe | |
parent | dd7498544f60ecf32d89c19b95eee105fbfb79ab (diff) | |
download | scummvm-rg350-0aaa6c415fc14229d0bd82fa3cfb175444a5c47a.tar.gz scummvm-rg350-0aaa6c415fc14229d0bd82fa3cfb175444a5c47a.tar.bz2 scummvm-rg350-0aaa6c415fc14229d0bd82fa3cfb175444a5c47a.zip |
TITANIC: Implemented CStarControlSub12 fn2
-rw-r--r-- | engines/titanic/star_control/base_star.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/star_control/base_star.h | 10 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub12.cpp | 21 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub20.cpp | 12 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub20.h | 9 |
5 files changed, 45 insertions, 13 deletions
diff --git a/engines/titanic/star_control/base_star.cpp b/engines/titanic/star_control/base_star.cpp index ffe5fd05b4..c1564e135a 100644 --- a/engines/titanic/star_control/base_star.cpp +++ b/engines/titanic/star_control/base_star.cpp @@ -214,4 +214,10 @@ int CBaseStar::baseFn2(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12) { return ref._index; } +/*------------------------------------------------------------------------*/ + +void CStarVector::proc1() { + _owner->setArrayVector(_vector); +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/base_star.h b/engines/titanic/star_control/base_star.h index 8fc36ba6c7..7dd3fb5b0e 100644 --- a/engines/titanic/star_control/base_star.h +++ b/engines/titanic/star_control/base_star.h @@ -146,6 +146,16 @@ public: int baseFn2(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12); }; +class CStarVector { +private: + CStarControlSub12 *_owner; + FVector _vector; +public: + CStarVector(CStarControlSub12 *owner, const FVector &v) : _owner(owner), _vector(v) {} + + virtual void proc1(); +}; + } // End of namespace Titanic #endif /* TITANIC_STAR_CONTROL_SUB3_H */ diff --git a/engines/titanic/star_control/star_control_sub12.cpp b/engines/titanic/star_control/star_control_sub12.cpp index 254b2a8cd8..5e8cf5a094 100644 --- a/engines/titanic/star_control/star_control_sub12.cpp +++ b/engines/titanic/star_control/star_control_sub12.cpp @@ -456,7 +456,26 @@ void CStarControlSub12::fn1(CStarControlSub13 *sub13, const FVector &v) { } void CStarControlSub12::fn2(FVector v1, FVector v2, FVector v3) { - // TODO + if (_currentIndex == -1) { + FVector tempV; + tempV._z = _sub13._field10; + v3._z = v1._z; + tempV._x = _sub13._fieldD0 * v1._y * v1._z / _sub13._fieldC8; + v3._y = _sub13._fieldCC * tempV._z * v3._x / _sub13._fieldC8; + v3._x = _sub13._fieldCC * v1._x * v1._z / _sub13._fieldC8 - _sub13._valArray[2]; + tempV._y = _sub13._fieldD0 * tempV._z * v3._y / _sub13._fieldC8; + tempV._x = tempV._x - _sub13._valArray[2]; + + v3.normalize(); + tempV.normalize(); + + FMatrix matrix = _sub13.getMatrix(); + const FVector &pos = _sub13._position; + _handlerP->proc10(v3, tempV, pos, matrix); + + CStarVector *sv = new CStarVector(this, v2); + _handlerP->setVector(sv); + } } void CStarControlSub12::fn3(CStarControlSub13 *sub13, const FVector &v) { diff --git a/engines/titanic/star_control/star_control_sub20.cpp b/engines/titanic/star_control/star_control_sub20.cpp index ca60cc9948..955a855841 100644 --- a/engines/titanic/star_control/star_control_sub20.cpp +++ b/engines/titanic/star_control/star_control_sub20.cpp @@ -27,7 +27,7 @@ namespace Titanic { CStarControlSub20::CStarControlSub20(const CStar20Data *src) { _lockCounter = 0; - _dataP = nullptr; + _starVector = nullptr; if (src) { copyFrom(src); @@ -100,15 +100,15 @@ void CStarControlSub20::proc11(CErrorCode &errorCode, FVector &v, const FMatrix } } -void CStarControlSub20::setData(void *data) { +void CStarControlSub20::setVector(CStarVector *sv) { clear(); - _dataP = (byte *)data; + _starVector = sv; } void CStarControlSub20::clear() { - if (_dataP) { - delete _dataP; - _dataP = nullptr; + if (_starVector) { + delete _starVector; + _starVector = nullptr; } } diff --git a/engines/titanic/star_control/star_control_sub20.h b/engines/titanic/star_control/star_control_sub20.h index 49b63d5d5d..5d7e8c0009 100644 --- a/engines/titanic/star_control/star_control_sub20.h +++ b/engines/titanic/star_control/star_control_sub20.h @@ -24,6 +24,7 @@ #define TITANIC_STAR_CONTROL_SUB20_H #include "titanic/support/simple_file.h" +#include "titanic/star_control/base_star.h" #include "titanic/star_control/error_code.h" #include "titanic/star_control/fmatrix.h" @@ -43,7 +44,7 @@ struct CStar20Data { class CStarControlSub20 : public CStar20Data { public: int _lockCounter; - byte *_dataP; + CStarVector *_starVector; public: CStarControlSub20(const CStar20Data *src); virtual ~CStarControlSub20(); @@ -58,11 +59,7 @@ public: virtual void proc9(FVector &v1, FVector &v2, FMatrix &matrix) {} virtual void proc10(const FVector &v1, const FVector &v2, const FVector &v3, const FMatrix &m) {} virtual void proc11(CErrorCode &errorCode, FVector &v, const FMatrix &m); - - /** - * Set the data - */ - virtual void setData(void *data); + virtual void setVector(CStarVector *sv); /** * Clear the class |