aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/star_control
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/star_control')
-rw-r--r--engines/titanic/star_control/base_star.cpp34
-rw-r--r--engines/titanic/star_control/base_star.h2
-rw-r--r--engines/titanic/star_control/fpoint.h2
-rw-r--r--engines/titanic/star_control/star_control_sub5.cpp4
-rw-r--r--engines/titanic/star_control/star_control_sub5.h6
-rw-r--r--engines/titanic/star_control/star_control_sub6.h7
6 files changed, 47 insertions, 8 deletions
diff --git a/engines/titanic/star_control/base_star.cpp b/engines/titanic/star_control/base_star.cpp
index 24d3e02b78..218176af9f 100644
--- a/engines/titanic/star_control/base_star.cpp
+++ b/engines/titanic/star_control/base_star.cpp
@@ -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() {
@@ -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) {
diff --git a/engines/titanic/star_control/base_star.h b/engines/titanic/star_control/base_star.h
index 2c1c389e37..f3e16f154e 100644
--- a/engines/titanic/star_control/base_star.h
+++ b/engines/titanic/star_control/base_star.h
@@ -57,6 +57,8 @@ protected:
double _minVal;
double _maxVal;
double _range;
+ double _value1, _value2;
+ double _value3, _value4;
protected:
/**
* Get a pointer to a data entry
diff --git a/engines/titanic/star_control/fpoint.h b/engines/titanic/star_control/fpoint.h
index 33181d937b..9ce58c08af 100644
--- a/engines/titanic/star_control/fpoint.h
+++ b/engines/titanic/star_control/fpoint.h
@@ -37,6 +37,8 @@ public:
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;
diff --git a/engines/titanic/star_control/star_control_sub5.cpp b/engines/titanic/star_control/star_control_sub5.cpp
index 0503806e65..16aff46096 100644
--- a/engines/titanic/star_control/star_control_sub5.cpp
+++ b/engines/titanic/star_control/star_control_sub5.cpp
@@ -21,6 +21,7 @@
*/
#include "titanic/star_control/star_control_sub5.h"
+#include "titanic/star_control/star_control_sub12.h"
namespace Titanic {
@@ -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
}
diff --git a/engines/titanic/star_control/star_control_sub5.h b/engines/titanic/star_control/star_control_sub5.h
index d90408e090..4e1a5be5d3 100644
--- a/engines/titanic/star_control/star_control_sub5.h
+++ b/engines/titanic/star_control/star_control_sub5.h
@@ -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;
@@ -49,7 +52,8 @@ public:
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; }
diff --git a/engines/titanic/star_control/star_control_sub6.h b/engines/titanic/star_control/star_control_sub6.h
index 118c7c7f10..761cc1625f 100644
--- a/engines/titanic/star_control/star_control_sub6.h
+++ b/engines/titanic/star_control/star_control_sub6.h
@@ -29,16 +29,15 @@ 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);