diff options
author | Paul Gilbert | 2017-04-15 22:21:01 -0400 |
---|---|---|
committer | Paul Gilbert | 2017-04-15 22:21:01 -0400 |
commit | 93c2ca3c94fc97dd32b03f486244064216a80019 (patch) | |
tree | 4c9ccefe2e023dc84356c0ba7b27a8ced0d9d67d /engines | |
parent | 074e466f914022901e26a12988b5e9c24e9a74c8 (diff) | |
download | scummvm-rg350-93c2ca3c94fc97dd32b03f486244064216a80019.tar.gz scummvm-rg350-93c2ca3c94fc97dd32b03f486244064216a80019.tar.bz2 scummvm-rg350-93c2ca3c94fc97dd32b03f486244064216a80019.zip |
TITANIC: Renaming methods for setting camera movement
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/star_control/base_stars.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/star_control/base_stars.h | 6 | ||||
-rw-r--r-- | engines/titanic/star_control/star_camera.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/star_control/star_camera.h | 7 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub2.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub20.h | 7 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub21.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub21.h | 2 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub23.cpp | 25 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub23.h | 6 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub24.cpp | 14 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub24.h | 7 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub27.cpp | 26 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub27.h | 7 |
14 files changed, 72 insertions, 49 deletions
diff --git a/engines/titanic/star_control/base_stars.cpp b/engines/titanic/star_control/base_stars.cpp index dbe239ec39..12fa566d99 100644 --- a/engines/titanic/star_control/base_stars.cpp +++ b/engines/titanic/star_control/base_stars.cpp @@ -544,7 +544,7 @@ void CBaseStars::draw4(CSurfaceArea *surfaceArea, CStarCamera *camera, CStarClos } } -int CBaseStars::baseFn1(CSurfaceArea *surfaceArea, CStarCamera *camera, +int CBaseStars::findStar(CSurfaceArea *surfaceArea, CStarCamera *camera, const Common::Point &pt) { CStarRef1 ref(this, pt); ref.process(surfaceArea, camera); diff --git a/engines/titanic/star_control/base_stars.h b/engines/titanic/star_control/base_stars.h index 34bec4b6dc..e77b20ec08 100644 --- a/engines/titanic/star_control/base_stars.h +++ b/engines/titanic/star_control/base_stars.h @@ -144,7 +144,11 @@ public: */ const CBaseStarEntry *getDataPtr(int index) const; - int baseFn1(CSurfaceArea *surfaceArea, CStarCamera *camera, + /** + * Checks for the presence of a star at a given position on the + * screen given the specified camera view, and returns it's index + */ + int findStar(CSurfaceArea *surfaceArea, CStarCamera *camera, const Common::Point &pt); int baseFn2(CSurfaceArea *surfaceArea, CStarCamera *camera); diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp index 651dbddd9a..8f091821ab 100644 --- a/engines/titanic/star_control/star_camera.cpp +++ b/engines/titanic/star_control/star_camera.cpp @@ -116,11 +116,11 @@ void CStarCamera::proc13(CStarControlSub13 *dest) { *dest = _sub13; } -void CStarCamera::proc14(FVector &v) { +void CStarCamera::setDestination(const FVector &v) { FMatrix matrix = _sub13.getMatrix(); FVector vector = _sub13._position; - _handlerP->proc9(vector, v, matrix); + _handlerP->moveTo(vector, v, matrix); } void CStarCamera::proc15(CErrorCode *errorCode) { diff --git a/engines/titanic/star_control/star_camera.h b/engines/titanic/star_control/star_camera.h index 6a0cd2c6d4..194079a0fc 100644 --- a/engines/titanic/star_control/star_camera.h +++ b/engines/titanic/star_control/star_camera.h @@ -78,7 +78,12 @@ public: virtual void proc11(); virtual void proc12(StarMode mode, double v2); virtual void proc13(CStarControlSub13 *dest); - virtual void proc14(FVector &v); + + /** + * Sets the destination to move the camera to + */ + virtual void setDestination(const FVector &v); + virtual void proc15(CErrorCode *errorCode); virtual void proc16(); virtual void proc17(); diff --git a/engines/titanic/star_control/star_control_sub2.cpp b/engines/titanic/star_control/star_control_sub2.cpp index 221efa9772..2416d3cb24 100644 --- a/engines/titanic/star_control/star_control_sub2.cpp +++ b/engines/titanic/star_control/star_control_sub2.cpp @@ -38,11 +38,11 @@ bool CStarControlSub2::loadYale(int v1) { bool CStarControlSub2::selectStar(CSurfaceArea *surfaceArea, CStarCamera *camera, const Common::Point &pt, void *handler) { - int index = baseFn1(surfaceArea, camera, pt); + int index = findStar(surfaceArea, camera, pt); if (index == -1) { return false; } else if (!handler) { - camera->proc14(_data[index]._position); + camera->setDestination(_data[index]._position); return true; } else { error("no handler ever passed in original"); diff --git a/engines/titanic/star_control/star_control_sub20.h b/engines/titanic/star_control/star_control_sub20.h index ce3149939b..102773f1d6 100644 --- a/engines/titanic/star_control/star_control_sub20.h +++ b/engines/titanic/star_control/star_control_sub20.h @@ -56,7 +56,12 @@ public: virtual void proc6(); virtual void proc7(); virtual void proc8(FVector &v1, FVector &v2, FMatrix &m1, FMatrix &m2) {} - virtual void proc9(FVector &v1, FVector &v2, FMatrix &matrix) {} + + /** + * Start a movement to a given specified destination + */ + virtual void moveTo(const FVector &srcV, const FVector &destV, const FMatrix &srcM) {} + virtual void proc10(const FVector &v1, const FVector &v2, const FVector &v3, const FMatrix &m) {} virtual void proc11(CErrorCode &errorCode, FVector &v, FMatrix &m); virtual void setVector(CStarVector *sv); diff --git a/engines/titanic/star_control/star_control_sub21.cpp b/engines/titanic/star_control/star_control_sub21.cpp index c96e29c7e7..6c5608eb27 100644 --- a/engines/titanic/star_control/star_control_sub21.cpp +++ b/engines/titanic/star_control/star_control_sub21.cpp @@ -31,11 +31,11 @@ CStarControlSub21::CStarControlSub21(const CStar20Data *src) : CStarControlSub20(src) { } -void CStarControlSub21::proc9(FVector &v1, FVector &v2, FMatrix &matrix) { +void CStarControlSub21::moveTo(const FVector &srcV, const FVector &destV, const FMatrix &srcM) { if (isLocked()) decLockCount(); - _sub24.proc4(v1, v2, matrix); + _sub24.setPath(srcV, destV, srcM); } void CStarControlSub21::proc10(const FVector &v1, const FVector &v2, const FVector &v3, const FMatrix &m) { diff --git a/engines/titanic/star_control/star_control_sub21.h b/engines/titanic/star_control/star_control_sub21.h index 17e0a427a6..3776121d96 100644 --- a/engines/titanic/star_control/star_control_sub21.h +++ b/engines/titanic/star_control/star_control_sub21.h @@ -35,7 +35,7 @@ public: CStarControlSub21(const CStar20Data *src); virtual ~CStarControlSub21() {} - virtual void proc9(FVector &v1, FVector &v2, FMatrix &matrix); + virtual void moveTo(const FVector &srcV, const FVector &destV, const FMatrix &srcM); virtual void proc10(const FVector &v1, const FVector &v2, const FVector &v3, const FMatrix &m); virtual void proc11(CErrorCode &errorCode, FVector &v, FMatrix &m); }; diff --git a/engines/titanic/star_control/star_control_sub23.cpp b/engines/titanic/star_control/star_control_sub23.cpp index 7b329e77e7..792c3a2304 100644 --- a/engines/titanic/star_control/star_control_sub23.cpp +++ b/engines/titanic/star_control/star_control_sub23.cpp @@ -25,7 +25,7 @@ namespace Titanic { -CStarControlSub23::CStarControlSub23() : _row1(0.0, 1000000.0, 0.0) { +CStarControlSub23::CStarControlSub23() : _srcPos(0.0, 1000000.0, 0.0) { _field4 = 0; _active = false; _field24 = 0.0; @@ -42,10 +42,10 @@ CStarControlSub23::CStarControlSub23() : _row1(0.0, 1000000.0, 0.0) { } void CStarControlSub23::proc2(FVector &v1, FVector &v2, FMatrix &m1, FMatrix &m2) { - _row1 = v1; - _row2 = v2; - _row3 = _row2 - _row1; - _field24 = _row3.normalize(); + _srcPos = v1; + _destPos = v2; + _posDelta = _destPos - _srcPos; + _field24 = _posDelta.normalize(); _active = false; _field34 = 0; @@ -57,20 +57,19 @@ void CStarControlSub23::proc2(FVector &v1, FVector &v2, FMatrix &m1, FMatrix &m2 } void CStarControlSub23::proc3(const FMatrix &m1, const FMatrix &m2) { - _row1.clear(); - _row2.clear(); + _srcPos.clear(); + _destPos.clear(); _moveDelayCtr = 1.0; _field24 = 0.0; _active = false; _field34 = 0; } -void CStarControlSub23::proc4(FVector &v1, FVector &v2, FMatrix &m) { - _row1 = v1; - _row2 = v2; - FVector vector = _row2 - _row1; - _row3 = vector; - _field24 = _row3.normalize(); +void CStarControlSub23::setPath(const FVector &srcV, const FVector &destV, const FMatrix &srcM) { + _srcPos = srcV; + _destPos = destV; + _posDelta = _destPos - _srcPos; + _field24 = _posDelta.normalize(); _active = false; _field34 = 0; diff --git a/engines/titanic/star_control/star_control_sub23.h b/engines/titanic/star_control/star_control_sub23.h index ee8cd2f4d4..8016d6f56f 100644 --- a/engines/titanic/star_control/star_control_sub23.h +++ b/engines/titanic/star_control/star_control_sub23.h @@ -34,9 +34,9 @@ class CStarControlSub23 { protected: int _field4; bool _active; - FVector _row1, _row2; + FVector _srcPos, _destPos; double _field24; - FVector _row3; + FVector _posDelta; int _field34; double _field38; double _field3C; @@ -55,7 +55,7 @@ public: virtual void proc2(FVector &v1, FVector &v2, FMatrix &m1, FMatrix &m2); virtual void proc3(const FMatrix &m1, const FMatrix &m2); - virtual void proc4(FVector &v1, FVector &v2, FMatrix &m); + virtual void setPath(const FVector &srcV, const FVector &destV, const FMatrix &srcM); virtual int proc5(CErrorCode &errorCode, FVector &v, FMatrix &m) { return 2; } virtual void proc6(int val1, int val2, float val); diff --git a/engines/titanic/star_control/star_control_sub24.cpp b/engines/titanic/star_control/star_control_sub24.cpp index 43670406a1..d716079e31 100644 --- a/engines/titanic/star_control/star_control_sub24.cpp +++ b/engines/titanic/star_control/star_control_sub24.cpp @@ -34,8 +34,8 @@ void CStarControlSub24::proc3(const FMatrix &m1, const FMatrix &m2) { _active = true; } -void CStarControlSub24::proc4(FVector &v1, FVector &v2, FMatrix &m) { - CStarControlSub23::proc4(v1, v2, m); +void CStarControlSub24::setPath(const FVector &srcV, const FVector &destV, const FMatrix &srcM) { + CStarControlSub23::setPath(srcV, destV, srcM); if (_field24 > 8000.0) { _active = true; @@ -43,8 +43,8 @@ void CStarControlSub24::proc4(FVector &v1, FVector &v2, FMatrix &m) { proc6(120, 4, _field24 - 8000.0); } - FVector row3 = m._row3; - double mult = _row3._x * row3._x + _row3._y * row3._y+ _row3._z * row3._z; + FVector row3 = srcM._row3; + double mult = _posDelta._x * row3._x + _posDelta._y * row3._y+ _posDelta._z * row3._z; _moveDelayCtr = 1.0; bool flag = false; @@ -59,7 +59,7 @@ void CStarControlSub24::proc4(FVector &v1, FVector &v2, FMatrix &m) { if (!flag) { const FVector *tv; FVector tempV1, tempV2; - FVector::addAndNormalize(tempV1, row3, _row3); + FVector::addAndNormalize(tempV1, row3, _posDelta); tv = FVector::addAndNormalize(tempV2, row3, tempV1); tempV1 = *tv; @@ -71,7 +71,7 @@ void CStarControlSub24::proc4(FVector &v1, FVector &v2, FMatrix &m) { FMatrix m1; m1.fn1(tempV1); - _sub25.fn1(m, m1); + _sub25.fn1(srcM, m1); _moveDelayCtr = 0.0; _moveDelayInc = 0.1; @@ -99,7 +99,7 @@ int CStarControlSub24::proc5(CErrorCode &errorCode, FVector &v, FMatrix &m) { } v2 = m._row3; - v3 = _row2 - v; + v3 = _destPos - v; v3.normalize(); double val = m._row3._x * v3._x + m._row3._y * v3._y + m._row3._z * v3._z; diff --git a/engines/titanic/star_control/star_control_sub24.h b/engines/titanic/star_control/star_control_sub24.h index 16f53610ec..f3d38ef13b 100644 --- a/engines/titanic/star_control/star_control_sub24.h +++ b/engines/titanic/star_control/star_control_sub24.h @@ -32,7 +32,12 @@ public: virtual ~CStarControlSub24() {} virtual void proc3(const FMatrix &m1, const FMatrix &m2); - virtual void proc4(FVector &v1, FVector &v2, FMatrix &m); + + /** + * Sets the path to animate movement between + */ + virtual void setPath(const FVector &srcV, const FVector &destV, const FMatrix &srcM); + virtual int proc5(CErrorCode &errorCode, FVector &v, FMatrix &m); }; diff --git a/engines/titanic/star_control/star_control_sub27.cpp b/engines/titanic/star_control/star_control_sub27.cpp index a300b51db0..cedaf9f421 100644 --- a/engines/titanic/star_control/star_control_sub27.cpp +++ b/engines/titanic/star_control/star_control_sub27.cpp @@ -59,23 +59,23 @@ int CStarControlSub27::proc5(CErrorCode &errorCode, FVector &v, FMatrix &m) { if (_field40 >= 0) { double powVal = _powers[_field40]; - v += _row3 * powVal; - fn1(v); + v += _posDelta * powVal; + getVectorOnPath(v); --_field40; errorCode.set(); return 1; } else if (_field44 > 0) { - v += _row3 * _field38; - fn1(v); + v += _posDelta * _field38; + getVectorOnPath(v); --_field44; errorCode.set(); return 1; } else if (_field48 >= 0) { double powVal = _powers[31 - _field48]; - v += _row3 * powVal; - fn1(v); + v += _posDelta * powVal; + getVectorOnPath(v); --_field48; errorCode.set(); @@ -86,19 +86,19 @@ int CStarControlSub27::proc5(CErrorCode &errorCode, FVector &v, FMatrix &m) { } } -void CStarControlSub27::fn1(FVector &v) const { - double distance = _row1.getDistance(v); +void CStarControlSub27::getVectorOnPath(FVector &v) const { + double distance = _posDelta.getDistance(v); distance /= _field24; if (distance <= 0.0) { - v = _row1; + v = _srcPos; } else if (distance >= 1.0) { - v = _row2; + v = _destPos; } else { v = FVector( - (_row2._x - _row1._x) * distance + _row1._x, - (_row2._y - _row1._y) * distance + _row1._y, - (_row2._z - _row1._z) * distance + _row1._z + (_destPos._x - _srcPos._x) * distance + _srcPos._x, + (_destPos._y - _srcPos._y) * distance + _srcPos._y, + (_destPos._z - _srcPos._z) * distance + _srcPos._z ); } } diff --git a/engines/titanic/star_control/star_control_sub27.h b/engines/titanic/star_control/star_control_sub27.h index ff4136c1c5..929544b815 100644 --- a/engines/titanic/star_control/star_control_sub27.h +++ b/engines/titanic/star_control/star_control_sub27.h @@ -29,7 +29,12 @@ namespace Titanic { class CStarControlSub27 : public CStarControlSub23 { private: - void fn1(FVector &v) const; + /** + * Given a vector, figures out how far is from the movement source, and + * returns a vector on the proper point along the path to the destination + * with that same distance from the source. + */ + void getVectorOnPath(FVector &v) const; public: virtual ~CStarControlSub27() {} |