Skip to content

Commit

Permalink
TITANIC: Beginnings of CBaseStar draw support methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Mar 1, 2017
1 parent 7898c90 commit ace2fa7
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 8 deletions.
34 changes: 32 additions & 2 deletions engines/titanic/star_control/base_star.cpp
Expand Up @@ -46,7 +46,8 @@ void CBaseStarEntry::load(Common::SeekableReadStream &s) {

/*------------------------------------------------------------------------*/

CBaseStar::CBaseStar() : _minVal(0.0), _maxVal(1.0), _range(0.0) {
CBaseStar::CBaseStar() : _minVal(0.0), _maxVal(1.0), _range(0.0),
_value1(0.0), _value2(0.0), _value3(0.0), _value4(0.0) {
}

void CBaseStar::clear() {
Expand Down Expand Up @@ -148,7 +149,36 @@ void CBaseStar::draw(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStarC
}

void CBaseStar::draw1(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStarControlSub5 *sub5) {
// TODO
CStarControlSub6 sub6 = sub12->proc23();
sub12->proc36(&_value1, &_value2, &_value3, &_value4);

FPoint centroid = surfaceArea->_centroid - FPoint(0.5, 0.5);
double v70 = sub12->proc25();
double minVal = v70 - 9216.0;
//int width1 = surfaceArea->_width - 1;
//int height1 = surfaceArea->_height - 1;
FVector vector;
double v4;

for (uint idx = 0; idx < _data.size(); ++idx) {
CBaseStarEntry &entry = _data[idx];
vector._x = entry._val._v1;
vector._y = entry._val._v2;
vector._z = entry._val._v3;
v4 = vector._x * sub6._matrix._row1._z + vector._y * sub6._matrix._row2._z
+ vector._z * sub6._matrix._row3._z + sub6._field2C;
if (v4 <= minVal)
continue;


// TODO Lots of stuff
double v17 = 0.0, v98 = 0.0;
if (v17 >= 1.0e12) {
// TODO
} else {
sub5->proc2(&sub6, &vector, centroid._x, centroid._y, v98, surfaceArea, sub12);
}
}
}

void CBaseStar::draw2(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStarControlSub5 *sub5) {
Expand Down
2 changes: 2 additions & 0 deletions engines/titanic/star_control/base_star.h
Expand Up @@ -57,6 +57,8 @@ class CBaseStar {
double _minVal;
double _maxVal;
double _range;
double _value1, _value2;
double _value3, _value4;
protected:
/**
* Get a pointer to a data entry
Expand Down
2 changes: 2 additions & 0 deletions engines/titanic/star_control/fpoint.h
Expand Up @@ -37,6 +37,8 @@ class FPoint {

bool operator==(const FPoint &p) const { return _x == p._x && _y == p._y; }
bool operator!=(const FPoint &p) const { return _x != p._x || _y != p._y; }
FPoint operator+(const FPoint &delta) const { return FPoint(_x + delta._x, _y + delta._y); }
FPoint operator-(const FPoint &delta) const { return FPoint(_x - delta._x, _y - delta._y); }

void operator+=(const FPoint &delta) {
_x += delta._x;
Expand Down
4 changes: 3 additions & 1 deletion engines/titanic/star_control/star_control_sub5.cpp
Expand Up @@ -21,6 +21,7 @@
*/

#include "titanic/star_control/star_control_sub5.h"
#include "titanic/star_control/star_control_sub12.h"

namespace Titanic {

Expand All @@ -33,7 +34,8 @@ bool CStarControlSub5::setup() {
return true;
}

void CStarControlSub5::proc2() {
void CStarControlSub5::proc2(CStarControlSub6 *sub6, FVector *vector, double v1, double v2, double v3,
CSurfaceArea *surfaceArea, CStarControlSub12 *sub12) {
// TODO
}

Expand Down
6 changes: 5 additions & 1 deletion engines/titanic/star_control/star_control_sub5.h
Expand Up @@ -25,9 +25,12 @@

#include "titanic/star_control/star_control_sub6.h"
#include "titanic/star_control/error_code.h"
#include "titanic/star_control/surface_area.h"

namespace Titanic {

class CStarControlSub12;

class CStarControlSub5 {
struct SubEntry {
int _field0;
Expand All @@ -49,7 +52,8 @@ class CStarControlSub5 {
virtual ~CStarControlSub5() {}

virtual bool setup();
virtual void proc2();
virtual void proc2(CStarControlSub6 *sub6, FVector *vector, double v1, double v2, double v3,
CSurfaceArea *surfaceArea, CStarControlSub12 *sub12);
virtual void proc3(CErrorCode *errorCode);

int get4() const { return _field4; }
Expand Down
7 changes: 3 additions & 4 deletions engines/titanic/star_control/star_control_sub6.h
Expand Up @@ -28,17 +28,16 @@
namespace Titanic {

class CStarControlSub6 {
private:
int _field24;
int _field28;
int _field2C;
private:
static CStarControlSub6 *_static;
public:
static void init();
static void deinit();
public:
FMatrix _matrix;
int _field24;
int _field28;
int _field2C;
public:
CStarControlSub6();
CStarControlSub6(int mode, double amount);
Expand Down

0 comments on commit ace2fa7

Please sign in to comment.