[Scummvm-git-logs] scummvm master -> a5e00ad98796c5a7d2f8ddaca817e0ec3a444290

dreammaster dreammaster at scummvm.org
Mon Mar 13 01:19:00 CET 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:
a5e00ad987 TITANIC: More matrix renamings


Commit: a5e00ad98796c5a7d2f8ddaca817e0ec3a444290
    https://github.com/scummvm/scummvm/commit/a5e00ad98796c5a7d2f8ddaca817e0ec3a444290
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-03-12T20:18:53-04:00

Commit Message:
TITANIC: More matrix renamings

Changed paths:
    engines/titanic/star_control/dmatrix.cpp
    engines/titanic/star_control/dmatrix.h
    engines/titanic/star_control/fvector.h
    engines/titanic/star_control/star_control_sub13.cpp
    engines/titanic/star_control/star_control_sub6.cpp
    engines/titanic/star_control/star_control_sub6.h
    engines/titanic/star_control/star_view.cpp


diff --git a/engines/titanic/star_control/dmatrix.cpp b/engines/titanic/star_control/dmatrix.cpp
index 9fc7a85..1405f4f 100644
--- a/engines/titanic/star_control/dmatrix.cpp
+++ b/engines/titanic/star_control/dmatrix.cpp
@@ -46,7 +46,7 @@ DMatrix::DMatrix(int mode, const FMatrix *src) {
 	_frow2._z = src->_row2._z;
 }
 
