aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2016-07-17 10:44:35 -0400
committerPaul Gilbert2016-07-17 13:10:01 -0400
commitc4e3cd87abbddef07436c83736cd3acebd0798aa (patch)
treef6cc0f19c07109a809f200b2ac95736c1e9af60b /engines
parentdee69e206906f59d6af5f6e6351d5b9d8770221f (diff)
downloadscummvm-rg350-c4e3cd87abbddef07436c83736cd3acebd0798aa.tar.gz
scummvm-rg350-c4e3cd87abbddef07436c83736cd3acebd0798aa.tar.bz2
scummvm-rg350-c4e3cd87abbddef07436c83736cd3acebd0798aa.zip
TITANIC: Finished startfield initDocument
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/pet_control/pet_starfield.cpp4
-rw-r--r--engines/titanic/star_control/star_control.cpp15
-rw-r--r--engines/titanic/star_control/star_control.h15
-rw-r--r--engines/titanic/star_control/star_control_sub1.cpp38
-rw-r--r--engines/titanic/star_control/star_control_sub1.h21
-rw-r--r--engines/titanic/star_control/star_control_sub2.cpp5
-rw-r--r--engines/titanic/star_control/star_control_sub2.h5
-rw-r--r--engines/titanic/star_control/star_control_sub5.cpp13
-rw-r--r--engines/titanic/star_control/star_control_sub5.h5
-rw-r--r--engines/titanic/star_control/star_points1.cpp9
-rw-r--r--engines/titanic/star_control/star_points1.h2
-rw-r--r--engines/titanic/star_control/star_points2.cpp4
-rw-r--r--engines/titanic/star_control/star_points2.h2
-rw-r--r--engines/titanic/star_control/star_view.cpp9
-rw-r--r--engines/titanic/star_control/star_view.h10
15 files changed, 124 insertions, 33 deletions
diff --git a/engines/titanic/pet_control/pet_starfield.cpp b/engines/titanic/pet_control/pet_starfield.cpp
index 35ef943f54..34d696e09c 100644
--- a/engines/titanic/pet_control/pet_starfield.cpp
+++ b/engines/titanic/pet_control/pet_starfield.cpp
@@ -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();
}
}
diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp
index e048d11e88..e8524320a2 100644
--- a/engines/titanic/star_control/star_control.cpp
+++ b/engines/titanic/star_control/star_control.cpp
@@ -126,17 +126,20 @@ void CStarControl::newFrame() {
// TODO
}
+void CStarControl::fn1(int action) {
+ // TODO
+}
-void CStarControl::fn3() {
- warning("CStarControl::fn3");
+bool CStarControl::fn4() {
+ return _sub1.get7();
}
-void CStarControl::fn1(int v) {
- warning("CStarControl::fn1");
+bool CStarControl::canSetStarDestination() const {
+ return _view.canSetStarDestination();
}
-void CStarControl::fn4() {
- warning("CStarControl::fn4");
+void CStarControl::starDestinationSet() {
+ _view.starDestinationSet();
}
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h
index c771373135..43cfdc4a05 100644
--- a/engines/titanic/star_control/star_control.h
+++ b/engines/titanic/star_control/star_control.h
@@ -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
diff --git a/engines/titanic/star_control/star_control_sub1.cpp b/engines/titanic/star_control/star_control_sub1.cpp
index c3a268eee3..35bce35fc3 100644
--- a/engines/titanic/star_control/star_control_sub1.cpp
+++ b/engines/titanic/star_control/star_control_sub1.cpp
@@ -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
diff --git a/engines/titanic/star_control/star_control_sub1.h b/engines/titanic/star_control/star_control_sub1.h
index dd7ae5f20c..8aab0b6ab4 100644
--- a/engines/titanic/star_control/star_control_sub1.h
+++ b/engines/titanic/star_control/star_control_sub1.h
@@ -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
diff --git a/engines/titanic/star_control/star_control_sub2.cpp b/engines/titanic/star_control/star_control_sub2.cpp
index eeebaa157a..fcbb70cbcb 100644
--- a/engines/titanic/star_control/star_control_sub2.cpp
+++ b/engines/titanic/star_control/star_control_sub2.cpp
@@ -45,4 +45,9 @@ bool CStarControlSub2::proc7(int v1, int v2) {
return true;
}
+bool CStarControlSub2::setup() {
+ // TODO
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control_sub2.h b/engines/titanic/star_control/star_control_sub2.h
index bfbe02c41c..cd7781548f 100644
--- a/engines/titanic/star_control/star_control_sub2.h
+++ b/engines/titanic/star_control/star_control_sub2.h
@@ -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
diff --git a/engines/titanic/star_control/star_control_sub5.cpp b/engines/titanic/star_control/star_control_sub5.cpp
index 64e48e1814..e2899220c8 100644
--- a/engines/titanic/star_control/star_control_sub5.cpp
+++ b/engines/titanic/star_control/star_control_sub5.cpp
@@ -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
diff --git a/engines/titanic/star_control/star_control_sub5.h b/engines/titanic/star_control/star_control_sub5.h
index c3621e93b4..e245b29d10 100644
--- a/engines/titanic/star_control/star_control_sub5.h
+++ b/engines/titanic/star_control/star_control_sub5.h
@@ -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
diff --git a/engines/titanic/star_control/star_points1.cpp b/engines/titanic/star_control/star_points1.cpp
index 9e684f3c10..6e698d61f7 100644
--- a/engines/titanic/star_control/star_points1.cpp
+++ b/engines/titanic/star_control/star_points1.cpp
@@ -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
}
diff --git a/engines/titanic/star_control/star_points1.h b/engines/titanic/star_control/star_points1.h
index 41fb6b488e..a6e4ee2ec9 100644
--- a/engines/titanic/star_control/star_points1.h
+++ b/engines/titanic/star_control/star_points1.h
@@ -40,7 +40,7 @@ public:
/**
* Initialize the array
*/
- void initialize();
+ bool initialize();
/**
* Draw the starfield points
diff --git a/engines/titanic/star_control/star_points2.cpp b/engines/titanic/star_control/star_points2.cpp
index 10d10e1836..4fea298f93 100644
--- a/engines/titanic/star_control/star_points2.cpp
+++ b/engines/titanic/star_control/star_points2.cpp
@@ -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
diff --git a/engines/titanic/star_control/star_points2.h b/engines/titanic/star_control/star_points2.h
index 0ba5e0a655..31bded4069 100644
--- a/engines/titanic/star_control/star_points2.h
+++ b/engines/titanic/star_control/star_points2.h
@@ -45,7 +45,7 @@ public:
/**
* Initializes the data
*/
- void initialize();
+ bool initialize();
};
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp
index 35920a38ba..5bfef41847 100644
--- a/engines/titanic/star_control/star_view.cpp
+++ b/engines/titanic/star_control/star_view.cpp
@@ -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
diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h
index 7ec86b5d22..cc40fb4a16 100644
--- a/engines/titanic/star_control/star_view.h
+++ b/engines/titanic/star_control/star_view.h
@@ -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