mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
TITANIC: Implementing CStarControlSub21 class
This commit is contained in:
@@ -29,15 +29,15 @@ namespace Titanic {
|
||||
DMatrix *DMatrix::_static;
|
||||
|
||||
DMatrix::DMatrix() :
|
||||
_row1(1.0, 0.0, 0.0), _row2(0.0, 1.0, 0.0), _row3(0.0, 0.0, 1.0) {
|
||||
_row1(1.875, 0.0, 0.0), _row2(0.0, 1.875, 0.0), _row3(0.0, 0.0, 1.875) {
|
||||
}
|
||||
|
||||
DMatrix::DMatrix(int mode, const FMatrix *src) {
|
||||
assert(!mode);
|
||||
|
||||
_row1._x = 1.0;
|
||||
_row2._y = 1.0;
|
||||
_row3._z = 1.0;
|
||||
_row1._x = 1.875;
|
||||
_row2._y = 1.875;
|
||||
_row3._z = 1.875;
|
||||
_frow1._x = src->_row1._x;
|
||||
_frow1._y = src->_row1._y;
|
||||
_frow1._z = src->_row1._z;
|
||||
@@ -50,6 +50,12 @@ DMatrix::DMatrix(int mode, double val) {
|
||||
set(mode, val);
|
||||
}
|
||||
|
||||
DMatrix::DMatrix(const FMatrix &src) {
|
||||
_row1 = src._row1;
|
||||
_row2 = src._row2;
|
||||
_row3 = src._row3;
|
||||
}
|
||||
|
||||
void DMatrix::init() {
|
||||
_static = nullptr;
|
||||
}
|
||||
@@ -94,6 +100,10 @@ void DMatrix::set(int mode, double amount) {
|
||||
}
|
||||
}
|
||||
|
||||
void DMatrix::fn1(DMatrix &m) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void DMatrix::fn3(CStarControlSub26 *sub26) {
|
||||
double v = sub26->fn1();
|
||||
v = (v < 0.0) ? 0.0 : 2.0 / v;
|
||||
@@ -101,4 +111,9 @@ void DMatrix::fn3(CStarControlSub26 *sub26) {
|
||||
error("TODO: DMatrix::fn3 %d", (int)v);
|
||||
}
|
||||
|
||||
const DMatrix *DMatrix::fn4(DMatrix &dest, const DMatrix &m1, const DMatrix &m2) {
|
||||
// TODO
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
||||
@@ -51,13 +51,17 @@ public:
|
||||
DMatrix();
|
||||
DMatrix(int mode, const FMatrix *src);
|
||||
DMatrix(int mode, double val);
|
||||
DMatrix(const FMatrix &src);
|
||||
|
||||
/**
|
||||
* Sets up data for the matrix
|
||||
*/
|
||||
void set(int mode, double amount);
|
||||
|
||||
void fn1(DMatrix &m);
|
||||
void fn3(CStarControlSub26 *sub26);
|
||||
|
||||
const DMatrix *fn4(DMatrix &dest, const DMatrix &m1, const DMatrix &m2);
|
||||
};
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
void DVector::fn3() {
|
||||
void DVector::normalize() {
|
||||
double hyp = sqrt(_x * _x + _y * _y + _z * _z);
|
||||
assert(hyp);
|
||||
|
||||
@@ -34,4 +34,29 @@ void DVector::fn3() {
|
||||
_z *= 1.0 / hyp;
|
||||
}
|
||||
|
||||
double DVector::getDistance(const DVector &src) {
|
||||
return sqrt((src._x - _x) * (src._x - _x) + (src._y - _y) * (src._y - _y) + (src._z - _z) * (src._z - _z));
|
||||
}
|
||||
|
||||
void DVector::fn1(DVector &dest, const DMatrix &m) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void DVector::fn2(double val) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void DVector::fn3(DVector &dest) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
const DMatrix *DVector::fn4(const DVector &v, DMatrix &m) {
|
||||
// TODO
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DVector::fn5(DMatrix &dest) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
||||
@@ -23,8 +23,12 @@
|
||||
#ifndef TITANIC_DVECTOR_H
|
||||
#define TITANIC_DVECTOR_H
|
||||
|
||||
#include "titanic/star_control/fvector.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
class DMatrix;
|
||||
|
||||
/**
|
||||
* Double based vector class.
|
||||
* @remarks TODO: See if it can be merged with FVector
|
||||
@@ -35,8 +39,20 @@ public:
|
||||
public:
|
||||
DVector() : _x(0), _y(0), _z(0) {}
|
||||
DVector(double x, double y, double z) : _x(x), _y(y), _z(z) {}
|
||||
DVector(const FVector &v) : _x(v._x), _y(v._y), _z(v._z) {}
|
||||
|
||||
void fn3();
|
||||
void normalize();
|
||||
|
||||
/**
|
||||
* Returns the distance between this vector and the passed one
|
||||
*/
|
||||
double getDistance(const DVector &src);
|
||||
|
||||
void fn1(DVector &dest, const DMatrix &m);
|
||||
void fn2(double val);
|
||||
void fn3(DVector &dest);
|
||||
const DMatrix *fn4(const DVector &v, DMatrix &m);
|
||||
void fn5(DMatrix &dest);
|
||||
};
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
||||
@@ -28,17 +28,17 @@ FMatrix::FMatrix() :
|
||||
_row1(1.0, 0.0, 0.0), _row2(0.0, 1.0, 0.0), _row3(0.0, 0.0, 1.0) {
|
||||
}
|
||||
|
||||
FMatrix::FMatrix(DMatrix *src) {
|
||||
FMatrix::FMatrix(const DMatrix &src) {
|
||||
copyFrom(src);
|
||||
}
|
||||
|
||||
FMatrix::FMatrix(FMatrix *src) {
|
||||
_row1 = src->_row1;
|
||||
_row2 = src->_row2;
|
||||
_row3 = src->_row3;
|
||||
FMatrix::FMatrix(const FMatrix &src) {
|
||||
_row1 = src._row1;
|
||||
_row2 = src._row2;
|
||||
_row3 = src._row3;
|
||||
}
|
||||
|
||||
void FMatrix::copyFrom(const DMatrix *src) {
|
||||
void FMatrix::copyFrom(const DMatrix &src) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
||||
@@ -39,15 +39,15 @@ private:
|
||||
/**
|
||||
* Copys data from a given source
|
||||
*/
|
||||
void copyFrom(const DMatrix *src);
|
||||
void copyFrom(const DMatrix &src);
|
||||
public:
|
||||
FVector _row1;
|
||||
FVector _row2;
|
||||
FVector _row3;
|
||||
public:
|
||||
FMatrix();
|
||||
FMatrix(DMatrix *src);
|
||||
FMatrix(FMatrix *src);
|
||||
FMatrix(const DMatrix &src);
|
||||
FMatrix(const FMatrix &src);
|
||||
|
||||
/**
|
||||
* Load the data for the class from file
|
||||
|
||||
@@ -113,11 +113,11 @@ void CStarControlSub12::proc13(CStarControlSub13 *dest) {
|
||||
*dest = _sub13;
|
||||
}
|
||||
|
||||
void CStarControlSub12::proc14(int v) {
|
||||
void CStarControlSub12::proc14(FVector &v) {
|
||||
FMatrix matrix = _sub13.getMatrix();
|
||||
FVector vector = _sub13._position;
|
||||
|
||||
_handlerP->proc9(&vector, v, &matrix);
|
||||
_handlerP->proc9(vector, v, matrix);
|
||||
}
|
||||
|
||||
void CStarControlSub12::proc15(CErrorCode *errorCode) {
|
||||
@@ -131,7 +131,7 @@ void CStarControlSub12::proc15(CErrorCode *errorCode) {
|
||||
|
||||
FVector v1 = _sub13._position;
|
||||
FVector v2 = _sub13._position;
|
||||
_handlerP->proc11(*errorCode, v2, _matrix2);
|
||||
_handlerP->proc11(*errorCode, v2, *_matrix2);
|
||||
|
||||
if (v1 != v2) {
|
||||
_sub13.setPosition(v2);
|
||||
@@ -139,7 +139,7 @@ void CStarControlSub12::proc15(CErrorCode *errorCode) {
|
||||
}
|
||||
|
||||
if (_matrix1 != _matrix2) {
|
||||
_sub13.setMatrix(_matrix2);
|
||||
_sub13.setMatrix(*_matrix2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
virtual void proc11();
|
||||
virtual void proc12(StarMode mode, double v2);
|
||||
virtual void proc13(CStarControlSub13 *dest);
|
||||
virtual void proc14(int v);
|
||||
virtual void proc14(FVector &v);
|
||||
virtual void proc15(CErrorCode *errorCode);
|
||||
virtual void proc16();
|
||||
virtual void proc17();
|
||||
|
||||
@@ -40,7 +40,7 @@ CStarControlSub13::CStarControlSub13() {
|
||||
}
|
||||
|
||||
CStarControlSub13::CStarControlSub13(CStarControlSub13 *src) :
|
||||
_matrix(&src->_matrix), _sub1(&src->_sub1), _sub2(&src->_sub2) {
|
||||
_matrix(src->_matrix), _sub1(&src->_sub1), _sub2(&src->_sub2) {
|
||||
_position = src->_position;
|
||||
_fieldC = src->_fieldC;
|
||||
_field10 = src->_field10;
|
||||
@@ -168,7 +168,7 @@ void CStarControlSub13::fn12() {
|
||||
s = CStarControlSub6::setup(&s2, s, &m3);
|
||||
|
||||
m1.copyFrom(*s);
|
||||
_matrix.fn2(&m1);
|
||||
_matrix.fn2(m1);
|
||||
_fieldD4 = 0;
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ void CStarControlSub13::reset() {
|
||||
_sub2._vector._x = _position._x;
|
||||
_sub2._vector._y = _position._y;
|
||||
_sub2._vector._z = _position._z;
|
||||
_sub2.fn3(&_sub1);
|
||||
_sub2.fn3(_sub1);
|
||||
|
||||
double widthV = (double)_width * 0.5;
|
||||
double heightV = (double)_height * 0.5;
|
||||
|
||||
@@ -55,8 +55,8 @@ public:
|
||||
virtual void proc6();
|
||||
virtual void proc7();
|
||||
virtual void proc8() {}
|
||||
virtual void proc9(FVector *v, int v2, FMatrix *matrix) {}
|
||||
virtual void proc10() {}
|
||||
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);
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,15 +21,51 @@
|
||||
*/
|
||||
|
||||
#include "titanic/star_control/star_control_sub21.h"
|
||||
#include "titanic/star_control/dmatrix.h"
|
||||
#include "titanic/star_control/dvector.h"
|
||||
#include "common/textconsole.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
CStarControlSub21::CStarControlSub21(const CStar20Data *src) :
|
||||
CStarControlSub20(src) {
|
||||
#if 0
|
||||
_sub24()
|
||||
#endif
|
||||
}
|
||||
|
||||
void CStarControlSub21::proc9(FVector &v1, FVector &v2, FMatrix &matrix) {
|
||||
if (isLocked())
|
||||
decLockCount();
|
||||
|
||||
_sub24.proc4(v1, v2, matrix);
|
||||
}
|
||||
|
||||
void CStarControlSub21::proc10(const FVector &v1, const FVector &v2, const FVector &v3, const FMatrix &m) {
|
||||
if (isLocked())
|
||||
decLockCount();
|
||||
|
||||
DVector vector1 = v1;
|
||||
DVector vector2 = v2;
|
||||
DMatrix matrix1, matrix2 = m, matrix3;
|
||||
vector2.fn4(vector1, matrix1);
|
||||
const DMatrix *matrixP = matrix1.fn4(matrix3, matrix1, matrix2);
|
||||
|
||||
FMatrix matrix4 = *matrixP;
|
||||
_sub24.proc3(m, matrix4);
|
||||
incLockCount();
|
||||
}
|
||||
|
||||
void CStarControlSub21::proc11(CErrorCode &errorCode, FVector &v, const FMatrix &m) {
|
||||
if (_sub24.get8()) {
|
||||
int val = _sub24.proc5(errorCode, v, m);
|
||||
if (val == 1)
|
||||
incLockCount();
|
||||
if (val == 2) {
|
||||
proc7();
|
||||
error("TODO: _dataP");
|
||||
}
|
||||
} else if (_size != 0.0) {
|
||||
// TODO
|
||||
error("TODO");
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
||||
@@ -30,11 +30,14 @@ namespace Titanic {
|
||||
|
||||
class CStarControlSub21 : public CStarControlSub20 {
|
||||
private:
|
||||
#if 0
|
||||
CStarControlSub24 _sub24;
|
||||
#endif
|
||||
public:
|
||||
CStarControlSub21(const CStar20Data *src);
|
||||
virtual ~CStarControlSub21() {}
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
||||
@@ -25,4 +25,17 @@
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
void CStarControlSub23::proc3(const FMatrix &m1, const FMatrix &m2) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CStarControlSub23::proc4(FVector &v1, FVector &v2, FMatrix &m) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
int CStarControlSub23::proc5(CErrorCode &errorCode, FVector &v, const FMatrix &m) {
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
||||
@@ -23,9 +23,40 @@
|
||||
#ifndef TITANIC_STAR_CONTROL_SUB23_H
|
||||
#define TITANIC_STAR_CONTROL_SUB23_H
|
||||
|
||||
#include "titanic/star_control/error_code.h"
|
||||
#include "titanic/star_control/fmatrix.h"
|
||||
#include "titanic/star_control/fvector.h"
|
||||
#include "titanic/star_control/star_control_sub25.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
class CStarControlSub23 {
|
||||
private:
|
||||
int _field4;
|
||||
int _field8;
|
||||
FVector _row1, _row2;
|
||||
int _field24;
|
||||
FVector _row3;
|
||||
int _field34;
|
||||
int _field38;
|
||||
int _field3C;
|
||||
int _field40;
|
||||
int _field44;
|
||||
int _field48;
|
||||
int _field4C;
|
||||
int _field50;
|
||||
int _field54;
|
||||
int _field58;
|
||||
double _field5C;
|
||||
int _field60;
|
||||
double _field64;
|
||||
CStarControlSub25 _sub25;
|
||||
public:
|
||||
virtual void proc3(const FMatrix &m1, const FMatrix &m2);
|
||||
virtual void proc4(FVector &v1, FVector &v2, FMatrix &m);
|
||||
virtual int proc5(CErrorCode &errorCode, FVector &v, const FMatrix &m);
|
||||
|
||||
int get8() const { return _field8; }
|
||||
};
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
namespace Titanic {
|
||||
|
||||
class CStarControlSub24 : public CStarControlSub23 {
|
||||
|
||||
};
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
||||
Reference in New Issue
Block a user