From d69404d5de6fded94803c36bd0d5fe012d705c0a Mon Sep 17 00:00:00 2001 From: David Fioramonti Date: Thu, 7 Sep 2017 05:08:38 -0700 Subject: TITANIC: Make use of CCameraAutoMover::setPath() more clear There was a setPath() adn setPath2() function took in different arguments and were doing the same thing, but not using the different arguments. I made it into one function that only takes in the arguments it uses. Also it was marked virtual, but all the derived classes, CMarkedAutoMover, and CUnmarkedAutoMover were just doing there own thing and then calling this base class implementation. Therefore, I made it be not virtual and the derived classes can do there own thing and then call this, but since they are doing slightly different things it makes sense to differentiate the names and not have them all be called setPath. I.e., the derived classes also change the orientation so that is included in their function names to reflect that. --- engines/titanic/star_control/camera_auto_mover.cpp | 29 +++------------------- 1 file changed, 3 insertions(+), 26 deletions(-) (limited to 'engines/titanic/star_control/camera_auto_mover.cpp') diff --git a/engines/titanic/star_control/camera_auto_mover.cpp b/engines/titanic/star_control/camera_auto_mover.cpp index fcd1e9e0ee..1b016bc549 100644 --- a/engines/titanic/star_control/camera_auto_mover.cpp +++ b/engines/titanic/star_control/camera_auto_mover.cpp @@ -41,25 +41,6 @@ CCameraAutoMover::CCameraAutoMover() : _srcPos(0.0, 1000000.0, 0.0) { _transitionPercentInc = 0.0; } -// TODO: same as setPath also orientations are not used -void CCameraAutoMover::setPath2(const FVector &oldPos, const FVector &newPos, - const FMatrix &oldOrientation, const FMatrix &newOrientation) { - _srcPos = oldPos; - _destPos = newPos; - _posDelta = _destPos - _srcPos; - - float temp = 0.0; - _posDelta.normalize(temp); // Do the normalization, put the scale amount in temp - _distance = temp; - _active = false; - _field34 = false; - _transitionPercent = 1.0; - _field40 = -1; - _field44 = -1; - _field48 = -1; - _field4C = 0; -} - // TODO: same as proc2 also orientations are not used void CCameraAutoMover::setOrientations(const FMatrix &srcOrient, const FMatrix &destOrient) { _srcPos.clear(); @@ -70,18 +51,14 @@ void CCameraAutoMover::setOrientations(const FMatrix &srcOrient, const FMatrix & _field34 = false; } -// TODO: same as setPath2 also orientations are not used -void CCameraAutoMover::setPath(const FVector &srcV, const FVector &destV, const FMatrix &orientation) { +void CCameraAutoMover::setPath(const FVector &srcV, const FVector &destV) { _srcPos = srcV; _destPos = destV; _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); - } + _posDelta.normalize(temp); // normalization won't happen if _posDelta is zero vector + // and that is okay _distance = temp; _active = false; -- cgit v1.2.3 From 4bdea384c30586a861ccbc102039258faafe3d90 Mon Sep 17 00:00:00 2001 From: David Fioramonti Date: Thu, 7 Sep 2017 05:16:26 -0700 Subject: TITANIC: make sure of setOrientations more clear Made camera automover setOrientations not virtual and reduced arguments also changed name since to differentiate it from behavior of derived classes. --- engines/titanic/star_control/camera_auto_mover.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'engines/titanic/star_control/camera_auto_mover.cpp') diff --git a/engines/titanic/star_control/camera_auto_mover.cpp b/engines/titanic/star_control/camera_auto_mover.cpp index 1b016bc549..71f7de85b2 100644 --- a/engines/titanic/star_control/camera_auto_mover.cpp +++ b/engines/titanic/star_control/camera_auto_mover.cpp @@ -41,8 +41,7 @@ CCameraAutoMover::CCameraAutoMover() : _srcPos(0.0, 1000000.0, 0.0) { _transitionPercentInc = 0.0; } -// TODO: same as proc2 also orientations are not used -void CCameraAutoMover::setOrientations(const FMatrix &srcOrient, const FMatrix &destOrient) { +void CCameraAutoMover::clear() { _srcPos.clear(); _destPos.clear(); _transitionPercent = 1.0; -- cgit v1.2.3