aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/star_control/camera_auto_mover.cpp18
-rw-r--r--engines/titanic/star_control/camera_auto_mover.h3
-rw-r--r--engines/titanic/star_control/marked_auto_mover.cpp2
-rw-r--r--engines/titanic/star_control/unmarked_auto_mover.cpp2
4 files changed, 14 insertions, 11 deletions
diff --git a/engines/titanic/star_control/camera_auto_mover.cpp b/engines/titanic/star_control/camera_auto_mover.cpp
index b94c4d601c..aa29fa0e8e 100644
--- a/engines/titanic/star_control/camera_auto_mover.cpp
+++ b/engines/titanic/star_control/camera_auto_mover.cpp
@@ -90,22 +90,24 @@ void CCameraAutoMover::setPath(const FVector &srcV, const FVector &destV, const
}
void CCameraAutoMover::calcSpeeds(int val1, int val2, float distance) {
+ // Usually val1 and val2 are small where as distance can be large
_field44 = val1;
- _field4C = val1 + 62;
+ _field4C = val1 + 2 * nMoverTransitions; // For _nMoverTransitions = 32 this second value was 64,
+ // should it always be x2 _nMoverTransitions?
_field38 = distance / (double)(val1 + val2 * 2);
- _field40 = 31;
- _field48 = 31;
+ _field40 = nMoverTransitions-1;
+ _field48 = nMoverTransitions-1;
_field3C = (double)val2 * _field38;
// Calculate the speeds for a graduated movement between stars
- double base = 0.0, total = 0.0;
- for (int idx = 31; idx >= 0; --idx) {
- _speeds[idx] = pow(base, 4.0);
+ double base = 0.0, total = 0.0, power = 4.0, baseInc = 0.03125;
+ for (int idx = nMoverTransitions - 1; idx >= 0; --idx) {
+ _speeds[idx] = pow(base, power);
total += _speeds[idx];
- base += 0.03125;
+ base += baseInc;
}
- for (int idx = 0; idx < 32; ++idx) {
+ for (int idx = 0; idx < nMoverTransitions; ++idx) {
_speeds[idx] = _speeds[idx] * _field3C / total;
}
}
diff --git a/engines/titanic/star_control/camera_auto_mover.h b/engines/titanic/star_control/camera_auto_mover.h
index 7b2e44fe13..210bd74091 100644
--- a/engines/titanic/star_control/camera_auto_mover.h
+++ b/engines/titanic/star_control/camera_auto_mover.h
@@ -31,6 +31,7 @@ namespace Titanic {
class CErrorCode;
class FMatrix;
+const int nMoverTransitions = 32; // The number of vector transitions when doing a mover change is fixed
/**
* Base class for automatic movement of the starview camera
@@ -49,7 +50,7 @@ protected:
int _field44;
int _field48;
int _field4C;
- double _speeds[32];
+ double _speeds[nMoverTransitions];
int _field54;
double _transitionPercent;
double _transitionPercentInc;
diff --git a/engines/titanic/star_control/marked_auto_mover.cpp b/engines/titanic/star_control/marked_auto_mover.cpp
index 22eb695427..0a1a7e4d49 100644
--- a/engines/titanic/star_control/marked_auto_mover.cpp
+++ b/engines/titanic/star_control/marked_auto_mover.cpp
@@ -74,7 +74,7 @@ int CMarkedAutoMover::proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orient
errorCode.set();
return 1;
} else if (_field48 >= 0) {
- double speedVal = _speeds[31 - _field48];
+ double speedVal = _speeds[nMoverTransitions - 1 - _field48];
pos += _posDelta * speedVal;
getVectorOnPath(pos);
diff --git a/engines/titanic/star_control/unmarked_auto_mover.cpp b/engines/titanic/star_control/unmarked_auto_mover.cpp
index 1461132c13..424e143b58 100644
--- a/engines/titanic/star_control/unmarked_auto_mover.cpp
+++ b/engines/titanic/star_control/unmarked_auto_mover.cpp
@@ -148,7 +148,7 @@ int CUnmarkedAutoMover::proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orie
}
if (_field48 >= 0) {
- double speedVal = _speeds[31 - _field48];
+ double speedVal = _speeds[nMoverTransitions - 1 - _field48];
v1._y = v2._y * speedVal;
v1._z = v2._z * speedVal;
v1._x = v2._x * speedVal;