aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/star_control/fmatrix.cpp2
-rw-r--r--engines/titanic/star_control/fvector.cpp4
-rw-r--r--engines/titanic/star_control/fvector.h13
-rw-r--r--engines/titanic/star_control/star_camera.cpp8
-rw-r--r--engines/titanic/star_control/viewport.cpp6
5 files changed, 21 insertions, 12 deletions
diff --git a/engines/titanic/star_control/fmatrix.cpp b/engines/titanic/star_control/fmatrix.cpp
index 470569c88d..e633db5dd0 100644
--- a/engines/titanic/star_control/fmatrix.cpp
+++ b/engines/titanic/star_control/fmatrix.cpp
@@ -124,7 +124,7 @@ void FMatrix::set(const DVector &row1, const DVector &row2, const DVector &row3)
void FMatrix::set(const FVector &v) {
_row3 = v;
- _row2 = _row3.fn1();
+ _row2 = _row3.swapComponents();
_row1 = _row3.crossProduct(_row2);
diff --git a/engines/titanic/star_control/fvector.cpp b/engines/titanic/star_control/fvector.cpp
index 75d30748d2..142d9ea3c0 100644
--- a/engines/titanic/star_control/fvector.cpp
+++ b/engines/titanic/star_control/fvector.cpp
@@ -31,7 +31,7 @@ namespace Titanic {
FVector::FVector(const DVector &src) : _x(src._x), _y(src._y), _z(src._z) {
}
-FVector FVector::fn1() const {
+FVector FVector::swapComponents() const {
return FVector(
(ABS(_x - _y) < 0.00001 && ABS(_y - _z) < 0.00001 &&
ABS(_x - _z) < 0.00001) ? -_y : _y,
@@ -78,7 +78,7 @@ float FVector::getDistance(const FVector &src) const {
return sqrt(xd * xd + yd * yd + zd * zd);
}
-FVector FVector::fn5(const FPose &pose) const {
+FVector FVector::MatProdRowVect(const FPose &pose) const {
FVector v;
v._x = pose._row2._x * _y + pose._row3._x * _z + pose._row1._x * _x + pose._vector._x;
v._y = pose._row2._y * _y + pose._row3._y * _z + pose._row1._y * _x + pose._vector._y;
diff --git a/engines/titanic/star_control/fvector.h b/engines/titanic/star_control/fvector.h
index f93ac60c26..ed5789ac7e 100644
--- a/engines/titanic/star_control/fvector.h
+++ b/engines/titanic/star_control/fvector.h
@@ -51,7 +51,12 @@ public:
_x = _y = _z = 0.0;
}
- FVector fn1() const;
+ /**
+ * Returns a vector with all components of this vector circularlly rotated up 1.
+ * this x being _y, this y being _z, and this z being _x. A sign change may also
+ * be done on x/_y based on some conditions.
+ */
+ FVector swapComponents() const;
/**
* Calculates the cross-product between this matrix and a passed one
@@ -80,7 +85,11 @@ public:
*/
float getDistance(const FVector &src) const;
- FVector fn5(const FPose &pose) const;
+ /**
+ * Returns a vector that is this vector on the left as a row vector
+ * times the 3x4 affine matrix on the right.
+ */
+ FVector MatProdRowVect(const FPose &pose) const;
/**
* Returns true if the passed vector equals this one
diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp
index af671ebbac..68427a3452 100644
--- a/engines/titanic/star_control/star_camera.cpp
+++ b/engines/titanic/star_control/star_camera.cpp
@@ -269,10 +269,10 @@ void CStarCamera::setViewportAngle(const FPoint &angles) {
tempV5 -= row1;
tempV6 -= row1;
- tempV1 = tempV1.fn5(pose);
- tempV4 = tempV4.fn5(pose);
- tempV5 = tempV5.fn5(pose);
- tempV6 = tempV6.fn5(pose);
+ tempV1 = tempV1.MatProdRowVect(pose);
+ tempV4 = tempV4.MatProdRowVect(pose);
+ tempV5 = tempV5.MatProdRowVect(pose);
+ tempV6 = tempV6.MatProdRowVect(pose);
tempV4 -= tempV1;
tempV5 -= tempV1;
diff --git a/engines/titanic/star_control/viewport.cpp b/engines/titanic/star_control/viewport.cpp
index 130d59d8d6..529b4bec3a 100644
--- a/engines/titanic/star_control/viewport.cpp
+++ b/engines/titanic/star_control/viewport.cpp
@@ -107,7 +107,7 @@ void CViewport::setPosition(const FVector &v) {
}
void CViewport::setPosition(const FPose &pose) {
- _position = _position.fn5(pose);
+ _position = _position.MatProdRowVect(pose);
_flag = false;
}
@@ -215,7 +215,7 @@ FVector CViewport::fn16(int index, const FVector &src) {
FVector CViewport::fn17(int index, const FVector &src) {
FVector dest;
FPose pose = getPose();
- FVector tv = src.fn5(pose);
+ FVector tv = src.MatProdRowVect(pose);
dest._x = (_valArray[index] + tv._x)
* _centerVector._x / (_centerVector._y * tv._z);
@@ -227,7 +227,7 @@ FVector CViewport::fn17(int index, const FVector &src) {
FVector CViewport::fn18(int index, const FVector &src) {
FVector dest;
FPose pose = getRawPose();
- FVector tv = src.fn5(pose);
+ FVector tv = src.MatProdRowVect(pose);
dest._x = (_valArray[index] + tv._x)
* _centerVector._x / (_centerVector._y * tv._z);