[Scummvm-git-logs] scummvm master -> 8ffdd29b1161f8339dbb92371ae3a19c42c1dab0

dreammaster dreammaster at scummvm.org
Thu Apr 6 03:29:49 CEST 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
8ffdd29b11 TITANIC: Renamed CStarControlSub6 to FPose


Commit: 8ffdd29b1161f8339dbb92371ae3a19c42c1dab0
    https://github.com/scummvm/scummvm/commit/8ffdd29b1161f8339dbb92371ae3a19c42c1dab0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-04-05T21:29:32-04:00

Commit Message:
TITANIC: Renamed CStarControlSub6 to FPose

Changed paths:
  A engines/titanic/star_control/fpose.cpp
  A engines/titanic/star_control/fpose.h
  R engines/titanic/star_control/star_control_sub6.cpp
  R engines/titanic/star_control/star_control_sub6.h
    engines/titanic/module.mk
    engines/titanic/star_control/base_star.cpp
    engines/titanic/star_control/fvector.cpp
    engines/titanic/star_control/fvector.h
    engines/titanic/star_control/star_control.cpp
    engines/titanic/star_control/star_control_sub12.cpp
    engines/titanic/star_control/star_control_sub12.h
    engines/titanic/star_control/star_control_sub13.cpp
    engines/titanic/star_control/star_control_sub13.h
    engines/titanic/star_control/star_control_sub5.cpp
    engines/titanic/star_control/star_control_sub5.h
    engines/titanic/star_control/star_control_sub7.cpp
    engines/titanic/star_control/star_points1.cpp
    engines/titanic/star_control/star_points2.cpp
    engines/titanic/star_control/star_ref.cpp
    engines/titanic/star_control/star_view.cpp


diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index 3d6c66d..42a67c8 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -436,12 +436,12 @@ MODULE_OBJS := \
 	star_control/dvector.o \
 	star_control/fmatrix.o \
 	star_control/fpoint.o \
+	star_control/fpose.o \
 	star_control/frange.o \
 	star_control/frect.o \
 	star_control/fvector.o \
 	star_control/star_control_sub2.o \
 	star_control/star_control_sub5.o \
-	star_control/star_control_sub6.o \
 	star_control/star_control_sub7.o \
 	star_control/star_control_sub8.o \
 	star_control/star_control_sub12.o \
