aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/star_control/star_camera.cpp
diff options
context:
space:
mode:
authorDavid Fioramonti2017-08-20 19:43:40 -0700
committerDavid Fioramonti2017-08-20 20:25:31 -0700
commit2a96a6fc7288a33a3726191338308af3581c9883 (patch)
treea43fac1a90a17bcf5973da6b3c557e376c57260d /engines/titanic/star_control/star_camera.cpp
parentffbfdac87ed43535091f5273eea3dd9e8ec6d979 (diff)
downloadscummvm-rg350-2a96a6fc7288a33a3726191338308af3581c9883.tar.gz
scummvm-rg350-2a96a6fc7288a33a3726191338308af3581c9883.tar.bz2
scummvm-rg350-2a96a6fc7288a33a3726191338308af3581c9883.zip
TITANIC: Prevent 2 star locking for large distances
I have added a conditional to the code so that if the player tries to lock onto the 2nd star and they are very far away, >1e8, then the game will not allow the star to be locked. This is a temporary workaround since if a distance of farther then this is attempted then the view will be throw way off and the stars will not be shown locking onto correctly. I've also made the locking functions return booleans so I can determine the success of the lockings. This is a partial fix for #9961.
Diffstat (limited to 'engines/titanic/star_control/star_camera.cpp')
-rw-r--r--engines/titanic/star_control/star_camera.cpp36
1 files changed, 25 insertions, 11 deletions
diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp
index fa19b95ee6..af671ebbac 100644
--- a/engines/titanic/star_control/star_camera.cpp
+++ b/engines/titanic/star_control/star_camera.cpp
@@ -450,9 +450,9 @@ void CStarCamera::deleteHandler() {
}
}
-void CStarCamera::lockMarker1(FVector v1, FVector v2, FVector v3) {
+bool CStarCamera::lockMarker1(FVector v1, FVector v2, FVector v3) {
if (_starLockState != ZERO_LOCKED)
- return;
+ return true;
FVector tempV;
double val1, val2, val3, val4, val5;
@@ -487,11 +487,12 @@ void CStarCamera::lockMarker1(FVector v1, FVector v2, FVector v3) {
CStarVector *sv = new CStarVector(this, v2);
_mover->setVector(sv);
+ return true;
}
-void CStarCamera::lockMarker2(CViewport *viewport, const FVector &v) {
+bool CStarCamera::lockMarker2(CViewport *viewport, const FVector &v) {
if (_starLockState != ONE_LOCKED)
- return;
+ return true;
DAffine m2(X_AXIS, _matrix._row1);
DVector tempV1 = v - _matrix._row1;
@@ -567,7 +568,7 @@ void CStarCamera::lockMarker2(CViewport *viewport, const FVector &v) {
m4._col2 -= m4._col1;
m4._col4 -= m4._col1;
- FMatrix m6 = _viewport.getOrientation();
+
double unusedScale=0.0;
if (!m4._col2.normalize(unusedScale) ||
@@ -581,16 +582,28 @@ void CStarCamera::lockMarker2(CViewport *viewport, const FVector &v) {
m5.set(m4._col3, m4._col2, m4._col4);
FVector newPos = m4._col1;
-
- _mover->proc8(_viewport._position, newPos, m6, m5);
+ FMatrix m6 = _viewport.getOrientation();
- CStarVector *sv = new CStarVector(this, v);
- _mover->setVector(sv);
+ if (minDistance > 1.0e8) {
+ // The transition will do poorly in this case.
+ //removeLockedStar(); // undo locking 2nd star
+ _mover->proc8(_viewport._position, _viewport._position, m6, m6);
+ //CStarVector *sv = new CStarVector(this, v);
+ //_mover->setVector(sv);
+ return false;
+ }
+ else {
+ _mover->proc8(_viewport._position, newPos, m6, m5);
+ CStarVector *sv = new CStarVector(this, v);
+ _mover->setVector(sv);
+
+ }
+ return true;
}
-void CStarCamera::lockMarker3(CViewport *viewport, const FVector &v) {
+bool CStarCamera::lockMarker3(CViewport *viewport, const FVector &v) {
if (_starLockState != TWO_LOCKED)
- return;
+ return true;
FMatrix newOr = viewport->getOrientation();
FMatrix oldOr = _viewport.getOrientation();
@@ -601,6 +614,7 @@ void CStarCamera::lockMarker3(CViewport *viewport, const FVector &v) {
CStarVector *sv = new CStarVector(this, v);
_mover->setVector(sv);
+ return true;
}
} // End of namespace Titanic