Skip to content
Permalink
Browse files

TITANIC: Implementing starfield methods

  • Loading branch information
dreammaster committed Mar 4, 2017
1 parent 1a67dee commit ae67a5029ef7ef0cfd15a280cd28191044abd417
@@ -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
@@ -67,7 +67,11 @@ class CStarControlSub8 {
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
@@ -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) {
@@ -39,12 +39,15 @@ class CStarField : public CStarControlSub2 {
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 @@ class CStarField : public CStarControlSub2 {

void fn1(CErrorCode *errorCode);
void fn6(CVideoSurface *surface, CStarControlSub12 *sub12);
void fn7();
void fn8(CVideoSurface *surface);

/**
* Called when the starfield is clicked
@@ -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
@@ -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 @@ class CStarPoints2 {
* Initializes the data
*/
bool initialize();

/**
* Draw the starfield points
*/
void draw(CSurfaceArea *surface, CStarControlSub12 *sub12);
};

} // End of namespace Titanic
@@ -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)
@@ -59,6 +59,8 @@ class CStarView {

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

0 comments on commit ae67a50

Please sign in to comment.
You can’t perform that action at this time.