aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/star_control/fmatrix.cpp36
-rw-r--r--engines/titanic/star_control/fpoint.cpp6
-rw-r--r--engines/titanic/star_control/fpoint.h6
-rw-r--r--engines/titanic/star_control/fvector.cpp12
-rw-r--r--engines/titanic/star_control/fvector.h10
-rw-r--r--engines/titanic/star_control/star_control_sub6.cpp14
-rw-r--r--engines/titanic/star_control/star_control_sub6.h4
-rw-r--r--engines/titanic/star_control/star_view.cpp4
8 files changed, 46 insertions, 46 deletions
diff --git a/engines/titanic/star_control/fmatrix.cpp b/engines/titanic/star_control/fmatrix.cpp
index 5885658835..11d96536f3 100644
--- a/engines/titanic/star_control/fmatrix.cpp
+++ b/engines/titanic/star_control/fmatrix.cpp
@@ -105,15 +105,15 @@ void FMatrix::fn1(const FVector &v) {
}
void FMatrix::fn2(const FMatrix &m) {
- double x1 = _row1._y * m._row2._x + _row1._z * m._row3._x + _row1._x * m._row1._x;
- double y1 = _row1._x * m._row1._y + m._row2._y * _row1._y + m._row3._y * _row1._z;
- double z1 = _row1._x * m._row1._z + _row1._y * m._row2._z + _row1._z * m._row3._z;
- double x2 = m._row1._x * _row2._x + m._row3._x * _row2._z + m._row2._x * _row2._y;
- double y2 = m._row3._y * _row2._z + m._row1._y * _row2._x + m._row2._y * _row2._y;
- double z2 = _row2._z * m._row3._z + _row2._x * m._row1._z + _row2._y * m._row2._z;
- double x3 = m._row1._x * _row3._x + _row3._z * m._row3._x + _row3._y * m._row2._x;
- double y3 = _row3._y * m._row2._y + _row3._z * m._row3._y + _row3._x * m._row1._y;
- double z3 = _row3._x * m._row1._z + _row3._y * m._row2._z + _row3._z * m._row3._z;
+ float x1 = _row1._y * m._row2._x + _row1._z * m._row3._x + _row1._x * m._row1._x;
+ float y1 = _row1._x * m._row1._y + m._row2._y * _row1._y + m._row3._y * _row1._z;
+ float z1 = _row1._x * m._row1._z + _row1._y * m._row2._z + _row1._z * m._row3._z;
+ float x2 = m._row1._x * _row2._x + m._row3._x * _row2._z + m._row2._x * _row2._y;
+ float y2 = m._row3._y * _row2._z + m._row1._y * _row2._x + m._row2._y * _row2._y;
+ float z2 = _row2._z * m._row3._z + _row2._x * m._row1._z + _row2._y * m._row2._z;
+ float x3 = m._row1._x * _row3._x + _row3._z * m._row3._x + _row3._y * m._row2._x;
+ float y3 = _row3._y * m._row2._y + _row3._z * m._row3._y + _row3._x * m._row1._y;
+ float z3 = _row3._x * m._row1._z + _row3._y * m._row2._z + _row3._z * m._row3._z;
_row1 = FVector(x1, y1, z1);
_row2 = FVector(x2, y2, z2);
@@ -121,15 +121,15 @@ void FMatrix::fn2(const FMatrix &m) {
}
void FMatrix::fn3(const FMatrix &m) {
- double x1 = _row2._x * m._row1._y + m._row1._z * _row3._x + _row1._x * m._row1._x;
- double y1 = m._row1._x * _row1._y + _row3._y * m._row1._z + _row2._y * m._row1._y;
- double z1 = m._row1._x * _row1._z + m._row1._y * _row2._z + m._row1._z * _row3._z;
- double x2 = _row1._x * m._row2._x + _row2._x * m._row2._y + _row3._x * m._row2._z;
- double y2 = _row3._y * m._row2._z + _row1._y * m._row2._x + _row2._y * m._row2._y;
- double z2 = m._row2._z * _row3._z + m._row2._x * _row1._z + m._row2._y * _row2._z;
- double x3 = _row1._x * m._row3._x + m._row3._z * _row3._x + m._row3._y * _row2._x;
- double y3 = m._row3._y * _row2._y + m._row3._z * _row3._y + m._row3._x * _row1._y;
- double z3 = m._row3._x * _row1._z + m._row3._y * _row2._z + m._row3._z * _row3._z;
+ float x1 = _row2._x * m._row1._y + m._row1._z * _row3._x + _row1._x * m._row1._x;
+ float y1 = m._row1._x * _row1._y + _row3._y * m._row1._z + _row2._y * m._row1._y;
+ float z1 = m._row1._x * _row1._z + m._row1._y * _row2._z + m._row1._z * _row3._z;
+ float x2 = _row1._x * m._row2._x + _row2._x * m._row2._y + _row3._x * m._row2._z;
+ float y2 = _row3._y * m._row2._z + _row1._y * m._row2._x + _row2._y * m._row2._y;
+ float z2 = m._row2._z * _row3._z + m._row2._x * _row1._z + m._row2._y * _row2._z;
+ float x3 = _row1._x * m._row3._x + m._row3._z * _row3._x + m._row3._y * _row2._x;
+ float y3 = m._row3._y * _row2._y + m._row3._z * _row3._y + m._row3._x * _row1._y;
+ float z3 = m._row3._x * _row1._z + m._row3._y * _row2._z + m._row3._z * _row3._z;
_row1 = FVector(x1, y1, z1);
_row2 = FVector(x2, y2, z2);
diff --git a/engines/titanic/star_control/fpoint.cpp b/engines/titanic/star_control/fpoint.cpp
index a7c764177a..e70cd64ebd 100644
--- a/engines/titanic/star_control/fpoint.cpp
+++ b/engines/titanic/star_control/fpoint.cpp
@@ -25,11 +25,11 @@
namespace Titanic {
-double FPoint::normalize() {
- double hyp = sqrt(_x * _x + _y * _y);
+float FPoint::normalize() {
+ float hyp = sqrt(_x * _x + _y * _y);
assert(hyp != 0.0);
- double fraction = 1.0 / hyp;
+ float fraction = 1.0 / hyp;
_x *= fraction;
_y *= fraction;
return hyp;
diff --git a/engines/titanic/star_control/fpoint.h b/engines/titanic/star_control/fpoint.h
index d967351289..d65da1a13f 100644
--- a/engines/titanic/star_control/fpoint.h
+++ b/engines/titanic/star_control/fpoint.h
@@ -32,10 +32,10 @@ namespace Titanic {
*/
class FPoint {
public:
- double _x, _y;
+ float _x, _y;
public:
FPoint() : _x(0), _y(0) {}
- FPoint(double x, double y) : _x(x), _y(y) {}
+ FPoint(float x, float y) : _x(x), _y(y) {}
FPoint(const Common::Point &pt) : _x(pt.x), _y(pt.y) {}
bool operator==(const FPoint &p) const { return _x == p._x && _y == p._y; }
@@ -57,7 +57,7 @@ public:
* Normalises the X and Y coordinates as fractions relative to the
* value of the hypotenuse formed by a triangle from the origin (0,0)
*/
- double normalize();
+ float normalize();
};
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/fvector.cpp b/engines/titanic/star_control/fvector.cpp
index eec16d1778..1e509b50d4 100644
--- a/engines/titanic/star_control/fvector.cpp
+++ b/engines/titanic/star_control/fvector.cpp
@@ -48,8 +48,8 @@ FVector FVector::crossProduct(const FVector &src) const {
);
}
-double FVector::normalize() {
- double hyp = sqrt(_x * _x + _y * _y + _z * _z);
+float FVector::normalize() {
+ float hyp = sqrt(_x * _x + _y * _y + _z * _z);
assert(hyp);
_x *= 1.0 / hyp;
@@ -66,10 +66,10 @@ const FVector *FVector::addAndNormalize(FVector &dest, const FVector &v1, const
return &dest;
}
-double FVector::getDistance(const FVector &src) const {
- double xd = src._x - _x;
- double yd = src._y - _y;
- double zd = src._z - _z;
+float FVector::getDistance(const FVector &src) const {
+ float xd = src._x - _x;
+ float yd = src._y - _y;
+ float zd = src._z - _z;
return sqrt(xd * xd + yd * yd + zd * zd);
}
diff --git a/engines/titanic/star_control/fvector.h b/engines/titanic/star_control/fvector.h
index dd8a25e957..22ce5e8216 100644
--- a/engines/titanic/star_control/fvector.h
+++ b/engines/titanic/star_control/fvector.h
@@ -38,10 +38,10 @@ class DVector;
*/
class FVector {
public:
- double _x, _y, _z;
+ float _x, _y, _z;
public:
FVector() : _x(0), _y(0), _z(0) {}
- FVector(double x, double y, double z) : _x(x), _y(y), _z(z) {}
+ FVector(float x, float y, float z) : _x(x), _y(y), _z(z) {}
FVector(const DVector &src);
/**
@@ -61,7 +61,7 @@ public:
/**
* Normalizes the vector so the length from origin equals 1.0
*/
- double normalize();
+ float normalize();
/**
* Adds two vectors together and then normalizes the result
@@ -71,7 +71,7 @@ public:
/**
* Returns the distance between a specified point and this one
*/
- double getDistance(const FVector &src) const;
+ float getDistance(const FVector &src) const;
FVector fn5(const CStarControlSub6 *sub6) const;
@@ -97,7 +97,7 @@ public:
return FVector(_x - delta._x, _y - delta._y, _z - delta._z);
}
- const FVector operator*(double right) const {
+ const FVector operator*(float right) const {
return FVector(_x * right, _y * right, _z * right);
}
diff --git a/engines/titanic/star_control/star_control_sub6.cpp b/engines/titanic/star_control/star_control_sub6.cpp
index 7d9cee4ace..5bedb6f02e 100644
--- a/engines/titanic/star_control/star_control_sub6.cpp
+++ b/engines/titanic/star_control/star_control_sub6.cpp
@@ -28,7 +28,7 @@ CStarControlSub6::CStarControlSub6() {
clear();
}
-CStarControlSub6::CStarControlSub6(Axis axis, double amount) {
+CStarControlSub6::CStarControlSub6(Axis axis, float amount) {
setRotationMatrix(axis, amount);
}
@@ -83,10 +83,10 @@ void CStarControlSub6::identity() {
_vector.clear();
}
-void CStarControlSub6::setRotationMatrix(Axis axis, double amount) {
- const double ROTATION = 2 * M_PI / 360.0;
- double sinVal = sin(amount * ROTATION);
- double cosVal = cos(amount * ROTATION);
+void CStarControlSub6::setRotationMatrix(Axis axis, float amount) {
+ const float ROTATION = 2 * M_PI / 360.0;
+ float sinVal = sin(amount * ROTATION);
+ float cosVal = cos(amount * ROTATION);
switch (axis) {
case X_AXIS:
@@ -146,8 +146,8 @@ void CStarControlSub6::copyFrom(const FMatrix &src) {
}
CStarControlSub6 CStarControlSub6::fn4() const {
- double v2, v3, v6, v7, v8, v9, v10, v11;
- double v12, v13, v14, v15, v16, v17, v18;
+ float v2, v3, v6, v7, v8, v9, v10, v11;
+ float v12, v13, v14, v15, v16, v17, v18;
CStarControlSub6 result;
v16 = _row3._z * _row2._y;
diff --git a/engines/titanic/star_control/star_control_sub6.h b/engines/titanic/star_control/star_control_sub6.h
index 6ac22a79df..3ded69b938 100644
--- a/engines/titanic/star_control/star_control_sub6.h
+++ b/engines/titanic/star_control/star_control_sub6.h
@@ -32,7 +32,7 @@ public:
FVector _vector;
public:
CStarControlSub6();
- CStarControlSub6(Axis axis, double amount);
+ CStarControlSub6(Axis axis, float amount);
CStarControlSub6(const CStarControlSub6 *src);
CStarControlSub6(const CStarControlSub6 *s1, const CStarControlSub6 *s2);
@@ -44,7 +44,7 @@ public:
/**
* Sets a rotation matrix for the given axis for the given amount
*/
- void setRotationMatrix(Axis axis, double val);
+ void setRotationMatrix(Axis axis, float val);
void copyFrom(const CStarControlSub6 *src);
diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp
index d3693d5042..d529012d98 100644
--- a/engines/titanic/star_control/star_view.cpp
+++ b/engines/titanic/star_control/star_view.cpp
@@ -126,10 +126,10 @@ bool CStarView::MouseMoveMsg(int unused, const Point &pt) {
FPoint centerPt(300.0, 170.0);
if (fpt != centerPt) {
- double threshold = MIN(centerPt._x, centerPt._y) * 0.5;
+ float threshold = MIN(centerPt._x, centerPt._y) * 0.5;
FPoint tempPt = fpt - centerPt;
- double distance = tempPt.normalize();
+ float distance = tempPt.normalize();
if (distance >= threshold) {
distance -= threshold;