aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/star_control/star_control_sub8.cpp15
-rw-r--r--engines/titanic/star_control/star_control_sub8.h4
-rw-r--r--engines/titanic/star_control/star_field.cpp65
-rw-r--r--engines/titanic/star_control/star_field.h9
-rw-r--r--engines/titanic/star_control/star_points2.cpp5
-rw-r--r--engines/titanic/star_control/star_points2.h8
-rw-r--r--engines/titanic/star_control/star_view.cpp31
-rw-r--r--engines/titanic/star_control/star_view.h2
8 files changed, 124 insertions, 15 deletions
diff --git a/engines/titanic/star_control/star_control_sub8.cpp b/engines/titanic/star_control/star_control_sub8.cpp
index f53c6f0a6c..f2b52a984f 100644
--- a/engines/titanic/star_control/star_control_sub8.cpp
+++ b/engines/titanic/star_control/star_control_sub8.cpp
@@ -29,7 +29,7 @@ namespace Titanic {
CStarControlSub8::CStarControlSub8() : _field8(-1) {
#if 0
- _field0(0), _field4(0), _field8(-1), _fieldC(-1)
+ _field4(0), _field8(-1), _fieldC(-1)
#endif
}
@@ -52,4 +52,17 @@ void CStarControlSub8::fn1(CStarField *starField, CSurfaceArea *surfaceArea, CSt
// TODO
}
+void CStarControlSub8::fn2(CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7) {
+ // TODO
+}
+
+void CStarControlSub8::fn3() {
+ if (_field8 < 3)
+ ++_field8;
+}
+
+void CStarControlSub8::draw(CSurfaceArea *surfaceArea) {
+ // TODO
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control_sub8.h b/engines/titanic/star_control/star_control_sub8.h
index 0c0cdcf37c..37944a78ed 100644
--- a/engines/titanic/star_control/star_control_sub8.h
+++ b/engines/titanic/star_control/star_control_sub8.h
@@ -67,7 +67,11 @@ public:
void selectStar(int starNum, CVideoSurface *surface, CStarField *starField,
CStarControlSub7 *sub7);
+ void draw(CSurfaceArea *surfaceArea);
+
void fn1(CStarField *starField, CSurfaceArea *surfaceArea, CStarControlSub12 *sub12);
+ void fn2(CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7);
+ void fn3();
};
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp
index 24b30bfc9b..43748ea0f8 100644
--- a/engines/titanic/star_control/star_field.cpp
+++ b/engines/titanic/star_control/star_field.cpp
@@ -25,15 +25,15 @@
namespace Titanic {
-CStarField::CStarField() : _val1(0), _val2(0), _mode(MODE_STARFIELD),
+CStarField::CStarField() : _points1On(false), _points2On(false), _mode(MODE_STARFIELD),
_val4(true), _val5(0), _isSolved(false) {
}
void CStarField::load(SimpleFile *file) {
_sub7.load(file);
_sub8.load(file);
- _val1 = file->readNumber();
- _val2 = file->readNumber();
+ _points1On = file->readNumber();
+ _points2On = file->readNumber();
_mode = (StarMode)file->readNumber();
_val4 = file->readNumber();
_isSolved = file->readNumber();
@@ -42,8 +42,8 @@ void CStarField::load(SimpleFile *file) {
void CStarField::save(SimpleFile *file, int indent) {
_sub7.save(file, indent);
_sub8.save(file, indent);
- file->writeNumberLine(_val1, indent);
- file->writeNumberLine(_val2, indent);
+ file->writeNumberLine(_points1On, indent);
+ file->writeNumberLine(_points2On, indent);
file->writeNumberLine(_mode, indent);
file->writeNumberLine(_val4, indent);
file->writeNumberLine(_isSolved, indent);
@@ -64,25 +64,34 @@ bool CStarField::initDocument() {
void CStarField::render(CVideoSurface *surface, CStarControlSub12 *sub12) {
CSurfaceArea surfaceArea(surface);
draw(&surfaceArea, sub12, &_sub5);
+ if (_val4)
+ fn3(&surfaceArea);
+ _sub7.draw(&surfaceArea, sub12, nullptr);
+ _sub8.draw(&surfaceArea);
- // TODO
+ if (_points2On)
+ _points2.draw(&surfaceArea, sub12);
+ if (_points1On)
+ _points1.draw(&surfaceArea, sub12);
+
+ fn4(&surfaceArea, sub12);
}
int CStarField::get1() const {
- return _val1;
+ return _points1On;
}
void CStarField::set1(int val) {
- _val1 = val;
+ _points1On = val;
}
int CStarField::get2() const {
- return _val2;
+ return _points2On;
}
void CStarField::set2(int val) {
- _val2 = val;
+ _points2On = val;
}
int CStarField::get54() const {
@@ -131,11 +140,47 @@ void CStarField::fn1(CErrorCode *errorCode) {
_sub5.proc3(errorCode);
}
+void CStarField::fn3(CSurfaceArea *surfaceArea) {
+ surfaceArea->_pixel = 0x323232;
+ surfaceArea->setColorFromPixel();
+
+ surfaceArea->fn1(FRect(202.60417, 63.75, 397.39584, 63.75));
+ surfaceArea->fn1(FRect(202.60417, 276.25, 397.39584, 276.25));
+ surfaceArea->fn1(FRect(193.75, 72.604164, 193.75, 267.39584));
+ surfaceArea->fn1(FRect(406.25, 72.604164, 406.25, 267.39584));
+ surfaceArea->fn1(FRect(202.60417, 63.75, 202.60417, 68.177086));
+ surfaceArea->fn1(FRect(397.39584, 63.75, 397.39584, 68.177086));
+ surfaceArea->fn1(FRect(202.60417, 276.25, 202.60417, 271.82291));
+ surfaceArea->fn1(FRect(397.39584, 276.25, 397.39584, 271.82291));
+ surfaceArea->fn1(FRect(193.75, 72.604164, 198.17708, 72.604164));
+ surfaceArea->fn1(FRect(193.75, 267.39584, 198.17708, 267.39584));
+ surfaceArea->fn1(FRect(406.25, 72.604164, 401.82291, 72.604164));
+ surfaceArea->fn1(FRect(406.25, 267.39584, 401.82291, 267.39584));
+ surfaceArea->fn1(FRect(300.0, 63.75, 300.0, 54.895832));
+ surfaceArea->fn1(FRect(300.0, 276.25, 300.0, 285.10416));
+ surfaceArea->fn1(FRect(193.75, 170.0, 184.89583, 170.0));
+ surfaceArea->fn1(FRect(406.25, 170.0, 415.10416, 170.0));
+}
+
+void CStarField::fn4(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12) {
+ // TODO
+}
+
void CStarField::fn6(CVideoSurface *surface, CStarControlSub12 *sub12) {
CSurfaceArea surfaceArea(surface);
}
+void CStarField::fn7() {
+ _sub8.fn3();
+ setSolved();
+}
+
+void CStarField::fn8(CVideoSurface *surface) {
+ _sub8.fn2(surface, this, &_sub7);
+ setSolved();
+}
+
bool CStarField::mouseButtonDown(CVideoSurface *surface, CStarControlSub12 *sub12,
int flags, const Common::Point &pt) {
if (_mode == MODE_STARFIELD) {
diff --git a/engines/titanic/star_control/star_field.h b/engines/titanic/star_control/star_field.h
index 2c7e562304..6787e06613 100644
--- a/engines/titanic/star_control/star_field.h
+++ b/engines/titanic/star_control/star_field.h
@@ -39,12 +39,15 @@ private:
CStarPoints1 _points1;
CStarPoints2 _points2;
CStarControlSub5 _sub5;
- int _val1;
- int _val2;
+ bool _points1On;
+ bool _points2On;
StarMode _mode;
bool _val4;
int _val5;
bool _isSolved;
+private:
+ void fn3(CSurfaceArea *surfaceArea);
+ void fn4(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12);
public:
CStarField();
@@ -103,6 +106,8 @@ public:
void fn1(CErrorCode *errorCode);
void fn6(CVideoSurface *surface, CStarControlSub12 *sub12);
+ void fn7();
+ void fn8(CVideoSurface *surface);
/**
* Called when the starfield is clicked
diff --git a/engines/titanic/star_control/star_points2.cpp b/engines/titanic/star_control/star_points2.cpp
index 287a46eaa7..9c4cfe8cf5 100644
--- a/engines/titanic/star_control/star_points2.cpp
+++ b/engines/titanic/star_control/star_points2.cpp
@@ -21,6 +21,7 @@
*/
#include "titanic/star_control/star_points2.h"
+#include "titanic/star_control/star_control_sub12.h"
#include "titanic/titanic.h"
namespace Titanic {
@@ -57,4 +58,8 @@ bool CStarPoints2::initialize() {
return true;
}
+void CStarPoints2::draw(CSurfaceArea *surface, CStarControlSub12 *sub12) {
+ // TODO
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_points2.h b/engines/titanic/star_control/star_points2.h
index df302f690b..d7192af2f0 100644
--- a/engines/titanic/star_control/star_points2.h
+++ b/engines/titanic/star_control/star_points2.h
@@ -25,9 +25,12 @@
#include "common/array.h"
#include "titanic/star_control/fvector.h"
+#include "titanic/star_control/surface_area.h"
namespace Titanic {
+class CStarControlSub12;
+
class CStarPoints2 {
class RootEntry : public Common::Array<FVector> {
public:
@@ -41,6 +44,11 @@ public:
* Initializes the data
*/
bool initialize();
+
+ /**
+ * Draw the starfield points
+ */
+ void draw(CSurfaceArea *surface, CStarControlSub12 *sub12);
};
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp
index d5026324f3..e717206e55 100644
--- a/engines/titanic/star_control/star_view.cpp
+++ b/engines/titanic/star_control/star_view.cpp
@@ -242,7 +242,7 @@ void CStarView::starDestinationSet() {
}
void CStarView::resetPosition() {
- // TODO
+ _sub12.setPosition(FVector(0.0, 0.0, 0.0));
}
bool CStarView::fn1() {
@@ -359,7 +359,10 @@ void CStarView::fn16() {
}
void CStarView::fn17() {
- // TODO
+ if (_starField && !_showingPhoto) {
+ _sub12.proc35();
+ _starField->fn8(_videoSurface2);
+ }
}
void CStarView::fn18(CStarControlSub12 *sub12) {
@@ -410,12 +413,36 @@ void CStarView::randomizeVectors2(FVector *v1, FVector *v2) {
v1->_y = 3072.0 - g_vm->getRandomFloat() * -4096.0;
v1->_z = 3072.0 - g_vm->getRandomFloat() * -4096.0;
+ // TODO: Doublecheck
+ v2->_x = -v1->_x;
+ v2->_y = -v1->_y;
+ v2->_z = -v1->_z;
+ v2->fn3();
+}
+
+void CStarView::randomizeVectors3(FVector *v1, FVector *v2) {
+ v1->_x = 3072.0 - g_vm->getRandomFloat() * -4096.0;
+ v1->_y = 3072.0 - g_vm->getRandomFloat() * -4096.0;
+ v1->_z = 3072.0 - g_vm->getRandomFloat() * -4096.0;
+
+ // TODO: Doublecheck
v2->_x = -v1->_x;
v2->_y = -v1->_y;
v2->_z = -v1->_z;
v2->fn3();
}
+void CStarView::randomizeVectors4(FVector *v1, FVector *v2) {
+ v1->_x = 3072.0 - g_vm->getRandomFloat() * -4096.0;
+ v1->_y = 3072.0 - g_vm->getRandomFloat() * -4096.0;
+ v1->_z = 3072.0 - g_vm->getRandomFloat() * -4096.0;
+
+ // TODO: Doublecheck
+ v2->_x = -v1->_x;
+ v2->_y = -v1->_y;
+ v2->_z = -v1->_z;
+ v2->fn3();
+}
void CStarView::resizeSurface(CScreenManager *scrManager, int width, int height,
CVideoSurface **surface) {
if (!surface)
diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h
index bb3310d009..e2978e6da0 100644
--- a/engines/titanic/star_control/star_view.h
+++ b/engines/titanic/star_control/star_view.h
@@ -59,6 +59,8 @@ private:
void randomizeVectors1(FVector *v1, FVector *v2);
void randomizeVectors2(FVector *v1, FVector *v2);
+ void randomizeVectors3(FVector *v1, FVector *v2);
+ void randomizeVectors4(FVector *v1, FVector *v2);
/**
* Handles resizing the surface