mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-01 15:09:47 +00:00
TITANIC: Adding CStarControlSub12 methods
This commit is contained in:
parent
87db74d771
commit
020655a6f3
@ -25,6 +25,7 @@
|
||||
#include "titanic/star_control/dmatrix.h"
|
||||
#include "titanic/star_control/error_code.h"
|
||||
#include "titanic/star_control/star_control_sub6.h"
|
||||
#include "titanic/star_control/star_control_sub12.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
@ -38,11 +39,13 @@ END_MESSAGE_MAP()
|
||||
CStarControl::CStarControl() : _fieldBC(0), _field80B0(0),
|
||||
_starRect(20, 10, 620, 350) {
|
||||
CStarControlSub6::init();
|
||||
CStarControlSub12::init();
|
||||
DMatrix::init();
|
||||
}
|
||||
|
||||
CStarControl::~CStarControl() {
|
||||
CStarControlSub6::deinit();
|
||||
CStarControlSub12::deinit();
|
||||
DMatrix::deinit();
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,9 @@
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
FMatrix *CStarControlSub12::_matrix1;
|
||||
FMatrix *CStarControlSub12::_matrix2;
|
||||
|
||||
CStarControlSub12::CStarControlSub12(void *val1, void *val2) :
|
||||
_field4(-1), _handlerP(nullptr), _field108(0),
|
||||
_sub13(val1) {
|
||||
@ -34,7 +37,18 @@ CStarControlSub12::CStarControlSub12(void *val1, void *val2) :
|
||||
|
||||
CStarControlSub12::CStarControlSub12(CStarControlSub13 *src) :
|
||||
_field4(-1), _handlerP(nullptr), _field108(0), _sub13(src) {
|
||||
}
|
||||
|
||||
void CStarControlSub12::init() {
|
||||
_matrix1 = nullptr;
|
||||
_matrix2 = nullptr;
|
||||
}
|
||||
|
||||
void CStarControlSub12::deinit() {
|
||||
delete _matrix1;
|
||||
delete _matrix2;
|
||||
_matrix1 = nullptr;
|
||||
_matrix2 = nullptr;
|
||||
}
|
||||
|
||||
CStarControlSub12::~CStarControlSub12() {
|
||||
@ -49,16 +63,16 @@ void CStarControlSub12::proc3(const void *src) {
|
||||
_handlerP->copyFrom1(src);
|
||||
}
|
||||
|
||||
void CStarControlSub12::proc4(const void *src) {
|
||||
void CStarControlSub12::setPosition(const FVector &v) {
|
||||
if (!isLocked()) {
|
||||
_sub13.fn10(src);
|
||||
_sub13.setPosition(v);
|
||||
set108();
|
||||
}
|
||||
}
|
||||
|
||||
void CStarControlSub12::proc5(const FVector *src) {
|
||||
void CStarControlSub12::proc5(const FVector &v) {
|
||||
if (!isLocked())
|
||||
_sub13.fn11(src);
|
||||
_sub13.fn11(v);
|
||||
}
|
||||
|
||||
void CStarControlSub12::proc6(int v) {
|
||||
@ -100,6 +114,38 @@ void CStarControlSub12::proc13(CStarControlSub13 *dest) {
|
||||
*dest = _sub13;
|
||||
}
|
||||
|
||||
void CStarControlSub12::proc14(int v) {
|
||||
FMatrix matrix;
|
||||
_sub13.getMatrix(&matrix);
|
||||
FVector vector = _sub13._position;
|
||||
|
||||
_handlerP->proc9(&vector, v, &matrix);
|
||||
}
|
||||
|
||||
void CStarControlSub12::proc15(int v) {
|
||||
if (!_matrix1)
|
||||
_matrix1 = new FMatrix();
|
||||
if (!_matrix2)
|
||||
_matrix2 = new FMatrix();
|
||||
|
||||
_sub13.getMatrix(_matrix1);
|
||||
*_matrix2 = *_matrix1;
|
||||
|
||||
FVector v1 = _sub13._position;
|
||||
FVector v2 = _sub13._position;
|
||||
CErrorCode errorCode;
|
||||
_handlerP->proc11(errorCode, v2, _matrix2);
|
||||
|
||||
if (v1 != v2) {
|
||||
_sub13.setPosition(v2);
|
||||
set108();
|
||||
}
|
||||
|
||||
if (_matrix1 != _matrix2) {
|
||||
_sub13.setMatrix(_matrix2);
|
||||
}
|
||||
}
|
||||
|
||||
void CStarControlSub12::load(SimpleFile *file, int param) {
|
||||
_sub13.load(file, param);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#define TITANIC_STAR_CONTROL_SUB12_H
|
||||
|
||||
#include "titanic/support/simple_file.h"
|
||||
#include "titanic/star_control/fmatrix.h"
|
||||
#include "titanic/star_control/star_control_sub13.h"
|
||||
#include "titanic/star_control/star_control_sub20.h"
|
||||
|
||||
@ -36,6 +37,9 @@ class CStarControlSub12 {
|
||||
int _field8;
|
||||
ArrayEntry() : _field0(0), _field4(0), _field8(0) {}
|
||||
};
|
||||
private:
|
||||
static FMatrix *_matrix1;
|
||||
static FMatrix *_matrix2;
|
||||
private:
|
||||
int _field4;
|
||||
ArrayEntry _array[3];
|
||||
@ -57,6 +61,9 @@ private:
|
||||
* Return whether the handler is locked
|
||||
*/
|
||||
bool isLocked() { return _handlerP->isLocked(); }
|
||||
public:
|
||||
static void init();
|
||||
static void deinit();
|
||||
public:
|
||||
CStarControlSub12(void *val1, void *val2);
|
||||
CStarControlSub12(CStarControlSub13 *src);
|
||||
@ -64,8 +71,8 @@ public:
|
||||
|
||||
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 setPosition(const FVector &v);
|
||||
virtual void proc5(const FVector &v);
|
||||
virtual void proc6(int v);
|
||||
virtual void proc7(int v);
|
||||
virtual void proc8(int v);
|
||||
@ -74,6 +81,8 @@ public:
|
||||
virtual void proc11();
|
||||
virtual void proc12(double v1, double v2);
|
||||
virtual void proc13(CStarControlSub13 *dest);
|
||||
virtual void proc14(int v);
|
||||
virtual void proc15(int v);
|
||||
|
||||
/**
|
||||
* Load the data for the class from file
|
||||
|
@ -26,8 +26,7 @@
|
||||
namespace Titanic {
|
||||
|
||||
CStarControlSub13::CStarControlSub13(void *src) :
|
||||
_field0(0), _field4(0), _field8(0), _fieldC0(0),
|
||||
_fieldC4(0), _fieldC8(0), _fieldCC(0), _fieldD0(0) {
|
||||
_fieldC0(0), _fieldC4(0), _fieldC8(0), _fieldCC(0), _fieldD0(0) {
|
||||
if (src) {
|
||||
setup(src);
|
||||
} else {
|
||||
@ -46,9 +45,7 @@ CStarControlSub13::CStarControlSub13(void *src) :
|
||||
|
||||
CStarControlSub13::CStarControlSub13(CStarControlSub13 *src) :
|
||||
_matrix(&src->_matrix), _sub1(&src->_sub1), _sub2(&src->_sub2) {
|
||||
_field0 = src->_field0;
|
||||
_field4 = src->_field4;
|
||||
_field8 = src->_field8;
|
||||
_position = src->_position;
|
||||
_fieldC = src->_fieldC;
|
||||
_field10 = src->_field10;
|
||||
_field14 = src->_field14;
|
||||
@ -87,9 +84,9 @@ void CStarControlSub13::copyFrom(const void *src) {
|
||||
}
|
||||
|
||||
void CStarControlSub13::load(SimpleFile *file, int param) {
|
||||
_field0 = file->readFloat();
|
||||
_field4 = file->readFloat();
|
||||
_field8 = file->readFloat();
|
||||
_position._x = file->readFloat();
|
||||
_position._y = file->readFloat();
|
||||
_position._z = file->readFloat();
|
||||
_fieldC = file->readFloat();
|
||||
_field10 = file->readFloat();
|
||||
_field14 = file->readFloat();
|
||||
@ -109,9 +106,9 @@ void CStarControlSub13::load(SimpleFile *file, int param) {
|
||||
}
|
||||
|
||||
void CStarControlSub13::save(SimpleFile *file, int indent) {
|
||||
file->writeFloatLine(_field0, indent);
|
||||
file->writeFloatLine(_field4, indent);
|
||||
file->writeFloatLine(_field8, indent);
|
||||
file->writeFloatLine(_position._x, indent);
|
||||
file->writeFloatLine(_position._y, indent);
|
||||
file->writeFloatLine(_position._z, indent);
|
||||
file->writeFloatLine(_fieldC, indent);
|
||||
file->writeFloatLine(_field10, indent);
|
||||
file->writeFloatLine(_field14, indent);
|
||||
@ -125,12 +122,18 @@ void CStarControlSub13::save(SimpleFile *file, int indent) {
|
||||
_matrix.save(file, indent);
|
||||
}
|
||||
|
||||
void CStarControlSub13::fn10(const void *src) {
|
||||
error("TODO: CStarControlSub13::fn10");
|
||||
void CStarControlSub13::setPosition(const FVector &v) {
|
||||
_position = v;
|
||||
_fieldD4 = 0;
|
||||
}
|
||||
|
||||
void CStarControlSub13::fn11(const FVector *v) {
|
||||
_matrix.fn1(v);
|
||||
void CStarControlSub13::setMatrix(const FMatrix &m) {
|
||||
_matrix = m;
|
||||
_fieldD4 = 0;
|
||||
}
|
||||
|
||||
void CStarControlSub13::fn11(const FVector &v) {
|
||||
_matrix.fn1(&v);
|
||||
_fieldD4 = 0;
|
||||
}
|
||||
|
||||
@ -176,4 +179,8 @@ void CStarControlSub13::fn13(double v1, double v2) {
|
||||
_field24 = v2 ? 2 : 0;
|
||||
}
|
||||
|
||||
void CStarControlSub13::getMatrix(FMatrix *matrix) {
|
||||
*matrix = _matrix;
|
||||
}
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
@ -31,9 +31,6 @@ namespace Titanic {
|
||||
|
||||
class CStarControlSub13 {
|
||||
private:
|
||||
double _field0;
|
||||
double _field4;
|
||||
double _field8;
|
||||
double _fieldC;
|
||||
double _field10;
|
||||
double _field14;
|
||||
@ -54,6 +51,8 @@ private:
|
||||
int _fieldD4;
|
||||
private:
|
||||
void setup(void *ptr);
|
||||
public:
|
||||
FVector _position;
|
||||
public:
|
||||
CStarControlSub13(void *ptr);
|
||||
CStarControlSub13(CStarControlSub13 *src);
|
||||
@ -70,11 +69,25 @@ public:
|
||||
*/
|
||||
void save(SimpleFile *file, int indent);
|
||||
|
||||
void fn10(const void *src);
|
||||
void fn11(const FVector *v);
|
||||
/**
|
||||
* Sets the position
|
||||
*/
|
||||
void setPosition(const FVector &v);
|
||||
|
||||
/**
|
||||
* Sets the matrix
|
||||
*/
|
||||
void setMatrix(const FMatrix &m);
|
||||
|
||||
void fn11(const FVector &v);
|
||||
void fn12();
|
||||
void fn13(double v1, double v2);
|
||||
|
||||
/**
|
||||
* Makes a copy of the instance's matrix into the passed matrix
|
||||
*/
|
||||
void getMatrix(FMatrix *matrix);
|
||||
|
||||
void setC(int v);
|
||||
void set10(int v);
|
||||
void set14(int v);
|
||||
|
@ -90,7 +90,7 @@ void CStarControlSub20::proc7() {
|
||||
}
|
||||
}
|
||||
|
||||
void CStarControlSub20::proc11(CErrorCode *errorCode, void *v2, void *v3) {
|
||||
void CStarControlSub20::proc11(CErrorCode &errorCode, FVector &v, const FMatrix &m) {
|
||||
if (_field4 > 0.0) {
|
||||
warning("TODO: CStarControlSub20::proc11");
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "titanic/support/simple_file.h"
|
||||
#include "titanic/star_control/error_code.h"
|
||||
#include "titanic/star_control/fmatrix.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
@ -51,9 +52,9 @@ public:
|
||||
virtual void proc6();
|
||||
virtual void proc7();
|
||||
virtual void proc8() {}
|
||||
virtual void proc9() {}
|
||||
virtual void proc9(FVector *v, int v2, FMatrix *matrix) {}
|
||||
virtual void proc10() {}
|
||||
virtual void proc11(CErrorCode *errorCode, void *v2, void *v3);
|
||||
virtual void proc11(CErrorCode &errorCode, FVector &v, const FMatrix &m);
|
||||
|
||||
/**
|
||||
* Set the data
|
||||
|
Loading…
Reference in New Issue
Block a user