diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/module.mk | 2 | ||||
-rw-r--r-- | engines/titanic/star_control/photo_crosshairs.cpp (renamed from engines/titanic/star_control/star_control_sub8.cpp) | 30 | ||||
-rw-r--r-- | engines/titanic/star_control/photo_crosshairs.h (renamed from engines/titanic/star_control/star_control_sub8.h) | 12 | ||||
-rw-r--r-- | engines/titanic/star_control/star_field.cpp | 26 | ||||
-rw-r--r-- | engines/titanic/star_control/star_field.h | 4 | ||||
-rw-r--r-- | engines/titanic/star_control/star_view.cpp | 2 |
6 files changed, 39 insertions, 37 deletions
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 2e53070a8c..c90fb91308 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -443,11 +443,11 @@ MODULE_OBJS := \ star_control/fvector.o \ star_control/matrix_transform.o \ star_control/orientation_changer.o \ + star_control/photo_crosshairs.o \ star_control/star_camera.o \ star_control/star_closeup.o \ star_control/star_control_sub2.o \ star_control/star_control_sub7.o \ - star_control/star_control_sub8.o \ star_control/star_control_sub21.o \ star_control/star_control_sub22.o \ star_control/star_control_sub23.o \ diff --git a/engines/titanic/star_control/star_control_sub8.cpp b/engines/titanic/star_control/photo_crosshairs.cpp index 470b357c00..061bd358fa 100644 --- a/engines/titanic/star_control/star_control_sub8.cpp +++ b/engines/titanic/star_control/photo_crosshairs.cpp @@ -20,7 +20,7 @@ * */ -#include "titanic/star_control/star_control_sub8.h" +#include "titanic/star_control/photo_crosshairs.h" #include "titanic/star_control/star_control_sub7.h" #include "titanic/star_control/star_camera.h" #include "titanic/star_control/star_field.h" @@ -28,10 +28,10 @@ namespace Titanic { -CStarControlSub8::CStarControlSub8() : _field8(-1), _entryIndex(-1) { +CPhotoCrosshairs::CPhotoCrosshairs() : _field8(-1), _entryIndex(-1) { } -void CStarControlSub8::selectStar(int index, CVideoSurface *surface, +void CPhotoCrosshairs::selectStar(int index, CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7) { if (_entryIndex >= 0) { if (_entryIndex == _field8) { @@ -93,7 +93,7 @@ void CStarControlSub8::selectStar(int index, CVideoSurface *surface, } } -bool CStarControlSub8::fn1(CStarField *starField, CSurfaceArea *surfaceArea, CStarCamera *camera) { +bool CPhotoCrosshairs::fn1(CStarField *starField, CSurfaceArea *surfaceArea, CStarCamera *camera) { int count = starField->baseFn2(surfaceArea, camera); if (count > 0) { @@ -107,7 +107,7 @@ bool CStarControlSub8::fn1(CStarField *starField, CSurfaceArea *surfaceArea, CSt } } -void CStarControlSub8::fn2(CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7) { +void CPhotoCrosshairs::fn2(CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7) { if (_field8 <= -1) { if (_entryIndex > -1) { fn5(_entryIndex, surface, starField, sub7); @@ -122,17 +122,17 @@ void CStarControlSub8::fn2(CVideoSurface *surface, CStarField *starField, CStarC } } -void CStarControlSub8::fn3() { +void CPhotoCrosshairs::fn3() { if (_field8 < 3) ++_field8; } -FPoint CStarControlSub8::getPosition() const { +FPoint CPhotoCrosshairs::getPosition() const { return (_entryIndex >= 0 && _entryIndex <= 2) ? FPoint(_entries[_entryIndex]) : FPoint(); } -void CStarControlSub8::draw(CSurfaceArea *surfaceArea) { +void CPhotoCrosshairs::draw(CSurfaceArea *surfaceArea) { if (!_positions.empty()) { uint savedPixel = surfaceArea->_pixel; surfaceArea->_pixel = 0xff; @@ -155,7 +155,7 @@ void CStarControlSub8::draw(CSurfaceArea *surfaceArea) { } } -void CStarControlSub8::allocate(int count) { +void CPhotoCrosshairs::allocate(int count) { if (!_positions.empty()) { if ((int)_positions.size() == count) return; @@ -166,12 +166,12 @@ void CStarControlSub8::allocate(int count) { _positions.resize(count); } -void CStarControlSub8::clear() { +void CPhotoCrosshairs::clear() { _positions.clear(); _field8 = _entryIndex = -1; } -int CStarControlSub8::indexOf(const Common::Point &pt) const { +int CPhotoCrosshairs::indexOf(const Common::Point &pt) const { Common::Rect r(pt.x - 2, pt.y - 2, pt.x + 2, pt.y + 2); for (int idx = 0; idx < (int)_positions.size(); ++idx) { @@ -182,14 +182,14 @@ int CStarControlSub8::indexOf(const Common::Point &pt) const { return -1; } -void CStarControlSub8::fn4(int index, CSurfaceArea *surfaceArea) { +void CPhotoCrosshairs::fn4(int index, CSurfaceArea *surfaceArea) { if (index >= 0 && index < (int)_positions.size()) { const CStarPosition &pt = _positions[index]; fn7(pt, surfaceArea); } } -void CStarControlSub8::fn5(int index, CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7) { +void CPhotoCrosshairs::fn5(int index, CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7) { surface->lock(); CSurfaceArea surfaceArea(surface); fn7(_positions[index + 1], &surfaceArea); @@ -199,12 +199,12 @@ void CStarControlSub8::fn5(int index, CVideoSurface *surface, CStarField *starFi sub7->addStar(starP); } -void CStarControlSub8::fn6(CSurfaceArea *surfaceArea) { +void CPhotoCrosshairs::fn6(CSurfaceArea *surfaceArea) { const CStarPosition &pt = _positions[_entryIndex]; fn7(pt, surfaceArea); } -void CStarControlSub8::fn7(const FPoint &pt, CSurfaceArea *surfaceArea) { +void CPhotoCrosshairs::fn7(const FPoint &pt, CSurfaceArea *surfaceArea) { uint savedPixel = surfaceArea->_pixel; surfaceArea->_pixel = 255; surfaceArea->setColorFromPixel(); diff --git a/engines/titanic/star_control/star_control_sub8.h b/engines/titanic/star_control/photo_crosshairs.h index 7c965826b5..469c425006 100644 --- a/engines/titanic/star_control/star_control_sub8.h +++ b/engines/titanic/star_control/photo_crosshairs.h @@ -20,8 +20,8 @@ * */ -#ifndef TITANIC_STAR_CONTROL_SUB8_H -#define TITANIC_STAR_CONTROL_SUB8_H +#ifndef TITANIC_PHOTO_CROSSHAIRS_H +#define TITANIC_PHOTO_CROSSHAIRS_H #include "common/array.h" #include "common/rect.h" @@ -37,7 +37,7 @@ class CStarField; class CStarControlSub7; class CStarCamera; -class CStarControlSub8 { +class CPhotoCrosshairs { private: Common::Array<CStarPosition> _positions; int _entryIndex; @@ -56,8 +56,8 @@ public: int _field8; int _fieldC; public: - CStarControlSub8(); - ~CStarControlSub8() { clear(); } + CPhotoCrosshairs(); + ~CPhotoCrosshairs() { clear(); } /** * Load the data for the class from file @@ -91,4 +91,4 @@ public: } // End of namespace Titanic -#endif /* TITANIC_STAR_CONTROL_SUB8_H */ +#endif /* TITANIC_PHOTO_CROSSHAIRS_H */ diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp index ea65495e0b..54ad3f6b20 100644 --- a/engines/titanic/star_control/star_field.cpp +++ b/engines/titanic/star_control/star_field.cpp @@ -33,7 +33,7 @@ CStarField::CStarField() : _points1On(false), _points2On(false), _mode(MODE_STAR void CStarField::load(SimpleFile *file) { _sub7.load(file); - _sub8.load(file); + _crosshairs.load(file); _points1On = file->readNumber(); _points2On = file->readNumber(); _mode = (StarMode)file->readNumber(); @@ -43,7 +43,7 @@ void CStarField::load(SimpleFile *file) { void CStarField::save(SimpleFile *file, int indent) { _sub7.save(file, indent); - _sub8.save(file, indent); + _crosshairs.save(file, indent); file->writeNumberLine(_points1On, indent); file->writeNumberLine(_points2On, indent); file->writeNumberLine(_mode, indent); @@ -70,7 +70,7 @@ void CStarField::render(CVideoSurface *surface, CStarCamera *camera) { drawCrosshairs(&surfaceArea); _sub7.draw(&surfaceArea, camera, nullptr); - _sub8.draw(&surfaceArea); + _crosshairs.draw(&surfaceArea); if (_points2On) _points2.draw(&surfaceArea, camera); @@ -123,7 +123,7 @@ bool CStarField::setCrosshairs(bool isVisible) { } int CStarField::get88() const { - return _sub8._field8; + return _crosshairs._field8; } int CStarField::get5() const { @@ -131,7 +131,7 @@ int CStarField::get5() const { } void CStarField::setSolved() { - _isSolved = _sub8._field8 == 2; + _isSolved = _crosshairs._field8 == 2; } bool CStarField::isSolved() const { @@ -183,10 +183,10 @@ void CStarField::fn4(CSurfaceArea *surfaceArea, CStarCamera *camera) { double CStarField::fn5(CSurfaceArea *surfaceArea, CStarCamera *camera, FVector &v1, FVector &v2, FVector &v3) { - if (_sub8._fieldC < 0) + if (_crosshairs._fieldC < 0) return -1.0; - const CBaseStarEntry *dataP = _sub7.getDataPtr(_sub8._fieldC); + const CBaseStarEntry *dataP = _sub7.getDataPtr(_crosshairs._fieldC); v2 = dataP->_position; FVector tv = camera->proc29(2, v2); @@ -197,7 +197,7 @@ double CStarField::fn5(CSurfaceArea *surfaceArea, CStarCamera *camera, v1 = FVector(tv._x + surfaceArea->_centroid._x, tv._y + surfaceArea->_centroid._y, tv._z); - FPoint pt = _sub8.getPosition(); + FPoint pt = _crosshairs.getPosition(); v3 = FVector(pt._x, pt._y, 1.0); double incr = (v1._x - pt._x) * (v1._x - pt._x); @@ -212,16 +212,16 @@ double CStarField::fn5(CSurfaceArea *surfaceArea, CStarCamera *camera, void CStarField::fn6(CVideoSurface *surface, CStarCamera *camera) { CSurfaceArea surfaceArea(surface); - _sub8.fn1(this, &surfaceArea, camera); + _crosshairs.fn1(this, &surfaceArea, camera); } void CStarField::fn7() { - _sub8.fn3(); + _crosshairs.fn3(); setSolved(); } void CStarField::fn8(CVideoSurface *surface) { - _sub8.fn2(surface, this, &_sub7); + _crosshairs.fn2(surface, this, &_sub7); setSolved(); } @@ -231,9 +231,9 @@ bool CStarField::mouseButtonDown(CVideoSurface *surface, CStarCamera *camera, CSurfaceArea surfaceArea(surface); return selectStar(&surfaceArea, camera, pt); } else { - int starNum = _sub8.indexOf(pt); + int starNum = _crosshairs.indexOf(pt); if (starNum >= 0) { - _sub8.selectStar(starNum, surface, this, &_sub7); + _crosshairs.selectStar(starNum, surface, this, &_sub7); return true; } diff --git a/engines/titanic/star_control/star_field.h b/engines/titanic/star_control/star_field.h index 0d80e27d9d..aed5cec1ae 100644 --- a/engines/titanic/star_control/star_field.h +++ b/engines/titanic/star_control/star_field.h @@ -26,7 +26,7 @@ #include "titanic/star_control/star_control_sub2.h" #include "titanic/star_control/star_closeup.h" #include "titanic/star_control/star_control_sub7.h" -#include "titanic/star_control/star_control_sub8.h" +#include "titanic/star_control/photo_crosshairs.h" #include "titanic/star_control/star_points1.h" #include "titanic/star_control/star_points2.h" @@ -35,7 +35,7 @@ namespace Titanic { class CStarField : public CStarControlSub2 { private: CStarControlSub7 _sub7; - CStarControlSub8 _sub8; + CPhotoCrosshairs _crosshairs; CStarPoints1 _points1; CStarPoints2 _points2; CStarCloseup _starCloseup; diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp index fad85914c0..689020342e 100644 --- a/engines/titanic/star_control/star_view.cpp +++ b/engines/titanic/star_control/star_view.cpp @@ -426,10 +426,12 @@ void CStarView::fn18(CStarCamera *camera) { int oldVal = _starField->get54(); bool oldCrosshairs = _starField->setCrosshairs(false); + // Render the starfield for the photograph view _photoSurface->clear(); _photoSurface->lock(); _starField->render(_photoSurface, camera); + // Render any previously set crosshairs _starField->setCrosshairs(oldCrosshairs); _starField->set54(oldVal); _starField->fn6(_photoSurface, camera); |