-DMatrix::DMatrix(DAxis axis, double amount) {
+DMatrix::DMatrix(Axis axis, double amount) {
 	setRotationMatrix(axis, amount);
 }
 
@@ -65,7 +65,7 @@ void DMatrix::deinit() {
 	_static = nullptr;
 }
 
-void DMatrix::setRotationMatrix(DAxis axis, double amount) {
+void DMatrix::setRotationMatrix(Axis axis, double amount) {
 	const double FACTOR = 0.0174532925199433;
 	double sinVal = sin(amount * FACTOR);
 	double cosVal = cos(amount * FACTOR);
diff --git a/engines/titanic/star_control/dmatrix.h b/engines/titanic/star_control/dmatrix.h
index 7d1f0e0..a015ebd 100644
--- a/engines/titanic/star_control/dmatrix.h
+++ b/engines/titanic/star_control/dmatrix.h
@@ -28,8 +28,6 @@
 
 namespace Titanic {
 
-enum DAxis { X_AXIS, Y_AXIS, Z_AXIS };
-
 class FMatrix;
 class CStarControlSub26;
 
@@ -52,13 +50,13 @@ public:
 public:
 	DMatrix();
 	DMatrix(int mode, const FMatrix *src);
-	DMatrix(DAxis axis, double amount);
+	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(DAxis axis, double amount);
+	void setRotationMatrix(Axis axis, double amount);
 
 	void fn1(DMatrix &m);
 	void fn3(CStarControlSub26 *sub26);
diff --git a/engines/titanic/star_control/fvector.h b/engines/titanic/star_control/fvector.h
index 83f0039..bf446fc 100644
--- a/engines/titanic/star_control/fvector.h
+++ b/engines/titanic/star_control/fvector.h
@@ -27,6 +27,8 @@
 
 namespace Titanic {
 
+enum Axis { X_AXIS, Y_AXIS, Z_AXIS };
+
 class CStarControlSub6;
 
 /**
diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/star_control_sub13.cpp
index cd7f0bb..1cd5538 100644
--- a/engines/titanic/star_control/star_control_sub13.cpp
+++ b/engines/titanic/star_control/star_control_sub13.cpp
@@ -158,9 +158,9 @@ void CStarControlSub13::set1C(double v) {
 void CStarControlSub13::fn12() {
 	_matrix.identity();
 
-	CStarControlSub6 m1(0, g_vm->getRandomNumber(359));
-	CStarControlSub6 m2(1, g_vm->getRandomNumber(359));
-	CStarControlSub6 m3(2, g_vm->getRandomNumber(359));
+	CStarControlSub6 m1(X_AXIS, g_vm->getRandomNumber(359));
+	CStarControlSub6 m2(Y_AXIS, g_vm->getRandomNumber(359));
+	CStarControlSub6 m3(Z_AXIS, g_vm->getRandomNumber(359));
 	
 	CStarControlSub6 s1, s2;
 	CStarControlSub6 *s;
diff --git a/engines/titanic/star_control/star_control_sub6.cpp b/engines/titanic/star_control/star_control_sub6.cpp
index f0ec68e..e45d6d2 100644
--- a/engines/titanic/star_control/star_control_sub6.cpp
+++ b/engines/titanic/star_control/star_control_sub6.cpp
@@ -30,8 +30,8 @@ CStarControlSub6::CStarControlSub6() {
 	clear();
 }
 
-CStarControlSub6::CStarControlSub6(int mode, double val) {
-	set(mode, val);
+CStarControlSub6::CStarControlSub6(Axis axis, double amount) {
+	setRotationMatrix(axis, amount);
 }
 
 CStarControlSub6::CStarControlSub6(const CStarControlSub6 *src) {
@@ -52,13 +52,13 @@ void CStarControlSub6::identity() {
 	_vector.clear();
 }
 
-void CStarControlSub6::set(int mode, double amount) {
+void CStarControlSub6::setRotationMatrix(Axis axis, double amount) {
 	const double ROTATION = 3.1415927 * 0.0055555557;
 	double sinVal = sin(amount * ROTATION);
 	double cosVal = cos(amount * ROTATION);
 
-	switch (mode) {
-	case 0:
+	switch (axis) {
+	case X_AXIS:
 		_row1._x = 1.0;
 		_row1._y = 0.0;
 		_row1._z = 0.0;
@@ -70,7 +70,7 @@ void CStarControlSub6::set(int mode, double amount) {
 		_row3._z = cosVal;
 		break;
 
-	case 1:
+	case Y_AXIS:
 		_row1._x = cosVal;
 		_row1._y = 0.0;
 		_row1._z = sinVal;
@@ -82,7 +82,7 @@ void CStarControlSub6::set(int mode, double amount) {
 		_row3._z = sinVal;
 		break;
 
-	case 2:
+	case Z_AXIS:
 		_row1._x = cosVal;
 		_row1._y = sinVal;
 		_row1._z = 0.0;
diff --git a/engines/titanic/star_control/star_control_sub6.h b/engines/titanic/star_control/star_control_sub6.h
index d638680..27b9162 100644
--- a/engines/titanic/star_control/star_control_sub6.h
+++ b/engines/titanic/star_control/star_control_sub6.h
@@ -37,7 +37,7 @@ public:
 	FVector _vector;
 public:
 	CStarControlSub6();
-	CStarControlSub6(int mode, double amount);
+	CStarControlSub6(Axis axis, double amount);
 	CStarControlSub6(const CStarControlSub6 *src);
 
 	/**
@@ -51,9 +51,9 @@ public:
 	static CStarControlSub6 *setup(CStarControlSub6 *dest, const CStarControlSub6 *s2, const CStarControlSub6 *s3);
 
 	/**
-	 * Sets the default data
+	 * Sets a rotation matrix for the given axis for the given amount
 	 */
-	void set(int mode, double val);
+	void setRotationMatrix(Axis axis, double val);
 
 	void copyFrom(const CStarControlSub6 *src);
 
diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp
index 540d2c7..34fd371 100644
--- a/engines/titanic/star_control/star_view.cpp
+++ b/engines/titanic/star_control/star_view.cpp
@@ -177,7 +177,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
 	case Common::KEYCODE_z:
 	case Common::KEYCODE_c:
 		if (v == -1) {
-			sub6.set(key == Common::KEYCODE_z ? MODE_PHOTO : MODE_STARFIELD, 1.0);
+			sub6.setRotationMatrix(key == Common::KEYCODE_z ? Y_AXIS : X_AXIS, 1.0);
 			_sub12.proc22(sub6);
 			_sub12.proc15(errorCode);
 			return true;
@@ -210,7 +210,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
 
 	case Common::KEYCODE_x:
 		if (v == -1) {
-			sub6.set(MODE_PHOTO, -1.0);
+			sub6.setRotationMatrix(Y_AXIS, -1.0);
 			_sub12.proc22(sub6);
 			_sub12.proc15(errorCode);
 			return true;
@@ -219,7 +219,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
 
 	case Common::KEYCODE_QUOTE:
 		if (v == -1) {
-			sub6.set(MODE_STARFIELD, -1.0);
+			sub6.setRotationMatrix(X_AXIS, -1.0);
 			_sub12.proc22(sub6);
 			_sub12.proc15(errorCode);
 			return true;





More information about the Scummvm-git-logs mailing list