From 312d63c3c951ed3781c4f7a1577b62cb862042b3 Mon Sep 17 00:00:00 2001 From: David Fioramonti Date: Sat, 19 Aug 2017 08:25:32 -0700 Subject: TITANIC: Prevent moving for locking stars when onto of star Originally, if you unlocked a star when you had 2 or 3 stars locked and then relocked without changing views then the game crashed. This was because it was trying to transition a distance of zero and this failed an assert (to normalize the length to be the distance). The transition is no longer done so the crash does not happen. Fixes #10147. --- engines/titanic/star_control/star_camera.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp index 1d543b376d..924ffaf153 100644 --- a/engines/titanic/star_control/star_camera.cpp +++ b/engines/titanic/star_control/star_camera.cpp @@ -563,21 +563,24 @@ void CStarCamera::lockMarker2(CViewport *viewport, const FVector &v) { m4._col2 -= m4._col1; m4._col4 -= m4._col1; + FMatrix m6 = _viewport.getOrientation(); + double unused_scale=0.0; if (!m4._col2.normalize(unused_scale) || !m4._col3.normalize(unused_scale) || !m4._col4.normalize(unused_scale) ) { // Do the normalizations, put the scale amount in unused_scale, - // but if any of the normalizations are unsuccessful, - // crash + // but if any of the normalizations are unsuccessful, crash assert(unused_scale); } m5.set(m4._col3, m4._col2, m4._col4); FVector newPos = m4._col1; - FMatrix m6 = _viewport.getOrientation(); - _mover->proc8(_viewport._position, newPos, m6, m5); - + + if (_viewport._position != newPos) { + // Only change view if positions are different + _mover->proc8(_viewport._position, newPos, m6, m5); + } CStarVector *sv = new CStarVector(this, v); _mover->setVector(sv); } @@ -591,7 +594,11 @@ void CStarCamera::lockMarker3(CViewport *viewport, const FVector &v) { FVector newPos = viewport->_position; FVector oldPos = _viewport._position; - _mover->proc8(oldPos, newPos, oldOr, newOr); + if (oldPos != newPos) { + // Only change view if positions are different + _mover->proc8(oldPos, newPos, oldOr, newOr); + } + CStarVector *sv = new CStarVector(this, v); _mover->setVector(sv); } -- cgit v1.2.3