diff options
author | Paul Gilbert | 2017-04-16 15:40:30 -0400 |
---|---|---|
committer | Paul Gilbert | 2017-04-16 15:40:54 -0400 |
commit | e1ea47eb5c029dea58ca6fa3336eec99e0b03d45 (patch) | |
tree | 1784786b84b433452af616e9440d7eb1d6f85d15 | |
parent | 4946f149b40ca421e7da6cad64ffbbf1b37744e3 (diff) | |
download | scummvm-rg350-e1ea47eb5c029dea58ca6fa3336eec99e0b03d45.tar.gz scummvm-rg350-e1ea47eb5c029dea58ca6fa3336eec99e0b03d45.tar.bz2 scummvm-rg350-e1ea47eb5c029dea58ca6fa3336eec99e0b03d45.zip |
TITANIC: Rename CStarControlSub13 to CViewport
-rw-r--r-- | engines/titanic/module.mk | 2 | ||||
-rw-r--r-- | engines/titanic/star_control/star_camera.cpp | 132 | ||||
-rw-r--r-- | engines/titanic/star_control/star_camera.h | 17 | ||||
-rw-r--r-- | engines/titanic/star_control/star_view.h | 4 | ||||
-rw-r--r-- | engines/titanic/star_control/viewport.cpp (renamed from engines/titanic/star_control/star_control_sub13.cpp) | 54 | ||||
-rw-r--r-- | engines/titanic/star_control/viewport.h (renamed from engines/titanic/star_control/star_control_sub13.h) | 18 |
6 files changed, 117 insertions, 110 deletions
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 305c341784..1228d73ae8 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -446,7 +446,6 @@ MODULE_OBJS := \ star_control/star_control_sub2.o \ star_control/star_control_sub7.o \ star_control/star_control_sub8.o \ - star_control/star_control_sub13.o \ star_control/star_control_sub21.o \ star_control/star_control_sub22.o \ star_control/star_control_sub23.o \ @@ -461,6 +460,7 @@ MODULE_OBJS := \ star_control/star_view.o \ star_control/surface_area.o \ star_control/surface_fader.o \ + star_control/viewport.o \ support/avi_surface.o \ support/direct_draw.o \ support/direct_draw_surface.o \ diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp index adcc7e4e94..de1ba6cf03 100644 --- a/engines/titanic/star_control/star_camera.cpp +++ b/engines/titanic/star_control/star_camera.cpp @@ -37,8 +37,8 @@ CStarCamera::CStarCamera(const CNavigationInfo *data) : setupHandler(data); } -CStarCamera::CStarCamera(CStarControlSub13 *src) : - _matrixRow(-1), _mover(nullptr), _field108(0), _sub13(src) { +CStarCamera::CStarCamera(CViewport *src) : + _matrixRow(-1), _mover(nullptr), _field108(0), _viewport(src) { } void CStarCamera::init() { @@ -57,8 +57,8 @@ CStarCamera::~CStarCamera() { deleteHandler(); } -void CStarCamera::proc2(const CStarControlSub13 *src) { - _sub13.copyFrom(src); +void CStarCamera::proc2(const CViewport *src) { + _viewport.copyFrom(src); } void CStarCamera::proc3(const CNavigationInfo *src) { @@ -67,58 +67,58 @@ void CStarCamera::proc3(const CNavigationInfo *src) { void CStarCamera::setPosition(const FVector &v) { if (!isLocked()) { - _sub13.setPosition(v); + _viewport.setPosition(v); set108(); } } void CStarCamera::proc5(const FVector &v) { if (!isLocked()) - _sub13.fn11(v); + _viewport.fn11(v); } void CStarCamera::proc6(int v) { if (!isLocked()) - _sub13.setC(v); + _viewport.setC(v); } void CStarCamera::proc7(int v) { if (!isLocked()) - _sub13.set10(v); + _viewport.set10(v); } void CStarCamera::proc8(int v) { if (!isLocked()) - _sub13.set14(v); + _viewport.set14(v); } void CStarCamera::proc9(int v) { if (!isLocked()) - _sub13.set18(v); + _viewport.set18(v); } void CStarCamera::proc10(int v) { if (!isLocked()) - _sub13.set1C(v); + _viewport.set1C(v); } void CStarCamera::proc11() { if (!isLocked()) - _sub13.fn12(); + _viewport.fn12(); } void CStarCamera::proc12(StarMode mode, double v2) { if (!isLocked()) - _sub13.fn13(mode, v2); + _viewport.fn13(mode, v2); } -void CStarCamera::proc13(CStarControlSub13 *dest) { - *dest = _sub13; +void CStarCamera::proc13(CViewport *dest) { + *dest = _viewport; } void CStarCamera::setDestination(const FVector &v) { - FMatrix matrix = _sub13.getMatrix(); - FVector vector = _sub13._position; + FMatrix matrix = _viewport.getMatrix(); + FVector vector = _viewport._position; _mover->moveTo(vector, v, matrix); } @@ -129,20 +129,20 @@ void CStarCamera::proc15(CErrorCode *errorCode) { if (!_matrix2) _matrix2 = new FMatrix(); - *_matrix1 = _sub13.getMatrix(); + *_matrix1 = _viewport.getMatrix(); *_matrix2 = *_matrix1; - FVector v1 = _sub13._position; - FVector v2 = _sub13._position; + FVector v1 = _viewport._position; + FVector v2 = _viewport._position; _mover->proc11(*errorCode, v2, *_matrix2); if (v1 != v2) { - _sub13.setPosition(v2); + _viewport.setPosition(v2); set108(); } if (*_matrix1 != *_matrix2) { - _sub13.setMatrix(*_matrix2); + _viewport.setMatrix(*_matrix2); } } @@ -164,60 +164,60 @@ void CStarCamera::proc19() { void CStarCamera::proc20(double factor) { if (!isLocked()) - _sub13.reposition(factor); + _viewport.reposition(factor); } void CStarCamera::proc21(const FPose &pose) { if (!isLocked()) { - _sub13.setPosition(pose); + _viewport.setPosition(pose); set108(); } } void CStarCamera::proc22(FMatrix &m) { if (!isLocked()) - _sub13.fn15(m); + _viewport.fn15(m); } FPose CStarCamera::getPose() { - return _sub13.getSub1(); + return _viewport.getSub1(); } FPose CStarCamera::getPose2() { - return _sub13.getSub2(); + return _viewport.getSub2(); } double CStarCamera::getThreshold() const { - return _sub13._field10; + return _viewport._field10; } double CStarCamera::proc26() const { - return _sub13._field14; + return _viewport._field14; } int CStarCamera::proc27() const { - return _sub13._field24; + return _viewport._field24; } FVector CStarCamera::proc28(int index, const FVector &src) { FVector dest; - dest._x = ((_sub13._valArray[index] + src._x) * _sub13._centerVector._x) - / (_sub13._centerVector._y * src._z); - dest._y = src._y * _sub13._centerVector._x / (_sub13._centerVector._z * src._z); + dest._x = ((_viewport._valArray[index] + src._x) * _viewport._centerVector._x) + / (_viewport._centerVector._y * src._z); + dest._y = src._y * _viewport._centerVector._x / (_viewport._centerVector._z * src._z); dest._z = src._z; return dest; } FVector CStarCamera::proc29(int index, const FVector &src) { - return _sub13.fn16(index, src); + return _viewport.fn16(index, src); } FVector CStarCamera::proc30(int index, const FVector &v) { - return _sub13.fn17(index, v); + return _viewport.fn17(index, v); } FVector CStarCamera::proc31(int index, const FVector &v) { - return _sub13.fn18(index, v); + return _viewport.fn18(index, v); } void CStarCamera::setViewportAngle(const FPoint &angles) { @@ -237,8 +237,8 @@ void CStarCamera::setViewportAngle(const FPoint &angles) { FPose subY(Y_AXIS, angles._x); FPose sub(subX, subY); - FMatrix m1 = _sub13.getMatrix(); - FVector tempV1 = _sub13._position; + FMatrix m1 = _viewport.getMatrix(); + FVector tempV1 = _viewport._position; FVector tempV2, tempV3, tempV4, tempV5, tempV6; tempV2._y = m1._row1._y * 100000.0; tempV2._z = m1._row1._z * 100000.0; @@ -312,8 +312,8 @@ void CStarCamera::setViewportAngle(const FPoint &angles) { tempV1 += row1; m1.set(tempV4, tempV5, tempV6); - _sub13.setMatrix(m1); - _sub13.setPosition(tempV1); + _viewport.setMatrix(m1); + _viewport.setPosition(tempV1); } else if (_matrixRow == 1) { FVector tempV2; DMatrix m1, m2, sub; @@ -332,8 +332,8 @@ void CStarCamera::setViewportAngle(const FPoint &angles) { subX = m1.fn1(); subX = subX.fn4(subY); - FMatrix m3 = _sub13.getMatrix(); - tempV2 = _sub13._position; + FMatrix m3 = _viewport.getMatrix(); + tempV2 = _viewport._position; multV._x = m3._row1._x * 1000000.0; multV._y = m3._row1._y * 1000000.0; multV._z = m3._row1._z * 1000000.0; @@ -386,8 +386,8 @@ void CStarCamera::setViewportAngle(const FPoint &angles) { tempV16 = tempV3; m3.set(mrow1, mrow2, mrow3); - _sub13.setMatrix(m3); - _sub13.setPosition(tempV16); + _viewport.setMatrix(m3); + _viewport.setPosition(tempV16); } } @@ -419,15 +419,15 @@ bool CStarCamera::removeMatrixRow() { } void CStarCamera::proc36(double *v1, double *v2, double *v3, double *v4) { - _sub13.fn19(v1, v2, v3, v4); + _viewport.fn19(v1, v2, v3, v4); } void CStarCamera::load(SimpleFile *file, int param) { - _sub13.load(file, param); + _viewport.load(file, param); } void CStarCamera::save(SimpleFile *file, int indent) { - _sub13.save(file, indent); + _viewport.save(file, indent); } bool CStarCamera::setupHandler(const CNavigationInfo *src) { @@ -464,12 +464,12 @@ void CStarCamera::deleteHandler() { } } -void CStarCamera::fn1(CStarControlSub13 *sub13, const FVector &v) { +void CStarCamera::fn1(CViewport *viewport, const FVector &v) { if (_matrixRow == 1) { - FMatrix m1 = sub13->getMatrix(); - FMatrix m2 = _sub13.getMatrix(); - FVector v1 = sub13->_position; - FVector v2 = _sub13._position; + FMatrix m1 = viewport->getMatrix(); + FMatrix m2 = _viewport.getMatrix(); + FVector v1 = viewport->_position; + FVector v2 = _viewport._position; _mover->proc8(v2, v1, m2, m1); CStarVector *sv = new CStarVector(this, v); @@ -480,19 +480,19 @@ void CStarCamera::fn1(CStarControlSub13 *sub13, const FVector &v) { void CStarCamera::fn2(FVector v1, FVector v2, FVector v3) { if (_matrixRow == -1) { FVector tempV; - tempV._z = _sub13._field10; + tempV._z = _viewport._field10; v3._z = v1._z; - tempV._x = _sub13._centerVector._z * v1._y * v1._z / _sub13._centerVector._x; - v3._y = _sub13._centerVector._y * tempV._z * v3._x / _sub13._centerVector._x; - v3._x = _sub13._centerVector._y * v1._x * v1._z / _sub13._centerVector._x - _sub13._valArray[2]; - tempV._y = _sub13._centerVector._z * tempV._z * v3._y / _sub13._centerVector._x; - tempV._x = tempV._x - _sub13._valArray[2]; + tempV._x = _viewport._centerVector._z * v1._y * v1._z / _viewport._centerVector._x; + v3._y = _viewport._centerVector._y * tempV._z * v3._x / _viewport._centerVector._x; + v3._x = _viewport._centerVector._y * v1._x * v1._z / _viewport._centerVector._x - _viewport._valArray[2]; + tempV._y = _viewport._centerVector._z * tempV._z * v3._y / _viewport._centerVector._x; + tempV._x = tempV._x - _viewport._valArray[2]; v3.normalize(); tempV.normalize(); - FMatrix matrix = _sub13.getMatrix(); - const FVector &pos = _sub13._position; + FMatrix matrix = _viewport.getMatrix(); + const FVector &pos = _viewport._position; _mover->proc10(v3, tempV, pos, matrix); CStarVector *sv = new CStarVector(this, v2); @@ -500,7 +500,7 @@ void CStarCamera::fn2(FVector v1, FVector v2, FVector v3) { } } -void CStarCamera::fn3(CStarControlSub13 *sub13, const FVector &v) { +void CStarCamera::fn3(CViewport *viewport, const FVector &v) { if (_matrixRow != 0) return; @@ -514,14 +514,14 @@ void CStarCamera::fn3(CStarControlSub13 *sub13, const FVector &v) { m1 = m1.fn4(m2); m2 = m1.fn1(); - DVector tempV2 = _sub13._position; + DVector tempV2 = _viewport._position; DMatrix m4; - m4._row1 = sub13->_position; + m4._row1 = viewport->_position; m4._row2 = DVector(0.0, 0.0, 0.0); m4._row3 = DVector(0.0, 0.0, 0.0); m4._row4 = DVector(0.0, 0.0, 0.0); - FMatrix m5 = sub13->getMatrix(); + FMatrix m5 = viewport->getMatrix(); DVector tempV3, tempV4; tempV4._x = m5._row1._x * 1000000.0 + m4._row1._x; tempV4._y = m5._row1._y * 1000000.0 + m4._row1._y; @@ -595,8 +595,8 @@ void CStarCamera::fn3(CStarControlSub13 *sub13, const FVector &v) { m5.set(m4._row3, m4._row2, m4._row4); FVector tempV6 = m4._row1; - FMatrix m6 = _sub13.getMatrix(); - _mover->proc8(_sub13._position, tempV6, m6, m5); + FMatrix m6 = _viewport.getMatrix(); + _mover->proc8(_viewport._position, tempV6, m6, m5); CStarVector *sv = new CStarVector(this, v); _mover->setVector(sv); diff --git a/engines/titanic/star_control/star_camera.h b/engines/titanic/star_control/star_camera.h index e389f14a4a..c759330d3e 100644 --- a/engines/titanic/star_control/star_camera.h +++ b/engines/titanic/star_control/star_camera.h @@ -27,12 +27,15 @@ #include "titanic/star_control/fmatrix.h" #include "titanic/star_control/fpoint.h" #include "titanic/star_control/base_stars.h" -#include "titanic/star_control/star_control_sub13.h" +#include "titanic/star_control/viewport.h" #include "titanic/star_control/camera_mover.h" #include "titanic/star_control/error_code.h" namespace Titanic { +/** + * Implements a reference point from which the starmap can be viewed + */ class CStarCamera { private: static FMatrix *_matrix1; @@ -41,7 +44,7 @@ private: int _matrixRow; FMatrix _matrix; CCameraMover *_mover; - CStarControlSub13 _sub13; + CViewport _viewport; int _field108; private: /** @@ -63,10 +66,10 @@ public: static void deinit(); public: CStarCamera(const CNavigationInfo *data); - CStarCamera(CStarControlSub13 *src); + CStarCamera(CViewport *src); virtual ~CStarCamera(); - virtual void proc2(const CStarControlSub13 *src); + virtual void proc2(const CViewport *src); virtual void proc3(const CNavigationInfo *src); virtual void setPosition(const FVector &v); virtual void proc5(const FVector &v); @@ -77,7 +80,7 @@ public: virtual void proc10(int v); virtual void proc11(); virtual void proc12(StarMode mode, double v2); - virtual void proc13(CStarControlSub13 *dest); + virtual void proc13(CViewport *dest); /** * Sets the destination to move the camera to @@ -133,9 +136,9 @@ public: void set108() { _field108 = true; } void reset108() { _field108 = false; } - void fn1(CStarControlSub13 *sub13, const FVector &v); + void fn1(CViewport *sub13, const FVector &v); void fn2(FVector v1, FVector v2, FVector v3); - void fn3(CStarControlSub13 *sub13, const FVector &v); + void fn3(CViewport *sub13, const FVector &v); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h index b1acad371a..99f2ef811b 100644 --- a/engines/titanic/star_control/star_view.h +++ b/engines/titanic/star_control/star_view.h @@ -26,7 +26,7 @@ #include "titanic/support/simple_file.h" #include "titanic/support/video_surface.h" #include "titanic/star_control/star_camera.h" -#include "titanic/star_control/star_control_sub13.h" +#include "titanic/star_control/viewport.h" #include "titanic/star_control/surface_fader.h" #include "titanic/star_control/error_code.h" #include "titanic/star_control/fvector.h" @@ -43,7 +43,7 @@ private: CVideoSurface *_videoSurface; CStarCamera _camera; bool _hasReference; - CStarControlSub13 _sub13; + CViewport _sub13; CSurfaceFader _fader; CVideoSurface *_videoSurface2; CGameObject *_homePhotoMask; diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/viewport.cpp index 8565d812f1..e759a05563 100644 --- a/engines/titanic/star_control/star_control_sub13.cpp +++ b/engines/titanic/star_control/viewport.cpp @@ -20,12 +20,12 @@ * */ -#include "titanic/star_control/star_control_sub13.h" +#include "titanic/star_control/viewport.h" #include "titanic/titanic.h" namespace Titanic { -CStarControlSub13::CStarControlSub13() { +CViewport::CViewport() { _fieldC = 0; _field10 = 800.0; _field14 = 10000.0; @@ -38,7 +38,7 @@ CStarControlSub13::CStarControlSub13() { Common::fill(&_valArray[0], &_valArray[5], 0.0); } -CStarControlSub13::CStarControlSub13(CStarControlSub13 *src) : +CViewport::CViewport(CViewport *src) : _matrix(src->_matrix), _sub1(src->_sub1), _sub2(src->_sub2) { _position = src->_position; _fieldC = src->_fieldC; @@ -57,11 +57,11 @@ CStarControlSub13::CStarControlSub13(CStarControlSub13 *src) : _flag = false; } -void CStarControlSub13::copyFrom(const CStarControlSub13 *src) { +void CViewport::copyFrom(const CViewport *src) { error("Unused function"); } -void CStarControlSub13::load(SimpleFile *file, int param) { +void CViewport::load(SimpleFile *file, int param) { _position._x = file->readFloat(); _position._y = file->readFloat(); _position._z = file->readFloat(); @@ -83,7 +83,7 @@ void CStarControlSub13::load(SimpleFile *file, int param) { _flag = false; } -void CStarControlSub13::save(SimpleFile *file, int indent) { +void CViewport::save(SimpleFile *file, int indent) { file->writeFloatLine(_position._x, indent); file->writeFloatLine(_position._y, indent); file->writeFloatLine(_position._z, indent); @@ -100,52 +100,52 @@ void CStarControlSub13::save(SimpleFile *file, int indent) { _matrix.save(file, indent); } -void CStarControlSub13::setPosition(const FVector &v) { +void CViewport::setPosition(const FVector &v) { debugC(DEBUG_INTERMEDIATE, kDebugStarfield, "Setting starmap position to %s", v.toString().c_str()); _position = v; _flag = false; } -void CStarControlSub13::setPosition(const FPose &pose) { +void CViewport::setPosition(const FPose &pose) { _position = _position.fn5(pose); _flag = false; } -void CStarControlSub13::setMatrix(const FMatrix &m) { +void CViewport::setMatrix(const FMatrix &m) { _matrix = m; _flag = false; } -void CStarControlSub13::fn11(const FVector &v) { +void CViewport::fn11(const FVector &v) { _matrix.fn1(v); _flag = false; } -void CStarControlSub13::setC(double v) { +void CViewport::setC(double v) { _fieldC = v; _flag = false; } -void CStarControlSub13::set10(double v) { +void CViewport::set10(double v) { _field10 = v; _flag = false; } -void CStarControlSub13::set14(double v) { +void CViewport::set14(double v) { _field10 = v; } -void CStarControlSub13::set18(double v) { +void CViewport::set18(double v) { _field18 = v; _flag = false; } -void CStarControlSub13::set1C(double v) { +void CViewport::set1C(double v) { _field1C = v; _flag = false; } -void CStarControlSub13::fn12() { +void CViewport::fn12() { _matrix.identity(); FPose m1(X_AXIS, g_vm->getRandomNumber(359)); @@ -160,7 +160,7 @@ void CStarControlSub13::fn12() { _flag = false; } -void CStarControlSub13::fn13(StarMode mode, double val) { +void CViewport::fn13(StarMode mode, double val) { if (mode == MODE_PHOTO) { _valArray[0] = val; _valArray[1] = -val; @@ -173,33 +173,33 @@ void CStarControlSub13::fn13(StarMode mode, double val) { _field24 = val ? 2 : 0; } -void CStarControlSub13::reposition(double factor) { +void CViewport::reposition(double factor) { _position._x = _matrix._row3._x * factor + _position._x; _position._y = _matrix._row3._y * factor + _position._y; _position._z = _matrix._row3._z * factor + _position._z; _flag = false; } -void CStarControlSub13::fn15(const FMatrix &matrix) { +void CViewport::fn15(const FMatrix &matrix) { _matrix.fn3(matrix); _flag = false; } -FPose CStarControlSub13::getSub1() { +FPose CViewport::getSub1() { if (!_flag) reset(); return _sub1; } -FPose CStarControlSub13::getSub2() { +FPose CViewport::getSub2() { if (!_flag) reset(); return _sub2; } -FVector CStarControlSub13::fn16(int index, const FVector &src) { +FVector CViewport::fn16(int index, const FVector &src) { FPose temp = getSub1(); FVector dest; @@ -212,7 +212,7 @@ FVector CStarControlSub13::fn16(int index, const FVector &src) { return dest; } -FVector CStarControlSub13::fn17(int index, const FVector &src) { +FVector CViewport::fn17(int index, const FVector &src) { FVector dest; FPose pose = getSub1(); FVector tv = src.fn5(pose); @@ -224,7 +224,7 @@ FVector CStarControlSub13::fn17(int index, const FVector &src) { return dest; } -FVector CStarControlSub13::fn18(int index, const FVector &src) { +FVector CViewport::fn18(int index, const FVector &src) { FVector dest; FPose pose = getSub2(); FVector tv = src.fn5(pose); @@ -236,14 +236,14 @@ FVector CStarControlSub13::fn18(int index, const FVector &src) { return dest; } -void CStarControlSub13::fn19(double *v1, double *v2, double *v3, double *v4) { +void CViewport::fn19(double *v1, double *v2, double *v3, double *v4) { *v1 = _centerVector._x / _centerVector._y; *v2 = _centerVector._x / _centerVector._z; *v3 = _valArray[3]; *v4 = _valArray[4]; } -void CStarControlSub13::reset() { +void CViewport::reset() { const double FACTOR = 2 * M_PI / 360.0; _sub2.copyFrom(_matrix); @@ -257,7 +257,7 @@ void CStarControlSub13::reset() { _flag = true; } -const FMatrix &CStarControlSub13::getMatrix() const { +const FMatrix &CViewport::getMatrix() const { return _matrix; } diff --git a/engines/titanic/star_control/star_control_sub13.h b/engines/titanic/star_control/viewport.h index ccf2cb8ce9..d984771680 100644 --- a/engines/titanic/star_control/star_control_sub13.h +++ b/engines/titanic/star_control/viewport.h @@ -20,8 +20,8 @@ * */ -#ifndef TITANIC_STAR_CONTROL_SUB13_H -#define TITANIC_STAR_CONTROL_SUB13_H +#ifndef TITANIC_VIEWPORT_H +#define TITANIC_VIEWPORT_H #include "titanic/support/simple_file.h" #include "titanic/star_control/base_stars.h" @@ -30,7 +30,11 @@ namespace Titanic { -class CStarControlSub13 { +/** + * Implements the viewport functionality for viewing the star field in + * a given position and orientation + */ +class CViewport { private: double _fieldC; double _field18; @@ -52,13 +56,13 @@ public: double _valArray[5]; FVector _centerVector; public: - CStarControlSub13(); - CStarControlSub13(CStarControlSub13 *src); + CViewport(); + CViewport(CViewport *src); /** * Copys the data from another instance */ - void copyFrom(const CStarControlSub13 *src); + void copyFrom(const CViewport *src); /** * Load the data for the class from file @@ -111,4 +115,4 @@ public: } // End of namespace Titanic -#endif /* TITANIC_STAR_CONTROL_SUB13_H */ +#endif /* TITANIC_VIEWPORT_H */ |