diff options
-rw-r--r-- | engines/titanic/star_control/star_array.cpp | 7 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub9.cpp | 23 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub9.h | 1 |
3 files changed, 15 insertions, 16 deletions
diff --git a/engines/titanic/star_control/star_array.cpp b/engines/titanic/star_control/star_array.cpp index d2a5fe1a84..2e4a928aa2 100644 --- a/engines/titanic/star_control/star_array.cpp +++ b/engines/titanic/star_control/star_array.cpp @@ -27,6 +27,7 @@ namespace Titanic { #define ARRAY_COUNT 876 +const double FACTOR = 3.1415927 * 0.0055555557; CStarArray::CStarArray() { } @@ -36,8 +37,6 @@ void CStarArray::initialize() { Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS"); assert(stream && stream->size() == (12 * ARRAY_COUNT)); - double factor = 3.1415927 * 0.0055555557; - _data.resize(ARRAY_COUNT); for (int idx = 0; idx < ARRAY_COUNT; ++idx) { CStarArrayEntry &entry = _data[idx]; @@ -47,8 +46,8 @@ void CStarArray::initialize() { double v2 = stream->readUint32LE(); stream->readUint32LE(); - v1 *= 0.0099999998 * factor; - v2 *= 0.015 * factor; + v1 *= 0.0099999998 * FACTOR; + v2 *= 0.015 * FACTOR; entry._v1 = cos(v2) * 3000000.0 * cos(v1); entry._v2 = sin(v2) * 3000000.0 * cos(v1); diff --git a/engines/titanic/star_control/star_control_sub9.cpp b/engines/titanic/star_control/star_control_sub9.cpp index fda2f5b5bf..e19977c4a4 100644 --- a/engines/titanic/star_control/star_control_sub9.cpp +++ b/engines/titanic/star_control/star_control_sub9.cpp @@ -26,6 +26,7 @@ namespace Titanic { #define ARRAY_COUNT 80 +const double FACTOR = 3.1415927 * 0.0055555557; void CStarControlSub9::initialize() { // Get a reference to the starfield points resource @@ -35,20 +36,20 @@ void CStarControlSub9::initialize() { for (int rootCtr = 0; rootCtr < ARRAY_COUNT; ++rootCtr) { // Get the number of sub-entries for this entry int count = stream->readUint32LE(); + double v1, v2; // Read in the sub-entries RootEntry &rootEntry = _data[rootCtr]; - rootEntry.resize(count); - for (int idx = 0; idx < count; ++idx) { - DataEntry &entry = rootEntry[idx]; - int v1 = stream->readSint32LE(); - int v2 = stream->readSint32LE(); - int v3 = stream->readSint32LE(); - int v4 = stream->readSint32LE(); - - warning("TODO: %d %d %d %d", v1, v2, v3, v4); - entry._v1 = 0; - // TODO: Processing here + rootEntry.resize(count * 2); + for (int idx = 0; idx < count * 2; ++idx) { + DataEntry &entry = rootEntry[idx * 2]; + v1 = stream->readSint32LE(); + v2 = stream->readSint32LE(); + v1 *= 0.015 * FACTOR; + v2 *= 0.0099999998 * FACTOR; + entry._v1 = cos(v1) * 3000000.0 * cos(v2); + entry._v2 = sin(v1) * 3000000.0 * cos(v2); + entry._v3 = sin(v2) * 3000000.0; } } } diff --git a/engines/titanic/star_control/star_control_sub9.h b/engines/titanic/star_control/star_control_sub9.h index ad05a4a478..5f334f48d1 100644 --- a/engines/titanic/star_control/star_control_sub9.h +++ b/engines/titanic/star_control/star_control_sub9.h @@ -32,7 +32,6 @@ class CStarControlSub9 { int _v1; int _v2; int _v3; - int _v4; }; class RootEntry : public Common::Array<DataEntry> { |