diff options
author | Paul Gilbert | 2017-06-02 20:29:51 -0400 |
---|---|---|
committer | Paul Gilbert | 2017-06-02 20:29:51 -0400 |
commit | 26ee9caebfed56c660df4ca9bbb09696f15baf65 (patch) | |
tree | 1477725bd81c5c21fd8be1519131c13e5b35ae72 /engines/titanic/star_control | |
parent | 10ada8b23b4b1b5050e94eca5818280ecc506a9a (diff) | |
download | scummvm-rg350-26ee9caebfed56c660df4ca9bbb09696f15baf65.tar.gz scummvm-rg350-26ee9caebfed56c660df4ca9bbb09696f15baf65.tar.bz2 scummvm-rg350-26ee9caebfed56c660df4ca9bbb09696f15baf65.zip |
TITANIC: Fix calculations in CStarCamera fn2
Diffstat (limited to 'engines/titanic/star_control')
-rw-r--r-- | engines/titanic/star_control/star_camera.cpp | 24 | ||||
-rw-r--r-- | engines/titanic/star_control/star_view.cpp | 2 |
2 files changed, 19 insertions, 7 deletions
diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp index fae519e1f1..392c53e202 100644 --- a/engines/titanic/star_control/star_camera.cpp +++ b/engines/titanic/star_control/star_camera.cpp @@ -479,20 +479,32 @@ void CStarCamera::fn1(CViewport *viewport, const FVector &v) { } void CStarCamera::fn2(FVector v1, FVector v2, FVector v3) { + // Calculations only done when the first marker is locked on if (_matrixRow == -1) { FVector tempV; + double val1, val2, val3, val4, val5; + double val6, val7, val8, val9; + + val1 = _viewport._centerVector._y * v1._x; tempV._z = _viewport._field10; + val2 = _viewport._centerVector._y * tempV._z * v3._x; + val3 = _viewport._centerVector._z * v1._y; + val4 = _viewport._centerVector._z * tempV._z; + val5 = val1 * v1._z / _viewport._centerVector._x; v3._z = v1._z; - tempV._x = _viewport._centerVector._z * v1._y * v1._z / _viewport._centerVector._x; - v3._y = _viewport._centerVector._y * tempV._z * v3._x / _viewport._centerVector._x; - v3._x = _viewport._centerVector._y * v1._x * v1._z / _viewport._centerVector._x - _viewport._valArray[2]; - tempV._y = _viewport._centerVector._z * tempV._z * v3._y / _viewport._centerVector._x; - tempV._x = tempV._x - _viewport._valArray[2]; + val6 = val4 * v3._y; + val7 = val3 * v1._z / _viewport._centerVector._x; + val8 = val6 / _viewport._centerVector._x; + val9 = val2 / _viewport._centerVector._x; + v3._x = val5 - _viewport._valArray[2]; + v3._y = val7; + tempV._x = val9 - _viewport._valArray[2]; + tempV._y = val8; v3.normalize(); tempV.normalize(); - FMatrix matrix = _viewport.getOrientation(); + DMatrix matrix = _viewport.getOrientation(); const FVector &pos = _viewport._position; _mover->proc10(v3, tempV, pos, matrix); diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp index 77724698e0..9b292d715b 100644 --- a/engines/titanic/star_control/star_view.cpp +++ b/engines/titanic/star_control/star_view.cpp @@ -379,7 +379,7 @@ void CStarView::lockStar() { if (_starField && !_showingPhoto) { CSurfaceArea surfaceArea(_videoSurface); FVector v1, v2, v3; - double val = _starField->fn5(&surfaceArea, &_camera, v1, v2, v3); + double val = _starField->fn5(&surfaceArea, &_camera, v1, v2, v3); if (val > -1.0) { v1 -= surfaceArea._centroid; |