aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/star_control
diff options
context:
space:
mode:
authorPaul Gilbert2016-07-17 23:18:06 -0400
committerPaul Gilbert2016-07-17 23:18:06 -0400
commit3ee3784073fb7c5299f553c3fd07842aed2d356f (patch)
treecbfabd97ab1f95d312db466022f1bf110802e0cb /engines/titanic/star_control
parent020655a6f3925a7a5e919274a96451bd434c2120 (diff)
downloadscummvm-rg350-3ee3784073fb7c5299f553c3fd07842aed2d356f.tar.gz
scummvm-rg350-3ee3784073fb7c5299f553c3fd07842aed2d356f.tar.bz2
scummvm-rg350-3ee3784073fb7c5299f553c3fd07842aed2d356f.zip
TITANIC: Added remaining CStarControlSub12 virtual methods
Diffstat (limited to 'engines/titanic/star_control')
-rw-r--r--engines/titanic/star_control/fvector.cpp3
-rw-r--r--engines/titanic/star_control/fvector.h4
-rw-r--r--engines/titanic/star_control/star_control_sub12.cpp98
-rw-r--r--engines/titanic/star_control/star_control_sub12.h31
-rw-r--r--engines/titanic/star_control/star_control_sub13.cpp51
-rw-r--r--engines/titanic/star_control/star_control_sub13.h27
-rw-r--r--engines/titanic/star_control/star_control_sub6.h3
7 files changed, 197 insertions, 20 deletions
diff --git a/engines/titanic/star_control/fvector.cpp b/engines/titanic/star_control/fvector.cpp
index ce7b62bc16..aa99e8b4d1 100644
--- a/engines/titanic/star_control/fvector.cpp
+++ b/engines/titanic/star_control/fvector.cpp
@@ -21,6 +21,7 @@
*/
#include "titanic/star_control/fvector.h"
+#include "titanic/star_control/star_control_sub6.h"
#include "common/algorithm.h"
#include "common/textconsole.h"
@@ -63,7 +64,7 @@ void FVector::fn4(FVector *dest, const FVector *v1, const FVector *v2) {
*dest = tempVector;
}
-void FVector::fn5(FVector *dest, const void *v) const {
+void FVector::fn5(FVector *dest, const CStarControlSub6 *sub6) const {
error("TODO: FVector::fn5");
}
diff --git a/engines/titanic/star_control/fvector.h b/engines/titanic/star_control/fvector.h
index 9af18dc71a..8e1ba47a3e 100644
--- a/engines/titanic/star_control/fvector.h
+++ b/engines/titanic/star_control/fvector.h
@@ -25,6 +25,8 @@
namespace Titanic {
+class CStarControlSub6;
+
/**
* Floating point vector class.
* @remarks TODO: See if it can be merged with DVector
@@ -46,7 +48,7 @@ public:
double getDistance(const FVector *src) const;
static void fn4(FVector *dest, const FVector *v1, const FVector *v2);
- void fn5(FVector *dest, const void *v) const;
+ void fn5(FVector *dest, const CStarControlSub6 *sub6) const;
/**
* Returns true if the passed vector equals this one
diff --git a/engines/titanic/star_control/star_control_sub12.cpp b/engines/titanic/star_control/star_control_sub12.cpp
index 967327014e..85b7c83878 100644
--- a/engines/titanic/star_control/star_control_sub12.cpp
+++ b/engines/titanic/star_control/star_control_sub12.cpp
@@ -30,13 +30,13 @@ FMatrix *CStarControlSub12::_matrix1;
FMatrix *CStarControlSub12::_matrix2;
CStarControlSub12::CStarControlSub12(void *val1, void *val2) :
- _field4(-1), _handlerP(nullptr), _field108(0),
+ _currentIndex(-1), _handlerP(nullptr), _field108(0),
_sub13(val1) {
setupHandler(val2);
}
CStarControlSub12::CStarControlSub12(CStarControlSub13 *src) :
- _field4(-1), _handlerP(nullptr), _field108(0), _sub13(src) {
+ _currentIndex(-1), _handlerP(nullptr), _field108(0), _sub13(src) {
}
void CStarControlSub12::init() {
@@ -146,6 +146,98 @@ void CStarControlSub12::proc15(int v) {
}
}
+void CStarControlSub12::proc16() {
+ _handlerP->proc4();
+}
+
+void CStarControlSub12::proc17() {
+ _handlerP->proc5();
+}
+
+void CStarControlSub12::proc18() {
+ _handlerP->proc6();
+}
+
+void CStarControlSub12::proc19() {
+ _handlerP->proc7();
+}
+
+void CStarControlSub12::proc20(double v) {
+ if (!isLocked())
+ _sub13.fn14(v);
+}
+
+void CStarControlSub12::proc21(CStarControlSub6 &sub6) {
+ if (!isLocked()) {
+ _sub13.setPosition(sub6);
+ set108();
+ }
+}
+
+void CStarControlSub12::proc22(FMatrix &m) {
+ if (!isLocked())
+ _sub13.fn15(m);
+}
+
+CStarControlSub6 CStarControlSub12::proc23() {
+ return _sub13.getSub1();
+}
+
+CStarControlSub6 CStarControlSub12::proc24() {
+ return _sub13.getSub2();
+}
+
+double CStarControlSub12::proc25() const {
+ return _sub13._field10;
+}
+
+double CStarControlSub12::proc26() const {
+ return _sub13._field14;
+}
+
+int CStarControlSub12::proc27() const {
+ return _sub13._field24;
+}
+
+FVector CStarControlSub12::proc28(int index, const void *v2) {
+ error("TODO: CStarControlSub12::proc28");
+ return FVector();
+}
+
+FVector CStarControlSub12::proc29(const FVector &v) {
+ return _sub13.fn16(v);
+}
+
+FVector CStarControlSub12::proc30(int index, const FVector &v) {
+ return _sub13.fn17(index, v);
+}
+
+FVector CStarControlSub12::proc31(int index, const FVector &v) {
+ return _sub13.fn18(index, v);
+}
+
+void CStarControlSub12::proc32(double v1, double v2) {
+ error("TODO: CStarControlSub12::proc32");
+}
+
+bool CStarControlSub12::setArrayVector(const FVector &v) {
+ if (_currentIndex >= 2)
+ return false;
+
+ error("TODO: CStarControlSub12::setArrayVector");
+}
+
+bool CStarControlSub12::proc35() {
+ if (_currentIndex == -1)
+ return false;
+
+ error("TODO: CStarControlSub12::proc35");
+}
+
+void CStarControlSub12::proc36(double *v1, double *v2, double *v3, double *v4) {
+ _sub13.fn19(v1, v2, v3, v4);
+}
+
void CStarControlSub12::load(SimpleFile *file, int param) {
_sub13.load(file, param);
}
@@ -157,7 +249,7 @@ void CStarControlSub12::save(SimpleFile *file, int indent) {
bool CStarControlSub12::setupHandler(void *src) {
CStarControlSub20 *handler = nullptr;
- switch (_field4) {
+ switch (_currentIndex) {
case -1:
handler = new CStarControlSub21(src);
break;
diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h
index 643e3dfb67..1d5f693d20 100644
--- a/engines/titanic/star_control/star_control_sub12.h
+++ b/engines/titanic/star_control/star_control_sub12.h
@@ -31,18 +31,12 @@
namespace Titanic {
class CStarControlSub12 {
- struct ArrayEntry {
- int _field0;
- int _field4;
- int _field8;
- ArrayEntry() : _field0(0), _field4(0), _field8(0) {}
- };
private:
static FMatrix *_matrix1;
static FMatrix *_matrix2;
private:
- int _field4;
- ArrayEntry _array[3];
+ int _currentIndex;
+ FVector _array[3];
CStarControlSub20 *_handlerP;
CStarControlSub13 _sub13;
int _field108;
@@ -83,6 +77,27 @@ public:
virtual void proc13(CStarControlSub13 *dest);
virtual void proc14(int v);
virtual void proc15(int v);
+ virtual void proc16();
+ virtual void proc17();
+ virtual void proc18();
+ virtual void proc19();
+ virtual void proc20(double v);
+ virtual void proc21(CStarControlSub6 &sub6);
+ virtual void proc22(FMatrix &m);
+ virtual CStarControlSub6 proc23();
+ virtual CStarControlSub6 proc24();
+ virtual double proc25() const;
+ virtual double proc26() const;
+ virtual int proc27() const;
+ virtual FVector proc28(int index, const void *v2);
+ virtual FVector proc29(const FVector &v);
+ virtual FVector proc30(int index, const FVector &v);
+ virtual FVector proc31(int index, const FVector &v);
+ virtual void proc32(double v1, double v2);
+ virtual int getCurrentIndex() const { return _currentIndex; }
+ virtual bool setArrayVector(const FVector &v);
+ virtual bool proc35();
+ virtual void proc36(double *v1, double *v2, double *v3, double *v4);
/**
* Load the data for the class from file
diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/star_control_sub13.cpp
index a69937bfb8..c721b395c6 100644
--- a/engines/titanic/star_control/star_control_sub13.cpp
+++ b/engines/titanic/star_control/star_control_sub13.cpp
@@ -127,6 +127,13 @@ void CStarControlSub13::setPosition(const FVector &v) {
_fieldD4 = 0;
}
+void CStarControlSub13::setPosition(const CStarControlSub6 &sub6) {
+ FVector vector;
+ _position.fn5(&vector, &sub6);
+ _position = sub6._matrix._row1;
+ _fieldD4 = 0;
+}
+
void CStarControlSub13::setMatrix(const FMatrix &m) {
_matrix = m;
_fieldD4 = 0;
@@ -179,6 +186,50 @@ void CStarControlSub13::fn13(double v1, double v2) {
_field24 = v2 ? 2 : 0;
}
+void CStarControlSub13::fn14(double v) {
+ error("TODO: CStarControlSub13::fn14");
+}
+
+void CStarControlSub13::fn15(FMatrix &matrix) {
+ _matrix.fn3(&matrix);
+ _fieldD4 = 0;
+}
+
+CStarControlSub6 CStarControlSub13::getSub1() {
+ if (!_fieldD4)
+ reset();
+
+ return _sub1;
+}
+
+CStarControlSub6 CStarControlSub13::getSub2() {
+ if (!_fieldD4)
+ reset();
+
+ return _sub2;
+}
+
+FVector CStarControlSub13::fn16(const FVector &v) {
+ error("TODO: CStarControlSub13::fn16");
+}
+
+FVector CStarControlSub13::fn17(int index, const FVector &v) {
+ error("TODO: CStarControlSub13::fn17");
+}
+
+FVector CStarControlSub13::fn18(int index, const FVector &v) {
+ error("TODO: CStarControlSub13::fn17");
+}
+
+void CStarControlSub13::fn19(double *v1, double *v2, double *v3, double *v4) {
+ error("TODO: CStarControlSub13::fn19");
+}
+
+void CStarControlSub13::reset() {
+ const double FACTOR = 3.1415927 * 0.0055555557;
+ error("TODO: CStarControlSub13::reset");
+}
+
void CStarControlSub13::getMatrix(FMatrix *matrix) {
*matrix = _matrix;
}
diff --git a/engines/titanic/star_control/star_control_sub13.h b/engines/titanic/star_control/star_control_sub13.h
index eacdce3447..2f0b479cec 100644
--- a/engines/titanic/star_control/star_control_sub13.h
+++ b/engines/titanic/star_control/star_control_sub13.h
@@ -32,27 +32,29 @@ namespace Titanic {
class CStarControlSub13 {
private:
double _fieldC;
- double _field10;
- double _field14;
double _field18;
double _field1C;
int _width;
int _height;
- int _field24;
double _valArray[5];
FMatrix _matrix;
CStarControlSub6 _sub1;
CStarControlSub6 _sub2;
- int _fieldC0;
- int _fieldC4;
+ double _fieldC0;
+ double _fieldC4;
int _fieldC8;
int _fieldCC;
- int _fieldD0;
+ double _fieldD0;
int _fieldD4;
private:
void setup(void *ptr);
+
+ void reset();
public:
FVector _position;
+ double _field10;
+ double _field14;
+ int _field24;
public:
CStarControlSub13(void *ptr);
CStarControlSub13(CStarControlSub13 *src);
@@ -75,6 +77,11 @@ public:
void setPosition(const FVector &v);
/**
+ * Sets the position
+ */
+ void setPosition(const CStarControlSub6 &sub6);
+
+ /**
* Sets the matrix
*/
void setMatrix(const FMatrix &m);
@@ -82,6 +89,14 @@ public:
void fn11(const FVector &v);
void fn12();
void fn13(double v1, double v2);
+ void fn14(double v);
+ void fn15(FMatrix &matrix);
+ CStarControlSub6 getSub1();
+ CStarControlSub6 getSub2();
+ FVector fn16(const FVector &v);
+ FVector fn17(int index, const FVector &v);
+ FVector fn18(int index, const FVector &v);
+ void fn19(double *v1, double *v2, double *v3, double *v4);
/**
* Makes a copy of the instance's matrix into the passed matrix
diff --git a/engines/titanic/star_control/star_control_sub6.h b/engines/titanic/star_control/star_control_sub6.h
index fe2b3d44b5..118c7c7f10 100644
--- a/engines/titanic/star_control/star_control_sub6.h
+++ b/engines/titanic/star_control/star_control_sub6.h
@@ -29,7 +29,6 @@ namespace Titanic {
class CStarControlSub6 {
private:
- FMatrix _matrix;
int _field24;
int _field28;
int _field2C;
@@ -39,6 +38,8 @@ public:
static void init();
static void deinit();
public:
+ FMatrix _matrix;
+public:
CStarControlSub6();
CStarControlSub6(int mode, double amount);
CStarControlSub6(const CStarControlSub6 *src);