[Scummvm-git-logs] scummvm master -> 78f69e198c8198075ded9e557bf1e2807a1c49f0

dreammaster dreammaster at scummvm.org
Fri May 26 04:27:32 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:
78f69e198c TITANIC: Fix calculating orientation transition matrixes


Commit: 78f69e198c8198075ded9e557bf1e2807a1c49f0
    https://github.com/scummvm/scummvm/commit/78f69e198c8198075ded9e557bf1e2807a1c49f0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-05-25T22:27:19-04:00

Commit Message:
TITANIC: Fix calculating orientation transition matrixes

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


diff --git a/engines/titanic/star_control/dmatrix.cpp b/engines/titanic/star_control/dmatrix.cpp
index 93268d1..079ce2f 100644
--- a/engines/titanic/star_control/dmatrix.cpp
+++ b/engines/titanic/star_control/dmatrix.cpp
@@ -177,28 +177,25 @@ DMatrix DMatrix::fn1() const {
 void DMatrix::loadTransform(const CMatrixTransform &src) {
 	double total = src.fn1();
 	double factor = (total <= 0.0) ? 0.0 : 2.0 / total;
-	DVector tempV = src._vector * factor;
-
-	double val1 = tempV._x * src._vector._x;
-	double val2 = tempV._y * src._vector._x;
-	double val3 = tempV._y * src._vector._y;
-	double val4 = tempV._x * src._field0;
-	double val5 = tempV._z + val3;
-	double val6 = tempV._z * src._vector._y;
-	double val7 = tempV._z * src._field0;
-	double val8 = val3 + val1;
-	double val9 = tempV._z * src._vector._x;
-	double val10 = tempV._y * src._field0;
-
-	_row1._x = 1.0 - val5;
-	_row1._y = val2 + val7;
-	_row1._z = val9 - val10;
-	_row2._x = val2 - val7;
-	_row2._y = 1.0 - (tempV._z + val1);
-	_row2._z = val6 + val4;
-	_row3._x = val9 + val10;
-	_row3._y = val6 - val4;
-	_row3._z = 1.0 - val8;
+	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;
+
+	_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;
diff --git a/engines/titanic/star_control/dvector.h b/engines/titanic/star_control/dvector.h
index e64933a..d967206 100644
--- a/engines/titanic/star_control/dvector.h
+++ b/engines/titanic/star_control/dvector.h
@@ -91,6 +91,10 @@ public:
 	const DVector operator*(double right) const {
 		return DVector(_x * right, _y * right, _z * right);
 	}
+
+	const DVector operator*(const DVector &right) const {
+		return DVector(_x * right._x, _y * right._y, _z * right._z);
+	}
 };
 
 } // End of namespace Titanic





More information about the Scummvm-git-logs mailing list