TITANIC: Adding CStarControlSub12 methods

This commit is contained in:
Paul Gilbert 2016-07-17 20:18:20 -04:00
parent 011286d4b8
commit 87db74d771
9 changed files with 169 additions and 10 deletions

View File

@ -78,17 +78,17 @@ void FMatrix::set(FVector *row1, FVector *row2, FVector *row3) {
_row3 = *row3;
}
void FMatrix::fn1(FVector *v) {
void FMatrix::fn1(const FVector *v) {
_row3._x = v->_x;
FVector tempVector;
tempVector.fn1(v);
_row3.fn1(&tempVector);
_row2._x = tempVector._x;
_row2._y = tempVector._y;
_row2._z = tempVector._z;
_row3.multiply(v, &_row2);
_row3.multiply(&tempVector, &_row2);
_row1._x = _row2._x;
_row1._y = _row2._y;
_row1._z = _row2._z;

View File

@ -69,7 +69,7 @@ public:
*/
void set(FVector *row1, FVector *row2, FVector *row3);
void fn1(FVector *v);
void fn1(const FVector *v);
void fn2(FMatrix *m);
void fn3(FMatrix *m);

View File

@ -41,6 +41,65 @@ CStarControlSub12::~CStarControlSub12() {
deleteHandler();
}
void CStarControlSub12::proc2(const void *src) {
_sub13.copyFrom(src);
}
void CStarControlSub12::proc3(const void *src) {
_handlerP->copyFrom1(src);
}
void CStarControlSub12::proc4(const void *src) {
if (!isLocked()) {
_sub13.fn10(src);
set108();
}
}
void CStarControlSub12::proc5(const FVector *src) {
if (!isLocked())
_sub13.fn11(src);
}
void CStarControlSub12::proc6(int v) {
if (!isLocked())
_sub13.setC(v);
}
void CStarControlSub12::proc7(int v) {
if (!isLocked())
_sub13.set10(v);
}
void CStarControlSub12::proc8(int v) {
if (!isLocked())
_sub13.set14(v);
}
void CStarControlSub12::proc9(int v) {
if (!isLocked())
_sub13.set18(v);
}
void CStarControlSub12::proc10(int v) {
if (!isLocked())
_sub13.set1C(v);
}
void CStarControlSub12::proc11() {
if (!isLocked())
_sub13.fn12();
}
void CStarControlSub12::proc12(double v1, double v2) {
if (!isLocked())
_sub13.fn13(v1, v2);
}
void CStarControlSub12::proc13(CStarControlSub13 *dest) {
*dest = _sub13;
}
void CStarControlSub12::load(SimpleFile *file, int param) {
_sub13.load(file, param);
}

View File

@ -52,12 +52,28 @@ private:
* Deletes any previous handler
*/
void deleteHandler();
/**
* Return whether the handler is locked
*/
bool isLocked() { return _handlerP->isLocked(); }
public:
CStarControlSub12(void *val1, void *val2);
CStarControlSub12(CStarControlSub13 *src);
virtual ~CStarControlSub12();
virtual void proc3() {}
virtual void proc2(const void *src);
virtual void proc3(const void *src);
virtual void proc4(const void *src);
virtual void proc5(const FVector *src);
virtual void proc6(int v);
virtual void proc7(int v);
virtual void proc8(int v);
virtual void proc9(int v);
virtual void proc10(int v);
virtual void proc11();
virtual void proc12(double v1, double v2);
virtual void proc13(CStarControlSub13 *dest);
/**
* Load the data for the class from file
@ -68,6 +84,11 @@ public:
* Save the data for the class to file
*/
virtual void save(SimpleFile *file, int indent);
bool is108() const { return _field108; }
void set108() { _field108 = true; }
void reset108() { _field108 = false; }
};
} // End of namespace Titanic

View File

