diff options
author | Paul Gilbert | 2017-03-23 21:09:30 -0400 |
---|---|---|
committer | Paul Gilbert | 2017-03-23 21:09:30 -0400 |
commit | 9a7cd6b367e08b2926cdbf9f42c4b457897520ea (patch) | |
tree | 7f2d8526076ecd913c64ee33f8f612fd53c1689e /engines | |
parent | 6da793a8dd4539294a6bc0347cd57c1fd0580044 (diff) | |
download | scummvm-rg350-9a7cd6b367e08b2926cdbf9f42c4b457897520ea.tar.gz scummvm-rg350-9a7cd6b367e08b2926cdbf9f42c4b457897520ea.tar.bz2 scummvm-rg350-9a7cd6b367e08b2926cdbf9f42c4b457897520ea.zip |
TITANIC: Finished CStarControlSub27 class
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/star_control/star_control_sub27.cpp | 54 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub27.h | 4 |
2 files changed, 55 insertions, 3 deletions
diff --git a/engines/titanic/star_control/star_control_sub27.cpp b/engines/titanic/star_control/star_control_sub27.cpp index e9559b250b..98c237c7fd 100644 --- a/engines/titanic/star_control/star_control_sub27.cpp +++ b/engines/titanic/star_control/star_control_sub27.cpp @@ -50,8 +50,58 @@ void CStarControlSub27::proc2(FVector &v1, FVector &v2, FMatrix &m1, FMatrix &m2 } int CStarControlSub27::proc5(CErrorCode &errorCode, FVector &v, FMatrix &m) { - // TODO - return 0; + if (!_field8) + return 0; + + _field58 += _field60; + _field58 = _field58; + _sub25.fn2(_field58, m); + errorCode.set(); + + if (_field40 >= 0) { + double powVal = _powers[_field40]; + v += _row3 * powVal; + fn1(v); + + --_field40; + errorCode.set(); + return 1; + } else if (_field44 > 0) { + v += _row3 * _field38; + fn1(v); + + --_field44; + errorCode.set(); + return 1; + } else if (_field48 >= 0) { + double powVal = _powers[31 - _field48]; + v += _row3 * powVal; + fn1(v); + + --_field48; + errorCode.set(); + return 1; + } else { + _field8 = 0; + return 2; + } +} + +void CStarControlSub27::fn1(FVector &v) const { + double distance = _row1.getDistance(v); + distance /= _field24; + + if (distance <= 0.0) { + v = _row1; + } else if (distance >= 1.0) { + v = _row2; + } else { + v = FVector( + (_row2._x - _row1._x) * distance + _row1._x, + (_row2._y - _row1._y) * distance + _row1._y, + (_row2._z - _row1._z) * distance + _row1._z + ); + } } } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub27.h b/engines/titanic/star_control/star_control_sub27.h index f8aa3d6ce7..ff4136c1c5 100644 --- a/engines/titanic/star_control/star_control_sub27.h +++ b/engines/titanic/star_control/star_control_sub27.h @@ -28,7 +28,9 @@ namespace Titanic { class CStarControlSub27 : public CStarControlSub23 { -public: +private: + void fn1(FVector &v) const; +public: virtual ~CStarControlSub27() {} virtual void proc2(FVector &v1, FVector &v2, FMatrix &m1, FMatrix &m2); |