Skip to content
Permalink
Browse files

TITANIC: Implemented CStarControlSub12 fn2

  • Loading branch information
dreammaster committed Mar 21, 2017
1 parent dd74985 commit 0aaa6c415fc14229d0bd82fa3cfb175444a5c47a
@@ -214,4 +214,10 @@ int CBaseStar::baseFn2(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12) {
return ref._index;
}

/*------------------------------------------------------------------------*/

void CStarVector::proc1() {
_owner->setArrayVector(_vector);
}

} // End of namespace Titanic
@@ -146,6 +146,16 @@ class CBaseStar {
int baseFn2(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12);
};

class CStarVector {
private:
CStarControlSub12 *_owner;
FVector _vector;
public:
CStarVector(CStarControlSub12 *owner, const FVector &v) : _owner(owner), _vector(v) {}

virtual void proc1();
};

} // End of namespace Titanic

#endif /* TITANIC_STAR_CONTROL_SUB3_H */
@@ -456,7 +456,26 @@ void CStarControlSub12::fn1(CStarControlSub13 *sub13, const FVector &v) {
}

void CStarControlSub12::fn2(FVector v1, FVector v2, FVector v3) {
// TODO
if (_currentIndex == -1) {
FVector tempV;
tempV._z = _sub13._field10;
v3._z = v1._z;
tempV._x = _sub13._fieldD0 * v1._y * v1._z / _sub13._fieldC8;
v3._y = _sub13._fieldCC * tempV._z * v3._x / _sub13._fieldC8;
v3._x = _sub13._fieldCC * v1._x * v1._z / _sub13._fieldC8 - _sub13._valArray[2];
tempV._y = _sub13._fieldD0 * tempV._z * v3._y / _sub13._fieldC8;
tempV._x = tempV._x - _sub13._valArray[2];

v3.normalize();
tempV.normalize();

FMatrix matrix = _sub13.getMatrix();
const FVector &pos = _sub13._position;
_handlerP->proc10(v3, tempV, pos, matrix);

CStarVector *sv = new CStarVector(this, v2);
_handlerP->setVector(sv);
}
}

void CStarControlSub12::fn3(CStarControlSub13 *sub13, const FVector &v) {
@@ -27,7 +27,7 @@ namespace Titanic {

CStarControlSub20::CStarControlSub20(const CStar20Data *src) {
_lockCounter = 0;
_dataP = nullptr;
_starVector = nullptr;

if (src) {
copyFrom(src);
@@ -100,15 +100,15 @@ void CStarControlSub20::proc11(CErrorCode &errorCode, FVector &v, const FMatrix
}
}

void CStarControlSub20::setData(void *data) {
void CStarControlSub20::setVector(CStarVector *sv) {
clear();
_dataP = (byte *)data;
_starVector = sv;
}

void CStarControlSub20::clear() {
if (_dataP) {
delete _dataP;
_dataP = nullptr;
if (_starVector) {
delete _starVector;
_starVector = nullptr;
}
}

@@ -24,6 +24,7 @@
#define TITANIC_STAR_CONTROL_SUB20_H

#include "titanic/support/simple_file.h"
#include "titanic/star_control/base_star.h"
#include "titanic/star_control/error_code.h"
#include "titanic/star_control/fmatrix.h"

@@ -43,7 +44,7 @@ struct CStar20Data {
class CStarControlSub20 : public CStar20Data {
public:
int _lockCounter;
byte *_dataP;
CStarVector *_starVector;
public:
CStarControlSub20(const CStar20Data *src);
virtual ~CStarControlSub20();
@@ -58,11 +59,7 @@ class CStarControlSub20 : public CStar20Data {
virtual void proc9(FVector &v1, FVector &v2, FMatrix &matrix) {}
virtual void proc10(const FVector &v1, const FVector &v2, const FVector &v3, const FMatrix &m) {}
virtual void proc11(CErrorCode &errorCode, FVector &v, const FMatrix &m);

/**
* Set the data
*/
virtual void setData(void *data);
virtual void setVector(CStarVector *sv);

/**
* Clear the class

0 comments on commit 0aaa6c4

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