diff options
author | David Fioramonti | 2017-08-31 19:17:54 -0700 |
---|---|---|
committer | David Fioramonti | 2017-08-31 19:25:40 -0700 |
commit | 0df15f0b0de7c31f75dab63836e92bc7899aa51d (patch) | |
tree | 6b881ef6551d8550dfd36f68540d738a6d6e233e /engines/titanic/star_control | |
parent | 88782928ff97d1a86e96b4badf1628ef40da0d59 (diff) | |
download | scummvm-rg350-0df15f0b0de7c31f75dab63836e92bc7899aa51d.tar.gz scummvm-rg350-0df15f0b0de7c31f75dab63836e92bc7899aa51d.tar.bz2 scummvm-rg350-0df15f0b0de7c31f75dab63836e92bc7899aa51d.zip |
TITANIC: Don't allow unlocking stars while locking onto a star
Fixes #10170.
I've added a boolean variable that tracks whether the game is
in the process of locking onto a star or not.
When the user hits the unlock button _isInLockingProcess gets checked and
the request to unlock is denied if the locking on is currently happening.
Once the locking on is finished then the release is lifted and the user
can unlock at this time (or after locking onto the next star).
Diffstat (limited to 'engines/titanic/star_control')
-rw-r--r-- | engines/titanic/star_control/star_camera.cpp | 16 | ||||
-rw-r--r-- | engines/titanic/star_control/star_camera.h | 10 | ||||
-rw-r--r-- | engines/titanic/star_control/star_view.cpp | 2 |
3 files changed, 24 insertions, 4 deletions
diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp index d3bc3d988f..c9cffd481f 100644 --- a/engines/titanic/star_control/star_camera.cpp +++ b/engines/titanic/star_control/star_camera.cpp @@ -41,12 +41,12 @@ FMatrix *CStarCamera::_priorOrientation; FMatrix *CStarCamera::_newOrientation; CStarCamera::CStarCamera(const CNavigationInfo *data) : - _starLockState(ZERO_LOCKED), _mover(nullptr), _isMoved(false) { + _starLockState(ZERO_LOCKED), _mover(nullptr), _isMoved(false), _isInLockingProcess(false) { setupHandler(data); } CStarCamera::CStarCamera(CViewport *src) : - _starLockState(ZERO_LOCKED), _mover(nullptr), _isMoved(false), _viewport(src) { + _starLockState(ZERO_LOCKED), _mover(nullptr), _isMoved(false), _isInLockingProcess(false), _viewport(src) { } void CStarCamera::init() { @@ -65,6 +65,10 @@ bool CStarCamera::isLocked() { return _mover->isLocked(); } +bool CStarCamera::isNotInLockingProcess() { + return !_isInLockingProcess; +} + CStarCamera::~CStarCamera() { deleteHandler(); } @@ -252,6 +256,8 @@ void CStarCamera::setViewportAngle(const FPoint &angles) { if (isLocked()) return; + _isInLockingProcess = false; + switch(_starLockState) { case ZERO_LOCKED: { FPose subX(X_AXIS, angles._y); @@ -471,6 +477,7 @@ bool CStarCamera::lockMarker1(FVector v1, FVector firstStarPosition, FVector v3) if (_starLockState != ZERO_LOCKED) return true; + _isInLockingProcess = true; FVector tempV; double val1, val2, val3, val4, val5; double val6, val7, val8, val9; @@ -504,12 +511,15 @@ bool CStarCamera::lockMarker1(FVector v1, FVector firstStarPosition, FVector v3) CStarVector *sv = new CStarVector(this, firstStarPosition); _mover->setVector(sv); + return true; } bool CStarCamera::lockMarker2(CViewport *viewport, const FVector &secondStarPosition) { if (_starLockState != ONE_LOCKED) return true; + + _isInLockingProcess = true; FVector firstStarPosition = _lockedStarsPos._row1; DAffine m2(0, firstStarPosition); // Identity matrix and col4 as the 1st stars position DVector starDelta = secondStarPosition - firstStarPosition; @@ -603,6 +613,7 @@ bool CStarCamera::lockMarker3(CViewport *viewport, const FVector &thirdStarPosit if (_starLockState != TWO_LOCKED) return true; + _isInLockingProcess = true; FMatrix newOr = viewport->getOrientation(); FMatrix oldOr = _viewport.getOrientation(); FVector newPos = viewport->_position; @@ -612,6 +623,7 @@ bool CStarCamera::lockMarker3(CViewport *viewport, const FVector &thirdStarPosit CStarVector *sv = new CStarVector(this, thirdStarPosition); _mover->setVector(sv); + return true; } diff --git a/engines/titanic/star_control/star_camera.h b/engines/titanic/star_control/star_camera.h index 71be90d345..72c26c12a6 100644 --- a/engines/titanic/star_control/star_camera.h +++ b/engines/titanic/star_control/star_camera.h @@ -49,7 +49,8 @@ private: FMatrix _lockedStarsPos; // Each row represents the location of a locked star CCameraMover *_mover; CViewport _viewport; - bool _isMoved; + bool _isMoved; // TODO: determine if this is being used + bool _isInLockingProcess; // The mover/view is homing in on a new star private: /** * Set up a handler @@ -77,6 +78,13 @@ public: virtual void proc3(const CNavigationInfo *src); /** + * The mover/view is not currently homing in on a new star + * This can mean it is unmarked, or that it is fully locked + * onto one star or more (but not in the process of doing so) + */ + bool isNotInLockingProcess(); + + /** * Set the camera position */ virtual void setPosition(const FVector &v); diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp index 6730d02391..e65c5dab61 100644 --- a/engines/titanic/star_control/star_view.cpp +++ b/engines/titanic/star_control/star_view.cpp @@ -434,7 +434,7 @@ void CStarView::lockStar() { } void CStarView::unlockStar() { - if (_starField && !_showingPhoto) { + if (_starField && !_showingPhoto && _camera.isNotInLockingProcess()) { _camera.removeLockedStar(); _starField->fn8(_photoSurface); } |