diff options
author | David Fioramonti | 2017-08-21 15:57:51 -0700 |
---|---|---|
committer | David Fioramonti | 2017-08-21 15:57:53 -0700 |
commit | 09a7a139f41a94162e00aa32fa4e37e0ce412d6c (patch) | |
tree | c5b2b053d824a55403abbb5afd453b17f46238cc | |
parent | 04598dd5adbafcc6821dfc9f2927457fc20a3c7c (diff) | |
download | scummvm-rg350-09a7a139f41a94162e00aa32fa4e37e0ce412d6c.tar.gz scummvm-rg350-09a7a139f41a94162e00aa32fa4e37e0ce412d6c.tar.bz2 scummvm-rg350-09a7a139f41a94162e00aa32fa4e37e0ce412d6c.zip |
TITANIC: Camera Auto Mover class cleanup
Named some functions, made _speeds be an array instead of
a dynamic one.
4 files changed, 11 insertions, 9 deletions
diff --git a/engines/titanic/star_control/camera_auto_mover.cpp b/engines/titanic/star_control/camera_auto_mover.cpp index 60a1cbde82..b94c4d601c 100644 --- a/engines/titanic/star_control/camera_auto_mover.cpp +++ b/engines/titanic/star_control/camera_auto_mover.cpp @@ -50,8 +50,7 @@ void CCameraAutoMover::proc2(const FVector &oldPos, const FVector &newPos, _destPos = newPos; _posDelta = _destPos - _srcPos; float temp = 0.0; - bool unused_status = _posDelta.normalize(temp); // Do the normalization, put the scale amount in temp - + _posDelta.normalize(temp); // Do the normalization, put the scale amount in temp _distance = temp; _active = false; _field34 = false; @@ -90,17 +89,16 @@ void CCameraAutoMover::setPath(const FVector &srcV, const FVector &destV, const _transitionPercent = 1.0; } -void CCameraAutoMover::proc6(int val1, int val2, float val) { +void CCameraAutoMover::calcSpeeds(int val1, int val2, float distance) { _field44 = val1; _field4C = val1 + 62; - _field38 = val / (double)(val1 + val2 * 2); + _field38 = distance / (double)(val1 + val2 * 2); _field40 = 31; _field48 = 31; _field3C = (double)val2 * _field38; // Calculate the speeds for a graduated movement between stars double base = 0.0, total = 0.0; - _speeds.resize(32); for (int idx = 31; idx >= 0; --idx) { _speeds[idx] = pow(base, 4.0); total += _speeds[idx]; diff --git a/engines/titanic/star_control/camera_auto_mover.h b/engines/titanic/star_control/camera_auto_mover.h index dc9cf6df45..7b2e44fe13 100644 --- a/engines/titanic/star_control/camera_auto_mover.h +++ b/engines/titanic/star_control/camera_auto_mover.h @@ -49,7 +49,7 @@ protected: int _field44; int _field48; int _field4C; - Common::Array<double> _speeds; + double _speeds[32]; int _field54; double _transitionPercent; double _transitionPercentInc; @@ -63,7 +63,11 @@ public: virtual void proc3(const FMatrix &srcOrient, const FMatrix &destOrient); virtual void setPath(const FVector &srcV, const FVector &destV, const FMatrix &orientation); virtual int proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) { return 2; } - virtual void proc6(int val1, int val2, float val); + /** + * Given a distance to cover, determines a bunch of speeds for a gradual transition + * from one position to another (the mover). The speeds go from fast to slow + */ + virtual void calcSpeeds(int val1, int val2, float distance); bool isActive() const { return _active; } }; diff --git a/engines/titanic/star_control/marked_auto_mover.cpp b/engines/titanic/star_control/marked_auto_mover.cpp index 0a2da6dda1..22eb695427 100644 --- a/engines/titanic/star_control/marked_auto_mover.cpp +++ b/engines/titanic/star_control/marked_auto_mover.cpp @@ -34,7 +34,7 @@ void CMarkedAutoMover::proc2(const FVector &oldPos, const FVector &newPos, double distance = _distance; _active = true; _field34 = true; - proc6(120, 4, distance); + calcSpeeds(120, 4, distance); _orientationChanger.load(oldOrientation, newOrientation); diff --git a/engines/titanic/star_control/unmarked_auto_mover.cpp b/engines/titanic/star_control/unmarked_auto_mover.cpp index 71063fa615..1461132c13 100644 --- a/engines/titanic/star_control/unmarked_auto_mover.cpp +++ b/engines/titanic/star_control/unmarked_auto_mover.cpp @@ -42,7 +42,7 @@ void CUnmarkedAutoMover::setPath(const FVector &srcV, const FVector &destV, cons if (_distance > 8000.0) { _active = true; _field34 = 1; - proc6(120, 4, _distance - 8000.0); + calcSpeeds(120, 4, _distance - 8000.0); } FVector row3 = orientation._row3; |