@ -21,6 +21,7 @@
*/
#include "titanic/star_control/star_control_sub13.h"
#include "titanic/titanic.h"
namespace Titanic {
@ -73,6 +74,18 @@ void CStarControlSub13::setup(void *ptr) {
// TODO
}
void CStarControlSub13::copyFrom(const void *src) {
if (!src)
return;
/*
_field0 = src->_field0;
_field4 = src->_field4;
_field8 = src->_field8;
_fieldC = src->_field18;
_field10 = src->_field1C;
*/
}
void CStarControlSub13::load(SimpleFile *file, int param) {
_field0 = file->readFloat();
_field4 = file->readFloat();
@ -112,5 +125,55 @@ void CStarControlSub13::save(SimpleFile *file, int indent) {
_matrix.save(file, indent);
}
void CStarControlSub13::fn10(const void *src) {
error("TODO: CStarControlSub13::fn10");
}
void CStarControlSub13::fn11(const FVector *v) {
_matrix.fn1(v);
_fieldD4 = 0;
}
void CStarControlSub13::setC(int v) {
_fieldC = v;
_fieldD4 = 0;
}
void CStarControlSub13::set10(int v) {
_field10 = v;
_fieldD4 = 0;
}
void CStarControlSub13::set14(int v) {
_field10 = v;
}
void CStarControlSub13::set18(int v) {
_field18 = v;
_fieldD4 = 0;
}
void CStarControlSub13::set1C(int v) {
_field1C = v;
_fieldD4 = 0;
}
void CStarControlSub13::fn12() {
_matrix.clear();
error("TODO: CStarControlSub13::fn12");
}
void CStarControlSub13::fn13(double v1, double v2) {
if (v1 == 0.0) {
_valArray[0] = v2;
_valArray[1] = -v2;
} else {
_valArray[3] = v2;
_valArray[4] = -v2;
}
_valArray[2] = 0.0;
_field24 = v2 ? 2 : 0;
}
} // End of namespace Titanic

View File

@ -58,6 +58,8 @@ public:
CStarControlSub13(void *ptr);
CStarControlSub13(CStarControlSub13 *src);
void copyFrom(const void *src);
/**
* Load the data for the class from file
*/
@ -67,6 +69,17 @@ public:
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent);
void fn10(const void *src);
void fn11(const FVector *v);
void fn12();
void fn13(double v1, double v2);
void setC(int v);
void set10(int v);
void set14(int v);
void set18(int v);
void set1C(int v);
};
} // End of namespace Titanic

View File

@ -47,11 +47,11 @@ CStarControlSub20::~CStarControlSub20() {
clear();
}
void CStarControlSub20::copyFrom1(void *src) {
void CStarControlSub20::copyFrom1(const void *src) {
error("TODO: CStarControlSub20::copyFrom1");
}
void CStarControlSub20::copyFrom2(void *src) {
void CStarControlSub20::copyFrom2(const void *src) {
error("TODO: CStarControlSub20::copyFrom2");
}

View File

@ -44,8 +44,8 @@ public:
CStarControlSub20(void *src);
virtual ~CStarControlSub20();
virtual void copyFrom1(void *src);
virtual void copyFrom2(void *src);
virtual void copyFrom1(const void *src);
virtual void copyFrom2(const void *src);
virtual void proc4();
virtual void proc5();
virtual void proc6();

View File

@ -32,7 +32,10 @@ CStarView::CStarView() : _sub12(nullptr, nullptr), _sub13((void *)nullptr),
_owner(nullptr), _starField(nullptr), _videoSurface(nullptr), _field118(0),
_videoSurface2(nullptr), _field210(0), _homePhotoMask(nullptr),
_field218(0), _field21C(0) {
_sub12.proc3();
static const uint DATA[8] = { 0, 0, 0x47C35000, 0, 0x41A00000,
0x3F800000, 0x3F800000, 0x3F800000 };
_sub12.proc3(&DATA[0]);
}
void CStarView::load(SimpleFile *file, int param) {