TITANIC: In-progress loading of second starfield points array

This commit is contained in:
Paul Gilbert 2016-07-03 11:28:49 -04:00
parent 82c0be2bc5
commit 4840e3e86b
5 changed files with 56 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -44,6 +44,7 @@ void CStarControlSub1::load(SimpleFile *file, int param) {
bool CStarControlSub1::initDocument() {
warning("CStarControlSub1::initDocument");
_starArray.initialize();
_sub9.initialize();
return true;
}

View File

@ -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

View File

@ -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