[Scummvm-git-logs] scummvm master -> 256b27581c73db80834a9c6185b36134bae748c8

dreammaster dreammaster at scummvm.org
Thu Jul 13 01:41:22 CEST 2017


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

Summary:
dc5645cb11 TITANIC: Change rows to cols in DMatrix, thanks to wjp
256b27581c TITANIC: Rename DMatrix to DAffine, thanks to wjp


Commit: dc5645cb113bc88a5e07393b4adf251d0037acf1
    https://github.com/scummvm/scummvm/commit/dc5645cb113bc88a5e07393b4adf251d0037acf1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-07-12T19:20:11-04:00

Commit Message:
TITANIC: Change rows to cols in DMatrix, thanks to wjp

Changed paths:
    engines/titanic/star_control/dmatrix.cpp
    engines/titanic/star_control/dmatrix.h
    engines/titanic/star_control/dvector.cpp
    engines/titanic/star_control/fmatrix.cpp
    engines/titanic/star_control/matrix_transform.cpp
    engines/titanic/star_control/star_camera.cpp


diff --git a/engines/titanic/star_control/dmatrix.cpp b/engines/titanic/star_control/dmatrix.cpp
index 296851b..4f9b22d 100644
--- a/engines/titanic/star_control/dmatrix.cpp
+++ b/engines/titanic/star_control/dmatrix.cpp
@@ -29,28 +29,28 @@ namespace Titanic {
 DMatrix *DMatrix::_static;
 
 DMatrix::DMatrix() :
-	_row1(0.0, 0.0, 0.0), _row2(0.0, 0.0, 0.0), _row3(0.0, 0.0, 0.0) {
+	_col1(0.0, 0.0, 0.0), _col2(0.0, 0.0, 0.0), _col3(0.0, 0.0, 0.0) {
 }
 
 DMatrix::DMatrix(int mode, const DVector &src) {
 	switch (mode) {
 	case 0:
-		_row1._x = 1.0;
-		_row2._y = 1.0;
-		_row3._z = 1.0;
-		_row4 = src;
+		_col1._x = 1.0;
+		_col2._y = 1.0;
+		_col3._z = 1.0;
+		_col4 = src;
 		break;
 
 	case 1:
-		_row1._x = src._x;
-		_row2._y = src._y;
-		_row3._z = src._z;
+		_col1._x = src._x;
+		_col2._y = src._y;
+		_col3._z = src._z;
 		break;
 
 	default:
-		_row1._x = 1.0;
-		_row2._y = 1.0;
-		_row3._z = 1.0;
+		_col1._x = 1.0;
+		_col2._y = 1.0;
+		_col3._z = 1.0;
 		break;
 	}
 }
@@ -60,9 +60,9 @@ DMatrix::DMatrix(Axis axis, double amount) {
 }
 
 DMatrix::DMatrix(const FMatrix &src) {
-	_row1 = src._row1;
-	_row2 = src._row2;
-	_row3 = src._row3;
+	_col1 = src._row1;
+	_col2 = src._row2;
+	_col3 = src._row3;
 }
 
 void DMatrix::init() {
@@ -81,27 +81,27 @@ void DMatrix::setRotationMatrix(Axis axis, double amount) {
 
 	switch (axis) {
 	case X_AXIS:
-		_row1._x = 1.0;
-		_row2._y = cosVal;
-		_row2._z = sinVal;
-		_row3._y = -sinVal;
-		_row3._z = cosVal;
+		_col1._x = 1.0;
+		_col2._y = cosVal;
+		_col2._z = sinVal;
+		_col3._y = -sinVal;
+		_col3._z = cosVal;
 		break;
 
 	case Y_AXIS:
-		_row1._x = cosVal;
-		_row1._z = sinVal;
-		_row2._y = 1.0;
-		_row3._x = -sinVal;
-		_row3._z = cosVal;
+		_col1._x = cosVal;
+		_col1._z = sinVal;
+		_col2._y = 1.0;
+		_col3._x = -sinVal;
+		_col3._z = cosVal;
 		break;
 
 	case Z_AXIS:
-		_row1._x = cosVal;
-		_row1._y = sinVal;
-		_row2._x = -sinVal;
-		_row2._y = cosVal;
-		_row3._z = 1.0;
+		_col1._x = cosVal;
+		_col1._y = sinVal;
+		_col2._x = -sinVal;
+		_col2._y = cosVal;
+		_col3._z = 1.0;
 		break;
 
 	default:
@@ -110,7 +110,7 @@ void DMatrix::setRotationMatrix(Axis axis, double amount) {
 }
 
 DMatrix DMatrix::fn1() const {
-	double val1 = _row1._x * _row3._z * _row2._y;
+	double val1 = _col1._x * _col3._z * _col2._y;
 	double val2 = 0.0;
 	double val3 = val1;
 
@@ -119,29 +119,29 @@ DMatrix DMatrix::fn1() const {
 		val1 = 0.0;
 	}
 
-	double val4 = _row3._x * _row1._y * _row2._z;
+	double val4 = _col3._x * _col1._y * _col2._z;
 	if (val4 < 0.0)
 		val2 = val2 + val4;
 	else
 		val1 = val1 + val4;
 
-	double val5 = _row3._y * _row1._z * _row2._x;
+	double val5 = _col3._y * _col1._z * _col2._x;
 	if (val5 < 0.0)
 		val2 = val2 + val5;
 	else
 		val1 = val1 + val5;
 
-	if (-(_row3._x * _row2._y * _row1._z) < 0.0)
-		val2 = val2 - _row3._x * _row2._y * _row1._z;
+	if (-(_col3._x * _col2._y * _col1._z) < 0.0)
+		val2 = val2 - _col3._x * _col2._y * _col1._z;
 	else
-		val1 = val1 - _row3._x * _row2._y * _row1._z;
-	if (-(_row1._y * _row3._z * _row2._x) < 0.0)
-		val2 = val2 - _row1._y * _row3._z * _row2._x;
+		val1 = val1 - _col3._x * _col2._y * _col1._z;
+	if (-(_col1._y * _col3._z * _col2._x) < 0.0)
+		val2 = val2 - _col1._y * _col3._z * _col2._x;
 	else
-		val1 = val1 - _row1._y * _row3._z * _row2._x;
+		val1 = val1 - _col1._y * _col3._z * _col2._x;
 
-	val3 = _row3._y * _row2._z;
-	double val6 = -(_row1._x * val3);
+	val3 = _col3._y * _col2._z;
+	double val6 = -(_col1._x * val3);
 	if (val6 < 0.0)
 		val2 = val2 + val6;
 	else
@@ -150,26 +150,26 @@ DMatrix DMatrix::fn1() const {
 	double val7 = val2 + val1;
 	assert(!(val7 == 0.0 || fabs(val7 / (val1 - val2)) < 1.0e-10));
 
-	double val8 = _row3._z * _row2._y;
+	double val8 = _col3._z * _col2._y;
 	double val9 = 1.0 / val7;
 
 	DMatrix m;
-	m._row1._x = (val8 - val3) * val9;
-	m._row2._x = -((_row3._z * _row2._x - _row3._x * _row2._z) * val9);
-	m._row3._x = (_row3._y * _row2._x - _row3._x * _row2._y) * val9;
-	m._row1._y = -((_row1._y * _row3._z - _row3._y * _row1._z) * val9);
-	m._row2._y = (_row1._x * _row3._z - _row3._x * _row1._z) * val9;
-	m._row3._y = -((_row1._x * _row3._y - _row3._x * _row1._y) * val9);
-	m._row1._z = (_row1._y * _row2._z - _row2._y * _row1._z) * val9;
-	m._row2._z = -((_row1._x * _row2._z - _row1._z * _row2._x) * val9);
-	m._row3._z = (_row1._x * _row2._y - _row1._y * _row2._x) * val9;
-
-	m._row4._x = -(m._row1._x * _row4._x + _row4._y * m._row2._x
-		+ _row4._z * m._row3._x);
-	m._row4._y = -(_row4._z * m._row3._y + _row4._y * m._row2._y
-		+ _row4._x * m._row1._y);
-	m._row4._z = -(_row4._z * m._row3._z + _row4._x * m._row1._z
-		+ _row4._y * m._row2._z);
+	m._col1._x = (val8 - val3) * val9;
+	m._col2._x = -((_col3._z * _col2._x - _col3._x * _col2._z) * val9);
+	m._col3._x = (_col3._y * _col2._x - _col3._x * _col2._y) * val9;
+	m._col1._y = -((_col1._y * _col3._z - _col3._y * _col1._z) * val9);
+	m._col2._y = (_col1._x * _col3._z - _col3._x * _col1._z) * val9;
+	m._col3._y = -((_col1._x * _col3._y - _col3._x * _col1._y) * val9);
+	m._col1._z = (_col1._y * _col2._z - _col2._y * _col1._z) * val9;
+	m._col2._z = -((_col1._x * _col2._z - _col1._z * _col2._x) * val9);
+	m._col3._z = (_col1._x * _col2._y - _col1._y * _col2._x) * val9;
+
+	m._col4._x = -(m._col1._x * _col4._x + _col4._y * m._col2._x
+		+ _col4._z * m._col3._x);
+	m._col4._y = -(_col4._z * m._col3._y + _col4._y * m._col2._y
+		+ _col4._x * m._col1._y);
+	m._col4._z = -(_col4._z * m._col3._z + _col4._x * m._col1._z
+		+ _col4._y * m._col2._z);
 
 	return m;
 }
@@ -187,46 +187,46 @@ void DMatrix::loadTransform(const CMatrixTransform &src) {
 	double val5 = temp1V._y * src._field0;
 	double val6 = temp1V._z * src._field0;
 
-	_row1._x = 1.0 - (temp2V._z + temp2V._y);
-	_row1._y = val1 + val6;
-	_row1._z = val2 - val5;
-	_row2._x = val1 - val6;
-	_row2._y = 1.0 - (temp2V._z + temp2V._x);
-	_row2._z = val3 + val4;
-	_row3._x = val2 + val5;
-	_row3._y = val3 - val4;
-	_row3._z = 1.0 - (temp2V._y + temp2V._x);
-	_row4._x = 0;
-	_row4._y = 0;
-	_row4._z = 0;
+	_col1._x = 1.0 - (temp2V._z + temp2V._y);
+	_col1._y = val1 + val6;
+	_col1._z = val2 - val5;
+	_col2._x = val1 - val6;
+	_col2._y = 1.0 - (temp2V._z + temp2V._x);
+	_col2._z = val3 + val4;
+	_col3._x = val2 + val5;
+	_col3._y = val3 - val4;
+	_col3._z = 1.0 - (temp2V._y + temp2V._x);
+	_col4._x = 0;
+	_col4._y = 0;
+	_col4._z = 0;
 }
 
 DMatrix DMatrix::fn4(const DMatrix &m) {
 	DMatrix dm;
-	dm._row1._x = m._row3._x * _row1._z + m._row2._x * _row1._y
-		+ m._row1._x * _row1._x;
-	dm._row1._y = _row1._x * m._row1._y + m._row3._y * _row1._z
-		+ m._row2._y * _row1._y;
-	dm._row1._z = _row1._x * m._row1._z + m._row3._z * _row1._z
-		+ m._row2._z * _row1._y;
-	dm._row2._x = m._row1._x * _row2._x + _row2._y * m._row2._x
-		+ _row2._z * m._row3._x;
-	dm._row2._y = _row2._y * m._row2._y + _row2._z * m._row3._y
-		+ m._row1._y * _row2._x;
-	dm._row2._z = m._row1._z * _row2._x + _row2._y * m._row2._z
-		+ _row2._z * m._row3._z;
-	dm._row3._x = m._row1._x * _row3._x + _row3._y * m._row2._x
-		+ _row3._z * m._row3._x;
-	dm._row3._y = _row3._y * m._row2._y + _row3._z * m._row3._y
-		+ m._row1._y * _row3._x;
-	dm._row3._z = m._row2._z * _row3._y + m._row3._z * _row3._z
-		+ m._row1._z * _row3._x;
-	dm._row4._x = m._row1._x * _row4._x + _row4._y * m._row2._x
-		+ _row4._z * m._row3._x + m._row4._x;
-	dm._row4._y = _row4._z * m._row3._y + _row4._y * m._row2._y
-		+ _row4._x * m._row1._y + m._row4._y;
-	dm._row4._z = _row4._y * m._row2._z + _row4._x * m._row1._z
-		+ _row4._z * m._row3._z + m._row4._z;
+	dm._col1._x = m._col3._x * _col1._z + m._col2._x * _col1._y
+		+ m._col1._x * _col1._x;
+	dm._col1._y = _col1._x * m._col1._y + m._col3._y * _col1._z
+		+ m._col2._y * _col1._y;
+	dm._col1._z = _col1._x * m._col1._z + m._col3._z * _col1._z
+		+ m._col2._z * _col1._y;
+	dm._col2._x = m._col1._x * _col2._x + _col2._y * m._col2._x
+		+ _col2._z * m._col3._x;
+	dm._col2._y = _col2._y * m._col2._y + _col2._z * m._col3._y
+		+ m._col1._y * _col2._x;
+	dm._col2._z = m._col1._z * _col2._x + _col2._y * m._col2._z
+		+ _col2._z * m._col3._z;
+	dm._col3._x = m._col1._x * _col3._x + _col3._y * m._col2._x
+		+ _col3._z * m._col3._x;
+	dm._col3._y = _col3._y * m._col2._y + _col3._z * m._col3._y
+		+ m._col1._y * _col3._x;
+	dm._col3._z = m._col2._z * _col3._y + m._col3._z * _col3._z
+		+ m._col1._z * _col3._x;
+	dm._col4._x = m._col1._x * _col4._x + _col4._y * m._col2._x
+		+ _col4._z * m._col3._x + m._col4._x;
+	dm._col4._y = _col4._z * m._col3._y + _col4._y * m._col2._y
+		+ _col4._x * m._col1._y + m._col4._y;
+	dm._col4._z = _col4._y * m._col2._z + _col4._x * m._col1._z
+		+ _col4._z * m._col3._z + m._col4._z;
 
 	return dm;
 }
diff --git a/engines/titanic/star_control/dmatrix.h b/engines/titanic/star_control/dmatrix.h
index 1cc3616..45837ce 100644
--- a/engines/titanic/star_control/dmatrix.h
+++ b/engines/titanic/star_control/dmatrix.h
@@ -39,10 +39,10 @@ class DMatrix {
 private:
 	static DMatrix *_static;
 public:
-	DVector _row1;
-	DVector _row2;
-	DVector _row3;
-	DVector _row4;
+	DVector _col1;
+	DVector _col2;
+	DVector _col3;
+	DVector _col4;
 public:
 	static void init();
 	static void deinit();
diff --git a/engines/titanic/star_control/dvector.cpp b/engines/titanic/star_control/dvector.cpp
index 23d601e..3f09b12 100644
--- a/engines/titanic/star_control/dvector.cpp
+++ b/engines/titanic/star_control/dvector.cpp
@@ -42,9 +42,9 @@ double DVector::getDistance(const DVector &src) {
 
 DVector DVector::fn1(const DMatrix &m) {
 	DVector dest;
-	dest._x = m._row3._x * _z + m._row2._x * _y + m._row1._x * _x + m._row4._x;
-	dest._y = m._row2._y * _y + m._row3._y * _z + m._row1._y * _x + m._row4._y;
-	dest._z = m._row3._z * _z + m._row2._z * _y + m._row1._z * _x + m._row4._z;
+	dest._x = m._col3._x * _z + m._col2._x * _y + m._col1._x * _x + m._col4._x;
+	dest._y = m._col2._y * _y + m._col3._y * _z + m._col1._y * _x + m._col4._y;
+	dest._z = m._col3._z * _z + m._col2._z * _y + m._col1._z * _x + m._col4._z;
 	return dest;
 }
 
diff --git a/engines/titanic/star_control/fmatrix.cpp b/engines/titanic/star_control/fmatrix.cpp
index ca35197..bf5754a 100644
--- a/engines/titanic/star_control/fmatrix.cpp
+++ b/engines/titanic/star_control/fmatrix.cpp
@@ -40,9 +40,9 @@ FMatrix::FMatrix(const FMatrix &src) {
 }
 
 void FMatrix::copyFrom(const DMatrix &src) {
-	_row1 = src._row1;
-	_row2 = src._row2;
-	_row3 = src._row3;
+	_row1 = src._col1;
+	_row2 = src._col2;
+	_row3 = src._col3;
 }
 
 void FMatrix::load(SimpleFile *file, int param) {
diff --git a/engines/titanic/star_control/matrix_transform.cpp b/engines/titanic/star_control/matrix_transform.cpp
index 9de21e4..20cadd5 100644
--- a/engines/titanic/star_control/matrix_transform.cpp
+++ b/engines/titanic/star_control/matrix_transform.cpp
@@ -55,46 +55,46 @@ CMatrixTransform CMatrixTransform::resize(double factor) const {
 }
 
 void CMatrixTransform::fn4(const DMatrix &m) {
-	double total = m._row1._x + m._row3._z + m._row2._y + 1.0;
+	double total = m._col1._x + m._col3._z + m._col2._y + 1.0;
 
 	if (total <= 0.00001) {
-		total = m._row3._z;
+		total = m._col3._z;
 
-		if (m._row1._x <= m._row3._z) {
-			if (m._row2._y > total)
-				total = m._row2._y;
-		} else if (m._row1._x > total) {
-			total = m._row1._x;
+		if (m._col1._x <= m._col3._z) {
+			if (m._col2._y > total)
+				total = m._col2._y;
+		} else if (m._col1._x > total) {
+			total = m._col1._x;
 		}
 
-		if (total == m._row1._x) {
-			double val1 = sqrt(m._row1._x - -1.0 - m._row2._y - m._row3._z);
+		if (total == m._col1._x) {
+			double val1 = sqrt(m._col1._x - -1.0 - m._col2._y - m._col3._z);
 			double val2 = 0.5 / val1;
 			_vector._x = val1 * 0.5;
-			_field0 = (m._row2._z - m._row3._y) * val2;
-			_vector._y = (m._row2._x + m._row1._y) * val2;
-			_vector._z = (m._row3._x + m._row1._z) * val2;
-		} else if (total == m._row2._y) {
-			double val1 = sqrt(m._row2._y - -1.0 - m._row3._z - m._row1._x);
+			_field0 = (m._col2._z - m._col3._y) * val2;
+			_vector._y = (m._col2._x + m._col1._y) * val2;
+			_vector._z = (m._col3._x + m._col1._z) * val2;
+		} else if (total == m._col2._y) {
+			double val1 = sqrt(m._col2._y - -1.0 - m._col3._z - m._col1._x);
 			double val2 = 0.5 / val1;
 			_vector._y = val1 * 0.5;
-			_field0 = (m._row3._x - m._row1._z) * val2;
-			_vector._z = (m._row3._y + m._row2._z) * val2;
-			_vector._x = (m._row2._x + m._row1._y) * val2;
-		} else if (total == m._row3._z) {
-			double val1 = sqrt(m._row3._z - -1.0 - m._row1._x - m._row2._y);
+			_field0 = (m._col3._x - m._col1._z) * val2;
+			_vector._z = (m._col3._y + m._col2._z) * val2;
+			_vector._x = (m._col2._x + m._col1._y) * val2;
+		} else if (total == m._col3._z) {
+			double val1 = sqrt(m._col3._z - -1.0 - m._col1._x - m._col2._y);
 			double val2 = 0.5 / val1;
 			_vector._z = val1 * 0.5;
-			_field0 = (m._row1._y - m._row2._x) * val2;
-			_vector._x = (m._row3._x + m._row1._z) * val2;
-			_vector._y = (m._row3._y + m._row2._z) * val2;
+			_field0 = (m._col1._y - m._col2._x) * val2;
+			_vector._x = (m._col3._x + m._col1._z) * val2;
+			_vector._y = (m._col3._y + m._col2._z) * val2;
 		}
 	} else {
 		double val1 = 0.5 / sqrt(total);
 		_field0 = sqrt(total) * 0.5;
-		_vector._x = (m._row2._z - m._row3._y) * val1;
-		_vector._y = (m._row3._x - m._row1._z) * val1;
-		_vector._z = (m._row1._y - m._row2._x) * val1;
+		_vector._x = (m._col2._z - m._col3._y) * val1;
+		_vector._y = (m._col3._x - m._col1._z) * val1;
+		_vector._z = (m._col1._y - m._col2._x) * val1;
 	}
 }
 
diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp
index c715daf..d3487e2 100644
--- a/engines/titanic/star_control/star_camera.cpp
+++ b/engines/titanic/star_control/star_camera.cpp
@@ -465,10 +465,10 @@ void CStarCamera::lockMarker2(CViewport *viewport, const FVector &v) {
 	
 	DVector tempV2 = _viewport._position;
 	DMatrix m4;
-	m4._row1 = viewport->_position;
-	m4._row2 = DVector(0.0, 0.0, 0.0);
-	m4._row3 = DVector(0.0, 0.0, 0.0);
-	m4._row4 = DVector(0.0, 0.0, 0.0);
+	m4._col1 = viewport->_position;
+	m4._col2 = DVector(0.0, 0.0, 0.0);
+	m4._col3 = DVector(0.0, 0.0, 0.0);
+	m4._col4 = DVector(0.0, 0.0, 0.0);
 
 	FMatrix m5 = viewport->getOrientation();
 	double yVal1 = m5._row1._y * 1000000.0;
@@ -476,39 +476,39 @@ void CStarCamera::lockMarker2(CViewport *viewport, const FVector &v) {
 	double xVal1 = m5._row2._x * 1000000.0;
 	double yVal2 = m5._row2._y * 1000000.0;
 	double zVal2 = m5._row2._z * 1000000.0;
-	double zVal3 = zVal1 + m4._row1._z;
-	double yVal3 = yVal1 + m4._row1._y;
-	double xVal2 = m5._row1._x * 1000000.0 + m4._row1._x;
-	double zVal4 = zVal2 + m4._row1._z;
-	double yVal4 = yVal2 + m4._row1._y;
-	double xVal3 = xVal1 + m4._row1._x;
+	double zVal3 = zVal1 + m4._col1._z;
+	double yVal3 = yVal1 + m4._col1._y;
+	double xVal2 = m5._row1._x * 1000000.0 + m4._col1._x;
+	double zVal4 = zVal2 + m4._col1._z;
+	double yVal4 = yVal2 + m4._col1._y;
+	double xVal3 = xVal1 + m4._col1._x;
 
 	DVector tempV4(xVal2, yVal3, zVal3);
 	DVector tempV3(xVal3, yVal4, zVal4);
-	m4._row3 = tempV4;
+	m4._col3 = tempV4;
 
 	FVector tempV5;
 	tempV5._x = m5._row3._x * 1000000.0;
 	tempV5._y = m5._row3._y * 1000000.0;
-	m4._row2 = tempV3;
+	m4._col2 = tempV3;
 
-	tempV3._x = tempV5._x + m4._row1._x;
-	tempV3._y = tempV5._y + m4._row1._y;
-	tempV3._z = m5._row3._z * 1000000.0 + m4._row1._z;
-	m4._row4 = tempV3;
+	tempV3._x = tempV5._x + m4._col1._x;
+	tempV3._y = tempV5._y + m4._col1._y;
+	tempV3._z = m5._row3._z * 1000000.0 + m4._col1._z;
+	m4._col4 = tempV3;
 
 	tempV2 = tempV2.fn1(m2);
-	m4._row1 = m4._row1.fn1(m2);
-	m4._row3 = m4._row3.fn1(m2);
-	m4._row2 = m4._row2.fn1(m2);
-	m4._row4 = m4._row4.fn1(m2);
+	m4._col1 = m4._col1.fn1(m2);
+	m4._col3 = m4._col3.fn1(m2);
+	m4._col2 = m4._col2.fn1(m2);
+	m4._col4 = m4._col4.fn1(m2);
 
 	// Find the angle that gives the minimum distance
 	DVector tempPos;
 	double minDistance = 1.0e20;
 	int minDegree = 0;
 	for (int degree = 0; degree < 360; ++degree) {
-		tempPos = m4._row1;
+		tempPos = m4._col1;
 		tempPos.fn2((double)degree);
 		double distance = tempV2.getDistance(tempPos);
 
@@ -518,25 +518,25 @@ void CStarCamera::lockMarker2(CViewport *viewport, const FVector &v) {
 		}
 	}
 
-	m4._row1.fn2((double)minDegree);
-	m4._row2.fn2((double)minDegree);
-	m4._row3.fn2((double)minDegree);
-	m4._row4.fn2((double)minDegree);
-	m4._row1 = m4._row1.fn1(m1);
-	m4._row2 = m4._row2.fn1(m1);
-	m4._row3 = m4._row3.fn1(m1);
-	m4._row4 = m4._row4.fn1(m1);
-
-	m4._row3 -= m4._row1;
-	m4._row2 -= m4._row1;
-	m4._row4 -= m4._row1;
-
-	m4._row3.normalize();
-	m4._row2.normalize();
-	m4._row4.normalize();
-	m5.set(m4._row3, m4._row2, m4._row4);
-
-	FVector newPos = m4._row1;
+	m4._col1.fn2((double)minDegree);
+	m4._col2.fn2((double)minDegree);
+	m4._col3.fn2((double)minDegree);
+	m4._col4.fn2((double)minDegree);
+	m4._col1 = m4._col1.fn1(m1);
+	m4._col2 = m4._col2.fn1(m1);
+	m4._col3 = m4._col3.fn1(m1);
+	m4._col4 = m4._col4.fn1(m1);
+
+	m4._col3 -= m4._col1;
+	m4._col2 -= m4._col1;
+	m4._col4 -= m4._col1;
+
+	m4._col3.normalize();
+	m4._col2.normalize();
+	m4._col4.normalize();
+	m5.set(m4._col3, m4._col2, m4._col4);
+
+	FVector newPos = m4._col1;
 	FMatrix m6 = _viewport.getOrientation();
 	_mover->proc8(_viewport._position, newPos, m6, m5);
 


Commit: 256b27581c73db80834a9c6185b36134bae748c8
    https://github.com/scummvm/scummvm/commit/256b27581c73db80834a9c6185b36134bae748c8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-07-12T19:41:05-04:00

Commit Message:
TITANIC: Rename DMatrix to DAffine, thanks to wjp

Changed paths:
  A engines/titanic/star_control/daffine.cpp
  A engines/titanic/star_control/daffine.h
  R engines/titanic/star_control/dmatrix.cpp
  R engines/titanic/star_control/dmatrix.h
    engines/titanic/module.mk
    engines/titanic/star_control/base_stars.cpp
    engines/titanic/star_control/dvector.cpp
    engines/titanic/star_control/dvector.h
    engines/titanic/star_control/fmatrix.cpp
    engines/titanic/star_control/fmatrix.h
    engines/titanic/star_control/matrix_transform.cpp
    engines/titanic/star_control/matrix_transform.h
    engines/titanic/star_control/orientation_changer.cpp
    engines/titanic/star_control/star_camera.cpp
    engines/titanic/star_control/star_camera.h
    engines/titanic/star_control/star_control.cpp
    engines/titanic/star_control/unmarked_camera_mover.cpp


diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index 6cc95f4..60997f4 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -434,7 +434,7 @@ MODULE_OBJS := \
 	star_control/base_stars.o \
 	star_control/camera_auto_mover.o \
 	star_control/camera_mover.o \
-	star_control/dmatrix.o \
+	star_control/daffine.o \
 	star_control/dvector.o \
 	star_control/fmatrix.o \
 	star_control/fpoint.o \
diff --git a/engines/titanic/star_control/base_stars.cpp b/engines/titanic/star_control/base_stars.cpp
index dddc399..94208e7 100644
--- a/engines/titanic/star_control/base_stars.cpp
+++ b/engines/titanic/star_control/base_stars.cpp
@@ -560,7 +560,7 @@ int CBaseStars::baseFn2(CSurfaceArea *surfaceArea, CStarCamera *camera) {
 /*------------------------------------------------------------------------*/
 
 void CStarVector::apply() {
-	_owner->addMatrixRow(_vector);
+	_owner->adDAffineRow(_vector);
 }
 
 } // End of namespace Titanic
diff --git a/engines/titanic/star_control/daffine.cpp b/engines/titanic/star_control/daffine.cpp
new file mode 100644
index 0000000..a7bed77
--- /dev/null
+++ b/engines/titanic/star_control/daffine.cpp
@@ -0,0 +1,234 @@
+/* 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/daffine.h"
+#include "titanic/star_control/fmatrix.h"
+#include "titanic/star_control/matrix_transform.h"
+
+namespace Titanic {
+
+DAffine *DAffine::_static;
+
+DAffine::DAffine() :
+	_col1(0.0, 0.0, 0.0), _col2(0.0, 0.0, 0.0), _col3(0.0, 0.0, 0.0) {
+}
+
+DAffine::DAffine(int mode, const DVector &src) {
+	switch (mode) {
+	case 0:
+		_col1._x = 1.0;
+		_col2._y = 1.0;
+		_col3._z = 1.0;
+		_col4 = src;
+		break;
+
+	case 1:
+		_col1._x = src._x;
+		_col2._y = src._y;
+		_col3._z = src._z;
+		break;
+
+	default:
+		_col1._x = 1.0;
+		_col2._y = 1.0;
+		_col3._z = 1.0;
+		break;
+	}
+}
+
+DAffine::DAffine(Axis axis, double amount) {
+	setRotationMatrix(axis, amount);
+}
+
+DAffine::DAffine(const FMatrix &src) {
+	_col1 = src._row1;
+	_col2 = src._row2;
+	_col3 = src._row3;
+}
+
+void DAffine::init() {
+	_static = nullptr;
+}
+
+void DAffine::deinit() {
+	delete _static;
+	_static = nullptr;
+}
+
+void DAffine::setRotationMatrix(Axis axis, double amount) {
+	const double FACTOR = 0.0174532925199433;
+	double sinVal = sin(amount * FACTOR);
+	double cosVal = cos(amount * FACTOR);
+
+	switch (axis) {
+	case X_AXIS:
+		_col1._x = 1.0;
+		_col2._y = cosVal;
+		_col2._z = sinVal;
+		_col3._y = -sinVal;
+		_col3._z = cosVal;
+		break;
+
+	case Y_AXIS:
+		_col1._x = cosVal;
+		_col1._z = sinVal;
+		_col2._y = 1.0;
+		_col3._x = -sinVal;
+		_col3._z = cosVal;
+		break;
+
+	case Z_AXIS:
+		_col1._x = cosVal;
+		_col1._y = sinVal;
+		_col2._x = -sinVal;
+		_col2._y = cosVal;
+		_col3._z = 1.0;
+		break;
+
+	default:
+		break;
+	}
+}
+
+DAffine DAffine::inverseTransform() const {
+	double val1 = _col1._x * _col3._z * _col2._y;
+	double val2 = 0.0;
+	double val3 = val1;
+
+	if (val1 < 0.0) {
+		val2 = val3;
+		val1 = 0.0;
+	}
+
+	double val4 = _col3._x * _col1._y * _col2._z;
+	if (val4 < 0.0)
+		val2 = val2 + val4;
+	else
+		val1 = val1 + val4;
+
+	double val5 = _col3._y * _col1._z * _col2._x;
+	if (val5 < 0.0)
+		val2 = val2 + val5;
+	else
+		val1 = val1 + val5;
+
+	if (-(_col3._x * _col2._y * _col1._z) < 0.0)
+		val2 = val2 - _col3._x * _col2._y * _col1._z;
+	else
+		val1 = val1 - _col3._x * _col2._y * _col1._z;
+	if (-(_col1._y * _col3._z * _col2._x) < 0.0)
+		val2 = val2 - _col1._y * _col3._z * _col2._x;
+	else
+		val1 = val1 - _col1._y * _col3._z * _col2._x;
+
+	val3 = _col3._y * _col2._z;
+	double val6 = -(_col1._x * val3);
+	if (val6 < 0.0)
+		val2 = val2 + val6;
+	else
+		val1 = val1 + val6;
+
+	double val7 = val2 + val1;
+	assert(!(val7 == 0.0 || fabs(val7 / (val1 - val2)) < 1.0e-10));
+
+	double val8 = _col3._z * _col2._y;
+	double val9 = 1.0 / val7;
+
+	DAffine m;
+	m._col1._x = (val8 - val3) * val9;
+	m._col2._x = -((_col3._z * _col2._x - _col3._x * _col2._z) * val9);
+	m._col3._x = (_col3._y * _col2._x - _col3._x * _col2._y) * val9;
+	m._col1._y = -((_col1._y * _col3._z - _col3._y * _col1._z) * val9);
+	m._col2._y = (_col1._x * _col3._z - _col3._x * _col1._z) * val9;
+	m._col3._y = -((_col1._x * _col3._y - _col3._x * _col1._y) * val9);
+	m._col1._z = (_col1._y * _col2._z - _col2._y * _col1._z) * val9;
+	m._col2._z = -((_col1._x * _col2._z - _col1._z * _col2._x) * val9);
+	m._col3._z = (_col1._x * _col2._y - _col1._y * _col2._x) * val9;
+
+	m._col4._x = -(m._col1._x * _col4._x + _col4._y * m._col2._x
+		+ _col4._z * m._col3._x);
+	m._col4._y = -(_col4._z * m._col3._y + _col4._y * m._col2._y
+		+ _col4._x * m._col1._y);
+	m._col4._z = -(_col4._z * m._col3._z + _col4._x * m._col1._z
+		+ _col4._y * m._col2._z);
+
+	return m;
+}
+
+void DAffine::loadTransform(const CMatrixTransform &src) {
+	double total = src.fn1();
+	double factor = (total <= 0.0) ? 0.0 : 2.0 / total;
+	DVector temp1V = src._vector * factor;
+	DVector temp2V = temp1V * src._vector;
+
+	double val1 = temp1V._y * src._vector._x;
+	double val2 = temp1V._z * src._vector._x;
+	double val3 = temp1V._z * src._vector._y;
+	double val4 = temp1V._x * src._field0;
+	double val5 = temp1V._y * src._field0;
+	double val6 = temp1V._z * src._field0;
+
+	_col1._x = 1.0 - (temp2V._z + temp2V._y);
+	_col1._y = val1 + val6;
+	_col1._z = val2 - val5;
+	_col2._x = val1 - val6;
+	_col2._y = 1.0 - (temp2V._z + temp2V._x);
+	_col2._z = val3 + val4;
+	_col3._x = val2 + val5;
+	_col3._y = val3 - val4;
+	_col3._z = 1.0 - (temp2V._y + temp2V._x);
+	_col4._x = 0;
+	_col4._y = 0;
+	_col4._z = 0;
+}
+
+DAffine DAffine::compose(const DAffine &m) {
+	DAffine dm;
+	dm._col1._x = m._col3._x * _col1._z + m._col2._x * _col1._y
+		+ m._col1._x * _col1._x;
+	dm._col1._y = _col1._x * m._col1._y + m._col3._y * _col1._z
+		+ m._col2._y * _col1._y;
+	dm._col1._z = _col1._x * m._col1._z + m._col3._z * _col1._z
+		+ m._col2._z * _col1._y;
+	dm._col2._x = m._col1._x * _col2._x + _col2._y * m._col2._x
+		+ _col2._z * m._col3._x;
+	dm._col2._y = _col2._y * m._col2._y + _col2._z * m._col3._y
+		+ m._col1._y * _col2._x;
+	dm._col2._z = m._col1._z * _col2._x + _col2._y * m._col2._z
+		+ _col2._z * m._col3._z;
+	dm._col3._x = m._col1._x * _col3._x + _col3._y * m._col2._x
+		+ _col3._z * m._col3._x;
+	dm._col3._y = _col3._y * m._col2._y + _col3._z * m._col3._y
+		+ m._col1._y * _col3._x;
+	dm._col3._z = m._col2._z * _col3._y + m._col3._z * _col3._z
+		+ m._col1._z * _col3._x;
+	dm._col4._x = m._col1._x * _col4._x + _col4._y * m._col2._x
+		+ _col4._z * m._col3._x + m._col4._x;
+	dm._col4._y = _col4._z * m._col3._y + _col4._y * m._col2._y
+		+ _col4._x * m._col1._y + m._col4._y;
+	dm._col4._z = _col4._y * m._col2._z + _col4._x * m._col1._z
+		+ _col4._z * m._col3._z + m._col4._z;
+
+	return dm;
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/star_control/daffine.h b/engines/titanic/star_control/daffine.h
new file mode 100644
index 0000000..50f8b95
--- /dev/null
+++ b/engines/titanic/star_control/daffine.h
@@ -0,0 +1,71 @@
+/* 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_DAFFINE_H
+#define TITANIC_DAFFINE_H
+
+#include "titanic/star_control/dvector.h"
+#include "titanic/star_control/fvector.h"
+
+namespace Titanic {
+
+class FMatrix;
+class CMatrixTransform;
+
+/**
+ * Affine transformation.
+ *
+ * Handles transformation functions between affine spaces,
+ * which preserves points, straight lines and planes
+ */
+class DAffine {
+private:
+	static DAffine *_static;
+public:
+	DVector _col1;
+	DVector _col2;
+	DVector _col3;
+	DVector _col4;
+public:
+	static void init();
+	static void deinit();
+public:
+	DAffine();
+	DAffine(int mode, const DVector &src);
+	DAffine(Axis axis, double amount);
+	DAffine(const FMatrix &src);
+
+	/**
+	 * Sets up a matrix for rotating on a given axis by a given amount
+	 */
+	void setRotationMatrix(Axis axis, double amount);
+
+	DAffine inverseTransform() const;
+
+	void loadTransform(const CMatrixTransform &src);
+
+	DAffine compose(const DAffine &m);
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_DAFFINE_H */
diff --git a/engines/titanic/star_control/dmatrix.cpp b/engines/titanic/star_control/dmatrix.cpp
deleted file mode 100644
index 4f9b22d..0000000
--- a/engines/titanic/star_control/dmatrix.cpp
+++ /dev/null
@@ -1,234 +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/dmatrix.h"
-#include "titanic/star_control/fmatrix.h"
-#include "titanic/star_control/matrix_transform.h"
-
-namespace Titanic {
-
-DMatrix *DMatrix::_static;
-
-DMatrix::DMatrix() :
-	_col1(0.0, 0.0, 0.0), _col2(0.0, 0.0, 0.0), _col3(0.0, 0.0, 0.0) {
-}
-
-DMatrix::DMatrix(int mode, const DVector &src) {
-	switch (mode) {
-	case 0:
-		_col1._x = 1.0;
-		_col2._y = 1.0;
-		_col3._z = 1.0;
-		_col4 = src;
-		break;
-
-	case 1:
-		_col1._x = src._x;
-		_col2._y = src._y;
-		_col3._z = src._z;
-		break;
-
-	default:
-		_col1._x = 1.0;
-		_col2._y = 1.0;
-		_col3._z = 1.0;
-		break;
-	}
-}
-
-DMatrix::DMatrix(Axis axis, double amount) {
-	setRotationMatrix(axis, amount);
-}
-
-DMatrix::DMatrix(const FMatrix &src) {
-	_col1 = src._row1;
-	_col2 = src._row2;
-	_col3 = src._row3;
-}
-
-void DMatrix::init() {
-	_static = nullptr;
-}
-
-void DMatrix::deinit() {
-	delete _static;
-	_static = nullptr;
-}
-
-void DMatrix::setRotationMatrix(Axis axis, double amount) {
-	const double FACTOR = 0.0174532925199433;
-	double sinVal = sin(amount * FACTOR);
-	double cosVal = cos(amount * FACTOR);
-
-	switch (axis) {
-	case X_AXIS:
-		_col1._x = 1.0;
-		_col2._y = cosVal;
-		_col2._z = sinVal;
-		_col3._y = -sinVal;
-		_col3._z = cosVal;
-		break;
-
-	case Y_AXIS:
-		_col1._x = cosVal;
-		_col1._z = sinVal;
-		_col2._y = 1.0;
-		_col3._x = -sinVal;
-		_col3._z = cosVal;
-		break;
-
-	case Z_AXIS:
-		_col1._x = cosVal;
-		_col1._y = sinVal;
-		_col2._x = -sinVal;
-		_col2._y = cosVal;
-		_col3._z = 1.0;
-		break;
-
-	default:
-		break;
-	}
-}
-
-DMatrix DMatrix::fn1() const {
-	double val1 = _col1._x * _col3._z * _col2._y;
-	double val2 = 0.0;
-	double val3 = val1;
-
-	if (val1 < 0.0) {
-		val2 = val3;
-		val1 = 0.0;
-	}
-
-	double val4 = _col3._x * _col1._y * _col2._z;
-	if (val4 < 0.0)
-		val2 = val2 + val4;
-	else
-		val1 = val1 + val4;
-
-	double val5 = _col3._y * _col1._z * _col2._x;
-	if (val5 < 0.0)
-		val2 = val2 + val5;
-	else
-		val1 = val1 + val5;
-
-	if (-(_col3._x * _col2._y * _col1._z) < 0.0)
-		val2 = val2 - _col3._x * _col2._y * _col1._z;
-	else
-		val1 = val1 - _col3._x * _col2._y * _col1._z;
-	if (-(_col1._y * _col3._z * _col2._x) < 0.0)
-		val2 = val2 - _col1._y * _col3._z * _col2._x;
-	else
-		val1 = val1 - _col1._y * _col3._z * _col2._x;
-
-	val3 = _col3._y * _col2._z;
-	double val6 = -(_col1._x * val3);
-	if (val6 < 0.0)
-		val2 = val2 + val6;
-	else
-		val1 = val1 + val6;
-
-	double val7 = val2 + val1;
-	assert(!(val7 == 0.0 || fabs(val7 / (val1 - val2)) < 1.0e-10));
-
-	double val8 = _col3._z * _col2._y;
-	double val9 = 1.0 / val7;
-
-	DMatrix m;
-	m._col1._x = (val8 - val3) * val9;
-	m._col2._x = -((_col3._z * _col2._x - _col3._x * _col2._z) * val9);
-	m._col3._x = (_col3._y * _col2._x - _col3._x * _col2._y) * val9;
-	m._col1._y = -((_col1._y * _col3._z - _col3._y * _col1._z) * val9);
-	m._col2._y = (_col1._x * _col3._z - _col3._x * _col1._z) * val9;
-	m._col3._y = -((_col1._x * _col3._y - _col3._x * _col1._y) * val9);
-	m._col1._z = (_col1._y * _col2._z - _col2._y * _col1._z) * val9;
-	m._col2._z = -((_col1._x * _col2._z - _col1._z * _col2._x) * val9);
-	m._col3._z = (_col1._x * _col2._y - _col1._y * _col2._x) * val9;
-
-	m._col4._x = -(m._col1._x * _col4._x + _col4._y * m._col2._x
-		+ _col4._z * m._col3._x);
-	m._col4._y = -(_col4._z * m._col3._y + _col4._y * m._col2._y
-		+ _col4._x * m._col1._y);
-	m._col4._z = -(_col4._z * m._col3._z + _col4._x * m._col1._z
-		+ _col4._y * m._col2._z);
-
-	return m;
-}
-
-void DMatrix::loadTransform(const CMatrixTransform &src) {
-	double total = src.fn1();
-	double factor = (total <= 0.0) ? 0.0 : 2.0 / total;
-	DVector temp1V = src._vector * factor;
-	DVector temp2V = temp1V * src._vector;
-
-	double val1 = temp1V._y * src._vector._x;
-	double val2 = temp1V._z * src._vector._x;
-	double val3 = temp1V._z * src._vector._y;
-	double val4 = temp1V._x * src._field0;
-	double val5 = temp1V._y * src._field0;
-	double val6 = temp1V._z * src._field0;
-
-	_col1._x = 1.0 - (temp2V._z + temp2V._y);
-	_col1._y = val1 + val6;
-	_col1._z = val2 - val5;
-	_col2._x = val1 - val6;
-	_col2._y = 1.0 - (temp2V._z + temp2V._x);
-	_col2._z = val3 + val4;
-	_col3._x = val2 + val5;
-	_col3._y = val3 - val4;
-	_col3._z = 1.0 - (temp2V._y + temp2V._x);
-	_col4._x = 0;
-	_col4._y = 0;
-	_col4._z = 0;
-}
-
-DMatrix DMatrix::fn4(const DMatrix &m) {
-	DMatrix dm;
-	dm._col1._x = m._col3._x * _col1._z + m._col2._x * _col1._y
-		+ m._col1._x * _col1._x;
-	dm._col1._y = _col1._x * m._col1._y + m._col3._y * _col1._z
-		+ m._col2._y * _col1._y;
-	dm._col1._z = _col1._x * m._col1._z + m._col3._z * _col1._z
-		+ m._col2._z * _col1._y;
-	dm._col2._x = m._col1._x * _col2._x + _col2._y * m._col2._x
-		+ _col2._z * m._col3._x;
-	dm._col2._y = _col2._y * m._col2._y + _col2._z * m._col3._y
-		+ m._col1._y * _col2._x;
-	dm._col2._z = m._col1._z * _col2._x + _col2._y * m._col2._z
-		+ _col2._z * m._col3._z;
-	dm._col3._x = m._col1._x * _col3._x + _col3._y * m._col2._x
-		+ _col3._z * m._col3._x;
-	dm._col3._y = _col3._y * m._col2._y + _col3._z * m._col3._y
-		+ m._col1._y * _col3._x;
-	dm._col3._z = m._col2._z * _col3._y + m._col3._z * _col3._z
-		+ m._col1._z * _col3._x;
-	dm._col4._x = m._col1._x * _col4._x + _col4._y * m._col2._x
-		+ _col4._z * m._col3._x + m._col4._x;
-	dm._col4._y = _col4._z * m._col3._y + _col4._y * m._col2._y
-		+ _col4._x * m._col1._y + m._col4._y;
-	dm._col4._z = _col4._y * m._col2._z + _col4._x * m._col1._z
-		+ _col4._z * m._col3._z + m._col4._z;
-
-	return dm;
-}
-
-} // End of namespace Titanic
diff --git a/engines/titanic/star_control/dmatrix.h b/engines/titanic/star_control/dmatrix.h
deleted file mode 100644
index 45837ce..0000000
--- a/engines/titanic/star_control/dmatrix.h
+++ /dev/null
@@ -1,69 +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_DMATRIX_H
-#define TITANIC_DMATRIX_H
-
-#include "titanic/star_control/dvector.h"
-#include "titanic/star_control/fvector.h"
-
-namespace Titanic {
-
-class FMatrix;
-class CMatrixTransform;
-
-/**
- * Double based matrix class.
- * @remarks		TODO: See if it can be merged with FMatrix
- */
-class DMatrix {
-private:
-	static DMatrix *_static;
-public:
-	DVector _col1;
-	DVector _col2;
-	DVector _col3;
-	DVector _col4;
-public:
-	static void init();
-	static void deinit();
-public:
-	DMatrix();
-	DMatrix(int mode, const DVector &src);
-	DMatrix(Axis axis, double amount);
-	DMatrix(const FMatrix &src);
-
-	/**
-	 * Sets up a matrix for rotating on a given axis by a given amount
-	 */
-	void setRotationMatrix(Axis axis, double amount);
-
-	DMatrix fn1() const;
-
-	void loadTransform(const CMatrixTransform &src);
-
-	DMatrix fn4(const DMatrix &m);
-};
-
-} // End of namespace Titanic
-
-#endif /* TITANIC_DMATRIX_H */
diff --git a/engines/titanic/star_control/dvector.cpp b/engines/titanic/star_control/dvector.cpp
index 3f09b12..a8754e7 100644
--- a/engines/titanic/star_control/dvector.cpp
+++ b/engines/titanic/star_control/dvector.cpp
@@ -21,7 +21,7 @@
  */
 
 #include "titanic/star_control/dvector.h"
-#include "titanic/star_control/dmatrix.h"
+#include "titanic/star_control/DAffine.h"
 #include "common/algorithm.h"
 
 namespace Titanic {
@@ -40,7 +40,7 @@ double DVector::getDistance(const DVector &src) {
 	return sqrt((src._x - _x) * (src._x - _x) + (src._y - _y) * (src._y - _y) + (src._z - _z) * (src._z - _z));
 }
 
-DVector DVector::fn1(const DMatrix &m) {
+DVector DVector::fn1(const DAffine &m) {
 	DVector dest;
 	dest._x = m._col3._x * _z + m._col2._x * _y + m._col1._x * _x + m._col4._x;
 	dest._y = m._col2._y * _y + m._col3._y * _z + m._col1._y * _x + m._col4._y;
@@ -80,31 +80,31 @@ DVector DVector::fn3() const {
 	return dest;
 }
 
-DMatrix DVector::fn4(const DVector &v) {
+DAffine DVector::fn4(const DVector &v) {
 	const double FACTOR = 180.0 / M_PI;
-	DMatrix matrix1, matrix2, matrix3, matrix4;
+	DAffine matrix1, matrix2, matrix3, matrix4;
 
 	DVector vector1 = fn3();
 	matrix1.setRotationMatrix(X_AXIS, vector1._y * FACTOR);
 	matrix2.setRotationMatrix(Y_AXIS, -(vector1._z * FACTOR));
-	matrix3 = matrix1.fn4(matrix2);
-	matrix4 = matrix3.fn1();
+	matrix3 = matrix1.compose(matrix2);
+	matrix4 = matrix3.inverseTransform();
 
 	vector1 = v.fn3();
 	matrix1.setRotationMatrix(X_AXIS, vector1._y * FACTOR);
 	matrix2.setRotationMatrix(Y_AXIS, -(vector1._z * FACTOR));
-	matrix3 = matrix1.fn4(matrix2);
+	matrix3 = matrix1.compose(matrix2);
 
-	return matrix4.fn4(matrix3);
+	return matrix4.compose(matrix3);
 }
 
-DMatrix DVector::fn5() const {
+DAffine DVector::fn5() const {
 	const double FACTOR = 180.0 / M_PI;
 	DVector v1 = fn3();
-	DMatrix m1, m2;
+	DAffine m1, m2;
 	m1.setRotationMatrix(X_AXIS, v1._y * FACTOR);
 	m2.setRotationMatrix(Y_AXIS, -(v1._z * FACTOR));
-	return m1.fn4(m2);
+	return m1.compose(m2);
 }
 
 } // End of namespace Titanic
diff --git a/engines/titanic/star_control/dvector.h b/engines/titanic/star_control/dvector.h
index ef54745..94df30e 100644
--- a/engines/titanic/star_control/dvector.h
+++ b/engines/titanic/star_control/dvector.h
@@ -27,7 +27,7 @@
 
 namespace Titanic {
 
-class DMatrix;
+class DAffine;
 
 /**
  * Double based vector class.
@@ -48,11 +48,11 @@ public:
 	 */
 	double getDistance(const DVector &src);
 
-	DVector fn1(const DMatrix &m);
+	DVector fn1(const DAffine &m);
 	void fn2(double angle);
 	DVector fn3() const;
-	DMatrix fn4(const DVector &v);
-	DMatrix fn5() const;
+	DAffine fn4(const DVector &v);
+	DAffine fn5() const;
 
 	/**
 	 * Returns true if the passed vector equals this one
diff --git a/engines/titanic/star_control/fmatrix.cpp b/engines/titanic/star_control/fmatrix.cpp
index bf5754a..e58797d 100644
--- a/engines/titanic/star_control/fmatrix.cpp
+++ b/engines/titanic/star_control/fmatrix.cpp
@@ -21,7 +21,7 @@
  */
 
 #include "titanic/star_control/fmatrix.h"
-#include "titanic/star_control/dmatrix.h"
+#include "titanic/star_control/DAffine.h"
 
 namespace Titanic {
 
@@ -29,7 +29,7 @@ FMatrix::FMatrix() :
 	_row1(1.0, 0.0, 0.0), _row2(0.0, 1.0, 0.0), _row3(0.0, 0.0, 1.0) {
 }
 
-FMatrix::FMatrix(const DMatrix &src) {
+FMatrix::FMatrix(const DAffine &src) {
 	copyFrom(src);
 }
 
@@ -39,7 +39,7 @@ FMatrix::FMatrix(const FMatrix &src) {
 	_row3 = src._row3;
 }
 
-void FMatrix::copyFrom(const DMatrix &src) {
+void FMatrix::copyFrom(const DAffine &src) {
 	_row1 = src._col1;
 	_row2 = src._col2;
 	_row3 = src._col3;
diff --git a/engines/titanic/star_control/fmatrix.h b/engines/titanic/star_control/fmatrix.h
index 34f39cf..95bb91c 100644
--- a/engines/titanic/star_control/fmatrix.h
+++ b/engines/titanic/star_control/fmatrix.h
@@ -28,26 +28,26 @@
 
 namespace Titanic {
 
-class DMatrix;
+class DAffine;
 class DVector;
 
 /**
  * Floating point matrix class.
- * @remarks		TODO: See if it can be merged with DMatrix
+ * @remarks		TODO: See if it can be merged with DAffine
  */
 class FMatrix {
 private:
 	/**
 	 * Copys data from a given source
 	 */
-	void copyFrom(const DMatrix &src);
+	void copyFrom(const DAffine &src);
 public:
 	FVector _row1;
 	FVector _row2;
 	FVector _row3;
 public:
 	FMatrix();
-	FMatrix(const DMatrix &src);
+	FMatrix(const DAffine &src);
 	FMatrix(const FMatrix &src);
 
 	/**
diff --git a/engines/titanic/star_control/matrix_transform.cpp b/engines/titanic/star_control/matrix_transform.cpp
index 20cadd5..226dffa 100644
--- a/engines/titanic/star_control/matrix_transform.cpp
+++ b/engines/titanic/star_control/matrix_transform.cpp
@@ -54,7 +54,7 @@ CMatrixTransform CMatrixTransform::resize(double factor) const {
 	return dest;
 }
 
-void CMatrixTransform::fn4(const DMatrix &m) {
+void CMatrixTransform::fn4(const DAffine &m) {
 	double total = m._col1._x + m._col3._z + m._col2._y + 1.0;
 
 	if (total <= 0.00001) {
diff --git a/engines/titanic/star_control/matrix_transform.h b/engines/titanic/star_control/matrix_transform.h
index fb7bfd3..9c5ba38 100644
--- a/engines/titanic/star_control/matrix_transform.h
+++ b/engines/titanic/star_control/matrix_transform.h
@@ -23,7 +23,7 @@
 #ifndef TITANIC_MATRIX_TRANSFORM_H
 #define TITANIC_MATRIX_TRANSFORM_H
 
-#include "titanic/star_control/dmatrix.h"
+#include "titanic/star_control/DAffine.h"
 
 namespace Titanic {
 
@@ -48,7 +48,7 @@ public:
 	void copyFrom(const CMatrixTransform &src);
 
 	double fn1() const;
-	void fn4(const DMatrix &m);
+	void fn4(const DAffine &m);
 	CMatrixTransform fn5(double percent, const CMatrixTransform &src);
 };
 
diff --git a/engines/titanic/star_control/orientation_changer.cpp b/engines/titanic/star_control/orientation_changer.cpp
index 1aff475..14f0100 100644
--- a/engines/titanic/star_control/orientation_changer.cpp
+++ b/engines/titanic/star_control/orientation_changer.cpp
@@ -21,7 +21,7 @@
  */
 
 #include "titanic/star_control/orientation_changer.h"
-#include "titanic/star_control/dmatrix.h"
+#include "titanic/star_control/DAffine.h"
 
 namespace Titanic {
 
@@ -41,7 +41,7 @@ FMatrix COrientationChanger::getOrientation(double percent) {
 	} else {
 		CMatrixTransform tfm = _sub1.fn5(percent, _sub2);
 
-		DMatrix m1;
+		DAffine m1;
 		m1.loadTransform(tfm);
 		return m1;
 	}
diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp
index d3487e2..dc8e684 100644
--- a/engines/titanic/star_control/star_camera.cpp
+++ b/engines/titanic/star_control/star_camera.cpp
@@ -23,7 +23,7 @@
 #include "titanic/star_control/star_camera.h"
 #include "titanic/star_control/unmarked_camera_mover.h"
 #include "titanic/star_control/marked_camera_mover.h"
-#include "titanic/star_control/dmatrix.h"
+#include "titanic/star_control/DAffine.h"
 #include "titanic/star_control/fmatrix.h"
 #include "titanic/titanic.h"
 
@@ -278,21 +278,21 @@ void CStarCamera::setViewportAngle(const FPoint &angles) {
 	} else if (_matrixRow == 1) {
 		// 2 markers locked in
 		FVector tempV2;
-		DMatrix m1, m2, sub;
+		DAffine m1, m2, sub;
 		DVector mrow1, mrow2, mrow3;
 		DVector tempV1, diffV, multV, multV2, tempV3, tempV4, tempV5, tempV6, tempV7;
 		DVector tempV8, tempV9, tempV10, tempV11, tempV12;
 		DVector tempV13, tempV14, tempV15, tempV16;
 
-		DMatrix subX(0, _matrix._row1);
-		DMatrix subY(Y_AXIS, angles._y);
+		DAffine subX(0, _matrix._row1);
+		DAffine subY(Y_AXIS, angles._y);
 
 		tempV1 = _matrix._row2 - _matrix._row1;
 		diffV = tempV1;
 		m1 = diffV.fn5();
-		m1 = m1.fn4(subX);
-		subX = m1.fn1();
-		subX = subX.fn4(subY);
+		m1 = m1.compose(subX);
+		subX = m1.inverseTransform();
+		subX = subX.compose(subY);
 
 		FMatrix m3 = _viewport.getOrientation();
 		tempV2 = _viewport._position;
@@ -345,7 +345,7 @@ void CStarCamera::setViewportAngle(const FPoint &angles) {
 	}
 }
 
-bool CStarCamera::addMatrixRow(const FVector v) {
+bool CStarCamera::adDAffineRow(const FVector v) {
 	if (_matrixRow >= 2)
 		return false;
 
@@ -457,14 +457,14 @@ void CStarCamera::lockMarker2(CViewport *viewport, const FVector &v) {
 	if (_matrixRow != 0)
 		return;
 
-	DMatrix m2(X_AXIS, _matrix._row1);
+	DAffine m2(X_AXIS, _matrix._row1);
 	DVector tempV1 = v - _matrix._row1;
-	DMatrix m1 = tempV1.fn5();
-	m1 = m1.fn4(m2);
-	m2 = m1.fn1();
+	DAffine m1 = tempV1.fn5();
+	m1 = m1.compose(m2);
+	m2 = m1.inverseTransform();
 	
 	DVector tempV2 = _viewport._position;
-	DMatrix m4;
+	DAffine m4;
 	m4._col1 = viewport->_position;
 	m4._col2 = DVector(0.0, 0.0, 0.0);
 	m4._col3 = DVector(0.0, 0.0, 0.0);
diff --git a/engines/titanic/star_control/star_camera.h b/engines/titanic/star_control/star_camera.h
index 454dfb8..1f0e12c 100644
--- a/engines/titanic/star_control/star_camera.h
+++ b/engines/titanic/star_control/star_camera.h
@@ -162,7 +162,7 @@ public:
 	 * @remarks		This can't be a pass-by-reference, since adding
 	 * the vector for the star destroys the calling star vector
 	 */
-	virtual bool addMatrixRow(const FVector v);
+	virtual bool adDAffineRow(const FVector v);
 
 	virtual bool removeMatrixRow();
 	virtual void proc36(double *v1, double *v2, double *v3, double *v4);
diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp
index 3a0eeae..f140e86 100644
--- a/engines/titanic/star_control/star_control.cpp
+++ b/engines/titanic/star_control/star_control.cpp
@@ -23,7 +23,7 @@
 #include "titanic/support/screen_manager.h"
 #include "titanic/pet_control/pet_control.h"
 #include "titanic/star_control/star_control.h"
-#include "titanic/star_control/dmatrix.h"
+#include "titanic/star_control/DAffine.h"
 #include "titanic/star_control/error_code.h"
 #include "titanic/star_control/fpose.h"
 #include "titanic/star_control/star_camera.h"
@@ -44,12 +44,12 @@ END_MESSAGE_MAP()
 CStarControl::CStarControl() : _enabled(false), _petControl(nullptr),
 		_starRect(20, 10, 620, 350) {
 	CStarCamera::init();
-	DMatrix::init();
+	DAffine::init();
 }
 
 CStarControl::~CStarControl() {
 	CStarCamera::deinit();
-	DMatrix::deinit();
+	DAffine::deinit();
 }
 
 void CStarControl::save(SimpleFile *file, int indent) {
diff --git a/engines/titanic/star_control/unmarked_camera_mover.cpp b/engines/titanic/star_control/unmarked_camera_mover.cpp
index bafab7b..017e348 100644
--- a/engines/titanic/star_control/unmarked_camera_mover.cpp
+++ b/engines/titanic/star_control/unmarked_camera_mover.cpp
@@ -21,7 +21,7 @@
  */
 
 #include "titanic/star_control/unmarked_camera_mover.h"
-#include "titanic/star_control/dmatrix.h"
+#include "titanic/star_control/DAffine.h"
 #include "titanic/star_control/dvector.h"
 #include "titanic/titanic.h"
 #include "common/textconsole.h"
@@ -47,8 +47,8 @@ void CUnmarkedCameraMover::proc10(const FVector &v1, const FVector &v2, const FV
 
 	DVector vector1 = v1;
 	DVector vector2 = v2;
-	DMatrix matrix1 = vector2.fn4(vector1);
-	DMatrix matrix2 = matrix1.fn4(m);
+	DAffine matrix1 = vector2.fn4(vector1);
+	DAffine matrix2 = matrix1.compose(m);
 
 	_autoMover.proc3(m, matrix2);
 	incLockCount();





More information about the Scummvm-git-logs mailing list