From ffbfdac87ed43535091f5273eea3dd9e8ec6d979 Mon Sep 17 00:00:00 2001 From: David Fioramonti Date: Sun, 20 Aug 2017 13:24:25 -0700 Subject: TITANIC: Change ship view and position even if not moved The code was preventing the position and view from changing when the distance between the current and new position for a marked auto mover was zero. This happens if you lock the 2nd or 3rd star and then unlock and relock again. It was prevented this with asserts and if statement checks and I removed them all. This section of code isn't doing any inverses based on the reciprocal of the distance so theres no issue with allowing transition speeds/distances of zero. Fixes #10148. --- engines/titanic/star_control/camera_auto_mover.cpp | 6 ++--- engines/titanic/star_control/marked_auto_mover.cpp | 28 ++++++++++------------ engines/titanic/star_control/star_camera.cpp | 10 ++------ 3 files changed, 17 insertions(+), 27 deletions(-) (limited to 'engines') diff --git a/engines/titanic/star_control/camera_auto_mover.cpp b/engines/titanic/star_control/camera_auto_mover.cpp index bcb94d27c2..60a1cbde82 100644 --- a/engines/titanic/star_control/camera_auto_mover.cpp +++ b/engines/titanic/star_control/camera_auto_mover.cpp @@ -50,10 +50,8 @@ void CCameraAutoMover::proc2(const FVector &oldPos, const FVector &newPos, _destPos = newPos; _posDelta = _destPos - _srcPos; float temp = 0.0; - if (!_posDelta.normalize(temp)) { // Do the normalization, put the scale amount in temp, - // but if it is unsuccessful, crash - assert(temp); - } + bool unused_status = _posDelta.normalize(temp); // Do the normalization, put the scale amount in temp + _distance = temp; _active = false; _field34 = false; diff --git a/engines/titanic/star_control/marked_auto_mover.cpp b/engines/titanic/star_control/marked_auto_mover.cpp index e3ab2b4f20..0a2da6dda1 100644 --- a/engines/titanic/star_control/marked_auto_mover.cpp +++ b/engines/titanic/star_control/marked_auto_mover.cpp @@ -32,24 +32,22 @@ void CMarkedAutoMover::proc2(const FVector &oldPos, const FVector &newPos, CCameraAutoMover::proc2(oldPos, newPos, oldOrientation, newOrientation); double distance = _distance; - if (distance > 0.0) { + _active = true; + _field34 = true; + proc6(120, 4, distance); + + + _orientationChanger.load(oldOrientation, newOrientation); + _transitionPercent = 0.0; + + if (_field4C == 0) { + _transitionPercentInc = 0.1; + _active = true; + } else { + _transitionPercentInc = 1.0 / _field4C; _active = true; - _field34 = true; - proc6(120, 4, distance); } - if (newPos != oldPos) { - _orientationChanger.load(oldOrientation, newOrientation); - _transitionPercent = 0.0; - - if (_field4C == 0) { - _transitionPercentInc = 0.1; - _active = true; - } else { - _transitionPercentInc = 1.0 / _field4C; - _active = true; - } - } } int CMarkedAutoMover::proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) { diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp index f1bf24b90e..fa19b95ee6 100644 --- a/engines/titanic/star_control/star_camera.cpp +++ b/engines/titanic/star_control/star_camera.cpp @@ -582,10 +582,7 @@ void CStarCamera::lockMarker2(CViewport *viewport, const FVector &v) { FVector newPos = m4._col1; - if (_viewport._position != newPos) { - // Only change view if positions are different - _mover->proc8(_viewport._position, newPos, m6, m5); - } + _mover->proc8(_viewport._position, newPos, m6, m5); CStarVector *sv = new CStarVector(this, v); _mover->setVector(sv); @@ -600,10 +597,7 @@ void CStarCamera::lockMarker3(CViewport *viewport, const FVector &v) { FVector newPos = viewport->_position; FVector oldPos = _viewport._position; - if (oldPos != newPos) { - // Only change view if positions are different - _mover->proc8(oldPos, newPos, oldOr, newOr); - } + _mover->proc8(oldPos, newPos, oldOr, newOr); CStarVector *sv = new CStarVector(this, v); _mover->setVector(sv); -- cgit v1.2.3