diff options
-rw-r--r-- | engines/titanic/star_control/star_camera.cpp | 48 | ||||
-rw-r--r-- | engines/titanic/star_control/star_camera.h | 10 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub2.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/star_control/star_view.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/star_control/viewport.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/star_control/viewport.h | 4 |
6 files changed, 40 insertions, 34 deletions
diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp index c48af063f7..5f69ebe664 100644 --- a/engines/titanic/star_control/star_camera.cpp +++ b/engines/titanic/star_control/star_camera.cpp @@ -29,8 +29,8 @@ namespace Titanic { -FMatrix *CStarCamera::_matrix1; -FMatrix *CStarCamera::_matrix2; +FMatrix *CStarCamera::_priorOrientation; +FMatrix *CStarCamera::_newOrientation; CStarCamera::CStarCamera(const CNavigationInfo *data) : _matrixRow(-1), _mover(nullptr), _field108(0) { @@ -42,15 +42,15 @@ CStarCamera::CStarCamera(CViewport *src) : } void CStarCamera::init() { - _matrix1 = nullptr; - _matrix2 = nullptr; + _priorOrientation = nullptr; + _newOrientation = nullptr; } void CStarCamera::deinit() { - delete _matrix1; - delete _matrix2; - _matrix1 = nullptr; - _matrix2 = nullptr; + delete _priorOrientation; + delete _newOrientation; + _priorOrientation = nullptr; + _newOrientation = nullptr; } CStarCamera::~CStarCamera() { @@ -123,26 +123,26 @@ void CStarCamera::setDestination(const FVector &v) { _mover->moveTo(vector, v, matrix); } -void CStarCamera::proc15(CErrorCode *errorCode) { - if (!_matrix1) - _matrix1 = new FMatrix(); - if (!_matrix2) - _matrix2 = new FMatrix(); +void CStarCamera::updatePosition(CErrorCode *errorCode) { + if (!_priorOrientation) + _priorOrientation = new FMatrix(); + if (!_newOrientation) + _newOrientation = new FMatrix(); - *_matrix1 = _viewport.getMatrix(); - *_matrix2 = *_matrix1; + *_priorOrientation = _viewport.getMatrix(); + *_newOrientation = *_priorOrientation; - FVector v1 = _viewport._position; - FVector v2 = _viewport._position; - _mover->proc11(*errorCode, v2, *_matrix2); + FVector priorPos = _viewport._position; + FVector newPos = _viewport._position; + _mover->proc11(*errorCode, newPos, *_newOrientation); - if (v1 != v2) { - _viewport.setPosition(v2); + if (newPos != priorPos) { + _viewport.setPosition(newPos); set108(); } - if (*_matrix1 != *_matrix2) { - _viewport.setMatrix(*_matrix2); + if (*_priorOrientation != *_newOrientation) { + _viewport.setOrientation(*_newOrientation); } } @@ -312,7 +312,7 @@ void CStarCamera::setViewportAngle(const FPoint &angles) { tempV1 += row1; m1.set(tempV4, tempV5, tempV6); - _viewport.setMatrix(m1); + _viewport.setOrientation(m1); _viewport.setPosition(tempV1); } else if (_matrixRow == 1) { FVector tempV2; @@ -386,7 +386,7 @@ void CStarCamera::setViewportAngle(const FPoint &angles) { tempV16 = tempV3; m3.set(mrow1, mrow2, mrow3); - _viewport.setMatrix(m3); + _viewport.setOrientation(m3); _viewport.setPosition(tempV16); } } diff --git a/engines/titanic/star_control/star_camera.h b/engines/titanic/star_control/star_camera.h index 263fb25107..5e0232516d 100644 --- a/engines/titanic/star_control/star_camera.h +++ b/engines/titanic/star_control/star_camera.h @@ -38,8 +38,8 @@ namespace Titanic { */ class CStarCamera { private: - static FMatrix *_matrix1; - static FMatrix *_matrix2; + static FMatrix *_priorOrientation; + static FMatrix *_newOrientation; private: int _matrixRow; FMatrix _matrix; @@ -87,7 +87,11 @@ public: */ virtual void setDestination(const FVector &v); - virtual void proc15(CErrorCode *errorCode); + /** + * Updates the camera position + */ + virtual void updatePosition(CErrorCode *errorCode); + virtual void proc16(); virtual void proc17(); virtual void proc18(); diff --git a/engines/titanic/star_control/star_control_sub2.cpp b/engines/titanic/star_control/star_control_sub2.cpp index 2416d3cb24..9870309b2a 100644 --- a/engines/titanic/star_control/star_control_sub2.cpp +++ b/engines/titanic/star_control/star_control_sub2.cpp @@ -22,6 +22,7 @@ #include "titanic/star_control/star_control_sub2.h" #include "titanic/star_control/star_camera.h" +#include "titanic/titanic.h" namespace Titanic { @@ -42,6 +43,7 @@ bool CStarControlSub2::selectStar(CSurfaceArea *surfaceArea, if (index == -1) { return false; } else if (!handler) { + debugC(DEBUG_BASIC, kDebugStarfield, "Select star %d", index); camera->setDestination(_data[index]._position); return true; } else { diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp index fd2c407045..e3d6162977 100644 --- a/engines/titanic/star_control/star_view.cpp +++ b/engines/titanic/star_control/star_view.cpp @@ -179,7 +179,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) { if (v == -1) { pose.setRotationMatrix(key == Common::KEYCODE_z ? Y_AXIS : X_AXIS, 1.0); _camera.proc22(pose); - _camera.proc15(errorCode); + _camera.updatePosition(errorCode); return true; } break; @@ -212,7 +212,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) { if (v == -1) { pose.setRotationMatrix(Y_AXIS, -1.0); _camera.proc22(pose); - _camera.proc15(errorCode); + _camera.updatePosition(errorCode); return true; } break; @@ -221,7 +221,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) { if (v == -1) { pose.setRotationMatrix(X_AXIS, -1.0); _camera.proc22(pose); - _camera.proc15(errorCode); + _camera.updatePosition(errorCode); return true; } break; @@ -248,7 +248,7 @@ void CStarView::resetPosition() { bool CStarView::fn1() { if (_videoSurface) { CErrorCode errorCode; - _camera.proc15(&errorCode); + _camera.updatePosition(&errorCode); if (_fader._index < 0 || _fader._index >= _fader._count) _starField->fn1(&errorCode); diff --git a/engines/titanic/star_control/viewport.cpp b/engines/titanic/star_control/viewport.cpp index adb9eb17dd..535f2f19fc 100644 --- a/engines/titanic/star_control/viewport.cpp +++ b/engines/titanic/star_control/viewport.cpp @@ -111,7 +111,7 @@ void CViewport::setPosition(const FPose &pose) { _flag = false; } -void CViewport::setMatrix(const FMatrix &m) { +void CViewport::setOrientation(const FMatrix &m) { _matrix = m; _flag = false; } diff --git a/engines/titanic/star_control/viewport.h b/engines/titanic/star_control/viewport.h index 0dd373878d..f0e6eab814 100644 --- a/engines/titanic/star_control/viewport.h +++ b/engines/titanic/star_control/viewport.h @@ -85,9 +85,9 @@ public: void setPosition(const FPose &pose); /** - * Sets the matrix + * Sets the orientation */ - void setMatrix(const FMatrix &m); + void setOrientation(const FMatrix &m); void fn11(const FVector &v); void fn12(); |