diff options
9 files changed, 69 insertions, 65 deletions
diff --git a/engines/titanic/star_control/star_control_sub12.cpp b/engines/titanic/star_control/star_control_sub12.cpp index 85b7c83878..5840495d34 100644 --- a/engines/titanic/star_control/star_control_sub12.cpp +++ b/engines/titanic/star_control/star_control_sub12.cpp @@ -29,10 +29,10 @@ namespace Titanic { FMatrix *CStarControlSub12::_matrix1; FMatrix *CStarControlSub12::_matrix2; -CStarControlSub12::CStarControlSub12(void *val1, void *val2) : +CStarControlSub12::CStarControlSub12(void *val1, const CStar20Data *data) : _currentIndex(-1), _handlerP(nullptr), _field108(0), _sub13(val1) { - setupHandler(val2); + setupHandler(data); } CStarControlSub12::CStarControlSub12(CStarControlSub13 *src) : @@ -59,8 +59,8 @@ void CStarControlSub12::proc2(const void *src) { _sub13.copyFrom(src); } -void CStarControlSub12::proc3(const void *src) { - _handlerP->copyFrom1(src); +void CStarControlSub12::proc3(const CStar20Data *src) { + _handlerP->copyFrom(src); } void CStarControlSub12::setPosition(const FVector &v) { @@ -246,7 +246,7 @@ void CStarControlSub12::save(SimpleFile *file, int indent) { _sub13.save(file, indent); } -bool CStarControlSub12::setupHandler(void *src) { +bool CStarControlSub12::setupHandler(const CStar20Data *src) { CStarControlSub20 *handler = nullptr; switch (_currentIndex) { diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h index 1d5f693d20..8da45df5c0 100644 --- a/engines/titanic/star_control/star_control_sub12.h +++ b/engines/titanic/star_control/star_control_sub12.h @@ -44,7 +44,7 @@ private: /** * Set up a handler */ - bool setupHandler(void *src); + bool setupHandler(const CStar20Data *src); /** * Deletes any previous handler @@ -59,12 +59,12 @@ public: static void init(); static void deinit(); public: - CStarControlSub12(void *val1, void *val2); + CStarControlSub12(void *val1, const CStar20Data *data); CStarControlSub12(CStarControlSub13 *src); virtual ~CStarControlSub12(); virtual void proc2(const void *src); - virtual void proc3(const void *src); + virtual void proc3(const CStar20Data *src); virtual void setPosition(const FVector &v); virtual void proc5(const FVector &v); virtual void proc6(int v); diff --git a/engines/titanic/star_control/star_control_sub20.cpp b/engines/titanic/star_control/star_control_sub20.cpp index 3611478100..36e70367b5 100644 --- a/engines/titanic/star_control/star_control_sub20.cpp +++ b/engines/titanic/star_control/star_control_sub20.cpp @@ -25,21 +25,21 @@ namespace Titanic { -CStarControlSub20::CStarControlSub20(void *src) { +CStarControlSub20::CStarControlSub20(const CStar20Data *src) { _lockCounter = 0; _dataP = nullptr; if (src) { - copyFrom1(src); + copyFrom(src); } else { - _field4 = 0.0; - _field8 = 0.0; - _fieldC = 20.0; - _field10 = 0.0; - _field14 = 50000.0; - _field18 = 1.0; - _field1C = 1.0; - _field20 = 0.0; + _data._field0 = 0.0; + _data._field4 = 0.0; + _data._field8 = 20.0; + _data._fieldC = 0.0; + _data._field10 = 50000.0; + _data._field14 = 1.0; + _data._field18 = 1.0; + _data._field1C = 0.0; } } @@ -47,51 +47,51 @@ CStarControlSub20::~CStarControlSub20() { clear(); } -void CStarControlSub20::copyFrom1(const void *src) { - error("TODO: CStarControlSub20::copyFrom1"); +void CStarControlSub20::copyFrom(const CStar20Data *src) { + _data = *src; } -void CStarControlSub20::copyFrom2(const void *src) { - error("TODO: CStarControlSub20::copyFrom2"); +void CStarControlSub20::copyTo(CStar20Data *dest) { + *dest = _data; } void CStarControlSub20::proc4() { - if (!isLocked() && _field4 < _field14) { - _field8 += _field4; - if (_fieldC == _field8) - _field4 -= _field8; + if (!isLocked() && _data._field0 < _data._field10) { + _data._field4 += _data._field0; + if (_data._field8 == _data._field4) + _data._field0 -= _data._field4; else - _field4 += _field8; + _data._field0 += _data._field4; } } void CStarControlSub20::proc5() { if (!isLocked()) { - _field8 -= _fieldC; - if (_field8 == _field4) - _field4 += _field8; + _data._field4 -= _data._field8; + if (_data._field4 == _data._field0) + _data._field0 += _data._field4; else - _field4 -= _field8; + _data._field0 -= _data._field4; - if (_field8 < 0.0) - _field8 = 0.0; + if (_data._field4 < 0.0) + _data._field4 = 0.0; } } void CStarControlSub20::proc6() { if (!isLocked()) - _field4 = _field14; + _data._field0 = _data._field10; } void CStarControlSub20::proc7() { if (!isLocked()) { - _field4 = 0.0; - _field8 = 0.0; + _data._field0 = 0.0; + _data._field4 = 0.0; } } void CStarControlSub20::proc11(CErrorCode &errorCode, FVector &v, const FMatrix &m) { - if (_field4 > 0.0) { + if (_data._field0 > 0.0) { warning("TODO: CStarControlSub20::proc11"); } } @@ -110,26 +110,26 @@ void CStarControlSub20::clear() { void CStarControlSub20::load(SimpleFile *file, int val) { if (!val) { - _field4 = file->readFloat(); - _field8 = file->readFloat(); - _fieldC = file->readFloat(); - _field10 = file->readFloat(); - _field14 = file->readFloat(); - _field18 = file->readFloat(); - _field1C = file->readFloat(); - _field20 = file->readFloat(); + _data._field0 = file->readFloat(); + _data._field4 = file->readFloat(); + _data._field8 = file->readFloat(); + _data._fieldC = file->readFloat(); + _data._field10 = file->readFloat(); + _data._field14 = file->readFloat(); + _data._field18 = file->readFloat(); + _data._field1C = file->readFloat(); } } void CStarControlSub20::save(SimpleFile *file, int indent) { - file->writeFloatLine(_field4, indent); - file->writeFloatLine(_field8, indent); - file->writeFloatLine(_fieldC, indent); - file->writeFloatLine(_field10, indent); - file->writeFloatLine(_field14, indent); - file->writeFloatLine(_field18, indent); - file->writeFloatLine(_field1C, indent); - file->writeFloatLine(_field20, indent); + file->writeFloatLine(_data._field0, indent); + file->writeFloatLine(_data._field4, indent); + file->writeFloatLine(_data._field8, indent); + file->writeFloatLine(_data._fieldC, indent); + file->writeFloatLine(_data._field10, indent); + file->writeFloatLine(_data._field14, indent); + file->writeFloatLine(_data._field18, indent); + file->writeFloatLine(_data._field1C, indent); } void CStarControlSub20::incLockCount() { diff --git a/engines/titanic/star_control/star_control_sub20.h b/engines/titanic/star_control/star_control_sub20.h index eaa9d4fecd..66e10a8145 100644 --- a/engines/titanic/star_control/star_control_sub20.h +++ b/engines/titanic/star_control/star_control_sub20.h @@ -29,8 +29,8 @@ namespace Titanic { -class CStarControlSub20 { -public: +struct CStar20Data { + double _field0; double _field4; double _field8; double _fieldC; @@ -38,15 +38,19 @@ public: double _field14; double _field18; double _field1C; - double _field20; +}; + +class CStarControlSub20 { +public: + CStar20Data _data; int _lockCounter; void *_dataP; public: - CStarControlSub20(void *src); + CStarControlSub20(const CStar20Data *src); virtual ~CStarControlSub20(); - virtual void copyFrom1(const void *src); - virtual void copyFrom2(const void *src); + virtual void copyFrom(const CStar20Data *src); + virtual void copyTo(CStar20Data *dest); virtual void proc4(); virtual void proc5(); virtual void proc6(); diff --git a/engines/titanic/star_control/star_control_sub21.cpp b/engines/titanic/star_control/star_control_sub21.cpp index 20b8bc5f86..1730244184 100644 --- a/engines/titanic/star_control/star_control_sub21.cpp +++ b/engines/titanic/star_control/star_control_sub21.cpp @@ -25,7 +25,7 @@ namespace Titanic { -CStarControlSub21::CStarControlSub21(void *src) : +CStarControlSub21::CStarControlSub21(const CStar20Data *src) : CStarControlSub20(src), _sub24() { } diff --git a/engines/titanic/star_control/star_control_sub21.h b/engines/titanic/star_control/star_control_sub21.h index 610f26ec65..5febda0ebb 100644 --- a/engines/titanic/star_control/star_control_sub21.h +++ b/engines/titanic/star_control/star_control_sub21.h @@ -32,7 +32,7 @@ class CStarControlSub21 : public CStarControlSub20 { private: CStarControlSub24 _sub24; public: - CStarControlSub21(void *src); + CStarControlSub21(const CStar20Data *src); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub22.cpp b/engines/titanic/star_control/star_control_sub22.cpp index 9298d5b6de..b06731b6d2 100644 --- a/engines/titanic/star_control/star_control_sub22.cpp +++ b/engines/titanic/star_control/star_control_sub22.cpp @@ -25,7 +25,7 @@ namespace Titanic { -CStarControlSub22::CStarControlSub22(void *src) : +CStarControlSub22::CStarControlSub22(const CStar20Data *src) : CStarControlSub20(src), _sub27() { } diff --git a/engines/titanic/star_control/star_control_sub22.h b/engines/titanic/star_control/star_control_sub22.h index dae231f703..88a114f8c3 100644 --- a/engines/titanic/star_control/star_control_sub22.h +++ b/engines/titanic/star_control/star_control_sub22.h @@ -32,7 +32,7 @@ class CStarControlSub22 : public CStarControlSub20 { private: CStarControlSub27 _sub27; public: - CStarControlSub22(void *src); + CStarControlSub22(const CStar20Data *src); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp index 5140dc086f..f5d1d36c49 100644 --- a/engines/titanic/star_control/star_view.cpp +++ b/engines/titanic/star_control/star_view.cpp @@ -32,10 +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) { - static const uint DATA[8] = { 0, 0, 0x47C35000, 0, 0x41A00000, + CStar20Data data = { 0, 0, 0x47C35000, 0, 0x41A00000, 0x3F800000, 0x3F800000, 0x3F800000 }; - _sub12.proc3(&DATA[0]); + _sub12.proc3(&data); } void CStarView::load(SimpleFile *file, int param) { |