diff options
Diffstat (limited to 'engines/titanic/star_control')
8 files changed, 17 insertions, 40 deletions
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; diff --git a/engines/titanic/star_control/camera_auto_mover.h b/engines/titanic/star_control/camera_auto_mover.h index 25384632fa..d83f15013c 100644 --- a/engines/titanic/star_control/camera_auto_mover.h +++ b/engines/titanic/star_control/camera_auto_mover.h @@ -59,14 +59,15 @@ public: CCameraAutoMover(); virtual ~CCameraAutoMover() {} - virtual void setPath2(const FVector &oldPos, const FVector &newPos, - const FMatrix &oldOrientation, const FMatrix &newOrientation); - /** * Clear src and dest orientation and set some default values for other fields */ virtual void setOrientations(const FMatrix &srcOrient, const FMatrix &destOrient); - virtual void setPath(const FVector &srcV, const FVector &destV, const FMatrix &orientation); + + /** + * Setup a transition to from one position to another + */ + void setPath(const FVector &srcV, const FVector &destV); /** * Applys speeds to the mover. More than one application is usually done for several transitions diff --git a/engines/titanic/star_control/marked_auto_mover.cpp b/engines/titanic/star_control/marked_auto_mover.cpp index 0787c48de3..ae987aa8fc 100644 --- a/engines/titanic/star_control/marked_auto_mover.cpp +++ b/engines/titanic/star_control/marked_auto_mover.cpp @@ -26,9 +26,9 @@ namespace Titanic { -void CMarkedAutoMover::setPath2(const FVector &oldPos, const FVector &newPos, +void CMarkedAutoMover::setPathOrients(const FVector &oldPos, const FVector &newPos, const FMatrix &oldOrientation, const FMatrix &newOrientation) { - CCameraAutoMover::setPath2(oldPos, newPos, oldOrientation, newOrientation); + CCameraAutoMover::setPath(oldPos, newPos); double distance = _distance; _active = true; diff --git a/engines/titanic/star_control/marked_auto_mover.h b/engines/titanic/star_control/marked_auto_mover.h index 856df99c03..ca7fbf3b7f 100644 --- a/engines/titanic/star_control/marked_auto_mover.h +++ b/engines/titanic/star_control/marked_auto_mover.h @@ -41,7 +41,7 @@ private: public: virtual ~CMarkedAutoMover() {} - virtual void setPath2(const FVector &oldPos, const FVector &newPos, + void setPathOrients(const FVector &oldPos, const FVector &newPos, const FMatrix &oldOrientation, const FMatrix &newOrientation); /** diff --git a/engines/titanic/star_control/marked_camera_mover.cpp b/engines/titanic/star_control/marked_camera_mover.cpp index ff9c055abb..df6edbec5f 100644 --- a/engines/titanic/star_control/marked_camera_mover.cpp +++ b/engines/titanic/star_control/marked_camera_mover.cpp @@ -32,13 +32,12 @@ CMarkedCameraMover::CMarkedCameraMover(const CNavigationInfo *src) : CCameraMover(src) { } - void CMarkedCameraMover::transitionBetweenPosOrients(const FVector &oldPos, const FVector &newPos, const FMatrix &oldOrientation, const FMatrix &newOrientation) { if (isLocked()) decLockCount(); - _autoMover.setPath2(oldPos, newPos, oldOrientation, newOrientation); + _autoMover.setPathOrients(oldPos, newPos, oldOrientation, newOrientation); incLockCount(); } diff --git a/engines/titanic/star_control/unmarked_auto_mover.cpp b/engines/titanic/star_control/unmarked_auto_mover.cpp index c84fbbab00..1120690b0e 100644 --- a/engines/titanic/star_control/unmarked_auto_mover.cpp +++ b/engines/titanic/star_control/unmarked_auto_mover.cpp @@ -36,8 +36,8 @@ void CUnmarkedAutoMover::setOrientations(const FMatrix &srcOrient, const FMatrix _active = true; } -void CUnmarkedAutoMover::setPath(const FVector &srcV, const FVector &destV, const FMatrix &orientation) { - CCameraAutoMover::setPath(srcV, destV, orientation); +void CUnmarkedAutoMover::setPathOrient(const FVector &srcV, const FVector &destV, const FMatrix &orientation) { + CCameraAutoMover::setPath(srcV, destV); if (_distance > 8000.0) { _active = true; diff --git a/engines/titanic/star_control/unmarked_auto_mover.h b/engines/titanic/star_control/unmarked_auto_mover.h index b7fb4e3c66..41c13311e0 100644 --- a/engines/titanic/star_control/unmarked_auto_mover.h +++ b/engines/titanic/star_control/unmarked_auto_mover.h @@ -37,9 +37,9 @@ public: virtual void setOrientations(const FMatrix &srcOrient, const FMatrix &destOrient); /** - * Sets the path to animate movement between + * Sets the path and starting and ending orientations to animate movement between */ - virtual void setPath(const FVector &srcV, const FVector &destV, const FMatrix &orientation); + void setPathOrient(const FVector &srcV, const FVector &destV, const FMatrix &orientation); virtual MoverState move(CErrorCode &errorCode, FVector &pos, FMatrix &orientation); }; diff --git a/engines/titanic/star_control/unmarked_camera_mover.cpp b/engines/titanic/star_control/unmarked_camera_mover.cpp index 200d549ce1..c879dc25e8 100644 --- a/engines/titanic/star_control/unmarked_camera_mover.cpp +++ b/engines/titanic/star_control/unmarked_camera_mover.cpp @@ -41,7 +41,7 @@ void CUnmarkedCameraMover::moveTo(const FVector &srcV, const FVector &destV, con debugC(DEBUG_BASIC, kDebugStarfield, "Starfield move %s to %s", srcV.toString().c_str(), destV.toString().c_str()); - _autoMover.setPath(srcV, destV, orientation); + _autoMover.setPathOrient(srcV, destV, orientation); } // TODO: v3 is unused |