TITANIC: Finished startfield initDocument

This commit is contained in:
Paul Gilbert
2016-07-17 13:10:01 -04:00
parent dee69e2069
commit c4e3cd87ab
15 changed files with 125 additions and 34 deletions
@@ -107,10 +107,10 @@ bool CPetStarfield::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
if (_petControl) {
CStarControl *starControl = _petControl->getStarControl();
if (starControl) {
if (starControl && starControl->canSetStarDestination()) {
CPETSetStarDestinationMsg starfieldMsg;
starfieldMsg.execute(_petControl->_remoteTarget);
starControl->fn3();
starControl->starDestinationSet();
}
}
+10 -7
View File
@@ -126,17 +126,20 @@ void CStarControl::newFrame() {
// TODO
}
void CStarControl::fn3() {
warning("CStarControl::fn3");
void CStarControl::fn1(int action) {
// TODO
}
void CStarControl::fn1(int v) {
warning("CStarControl::fn1");
bool CStarControl::fn4() {
return _sub1.get7();
}
void CStarControl::fn4() {
warning("CStarControl::fn4");
bool CStarControl::canSetStarDestination() const {
return _view.canSetStarDestination();
}
void CStarControl::starDestinationSet() {
_view.starDestinationSet();
}
} // End of namespace Titanic
+12 -3
View File
@@ -66,9 +66,18 @@ public:
*/
virtual void draw(CScreenManager *screenManager);
void fn1(int v);
void fn3();
void fn4();
void fn1(int action);
bool fn4();
/**
* Returns true if a star destination can be set
*/
bool canSetStarDestination() const;
/**
* Called when a star destination is set
*/
void starDestinationSet();
};
} // End of namespace Titanic
@@ -24,28 +24,42 @@
namespace Titanic {
CStarControlSub1::CStarControlSub1() :
_field7DA8(0), _field7DAC(0), _field7DB0(0),
_field7DB4(1), _field7DB8(0), _field7DBC(0) {
CStarControlSub1::CStarControlSub1() : _val1(0), _val2(0), _val3(0), _val4(1),
_val5(0), _val6(false) {
}
void CStarControlSub1::load(SimpleFile *file, int param) {
if (!param) {
_sub7.load(file);
_sub8.load(file);
_field7DA8 = file->readNumber();
_field7DAC = file->readNumber();
_field7DB0 = file->readNumber();
_field7DB4 = file->readNumber();
_field7DBC = file->readNumber();
_val1 = file->readNumber();
_val2 = file->readNumber();
_val3 = file->readNumber();
_val4 = file->readNumber();
_val6 = file->readNumber();
}
}
void CStarControlSub1::save(SimpleFile *file, int indent) {
_sub7.save(file, indent);
_sub8.save(file, indent);
file->writeNumberLine(_val1, indent);
file->writeNumberLine(_val2, indent);
file->writeNumberLine(_val3, indent);
file->writeNumberLine(_val4, indent);
file->writeNumberLine(_val6, indent);
}
bool CStarControlSub1::initDocument() {
warning("CStarControlSub1::initDocument");
_points1.initialize();
_points2.initialize();
return true;
bool valid = setup() && _points1.initialize();
if (valid)
valid = _sub5.setup();
if (valid)
valid = _points1.initialize();
if (valid)
valid = _points2.initialize();
return valid;
}
} // End of namespace Titanic
@@ -39,12 +39,13 @@ private:
CStarPoints1 _points1;
CStarPoints2 _points2;
CStarControlSub5 _sub5;
int _field7DA8;
int _field7DAC;
int _field7DB0;
int _field7DB4;
int _field7DB8;
int _field7DBC;
int _val1;
int _val2;
int _val3;
int _val4;
int _val5;
int _val6;
bool _val7;
public:
CStarControlSub1();
@@ -53,7 +54,15 @@ public:
*/
void load(SimpleFile *file, int param);
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent);
bool initDocument();
int get6() const { return _val6; }
bool get7() const { return _val7; }
};
} // End of namespace Titanic
@@ -45,4 +45,9 @@ bool CStarControlSub2::proc7(int v1, int v2) {
return true;
}
bool CStarControlSub2::setup() {
// TODO
return true;
}
} // End of namespace Titanic
@@ -35,6 +35,11 @@ public:
virtual bool proc4(int v1, int v2, int v3, int v4, int v5);
virtual bool loadStar();
virtual bool proc7(int v1, int v2);
/**
* Setup the control
*/
bool setup();
};
} // End of namespace Titanic
@@ -28,4 +28,17 @@ CStarControlSub5::CStarControlSub5() :
_field4(1), _field78AC(0), _field78B0(0) {
}
bool CStarControlSub5::setup() {
// TODO
return true;
}
void CStarControlSub5::proc2() {
// TODO
}
void CStarControlSub5::proc3(CErrorCode *errorCode) {
// TODO
}
} // End of namespace Titanic
@@ -24,6 +24,7 @@
#define TITANIC_STAR_CONTROL_SUB5_H
#include "titanic/star_control/star_control_sub6.h"
#include "titanic/star_control/error_code.h"
namespace Titanic {
@@ -43,6 +44,10 @@ private:
int _field78B0;
public:
CStarControlSub5();
virtual bool setup();
virtual void proc2();
virtual void proc3(CErrorCode *errorCode);
};
} // End of namespace Titanic
@@ -32,7 +32,7 @@ const double FACTOR = 3.1415927 * 0.0055555557;
CStarPoints1::CStarPoints1() {
}
void CStarPoints1::initialize() {
bool CStarPoints1::initialize() {
// Get a reference to the starfield points resource
Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS");
assert(stream && stream->size() == (12 * ARRAY_COUNT));
@@ -53,9 +53,16 @@ void CStarPoints1::initialize() {
entry._y = sin(v2) * 3000000.0 * cos(v1);
entry._z = sin(v1) * 3000000.0;
}
return true;
}
void CStarPoints1::draw(CSurfaceArea *surface, CStarControlSub12 *img) {
if (_data.empty())
return;
// TODO
}
+1 -1
View File
@@ -40,7 +40,7 @@ public:
/**
* Initialize the array
*/
void initialize();
bool initialize();
/**
* Draw the starfield points
@@ -28,7 +28,7 @@ namespace Titanic {
#define ARRAY_COUNT 80
const double FACTOR = 3.1415927 * 0.0055555557;
void CStarPoints2::initialize() {
bool CStarPoints2::initialize() {
// Get a reference to the starfield points resource
Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS2");
@@ -52,6 +52,8 @@ void CStarPoints2::initialize() {
entry._v3 = sin(v2) * 3000000.0;
}
}
return true;
}
} // End of namespace Titanic
+1 -1
View File
@@ -45,7 +45,7 @@ public:
/**
* Initializes the data
*/
void initialize();
bool initialize();
};
} // End of namespace Titanic
@@ -106,4 +106,13 @@ CErrorCode CStarView::KeyCharMsg(int key) {
return CErrorCode();
}
bool CStarView::canSetStarDestination() const {
// TODO
return false;
}
void CStarView::starDestinationSet() {
// TODO
}
} // End of namespace Titanic
+10
View File
@@ -88,6 +88,16 @@ public:
* Handles keyboard messages
*/
CErrorCode KeyCharMsg(int key);
/**
* Returns true if a star destination can be set
*/
bool canSetStarDestination() const;
/**
* Called when a star destination is set
*/
void starDestinationSet();
};
} // End of namespace Titanic