aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Fioramonti2017-08-19 08:25:32 -0700
committerDavid Fioramonti2017-08-19 08:36:02 -0700
commit312d63c3c951ed3781c4f7a1577b62cb862042b3 (patch)
tree39972816ae710d5ea77e03574fd7646f85cba4fe
parent24bec379d5f1d59dfac2ff304b8ccbc64f5ae5b2 (diff)
downloadscummvm-rg350-312d63c3c951ed3781c4f7a1577b62cb862042b3.tar.gz
scummvm-rg350-312d63c3c951ed3781c4f7a1577b62cb862042b3.tar.bz2
scummvm-rg350-312d63c3c951ed3781c4f7a1577b62cb862042b3.zip
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.
-rw-r--r--engines/titanic/star_control/star_camera.cpp19
1 files 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);
}