diff --git a/engines/titanic/star_control/base_star.cpp b/engines/titanic/star_control/base_star.cpp
index dfd7343..2556eee 100644
--- a/engines/titanic/star_control/base_star.cpp
+++ b/engines/titanic/star_control/base_star.cpp
@@ -159,7 +159,7 @@ void CBaseStar::draw(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStarC
 }
 
 void CBaseStar::draw1(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStarControlSub5 *sub5) {
-	CStarControlSub6 sub6 = sub12->proc23();
+	FPose pose = sub12->proc23();
 	sub12->proc36(&_value1, &_value2, &_value3, &_value4);
 
 	const double MAX_VAL = 1.0e9 * 1.0e9;
@@ -174,17 +174,17 @@ void CBaseStar::draw1(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStar
 	for (uint idx = 0; idx < _data.size(); ++idx) {
 		CBaseStarEntry &entry = _data[idx];
 		const FVector &vector = entry._position;
-		tempZ = vector._x * sub6._row1._z + vector._y * sub6._row2._z
-			+ vector._z * sub6._row3._z + sub6._vector._z;
+		tempZ = vector._x * pose._row1._z + vector._y * pose._row2._z
+			+ vector._z * pose._row3._z + pose._vector._z;
 		if (tempZ <= minVal)
 			continue;
 
-		tempY = vector._x * sub6._row1._y + vector._y * sub6._row2._y + vector._z * sub6._row3._y + sub6._vector._y;
-		tempX = vector._x * sub6._row1._x + vector._y * sub6._row2._x + vector._z * sub6._row3._x + sub6._vector._x;
+		tempY = vector._x * pose._row1._y + vector._y * pose._row2._y + vector._z * pose._row3._y + pose._vector._y;
+		tempX = vector._x * pose._row1._x + vector._y * pose._row2._x + vector._z * pose._row3._x + pose._vector._x;
 		total2 = tempY * tempY + tempX * tempX + tempZ * tempZ; 
 
 		if (total2 < 1.0e12) {
-			sub5->proc2(&sub6, vector, centroid._x, centroid._y, total2,
+			sub5->proc2(&pose, vector, centroid._x, centroid._y, total2,
 				surfaceArea, sub12);
 			continue;
 		}
@@ -244,7 +244,7 @@ void CBaseStar::draw1(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStar
 }
 
 void CBaseStar::draw2(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStarControlSub5 *sub5) {
-	CStarControlSub6 sub6 = sub12->proc23();
+	FPose pose = sub12->proc23();
 	sub12->proc36(&_value1, &_value2, &_value3, &_value4);
 
 	const double MAX_VAL = 1.0e9 * 1.0e9;
@@ -259,17 +259,17 @@ void CBaseStar::draw2(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStar
 	for (uint idx = 0; idx < _data.size(); ++idx) {
 		CBaseStarEntry &entry = _data[idx];
 		const FVector &vector = entry._position;
-		tempZ = vector._x * sub6._row1._z + vector._y * sub6._row2._z
-			+ vector._z * sub6._row3._z + sub6._vector._z;
+		tempZ = vector._x * pose._row1._z + vector._y * pose._row2._z
+			+ vector._z * pose._row3._z + pose._vector._z;
 		if (tempZ <= minVal)
 			continue;
 
-		tempY = vector._x * sub6._row1._y + vector._y * sub6._row2._y + vector._z * sub6._row3._y + vector._y;
-		tempX = vector._x * sub6._row1._x + vector._y * sub6._row2._x + vector._z * sub6._row3._x + vector._x;
+		tempY = vector._x * pose._row1._y + vector._y * pose._row2._y + vector._z * pose._row3._y + vector._y;
+		tempX = vector._x * pose._row1._x + vector._y * pose._row2._x + vector._z * pose._row3._x + vector._x;
 		total2 = tempY * tempY + tempX * tempX + tempZ * tempZ;
 
 		if (total2 < 1.0e12) {
-			sub5->proc2(&sub6, vector, centroid._x, centroid._y, total2,
+			sub5->proc2(&pose, vector, centroid._x, centroid._y, total2,
 				surfaceArea, sub12);
 			continue;
 		}
@@ -330,7 +330,7 @@ void CBaseStar::draw2(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStar
 }
 
 void CBaseStar::draw3(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStarControlSub5 *sub5) {
-	CStarControlSub6 sub6 = sub12->proc23();
+	FPose pose = sub12->proc23();
 	sub12->proc36(&_value1, &_value2, &_value3, &_value4);
 
 	const double MAX_VAL = 1.0e9 * 1.0e9;
@@ -348,17 +348,17 @@ void CBaseStar::draw3(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStar
 	for (uint idx = 0; idx < _data.size(); ++idx) {
 		CBaseStarEntry &entry = _data[idx];
 		const FVector &vector = entry._position;
-		tempZ = vector._x * sub6._row1._z + vector._y * sub6._row2._z
-			+ vector._z * sub6._row3._z + sub6._vector._z;
+		tempZ = vector._x * pose._row1._z + vector._y * pose._row2._z
+			+ vector._z * pose._row3._z + pose._vector._z;
 		if (tempZ <= minVal)
 			continue;
 
-		tempY = vector._x * sub6._row1._y + vector._y * sub6._row2._y + vector._z * sub6._row3._y + sub6._vector._y;
-		tempX = vector._x * sub6._row1._x + vector._y * sub6._row2._x + vector._z * sub6._row3._x + sub6._vector._x;
+		tempY = vector._x * pose._row1._y + vector._y * pose._row2._y + vector._z * pose._row3._y + pose._vector._y;
+		tempX = vector._x * pose._row1._x + vector._y * pose._row2._x + vector._z * pose._row3._x + pose._vector._x;
 		total2 = tempY * tempY + tempX * tempX + tempZ * tempZ;
 
 		if (total2 < 1.0e12) {
-			sub5->proc2(&sub6, vector, centroid._x, centroid._y, total2,
+			sub5->proc2(&pose, vector, centroid._x, centroid._y, total2,
 				surfaceArea, sub12);
 			continue;
 		}
@@ -437,7 +437,7 @@ void CBaseStar::draw3(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStar
 }
 
 void CBaseStar::draw4(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStarControlSub5 *sub5) {
-	CStarControlSub6 sub6 = sub12->proc23();
+	FPose pose = sub12->proc23();
 	sub12->proc36(&_value1, &_value2, &_value3, &_value4);
 
 	const double MAX_VAL = 1.0e9 * 1.0e9;
@@ -455,17 +455,17 @@ void CBaseStar::draw4(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStar
 		const CBaseStarEntry &entry = _data[idx];
 		const FVector &vector = entry._position;
 
-		tempZ = vector._x * sub6._row1._z + vector._y * sub6._row2._z
-			+ vector._z * sub6._row3._z + sub6._vector._z;
+		tempZ = vector._x * pose._row1._z + vector._y * pose._row2._z
+			+ vector._z * pose._row3._z + pose._vector._z;
 		if (tempZ <= minVal)
 			continue;
 	
-		tempY = vector._x * sub6._row1._y + vector._y * sub6._row2._y + vector._z * sub6._row3._y + sub6._vector._y;
-		tempX = vector._x * sub6._row1._x + vector._y * sub6._row2._x + vector._z * sub6._row3._x + sub6._vector._x;
+		tempY = vector._x * pose._row1._y + vector._y * pose._row2._y + vector._z * pose._row3._y + pose._vector._y;
+		tempX = vector._x * pose._row1._x + vector._y * pose._row2._x + vector._z * pose._row3._x + pose._vector._x;
 		total2 = tempY * tempY + tempX * tempX + tempZ * tempZ;
 
 		if (total2 < 1.0e12) {
-			sub5->proc2(&sub6, vector, centroid._x, centroid._y, total2,
+			sub5->proc2(&pose, vector, centroid._x, centroid._y, total2,
 				surfaceArea, sub12);
 			continue;
 		}
diff --git a/engines/titanic/star_control/fpose.cpp b/engines/titanic/star_control/fpose.cpp
new file mode 100644
index 0000000..d002e97
--- /dev/null
+++ b/engines/titanic/star_control/fpose.cpp
@@ -0,0 +1,214 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "titanic/star_control/fpose.h"
+
+namespace Titanic {
+
+FPose::FPose() {
+	clear();
+}
+
+FPose::FPose(Axis axis, float amount) {
+	setRotationMatrix(axis, amount);
+}
+
+FPose::FPose(const FPose &src) {
+	copyFrom(src);
+}
+
+FPose::FPose(const FPose &s1, const FPose &s2) {
+	_row1._x = s2._row1._x * s1._row1._x
+		+ s1._row1._z * s2._row3._x
+		+ s1._row1._y * s2._row2._x;
+	_row1._y = s1._row1._x * s2._row1._y
+		+ s2._row3._y * s1._row1._z
+		+ s2._row2._y * s1._row1._y;
+	_row1._z = s1._row1._x * s2._row1._z
+		+ s2._row3._z * s1._row1._z
+		+ s2._row2._z * s1._row1._y;
+	_row2._x = s2._row1._x * s1._row2._x
+		+ s1._row2._y * s2._row2._x
+		+ s1._row2._z * s2._row3._x;
+	_row2._y = s1._row2._y * s2._row2._y
+		+ s1._row2._z * s2._row3._y
+		+ s2._row1._y * s1._row2._x;
+	_row2._z = s2._row1._z * s1._row2._x
+		+ s1._row2._y * s2._row2._z
+		+ s1._row2._z * s2._row3._z;
+	_row3._x = s2._row1._x * s1._row3._x
+		+ s1._row3._y * s2._row2._x
+		+ s1._row3._z * s2._row3._x;
+	_row3._y = s1._row3._z * s2._row3._y
+		+ s1._row3._y * s2._row2._y
+		+ s2._row1._y * s1._row3._x;
+	_row3._z = s2._row3._z * s1._row3._z
+		+ s2._row2._z * s1._row3._y
+		+ s2._row1._z * s1._row3._x;
+	_vector._x = s2._row1._x * s1._vector._x
+		+ s1._vector._y * s2._row2._x
+		+ s1._vector._z * s2._row3._x
+		+ s2._vector._x;
+	_vector._y = s1._vector._z * s2._row3._y
+		+ s1._vector._y * s2._row2._y
+		+ s1._vector._x * s2._row1._y
+		+ s2._vector._y;
+	_vector._z = s1._vector._y * s2._row2._z
+		+ s1._vector._z * s2._row3._z
+		+ s1._vector._x * s2._row1._z
+		+ s2._vector._z;
+}
+
+void FPose::identity() {
+	FMatrix::identity();
+	_vector.clear();
+}
+
+void FPose::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:
+		_row1._x = 1.0;
+		_row1._y = 0.0;
+		_row1._z = 0.0;
+		_row2._x = 0.0;
+		_row2._y = cosVal;
+		_row2._z = sinVal;
+		_row3._x = 0.0;
+		_row3._y = -sinVal;
+		_row3._z = cosVal;
+		break;
+
+	case Y_AXIS:
+		_row1._x = cosVal;
+		_row1._y = 0.0;
+		_row1._z = sinVal;
+		_row2._x = 0.0;
+		_row2._y = 1.0;
+		_row2._z = 0.0;
+		_row3._x = -sinVal;
+		_row3._y = 0.0;
+		_row3._z = cosVal;
+		break;
+
+	case Z_AXIS:
+		_row1._x = cosVal;
+		_row1._y = sinVal;
+		_row1._z = 0.0;
+		_row2._x = -sinVal;
+		_row2._y = cosVal;
+		_row2._z = 0.0;
+		_row3._x = 0.0;
+		_row3._y = 0.0;
+		_row3._z = 1.0;
+		break;
+
+	default:
+		break;
+	}
+
+	_vector.clear();
+}
+
+void FPose::copyFrom(const FPose &src) {
+	_row1 = src._row1;
+	_row2 = src._row2;
+	_row3 = src._row3;
+	_vector = src._vector;
+}
+
+void FPose::copyFrom(const FMatrix &src) {
+	_row1 = src._row1;
+	_row2 = src._row2;
+	_row3 = src._row3;
+}
+
+FPose FPose::fn4() const {
+	float v2, v3, v6, v7, v8, v9, v10, v11;
+	float v12, v13, v14, v15, v16, v17, v18;
+	FPose result;
+
+	v16 = _row3._z * _row2._y;
+	v2 = _row1._x * v16;
+	v3 = 0.0;
+	v18 = v2;
+	if (v2 < 0.0) {
+		v3 = v18;
+		v2 = 0.0;
+	}
+	v6 = _row3._x * _row1._y * _row2._z;
+	if (v6 < 0.0)
+		v3 = v3 + v6;
+	else
+		v2 = v2 + v6;
+	v7 = _row3._y * _row1._z * _row2._x;
+	if (v7 < 0.0)
+		v3 = v3 + v7;
+	else
+		v2 = v2 + v7;
+	if (-(_row3._x * _row1._z * _row2._y) < 0.0)
+		v3 = v3 - _row3._x * _row1._z * _row2._y;
+	else
+		v2 = v2 - _row3._x * _row1._z * _row2._y;
+	if (-(_row1._y * _row2._x * _row3._z) < 0.0)
+		v3 = v3 - _row1._y * _row2._x * _row3._z;
+	else
+		v2 = v2 - _row1._y * _row2._x * _row3._z;
+	v17 = _row2._z * _row3._y;
+	if (-(_row1._x * v17) < 0.0)
+		v3 = v3 - _row1._x * v17;
+	else
+		v2 = v2 - _row1._x * v17;
+	v18 = v3 + v2;
+	assert(!(v18 == 0.0 || fabs(v18 / (v2 - v3)) < 1.0e-10));
+
+	v8 = 1.0 / v18;
+	v18 = v8;
+	result._row1._x = (v16 - v17) * v8;
+	result._row2._x = -(_row2._x * _row3._z - _row3._x * _row2._z) * v8;
+	result._row3._x = (_row3._y * _row2._x - _row3._x * _row2._y) * v8;
+	result._row1._y = -(_row1._y * _row3._z - _row3._y * _row1._z) * v8;
+	result._row2._y = (_row1._x * _row3._z - _row3._x * _row1._z) * v8;
+	result._row3._y = -(_row1._x * _row3._y - _row3._x * _row1._y) * v8;
+	result._row1._z = (_row1._y * _row2._z - _row1._z * _row2._y) * v8;
+	result._row2._z = -(_row1._x * _row2._z - _row1._z * _row2._x) * v8;
+	v9 = result._row1._x;
+	v10 = result._row2._y;
+	v11 = result._row3._y;
+	v12 = result._row1._z;
+	v13 = result._row2._z;
+	result._row3._z = (_row1._x * _row2._y - _row1._y * _row2._x) * v18;
+	v14 = v9;
+	v15 = result._row3._z;
+	result._vector._x = -(v14 * _vector._x
+		+ _vector._y * result._row2._x
+		+ _vector._z * result._row3._x);
+	result._vector._y = -(_vector._x * result._row1._y + v10 * _vector._y + v11 * _vector._z);
+	result._vector._z = -(v12 * _vector._x + v13 * _vector._y + v15 * _vector._z);
+
+	return result;
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/star_control/fpose.h b/engines/titanic/star_control/fpose.h
new file mode 100644
index 0000000..d1b7e15
--- /dev/null
+++ b/engines/titanic/star_control/fpose.h
@@ -0,0 +1,64 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TITANIC_FPOSE_H
+#define TITANIC_FPOSE_H
+
+#include "titanic/star_control/fmatrix.h"
+
+namespace Titanic {
+
+class FPose : public FMatrix {
+public:
+	FVector _vector;
+public:
+	FPose();
+	FPose(Axis axis, float amount);
+	FPose(const FPose &src);
+	FPose(const FPose &s1, const FPose &s2);
+
+	/**
+	 * Sets an identity matrix
+	 */
+	void identity();
+
+	/**
+	 * Sets a rotation matrix for the given axis for the given amount
+	 */
+	void setRotationMatrix(Axis axis, float val);
+
+	/**
+	 * Copy from the specified source pose
+	 */
+	void copyFrom(const FPose &src);
+
+	/**
+	 * Copy from the specified source matrix
+	 */
+	void copyFrom(const FMatrix &src);
+
+	FPose fn4() const;
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_FPOSE_H */
diff --git a/engines/titanic/star_control/fvector.cpp b/engines/titanic/star_control/fvector.cpp
index 1e509b5..19fbefb 100644
--- a/engines/titanic/star_control/fvector.cpp
+++ b/engines/titanic/star_control/fvector.cpp
@@ -22,7 +22,7 @@
 
 #include "titanic/star_control/fvector.h"
 #include "titanic/star_control/dvector.h"
-#include "titanic/star_control/star_control_sub6.h"
+#include "titanic/star_control/fpose.h"
 #include "common/algorithm.h"
 #include "common/textconsole.h"
 
@@ -74,11 +74,11 @@ float FVector::getDistance(const FVector &src) const {
 	return sqrt(xd * xd + yd * yd + zd * zd);
 }
 
-FVector FVector::fn5(const CStarControlSub6 *sub6) const {
+FVector FVector::fn5(const FPose &pose) const {
 	FVector v;
-	v._x = sub6->_row2._x * _y + sub6->_row3._x * _z + sub6->_row1._x * _x + sub6->_vector._x;
-	v._y = sub6->_row2._y * _y + sub6->_row3._y * _z + sub6->_row1._y * _x + sub6->_vector._y;
-	v._z = sub6->_row3._z * _z + sub6->_row2._z * _y + sub6->_row1._z * _x + sub6->_vector._z;
+	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;
+	v._z = pose._row3._z * _z + pose._row2._z * _y + pose._row1._z * _x + pose._vector._z;
 	return v;
 }
 
diff --git a/engines/titanic/star_control/fvector.h b/engines/titanic/star_control/fvector.h
index 22ce5e8..6ad2818 100644
--- a/engines/titanic/star_control/fvector.h
+++ b/engines/titanic/star_control/fvector.h
@@ -29,7 +29,7 @@ namespace Titanic {
 
 enum Axis { X_AXIS, Y_AXIS, Z_AXIS };
 
-class CStarControlSub6;
+class FPose;
 class DVector;
 
 /**
@@ -73,7 +73,7 @@ public:
 	 */
 	float getDistance(const FVector &src) const;
 
-	FVector fn5(const CStarControlSub6 *sub6) const;
+	FVector fn5(const FPose &pose) const;
 
 	/**
 	 * Returns true if the passed vector equals this one
diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp
index abdbf19..fd007d3 100644
--- a/engines/titanic/star_control/star_control.cpp
+++ b/engines/titanic/star_control/star_control.cpp
@@ -25,7 +25,7 @@
 #include "titanic/star_control/star_control.h"
 #include "titanic/star_control/dmatrix.h"
 #include "titanic/star_control/error_code.h"
-#include "titanic/star_control/star_control_sub6.h"
+#include "titanic/star_control/fpose.h"
 #include "titanic/star_control/star_control_sub12.h"
 #include "titanic/game_manager.h"
 #include "titanic/core/dont_save_file_item.h"
diff --git a/engines/titanic/star_control/star_control_sub12.cpp b/engines/titanic/star_control/star_control_sub12.cpp
index 74afebe..d07b3db 100644
--- a/engines/titanic/star_control/star_control_sub12.cpp
+++ b/engines/titanic/star_control/star_control_sub12.cpp
@@ -167,9 +167,9 @@ void CStarControlSub12::proc20(double factor) {
 		_sub13.reposition(factor);
 }
 
-void CStarControlSub12::proc21(const CStarControlSub6 *sub6) {
+void CStarControlSub12::proc21(const FPose &pose) {
 	if (!isLocked()) {
-		_sub13.setPosition(sub6);
+		_sub13.setPosition(pose);
 		set108();
 	}
 }
@@ -179,11 +179,11 @@ void CStarControlSub12::proc22(FMatrix &m) {
 		_sub13.fn15(m);
 }
 
-CStarControlSub6 CStarControlSub12::proc23() {
+FPose CStarControlSub12::proc23() {
 	return _sub13.getSub1();
 }
 
-CStarControlSub6 CStarControlSub12::proc24() {
+FPose CStarControlSub12::proc24() {
 	return _sub13.getSub2();
 }
 
@@ -225,17 +225,15 @@ void CStarControlSub12::setViewportPosition(const FPoint &angles) {
 		return;
 
 	if (_matrixRow == -1) {
-		CStarControlSub6 subX(X_AXIS, angles._y);
-		CStarControlSub6 subY(Y_AXIS, angles._x);
-		CStarControlSub6 sub(&subX, &subY);
-		subY.copyFrom(&sub);
-		proc22(subY);
+		FPose subX(X_AXIS, angles._y);
+		FPose subY(Y_AXIS, angles._x);
+		FPose sub(subX, subY);
+		proc22(sub);
 	} else if (_matrixRow == 0) {
 		FVector row1 = _matrix._row1;
-		CStarControlSub6 subX(X_AXIS, angles._y);
-		CStarControlSub6 subY(Y_AXIS, angles._x);
-		CStarControlSub6 sub(&subX, &subY);
-		subX.copyFrom(&sub);
+		FPose subX(X_AXIS, angles._y);
+		FPose subY(Y_AXIS, angles._x);
+		FPose sub(subX, subY);
 
 		FMatrix m1 = _sub13.getMatrix();
 		FVector tempV1 = _sub13._position;
@@ -280,10 +278,10 @@ void CStarControlSub12::setViewportPosition(const FPoint &angles) {
 		tempV6._y = tempV6._y - row1._y;
 		tempV6._z = tempV6._z - row1._z;
 
-		FVector modV1 = tempV1.fn5(&subX);
-		FVector modV2 = tempV4.fn5(&subX);
-		FVector modV3 = tempV5.fn5(&subX);
-		FVector modV4 = tempV6.fn5(&subX);
+		FVector modV1 = tempV1.fn5(sub);
+		FVector modV2 = tempV4.fn5(sub);
+		FVector modV3 = tempV5.fn5(sub);
+		FVector modV4 = tempV6.fn5(sub);
 		tempV1 = modV1;
 		tempV4 = modV2;
 		tempV5 = modV3;
diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h
index c36960e..ffbbf22 100644
--- a/engines/titanic/star_control/star_control_sub12.h
+++ b/engines/titanic/star_control/star_control_sub12.h
@@ -85,10 +85,10 @@ public:
 	virtual void proc18();
 	virtual void proc19();
 	virtual void proc20(double factor);
-	virtual void proc21(const CStarControlSub6 *sub6);
+	virtual void proc21(const FPose &pose);
 	virtual void proc22(FMatrix &m);
-	virtual CStarControlSub6 proc23();
-	virtual CStarControlSub6 proc24();
+	virtual FPose proc23();
+	virtual FPose proc24();
 	virtual double proc25() const;
 	virtual double proc26() const;
 	virtual int proc27() const;
diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/star_control_sub13.cpp
index d96a290..bbf7fe6 100644
--- a/engines/titanic/star_control/star_control_sub13.cpp
+++ b/engines/titanic/star_control/star_control_sub13.cpp
@@ -39,7 +39,7 @@ CStarControlSub13::CStarControlSub13() {
 }
 
 CStarControlSub13::CStarControlSub13(CStarControlSub13 *src) :
-		_matrix(src->_matrix), _sub1(&src->_sub1), _sub2(&src->_sub2) {
+		_matrix(src->_matrix), _sub1(src->_sub1), _sub2(src->_sub2) {
 	_position = src->_position;
 	_fieldC = src->_fieldC;
 	_field10 = src->_field10;
@@ -105,9 +105,9 @@ void CStarControlSub13::setPosition(const FVector &v) {
 	_flag = false;
 }
 
-void CStarControlSub13::setPosition(const CStarControlSub6 *sub6) {
-	_position.fn5(sub6);
-	_position = sub6->_row1;
+void CStarControlSub13::setPosition(const FPose &pose) {
+	_position.fn5(pose);
+	_position = pose._row1;
 	_flag = false;
 }
 
@@ -148,12 +148,12 @@ void CStarControlSub13::set1C(double v) {
 void CStarControlSub13::fn12() {
 	_matrix.identity();
 
-	CStarControlSub6 m1(X_AXIS, g_vm->getRandomNumber(359));
-	CStarControlSub6 m2(Y_AXIS, g_vm->getRandomNumber(359));
-	CStarControlSub6 m3(Z_AXIS, g_vm->getRandomNumber(359));
+	FPose m1(X_AXIS, g_vm->getRandomNumber(359));
+	FPose m2(Y_AXIS, g_vm->getRandomNumber(359));
+	FPose m3(Z_AXIS, g_vm->getRandomNumber(359));
 	
-	CStarControlSub6 s1(&m1, &m2);
-	CStarControlSub6 s2(&s1, &m3);
+	FPose s1(m1, m2);
+	FPose s2(s1, m3);
 
 	m1.copyFrom(s2);
 	_matrix.fn2(m1);
@@ -185,14 +185,14 @@ void CStarControlSub13::fn15(const FMatrix &matrix) {
 	_flag = false;
 }
 
-CStarControlSub6 CStarControlSub13::getSub1() {
+FPose CStarControlSub13::getSub1() {
 	if (!_flag)
 		reset();
 
 	return _sub1;
 }
 
-CStarControlSub6 CStarControlSub13::getSub2() {
+FPose CStarControlSub13::getSub2() {
 	if (!_flag)
 		reset();
 
@@ -200,7 +200,7 @@ CStarControlSub6 CStarControlSub13::getSub2() {
 }
 
 void CStarControlSub13::fn16(int index, const FVector &src, FVector &dest) {
-	CStarControlSub6 temp = getSub1();
+	FPose temp = getSub1();
 
 	dest._x = temp._row3._x * src._z + temp._row2._x * src._y
 		+ src._x * temp._row1._x + temp._vector._x;
@@ -212,8 +212,8 @@ void CStarControlSub13::fn16(int index, const FVector &src, FVector &dest) {
 
 FVector CStarControlSub13::fn17(int index, const FVector &src) {
 	FVector dest;
-	CStarControlSub6 sub6 = getSub1();
-	FVector tv = src.fn5(&sub6);
+	FPose pose = getSub1();
+	FVector tv = src.fn5(pose);
 
 	dest._x = (_valArray[index] + tv._x)
 		* _centerVector._x / (_centerVector._y * tv._z);
@@ -224,8 +224,8 @@ FVector CStarControlSub13::fn17(int index, const FVector &src) {
 
 FVector CStarControlSub13::fn18(int index, const FVector &src) {
 	FVector dest;
-	CStarControlSub6 sub6 = getSub2();
-	FVector tv = src.fn5(&sub6);
+	FPose pose = getSub2();
+	FVector tv = src.fn5(pose);
 
 	dest._x = (_valArray[index] + tv._x)
 		* _centerVector._x / (_centerVector._y * tv._z);
diff --git a/engines/titanic/star_control/star_control_sub13.h b/engines/titanic/star_control/star_control_sub13.h
index e47c42e..0d07691 100644
--- a/engines/titanic/star_control/star_control_sub13.h
+++ b/engines/titanic/star_control/star_control_sub13.h
@@ -25,7 +25,7 @@
 
 #include "titanic/support/simple_file.h"
 #include "titanic/star_control/base_star.h"
-#include "titanic/star_control/star_control_sub6.h"
+#include "titanic/star_control/fpose.h"
 #include "titanic/star_control/fmatrix.h"
 
 namespace Titanic {
@@ -38,8 +38,8 @@ private:
 	int _width;
 	int _height;
 	FMatrix _matrix;
-	CStarControlSub6 _sub1;
-	CStarControlSub6 _sub2;
+	FPose _sub1;
+	FPose _sub2;
 	FPoint _center;
 	bool _flag;
 private:
@@ -78,7 +78,7 @@ public:
 	/**
 	 * Sets the position
 	 */
-	void setPosition(const CStarControlSub6 *sub6);
+	void setPosition(const FPose &pose);
 
 	/**
 	 * Sets the matrix
@@ -90,8 +90,8 @@ public:
 	void fn13(StarMode mode, double val);
 	void reposition(double factor);
 	void fn15(const FMatrix &matrix);
-	CStarControlSub6 getSub1();
-	CStarControlSub6 getSub2();
+	FPose getSub1();
+	FPose getSub2();
 	void fn16(int index, const FVector &src, FVector &dest);
 	FVector fn17(int index, const FVector &src);
 	FVector fn18(int index, const FVector &src);
diff --git a/engines/titanic/star_control/star_control_sub5.cpp b/engines/titanic/star_control/star_control_sub5.cpp
index 328a992..0ef40e7 100644
--- a/engines/titanic/star_control/star_control_sub5.cpp
+++ b/engines/titanic/star_control/star_control_sub5.cpp
@@ -189,7 +189,7 @@ bool CStarControlSub5::setup2(int val1, int val2) {
 	return false;
 }
 
-void CStarControlSub5::proc2(CStarControlSub6 *sub6, const FVector &vector, double v1, double v2, double v3,
+void CStarControlSub5::proc2(FPose *pose, const FVector &vector, double v1, double v2, double v3,
 		CSurfaceArea *surfaceArea, CStarControlSub12 *sub12) {
 	const int VALUES[] = { 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4 };
 	double val1 = sub12->proc25();
@@ -252,15 +252,15 @@ void CStarControlSub5::proc2(CStarControlSub6 *sub6, const FVector &vector, doub
 			_sub1._vector._x = f22 * f10 + vector._x;
 			_sub1._vector._y = f9 * f22 + vector._y;
 			_sub1._vector._z = f22 * f12 + vector._z;
-			_sub2._row1._x = sub6->_row1._x * f13 + f16 * sub6->_row3._x + f15 * sub6->_row2._x;
-			_sub2._row1._y = f15 * sub6->_row2._y + f16 * sub6->_row3._y + f13 * sub6->_row1._y;
-			_sub2._row1._z = f16 * sub6->_row3._z + f13 * sub6->_row1._z + f15 * sub6->_row2._z;
-			_sub2._row2._x = sub6->_row1._x * f17 + f19 * sub6->_row3._x + f18 * sub6->_row2._x;
-			_sub2._row2._y = f18 * sub6->_row2._y + f17 * sub6->_row1._y + f19 * sub6->_row3._y;
-			_sub2._row2._z = f18 * sub6->_row2._z + f19 * sub6->_row3._z + f17 * sub6->_row1._z;
-			_sub2._row3._x = sub6->_row1._x * f20 + f21 * sub6->_row3._x;
-			_sub2._row3._y = f20 * sub6->_row1._y + f21 * sub6->_row3._y;
-			_sub2._row3._z = f20 * sub6->_row1._z + f21 * sub6->_row3._z;
+			_sub2._row1._x = pose->_row1._x * f13 + f16 * pose->_row3._x + f15 * pose->_row2._x;
+			_sub2._row1._y = f15 * pose->_row2._y + f16 * pose->_row3._y + f13 * pose->_row1._y;
+			_sub2._row1._z = f16 * pose->_row3._z + f13 * pose->_row1._z + f15 * pose->_row2._z;
+			_sub2._row2._x = pose->_row1._x * f17 + f19 * pose->_row3._x + f18 * pose->_row2._x;
+			_sub2._row2._y = f18 * pose->_row2._y + f17 * pose->_row1._y + f19 * pose->_row3._y;
+			_sub2._row2._z = f18 * pose->_row2._z + f19 * pose->_row3._z + f17 * pose->_row1._z;
+			_sub2._row3._x = pose->_row1._x * f20 + f21 * pose->_row3._x;
+			_sub2._row3._y = f20 * pose->_row1._y + f21 * pose->_row3._y;
+			_sub2._row3._z = f20 * pose->_row1._z + f21 * pose->_row3._z;
 
 			f23 = _sub1._vector._y;
 			f24 = _sub1._vector._z;
@@ -269,18 +269,18 @@ void CStarControlSub5::proc2(CStarControlSub6 *sub6, const FVector &vector, doub
 			f27 = _sub1._vector._x;
 
 			f28 = _sub1._vector._y;
-			_sub2._vector._x = sub6->_row1._x * _sub1._vector._x
-				+ sub6->_row3._x * _sub1._vector._z
-				+ sub6->_row2._x * f28
-				+ sub6->_vector._x;
-			_sub2._vector._y = f23 * sub6->_row2._y
-				+ f24 * sub6->_row3._y
-				+ f25 * sub6->_row1._y
-				+ sub6->_vector._y;
-			_sub2._vector._z = f26 * sub6->_row3._z
-				+ f27 * sub6->_row1._z
-				+ f28 * sub6->_row2._z
-				+ sub6->_vector._z;
+			_sub2._vector._x = pose->_row1._x * _sub1._vector._x
+				+ pose->_row3._x * _sub1._vector._z
+				+ pose->_row2._x * f28
+				+ pose->_vector._x;
+			_sub2._vector._y = f23 * pose->_row2._y
+				+ f24 * pose->_row3._y
+				+ f25 * pose->_row1._y
+				+ pose->_vector._y;
+			_sub2._vector._z = f26 * pose->_row3._z
+				+ f27 * pose->_row1._z
+				+ f28 * pose->_row2._z
+				+ pose->_vector._z;
 
 			size2 = (int)_array[1]._data2.size();
 			size1 = (int)_array[1]._data1.size();
@@ -407,22 +407,22 @@ void CStarControlSub5::proc2(CStarControlSub6 *sub6, const FVector &vector, doub
 		const FVector &d2v = entry._data2[ctr];
 		FVector newV = d2v + vector;
 
-		f41 = sub6->_row1._x;
-		f42 = sub6->_row3._x;
-		f43 = sub6->_row2._x;
+		f41 = pose->_row1._x;
+		f42 = pose->_row3._x;
+		f43 = pose->_row2._x;
 		f44 = f43 * newV._y;
 		f45 = f41 * newV._x + f42 * newV._z + f44;
-		f46 = f45 + sub6->_vector._x;
+		f46 = f45 + pose->_vector._x;
 
 		gridEntry._x = f46;
-		gridEntry._y = newV._y * sub6->_row2._y
-			+ newV._z * sub6->_row3._y
-			+ newV._x * sub6->_row1._y
-			+ sub6->_vector._y;
-		gridEntry._z = newV._z * sub6->_row3._z
-			+ newV._y * sub6->_row2._z
-			+ newV._x * sub6->_row1._z
-			+ sub6->_vector._z;
+		gridEntry._y = newV._y * pose->_row2._y
+			+ newV._z * pose->_row3._y
+			+ newV._x * pose->_row1._y
+			+ pose->_vector._y;
+		gridEntry._z = newV._z * pose->_row3._z
+			+ newV._y * pose->_row2._z
+			+ newV._x * pose->_row1._z
+			+ pose->_vector._z;
 	}
 
 	if (val2 <= 0) {
diff --git a/engines/titanic/star_control/star_control_sub5.h b/engines/titanic/star_control/star_control_sub5.h
index dc25ddc..395bdc6 100644
--- a/engines/titanic/star_control/star_control_sub5.h
+++ b/engines/titanic/star_control/star_control_sub5.h
@@ -25,7 +25,7 @@
 
 #include "common/array.h"
 #include "titanic/star_control/fvector.h"
-#include "titanic/star_control/star_control_sub6.h"
+#include "titanic/star_control/fpose.h"
 #include "titanic/star_control/error_code.h"
 #include "titanic/star_control/surface_area.h"
 
@@ -93,7 +93,7 @@ class CStarControlSub5 {
 	};
 private:
 	bool _flag;
-	CStarControlSub6 _sub1, _sub2;
+	FPose _sub1, _sub2;
 	SubEntry _array[5];
 	Entry _entries[1284];
 	int _multiplier;
@@ -116,7 +116,7 @@ public:
 	virtual ~CStarControlSub5() {}
 
 	virtual bool setup();
-	virtual void proc2(CStarControlSub6 *sub6, const FVector &vector, double v1, double v2, double v3,
+	virtual void proc2(FPose *pose, const FVector &vector, double v1, double v2, double v3,
 		CSurfaceArea *surfaceArea, CStarControlSub12 *sub12);
 	virtual void proc3(CErrorCode *errorCode);
 
diff --git a/engines/titanic/star_control/star_control_sub6.cpp b/engines/titanic/star_control/star_control_sub6.cpp
deleted file mode 100644
index 5bedb6f..0000000
--- a/engines/titanic/star_control/star_control_sub6.cpp
+++ /dev/null
@@ -1,214 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "titanic/star_control/star_control_sub6.h"
-
-namespace Titanic {
-
-CStarControlSub6::CStarControlSub6() {
-	clear();
-}
-
-CStarControlSub6::CStarControlSub6(Axis axis, float amount) {
-	setRotationMatrix(axis, amount);
-}
-
-CStarControlSub6::CStarControlSub6(const CStarControlSub6 *src) {
-	copyFrom(src);
-}
-
-CStarControlSub6::CStarControlSub6(const CStarControlSub6 *s1, const CStarControlSub6 *s2) {
-	_row1._x = s2->_row1._x * s1->_row1._x
-		+ s1->_row1._z * s2->_row3._x
-		+ s1->_row1._y * s2->_row2._x;
-	_row1._y = s1->_row1._x * s2->_row1._y
-		+ s2->_row3._y * s1->_row1._z
-		+ s2->_row2._y * s1->_row1._y;
-	_row1._z = s1->_row1._x * s2->_row1._z
-		+ s2->_row3._z * s1->_row1._z
-		+ s2->_row2._z * s1->_row1._y;
-	_row2._x = s2->_row1._x * s1->_row2._x
-		+ s1->_row2._y * s2->_row2._x
-		+ s1->_row2._z * s2->_row3._x;
-	_row2._y = s1->_row2._y * s2->_row2._y
-		+ s1->_row2._z * s2->_row3._y
-		+ s2->_row1._y * s1->_row2._x;
-	_row2._z = s2->_row1._z * s1->_row2._x
-		+ s1->_row2._y * s2->_row2._z
-		+ s1->_row2._z * s2->_row3._z;
-	_row3._x = s2->_row1._x * s1->_row3._x
-		+ s1->_row3._y * s2->_row2._x
-		+ s1->_row3._z * s2->_row3._x;
-	_row3._y = s1->_row3._z * s2->_row3._y
-		+ s1->_row3._y * s2->_row2._y
-		+ s2->_row1._y * s1->_row3._x;
-	_row3._z = s2->_row3._z * s1->_row3._z
-		+ s2->_row2._z * s1->_row3._y
-		+ s2->_row1._z * s1->_row3._x;
-	_vector._x = s2->_row1._x * s1->_vector._x
-		+ s1->_vector._y * s2->_row2._x
-		+ s1->_vector._z * s2->_row3._x
-		+ s2->_vector._x;
-	_vector._y = s1->_vector._z * s2->_row3._y
-		+ s1->_vector._y * s2->_row2._y
-		+ s1->_vector._x * s2->_row1._y
-		+ s2->_vector._y;
-	_vector._z = s1->_vector._y * s2->_row2._z
-		+ s1->_vector._z * s2->_row3._z
-		+ s1->_vector._x * s2->_row1._z
-		+ s2->_vector._z;
-}
-
-void CStarControlSub6::identity() {
-	FMatrix::identity();
-	_vector.clear();
-}
-
-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:
-		_row1._x = 1.0;
-		_row1._y = 0.0;
-		_row1._z = 0.0;
-		_row2._x = 0.0;
-		_row2._y = cosVal;
-		_row2._z = sinVal;
-		_row3._x = 0.0;
-		_row3._y = -sinVal;
-		_row3._z = cosVal;
-		break;
-
-	case Y_AXIS:
-		_row1._x = cosVal;
-		_row1._y = 0.0;
-		_row1._z = sinVal;
-		_row2._x = 0.0;
-		_row2._y = 1.0;
-		_row2._z = 0.0;
-		_row3._x = -sinVal;
-		_row3._y = 0.0;
-		_row3._z = cosVal;
-		break;
-
-	case Z_AXIS:
-		_row1._x = cosVal;
-		_row1._y = sinVal;
-		_row1._z = 0.0;
-		_row2._x = -sinVal;
-		_row2._y = cosVal;
-		_row2._z = 0.0;
-		_row3._x = 0.0;
-		_row3._y = 0.0;
-		_row3._z = 1.0;
-		break;
-
-	default:
-		break;
-	}
-
-	_vector.clear();
-}
-
-void CStarControlSub6::copyFrom(const CStarControlSub6 *src) {
-	_row1 = src->_row1;
-	_row2 = src->_row2;
-	_row3 = src->_row3;
-	_vector = src->_vector;
-}
-
-void CStarControlSub6::copyFrom(const FMatrix &src) {
-	_row1 = src._row1;
-	_row2 = src._row2;
-	_row3 = src._row3;
-}
-
-CStarControlSub6 CStarControlSub6::fn4() const {
-	float v2, v3, v6, v7, v8, v9, v10, v11;
-	float v12, v13, v14, v15, v16, v17, v18;
-	CStarControlSub6 result;
-
-	v16 = _row3._z * _row2._y;
-	v2 = _row1._x * v16;
-	v3 = 0.0;
-	v18 = v2;
-	if (v2 < 0.0) {
-		v3 = v18;
-		v2 = 0.0;
-	}
-	v6 = _row3._x * _row1._y * _row2._z;
-	if (v6 < 0.0)
-		v3 = v3 + v6;
-	else
-		v2 = v2 + v6;
-	v7 = _row3._y * _row1._z * _row2._x;
-	if (v7 < 0.0)
-		v3 = v3 + v7;
-	else
-		v2 = v2 + v7;
-	if (-(_row3._x * _row1._z * _row2._y) < 0.0)
-		v3 = v3 - _row3._x * _row1._z * _row2._y;
-	else
-		v2 = v2 - _row3._x * _row1._z * _row2._y;
-	if (-(_row1._y * _row2._x * _row3._z) < 0.0)
-		v3 = v3 - _row1._y * _row2._x * _row3._z;
-	else
-		v2 = v2 - _row1._y * _row2._x * _row3._z;
-	v17 = _row2._z * _row3._y;
-	if (-(_row1._x * v17) < 0.0)
-		v3 = v3 - _row1._x * v17;
-	else
-		v2 = v2 - _row1._x * v17;
-	v18 = v3 + v2;
-	assert(!(v18 == 0.0 || fabs(v18 / (v2 - v3)) < 1.0e-10));
-
-	v8 = 1.0 / v18;
-	v18 = v8;
-	result._row1._x = (v16 - v17) * v8;
-	result._row2._x = -(_row2._x * _row3._z - _row3._x * _row2._z) * v8;
-	result._row3._x = (_row3._y * _row2._x - _row3._x * _row2._y) * v8;
-	result._row1._y = -(_row1._y * _row3._z - _row3._y * _row1._z) * v8;
-	result._row2._y = (_row1._x * _row3._z - _row3._x * _row1._z) * v8;
-	result._row3._y = -(_row1._x * _row3._y - _row3._x * _row1._y) * v8;
-	result._row1._z = (_row1._y * _row2._z - _row1._z * _row2._y) * v8;
-	result._row2._z = -(_row1._x * _row2._z - _row1._z * _row2._x) * v8;
-	v9 = result._row1._x;
-	v10 = result._row2._y;
-	v11 = result._row3._y;
-	v12 = result._row1._z;
-	v13 = result._row2._z;
-	result._row3._z = (_row1._x * _row2._y - _row1._y * _row2._x) * v18;
-	v14 = v9;
-	v15 = result._row3._z;
-	result._vector._x = -(v14 * _vector._x
-		+ _vector._y * result._row2._x
-		+ _vector._z * result._row3._x);
-	result._vector._y = -(_vector._x * result._row1._y + v10 * _vector._y + v11 * _vector._z);
-	result._vector._z = -(v12 * _vector._x + v13 * _vector._y + v15 * _vector._z);
-
-	return result;
-}
-
-} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control_sub6.h b/engines/titanic/star_control/star_control_sub6.h
deleted file mode 100644
index 3ded69b..0000000
--- a/engines/titanic/star_control/star_control_sub6.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef TITANIC_STAR_CONTROL_SUB6_H
-#define TITANIC_STAR_CONTROL_SUB6_H
-
-#include "titanic/star_control/fmatrix.h"
-
-namespace Titanic {
-
-class CStarControlSub6 : public FMatrix {
-public:
-	FVector _vector;
-public:
-	CStarControlSub6();
-	CStarControlSub6(Axis axis, float amount);
-	CStarControlSub6(const CStarControlSub6 *src);
-	CStarControlSub6(const CStarControlSub6 *s1, const CStarControlSub6 *s2);
-
-	/**
-	 * Sets an identity matrix
-	 */
-	void identity();
-
-	/**
-	 * Sets a rotation matrix for the given axis for the given amount
-	 */
-	void setRotationMatrix(Axis axis, float val);
-
-	void copyFrom(const CStarControlSub6 *src);
-
-	/**
-	 * Copy from the specified matrix
-	 */
-	void copyFrom(const FMatrix &src);
-
-	CStarControlSub6 fn4() const;
-};
-
-} // End of namespace Titanic
-
-#endif /* TITANIC_STAR_CONTROL_SUB6_H */
diff --git a/engines/titanic/star_control/star_control_sub7.cpp b/engines/titanic/star_control/star_control_sub7.cpp
index 3e1f718..f7b8633 100644
--- a/engines/titanic/star_control/star_control_sub7.cpp
+++ b/engines/titanic/star_control/star_control_sub7.cpp
@@ -29,7 +29,7 @@ void CStarControlSub7::draw(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12,
 	if (_data.empty())
 		return;
 
-	CStarControlSub6 sub6 = sub12->proc23();
+	FPose pose = sub12->proc23();
 	double threshold = sub12->proc25();
 	FPoint center((double)surfaceArea->_width * 0.5,
 		surfaceArea->_height * 0.5);
@@ -42,12 +42,12 @@ void CStarControlSub7::draw(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12,
 	for (uint idx = 0; idx < _data.size(); ++idx) {
 		const CBaseStarEntry &star = _data[idx];
 
-		newV._x = sub6._row1._x * star._position._x + sub6._row3._x * star._position._z
-			+ sub6._row2._x * star._position._y + sub6._vector._x;
-		newV._y = sub6._row1._y * star._position._x + sub6._row3._y * star._position._z
-			+ sub6._row2._y * star._position._x + sub6._vector._y;
-		newV._z = sub6._row1._z * star._position._x + sub6._row3._z * star._position._z
-			+ sub6._row2._z * star._position._y + sub6._vector._z; 
+		newV._x = pose._row1._x * star._position._x + pose._row3._x * star._position._z
+			+ pose._row2._x * star._position._y + pose._vector._x;
+		newV._y = pose._row1._y * star._position._x + pose._row3._y * star._position._z
+			+ pose._row2._y * star._position._x + pose._vector._y;
+		newV._z = pose._row1._z * star._position._x + pose._row3._z * star._position._z
+			+ pose._row2._z * star._position._y + pose._vector._z; 
 
 		if (newV._z > threshold) {
 			FVector vTemp;
diff --git a/engines/titanic/star_control/star_points1.cpp b/engines/titanic/star_control/star_points1.cpp
index 0467461..fa16665 100644
--- a/engines/titanic/star_control/star_points1.cpp
+++ b/engines/titanic/star_control/star_points1.cpp
@@ -61,7 +61,7 @@ void CStarPoints1::draw(CSurfaceArea *surface, CStarControlSub12 *sub12) {
 	if (_data.empty())
 		return;
 
-	CStarControlSub6 sub6 = sub12->proc23();
+	FPose pose = sub12->proc23();
 	double threshold = sub12->proc25();
 	FVector vector1, vector2, vector3, vector4;
 	FVector vTemp = _data[0];
@@ -74,18 +74,18 @@ void CStarPoints1::draw(CSurfaceArea *surface, CStarControlSub12 *sub12) {
 	surface->setColorFromPixel();
 	SurfaceAreaMode oldMode = surface->setMode(SA_NONE);
 
-	vector1._z = vTemp._x * sub6._row1._z + vTemp._y * sub6._row2._z + vTemp._z * sub6._row3._z + sub6._vector._z;
-	vector1._x = vTemp._x * sub6._row1._x + vTemp._y * sub6._row2._x + vTemp._z * sub6._row3._x + sub6._vector._x;
-	vector1._y = vTemp._x * sub6._row1._y + vTemp._y * sub6._row2._y + vTemp._z * sub6._row3._y + sub6._vector._y; 
+	vector1._z = vTemp._x * pose._row1._z + vTemp._y * pose._row2._z + vTemp._z * pose._row3._z + pose._vector._z;
+	vector1._x = vTemp._x * pose._row1._x + vTemp._y * pose._row2._x + vTemp._z * pose._row3._x + pose._vector._x;
+	vector1._y = vTemp._x * pose._row1._y + vTemp._y * pose._row2._y + vTemp._z * pose._row3._y + pose._vector._y; 
 
 	for (uint idx = 1; idx < _data.size(); ++idx) {
 		const FVector &sv = _data[idx];
 		bool flag = _data[idx - 1]._flag;
 		vTemp = sv;
 
-		vector3._x = vTemp._x * sub6._row1._x + vTemp._y * sub6._row2._x + vTemp._z * sub6._row3._x * sub6._vector._x;
-		vector3._y = vTemp._x * sub6._row1._y + vTemp._y * sub6._row2._y + vTemp._z * sub6._row3._y * sub6._vector._y;
-		vector3._z = vTemp._x * sub6._row1._z + vTemp._y * sub6._row2._z + vTemp._z * sub6._row3._z + sub6._vector._z;
+		vector3._x = vTemp._x * pose._row1._x + vTemp._y * pose._row2._x + vTemp._z * pose._row3._x * pose._vector._x;
+		vector3._y = vTemp._x * pose._row1._y + vTemp._y * pose._row2._y + vTemp._z * pose._row3._y * pose._vector._y;
+		vector3._z = vTemp._x * pose._row1._z + vTemp._y * pose._row2._z + vTemp._z * pose._row3._z + pose._vector._z;
 
 		if (flag && vector1._z > threshold && vector3._z > threshold) {
 			vector2.clear();
diff --git a/engines/titanic/star_control/star_points2.cpp b/engines/titanic/star_control/star_points2.cpp
index 03de314..ee04b65 100644
--- a/engines/titanic/star_control/star_points2.cpp
+++ b/engines/titanic/star_control/star_points2.cpp
@@ -66,7 +66,7 @@ void CStarPoints2::draw(CSurfaceArea *surface, CStarControlSub12 *sub12) {
 	if (_data.empty())
 		return;
 
-	CStarControlSub6 sub6 = sub12->proc23();
+	FPose pose = sub12->proc23();
 	double threshold = sub12->proc25();
 	FVector vector1, vector2, vector3, vector4;
 	double vWidth2 = (double)surface->_width * 0.5;
@@ -85,18 +85,18 @@ void CStarPoints2::draw(CSurfaceArea *surface, CStarControlSub12 *sub12) {
 
 		for (uint idx = 0; idx < re.size(); ++idx) {
 			const CStarPointEntry &se = re[idx];
-			vector1._z = sub6._row2._z * se._v1._y + sub6._row3._z * se._v1._z
-				+ sub6._row1._z * se._v1._x + sub6._vector._z;
-			vector1._x = sub6._row2._x * se._v1._y + sub6._row3._x * se._v1._z
-				+ sub6._row1._x * se._v1._x + sub6._vector._x;
-			vector1._y = sub6._row2._y * se._v1._y + sub6._row3._y * se._v1._z
-				+ sub6._row1._y * se._v1._x + sub6._vector._y;
-			vector3._z = sub6._row2._z * se._v2._y + sub6._row2._x * se._v2._z
-				+ sub6._row1._z * se._v2._x + sub6._vector._y;
-			vector3._x = sub6._row3._z * se._v2._y + sub6._row3._x * se._v2._z
-				+ sub6._row1._x * se._v2._x + sub6._vector._y;
-			vector3._y = sub6._row2._y * se._v2._y + sub6._row3._y * se._v2._z
-				+ sub6._row1._y * se._v2._x + sub6._vector._y;
+			vector1._z = pose._row2._z * se._v1._y + pose._row3._z * se._v1._z
+				+ pose._row1._z * se._v1._x + pose._vector._z;
+			vector1._x = pose._row2._x * se._v1._y + pose._row3._x * se._v1._z
+				+ pose._row1._x * se._v1._x + pose._vector._x;
+			vector1._y = pose._row2._y * se._v1._y + pose._row3._y * se._v1._z
+				+ pose._row1._y * se._v1._x + pose._vector._y;
+			vector3._z = pose._row2._z * se._v2._y + pose._row2._x * se._v2._z
+				+ pose._row1._z * se._v2._x + pose._vector._y;
+			vector3._x = pose._row3._z * se._v2._y + pose._row3._x * se._v2._z
+				+ pose._row1._x * se._v2._x + pose._vector._y;
+			vector3._y = pose._row2._y * se._v2._y + pose._row3._y * se._v2._z
+				+ pose._row1._y * se._v2._x + pose._vector._y;
 
 			if (vector1._z > threshold && vector3._z > threshold) {
 				vector2.clear();
diff --git a/engines/titanic/star_control/star_ref.cpp b/engines/titanic/star_control/star_ref.cpp
index c1aae24..e15a0f7 100644
--- a/engines/titanic/star_control/star_ref.cpp
+++ b/engines/titanic/star_control/star_ref.cpp
@@ -29,7 +29,7 @@ void CBaseStarRef::process(CSurfaceArea *surface, CStarControlSub12 *sub12) {
 		return;
 
 	const double MAX_VAL = 1.0e9 * 1.0e9;
-	CStarControlSub6 sub6 = sub12->proc23();
+	FPose pose = sub12->proc23();
 	double threshold = sub12->proc25();
 	double vWidth2 = (double)surface->_width * 0.5;
 	double vHeight2 = (double)surface->_height * 0.5;
@@ -39,9 +39,9 @@ void CBaseStarRef::process(CSurfaceArea *surface, CStarControlSub12 *sub12) {
 	for (int idx = 0; idx < _star->size(); ++idx) {
 		const CBaseStarEntry &se = _star->_data[idx];
 		vTemp = se._position;
-		vector1._x = vTemp._x * sub6._row1._x + vTemp._y * sub6._row2._x + vTemp._z * sub6._row3._x + sub6._vector._x;
-		vector1._y = vTemp._x * sub6._row1._y + vTemp._y * sub6._row2._y + vTemp._z * sub6._row3._y + sub6._vector._y;
-		vector1._z = vTemp._x * sub6._row1._z + vTemp._y * sub6._row2._z + vTemp._z * sub6._row3._z + sub6._vector._z;
+		vector1._x = vTemp._x * pose._row1._x + vTemp._y * pose._row2._x + vTemp._z * pose._row3._x + pose._vector._x;
+		vector1._y = vTemp._x * pose._row1._y + vTemp._y * pose._row2._y + vTemp._z * pose._row3._y + pose._vector._y;
+		vector1._z = vTemp._x * pose._row1._z + vTemp._y * pose._row2._z + vTemp._z * pose._row3._z + pose._vector._z;
 		double hyp = vector1._x * vector1._x + vector1._y * vector1._y + vector1._z * vector1._z;
 
 		if (vector1._z > threshold && hyp >= 1.0e12 && hyp < MAX_VAL) {
diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp
index d529012..9c9e972 100644
--- a/engines/titanic/star_control/star_view.cpp
+++ b/engines/titanic/star_control/star_view.cpp
@@ -145,7 +145,7 @@ bool CStarView::MouseMoveMsg(int unused, const Point &pt) {
 }
 
 bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
-	CStarControlSub6 sub6;
+	FPose pose;
 	int v = _starField ? _starField->get88() : -1;
 
 	switch (key) {
@@ -177,8 +177,8 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
 	case Common::KEYCODE_z:
 	case Common::KEYCODE_c:
 		if (v == -1) {
-			sub6.setRotationMatrix(key == Common::KEYCODE_z ? Y_AXIS : X_AXIS, 1.0);
-			_sub12.proc22(sub6);
+			pose.setRotationMatrix(key == Common::KEYCODE_z ? Y_AXIS : X_AXIS, 1.0);
+			_sub12.proc22(pose);
 			_sub12.proc15(errorCode);
 			return true;
 		}
@@ -210,8 +210,8 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
 
 	case Common::KEYCODE_x:
 		if (v == -1) {
-			sub6.setRotationMatrix(Y_AXIS, -1.0);
-			_sub12.proc22(sub6);
+			pose.setRotationMatrix(Y_AXIS, -1.0);
+			_sub12.proc22(pose);
 			_sub12.proc15(errorCode);
 			return true;
 		}
@@ -219,8 +219,8 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
 
 	case Common::KEYCODE_QUOTE:
 		if (v == -1) {
-			sub6.setRotationMatrix(X_AXIS, -1.0);
-			_sub12.proc22(sub6);
+			pose.setRotationMatrix(X_AXIS, -1.0);
+			_sub12.proc22(pose);
 			_sub12.proc15(errorCode);
 			return true;
 		}





More information about the Scummvm-git-logs mailing list