diff options
-rw-r--r-- | engines/titanic/star_control/star_array.cpp | 5 | ||||
-rw-r--r-- | engines/titanic/star_control/star_array.h | 8 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub1.cpp | 1 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub9.cpp | 25 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub9.h | 22 |
5 files changed, 56 insertions, 5 deletions
diff --git a/engines/titanic/star_control/star_array.cpp b/engines/titanic/star_control/star_array.cpp index 1af608db51..f25d8376e7 100644 --- a/engines/titanic/star_control/star_array.cpp +++ b/engines/titanic/star_control/star_array.cpp @@ -21,6 +21,7 @@ */ #include "titanic/star_control/star_array.h" +#include "titanic/star_control/star_control_sub12.h" #include "titanic/titanic.h" namespace Titanic { @@ -47,4 +48,8 @@ void CStarArray::initialize() { } } +void CStarArray::draw(CSurfaceArea *surface, CStarControlSub12 *img) { + // TODO +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_array.h b/engines/titanic/star_control/star_array.h index 859db60ed1..827af01739 100644 --- a/engines/titanic/star_control/star_array.h +++ b/engines/titanic/star_control/star_array.h @@ -24,9 +24,12 @@ #define TITANIC_STAR_ARRAY_H #include "common/array.h" +#include "titanic/star_control/surface_area.h" namespace Titanic { +class CStarControlSub12; + class CStarArray { struct CStarArrayEntry { double _v1; @@ -42,6 +45,11 @@ public: * Initialize the array */ void initialize(); + + /** + * Draw the starfield points + */ + void draw(CSurfaceArea *surface, CStarControlSub12 *img); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub1.cpp b/engines/titanic/star_control/star_control_sub1.cpp index 5edbab1e86..75dc2303f1 100644 --- a/engines/titanic/star_control/star_control_sub1.cpp +++ b/engines/titanic/star_control/star_control_sub1.cpp @@ -44,6 +44,7 @@ void CStarControlSub1::load(SimpleFile *file, int param) { bool CStarControlSub1::initDocument() { warning("CStarControlSub1::initDocument"); _starArray.initialize(); + _sub9.initialize(); return true; } diff --git a/engines/titanic/star_control/star_control_sub9.cpp b/engines/titanic/star_control/star_control_sub9.cpp index 92ce8f6a85..be06e46f45 100644 --- a/engines/titanic/star_control/star_control_sub9.cpp +++ b/engines/titanic/star_control/star_control_sub9.cpp @@ -21,8 +21,33 @@ */ #include "titanic/star_control/star_control_sub9.h" +#include "titanic/titanic.h" namespace Titanic { +#define ARRAY_COUNT 80 + +void CStarControlSub9::initialize() { + // Get a reference to the starfield points resource + Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS2"); + + _data.resize(ARRAY_COUNT); + for (int rootCtr = 0; rootCtr < ARRAY_COUNT; ++rootCtr) { + // Get the number of sub-entries for this entry + int count = stream->readUint32LE(); + + // Read in the sub-entries + RootEntry &rootEntry = _data[rootCtr]; + rootEntry.resize(count); + for (int idx = 0; idx < count; ++idx) { + int v1 = stream->readSint32LE(); + int v2 = stream->readSint32LE(); + int v3 = stream->readSint32LE(); + int v4 = stream->readSint32LE(); + + // TODO: Processing here + } + } +} } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub9.h b/engines/titanic/star_control/star_control_sub9.h index 67a14a5109..ad05a4a478 100644 --- a/engines/titanic/star_control/star_control_sub9.h +++ b/engines/titanic/star_control/star_control_sub9.h @@ -23,18 +23,30 @@ #ifndef TITANIC_STAR_CONTROL_SUB9_H #define TITANIC_STAR_CONTROL_SUB9_H +#include "common/array.h" + namespace Titanic { class CStarControlSub9 { - struct ArrayEntry { + struct DataEntry { + int _v1; + int _v2; + int _v3; + int _v4; + }; + + class RootEntry : public Common::Array<DataEntry> { + public: int _field0; - int _field4; - int _field8; - ArrayEntry() : _field0(0), _field4(0), _field8(0) {} + RootEntry() : _field0(0) {} }; private: - ArrayEntry _array[80]; + Common::Array<RootEntry> _data; public: + /** + * Initializes the data + */ + void initialize(); }; } // End of namespace Titanic |