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

dreammaster dreammaster at scummvm.org
Thu Mar 16 01:34:20 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:
a75e386339 TITANIC: Change some constants to more sensible ones


Commit: a75e3863399a13db1fd518c6fca524d2bace4670
    https://github.com/scummvm/scummvm/commit/a75e3863399a13db1fd518c6fca524d2bace4670
Author: Michael DrĂ¼ing (michael at drueing.de)
Date: 2017-03-15T20:33:44-04:00

Commit Message:
TITANIC: Change some constants to more sensible ones

Changed paths:
    engines/titanic/star_control/star_control_sub13.cpp
    engines/titanic/star_control/star_control_sub5.cpp
    engines/titanic/star_control/star_control_sub6.cpp
    engines/titanic/star_control/star_points1.cpp
    engines/titanic/star_control/star_points2.cpp


diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/star_control_sub13.cpp
index e82ad3a..72badde 100644
--- a/engines/titanic/star_control/star_control_sub13.cpp
+++ b/engines/titanic/star_control/star_control_sub13.cpp
@@ -257,7 +257,7 @@ void CStarControlSub13::fn19(double *v1, double *v2, double *v3, double *v4) {
 }
 
 void CStarControlSub13::reset() {
-	const double FACTOR = 3.1415927 * 0.0055555557;
+	const double FACTOR = 2 * M_PI / 360.0;
 
 	_sub2.copyFrom(_matrix);
 	_sub2._vector._x = _position._x;
diff --git a/engines/titanic/star_control/star_control_sub5.cpp b/engines/titanic/star_control/star_control_sub5.cpp
index 4ca22ff..775c24c 100644
--- a/engines/titanic/star_control/star_control_sub5.cpp
+++ b/engines/titanic/star_control/star_control_sub5.cpp
@@ -37,7 +37,7 @@ bool CStarControlSub5::SineTable::setup() {
 	if (_data.empty()) {
 		_data.resize(1024);
 		for (int idx = 0; idx < 1024; ++idx)
-			_data[idx] = sin((double)idx * 6.283185307179586 * 0.001953125);
+			_data[idx] = sin((double)idx * 2 * M_PI / 512.0);
 	}
 
 	return true;
@@ -63,7 +63,7 @@ bool CStarControlSub5::setup() {
 bool CStarControlSub5::setup2(int val1, int val2) {
 	// TODO: Original set an explicit random seed here. Could be
 	// problematic if following random values need to be deterministic
-	const double FACTOR = 3.1415927 * 0.0055555557;
+	const double FACTOR = 2 * M_PI / 360.0;
 	const int VALUES1[] = { 0x800, 0xC00, 0x1000, 0x1400, 0x1800 };
 	const int VALUES2[] = {
 		0xF95BCD, 0xA505A0, 0xFFAD43, 0x98F4EB, 0xF3EFA5, 0,
@@ -162,7 +162,7 @@ bool CStarControlSub5::setup2(int val1, int val2) {
 			e->_field8 = g_vm->getRandomNumber(3) + 3;
 			e->_fieldC = g_vm->getRandomNumber(255);
 			e->_field10 = FACTOR * 17.0;
-			e->_field14 = 0.00390625;
+			e->_field14 = 1 / 256.0;
 		} else {
 			for (int ctr = 0; ctr < 5; ++ctr) {
 				e->_field0 = static_cast<int>(g_vm->getRandomFloat() * 1350.0
@@ -176,7 +176,7 @@ bool CStarControlSub5::setup2(int val1, int val2) {
 				e->_fieldC = g_vm->getRandomNumber(255);
 				e->_field10 = FACTOR * (double)g_vm->getRandomNumber(15);
 				e->_field14 = ((double)g_vm->getRandomNumber(0xfffffffe)
-					* 50.0 * 0.000015259022) * 0.00390625;
+					* 50.0 / 65536.0) / 256.0;
 			}
 		}
 	}
diff --git a/engines/titanic/star_control/star_control_sub6.cpp b/engines/titanic/star_control/star_control_sub6.cpp
index e45d6d2..a93f128 100644
--- a/engines/titanic/star_control/star_control_sub6.cpp
+++ b/engines/titanic/star_control/star_control_sub6.cpp
@@ -53,7 +53,7 @@ void CStarControlSub6::identity() {
 }
 
 void CStarControlSub6::setRotationMatrix(Axis axis, double amount) {
-	const double ROTATION = 3.1415927 * 0.0055555557;
+	const double ROTATION = 2 * M_PI / 360.0;
 	double sinVal = sin(amount * ROTATION);
 	double cosVal = cos(amount * ROTATION);
 
diff --git a/engines/titanic/star_control/star_points1.cpp b/engines/titanic/star_control/star_points1.cpp
index c72795f..ab5da11 100644
--- a/engines/titanic/star_control/star_points1.cpp
+++ b/engines/titanic/star_control/star_points1.cpp
@@ -27,7 +27,7 @@
 namespace Titanic {
 
 #define ARRAY_COUNT 876
-const double FACTOR = 3.1415927 * 0.0055555557;
+const double FACTOR = 2 * M_PI / 360.0;
 
 CStarPoints1::CStarPoints1() {
 }
diff --git a/engines/titanic/star_control/star_points2.cpp b/engines/titanic/star_control/star_points2.cpp
index 9c4cfe8..7a3e873 100644
--- a/engines/titanic/star_control/star_points2.cpp
+++ b/engines/titanic/star_control/star_points2.cpp
@@ -27,7 +27,7 @@
 namespace Titanic {
 
 #define ARRAY_COUNT 80
-const double FACTOR = 3.1415927 * 0.0055555557;
+const double FACTOR = 2 * M_PI / 360.0;
 
 bool CStarPoints2::initialize() {
 	// Get a reference to the starfield points resource
@@ -47,7 +47,7 @@ bool CStarPoints2::initialize() {
 			v1 = stream->readSint32LE();
 			v2 = stream->readSint32LE();
 			v1 *= 0.015 * FACTOR;
-			v2 *= 0.0099999998 * FACTOR;
+			v2 *= FACTOR / 100.0;
 
 			entry._x = cos(v1) * 3000000.0 * cos(v2);
 			entry._y = sin(v1) * 3000000.0 * cos(v2);





More information about the Scummvm-git-logs mailing list