aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/star_control/camera_auto_mover.cpp
diff options
context:
space:
mode:
authorDavid Fioramonti2017-08-19 07:00:39 -0700
committerDavid Fioramonti2017-08-19 08:36:02 -0700
commit24bec379d5f1d59dfac2ff304b8ccbc64f5ae5b2 (patch)
treeb77f40445fbb857ef970312bfc3fb69d4d19b57e /engines/titanic/star_control/camera_auto_mover.cpp
parent82d0053f8bd472ec598645550825257ddd78d683 (diff)
downloadscummvm-rg350-24bec379d5f1d59dfac2ff304b8ccbc64f5ae5b2.tar.gz
scummvm-rg350-24bec379d5f1d59dfac2ff304b8ccbc64f5ae5b2.tar.bz2
scummvm-rg350-24bec379d5f1d59dfac2ff304b8ccbc64f5ae5b2.zip
TITANIC: Pull assert out of dvector/fvector normalization
Before the normalization function was asserting if it couldn't normalize now the caller can determine what to do with a failed normalization.
Diffstat (limited to 'engines/titanic/star_control/camera_auto_mover.cpp')
-rw-r--r--engines/titanic/star_control/camera_auto_mover.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/engines/titanic/star_control/camera_auto_mover.cpp b/engines/titanic/star_control/camera_auto_mover.cpp
index 861248fc1f..bcb94d27c2 100644
--- a/engines/titanic/star_control/camera_auto_mover.cpp
+++ b/engines/titanic/star_control/camera_auto_mover.cpp
@@ -49,8 +49,12 @@ void CCameraAutoMover::proc2(const FVector &oldPos, const FVector &newPos,
_srcPos = oldPos;
_destPos = newPos;
_posDelta = _destPos - _srcPos;
- _distance = _posDelta.normalize();
-
+ 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);
+ }
+ _distance = temp;
_active = false;
_field34 = false;
_transitionPercent = 1.0;
@@ -73,8 +77,12 @@ void CCameraAutoMover::setPath(const FVector &srcV, const FVector &destV, const
_srcPos = srcV;
_destPos = destV;
_posDelta = _destPos - _srcPos;
- _distance = _posDelta.normalize();
-
+ 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);
+ }
+ _distance = temp;
_active = false;
_field34 = false;
_field40 = -1;