diff options
author | Paul Gilbert | 2017-05-30 20:01:49 -0400 |
---|---|---|
committer | Paul Gilbert | 2017-05-30 20:01:49 -0400 |
commit | 56474edca06e386948c7288d4f2a23cbf40f2767 (patch) | |
tree | a7eae123655291e0c2c20860172f04258285e4a0 /engines/titanic | |
parent | 6e46535c92fdfcc3a69b1dbec3f46dc5f818b6bf (diff) | |
download | scummvm-rg350-56474edca06e386948c7288d4f2a23cbf40f2767.tar.gz scummvm-rg350-56474edca06e386948c7288d4f2a23cbf40f2767.tar.bz2 scummvm-rg350-56474edca06e386948c7288d4f2a23cbf40f2767.zip |
TITANIC: Cleanup & fixes for starfield viewpoint box
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/star_control/star_closeup.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/star_control/star_crosshairs.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/star_control/star_field.cpp | 18 | ||||
-rw-r--r-- | engines/titanic/star_control/star_field.h | 10 | ||||
-rw-r--r-- | engines/titanic/star_control/star_markers.cpp | 14 | ||||
-rw-r--r-- | engines/titanic/star_control/star_points1.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/star_control/star_points2.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/star_control/star_view.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/star_control/star_view.h | 4 | ||||
-rw-r--r-- | engines/titanic/star_control/surface_area.cpp | 24 | ||||
-rw-r--r-- | engines/titanic/star_control/surface_area.h | 6 |
12 files changed, 53 insertions, 47 deletions
diff --git a/engines/titanic/star_control/star_closeup.cpp b/engines/titanic/star_control/star_closeup.cpp index c5e5e584db..3af7d556cc 100644 --- a/engines/titanic/star_control/star_closeup.cpp +++ b/engines/titanic/star_control/star_closeup.cpp @@ -291,7 +291,7 @@ void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector } if (val2 <= 0) { - surfaceArea->setMode(SA_NONE); + surfaceArea->setMode(SA_SOLID); surfaceArea->_pixel = MKTAG_BE(entryP->_pixel1, entryP->_pixel2, entryP->_pixel3, 0); surfaceArea->setColorFromPixel(); @@ -314,7 +314,7 @@ void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector } } } else { - surfaceArea->setMode(SA_NONE); + surfaceArea->setMode(SA_SOLID); surfaceArea->_pixel = entryP->_pixel1; surfaceArea->setColorFromPixel(); @@ -396,7 +396,7 @@ void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector } if (val2 <= 0) { - surfaceArea->setMode(SA_NONE); + surfaceArea->setMode(SA_SOLID); surfaceArea->_pixel = pixel1; surfaceArea->setColorFromPixel(); @@ -418,7 +418,7 @@ void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector } } } else { - surfaceArea->setMode(SA_NONE); + surfaceArea->setMode(SA_SOLID); surfaceArea->_pixel = pixel2; surfaceArea->setColorFromPixel(); diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index 05e37ca96f..06ab3d363a 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -215,7 +215,7 @@ void CStarControl::doAction(StarControlAction action) { break; case STAR_11: - _view.toggleCrosshairs(); + _view.toggleBox(); break; case STAR_12: diff --git a/engines/titanic/star_control/star_crosshairs.cpp b/engines/titanic/star_control/star_crosshairs.cpp index 2f64505d32..4c8a1c8c69 100644 --- a/engines/titanic/star_control/star_crosshairs.cpp +++ b/engines/titanic/star_control/star_crosshairs.cpp @@ -161,7 +161,7 @@ void CStarCrosshairs::draw(CSurfaceArea *surfaceArea) { uint savedPixel = surfaceArea->_pixel; surfaceArea->_pixel = 0xff; surfaceArea->setColorFromPixel(); - SurfaceAreaMode savedMode = surfaceArea->setMode(SA_NONE); + SurfaceAreaMode savedMode = surfaceArea->setMode(SA_SOLID); for (int idx = 0; idx < _entryIndex; ++idx) { const CStarPosition &src = _entries[idx]; diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp index 669423bc60..13afb59c49 100644 --- a/engines/titanic/star_control/star_field.cpp +++ b/engines/titanic/star_control/star_field.cpp @@ -28,7 +28,7 @@ namespace Titanic { CStarField::CStarField() : _points1On(false), _points2On(false), _mode(MODE_STARFIELD), - _showCrosshairs(true), _val5(0), _isSolved(false) { + _showBox(true), _val5(0), _isSolved(false) { } void CStarField::load(SimpleFile *file) { @@ -37,7 +37,7 @@ void CStarField::load(SimpleFile *file) { _points1On = file->readNumber(); _points2On = file->readNumber(); _mode = (StarMode)file->readNumber(); - _showCrosshairs = file->readNumber(); + _showBox = file->readNumber(); _isSolved = file->readNumber(); } @@ -47,7 +47,7 @@ void CStarField::save(SimpleFile *file, int indent) { file->writeNumberLine(_points1On, indent); file->writeNumberLine(_points2On, indent); file->writeNumberLine(_mode, indent); - file->writeNumberLine(_showCrosshairs, indent); + file->writeNumberLine(_showBox, indent); file->writeNumberLine(_isSolved, indent); } @@ -66,7 +66,7 @@ bool CStarField::initDocument() { void CStarField::render(CVideoSurface *surface, CStarCamera *camera) { CSurfaceArea surfaceArea(surface); draw(&surfaceArea, camera, &_starCloseup); - if (_showCrosshairs) + if (_showBox) drawBox(&surfaceArea); _markers.draw(&surfaceArea, camera, nullptr); @@ -112,13 +112,13 @@ void CStarField::setMode(StarMode mode) { _mode = mode; } -void CStarField::toggleCrosshairs() { - _showCrosshairs = !_showCrosshairs; +void CStarField::toggleBox() { + _showBox = !_showBox; } -bool CStarField::setCrosshairs(bool isVisible) { - bool oldVal = _showCrosshairs; - _showCrosshairs = isVisible; +bool CStarField::setBoxVisible(bool isVisible) { + bool oldVal = _showBox; + _showBox = isVisible; return oldVal; } diff --git a/engines/titanic/star_control/star_field.h b/engines/titanic/star_control/star_field.h index ecac23eac3..1cca40567b 100644 --- a/engines/titanic/star_control/star_field.h +++ b/engines/titanic/star_control/star_field.h @@ -42,7 +42,7 @@ private: bool _points1On; bool _points2On; StarMode _mode; - bool _showCrosshairs; + bool _showBox; int _val5; bool _isSolved; private: @@ -90,14 +90,14 @@ public: void setMode(StarMode mode); /** - * Toggles whether the crosshairs box is visible + * Toggles whether the big box is visible */ - void toggleCrosshairs(); + void toggleBox(); /** - * Sets whether the crosshairs box is visible + * Sets whether the big box is visible */ - bool setCrosshairs(bool isVisible); + bool setBoxVisible(bool isVisible); /** * Returns the index for the number of star matches diff --git a/engines/titanic/star_control/star_markers.cpp b/engines/titanic/star_control/star_markers.cpp index fd64458f79..5fa059c6f0 100644 --- a/engines/titanic/star_control/star_markers.cpp +++ b/engines/titanic/star_control/star_markers.cpp @@ -34,7 +34,7 @@ void CStarMarkers::draw(CSurfaceArea *surfaceArea, CStarCamera *camera, CStarClo FPoint center((double)surfaceArea->_width * 0.5, surfaceArea->_height * 0.5); FVector newV; - int x1, x2, x3, y1, y2, y3; + double x1, x2, x3, y1, y2, y3; uint savedPixel = surfaceArea->_pixel; surfaceArea->_pixel = 0xffff; @@ -54,14 +54,14 @@ void CStarMarkers::draw(CSurfaceArea *surfaceArea, CStarCamera *camera, CStarClo x2 = center._x + vTemp._x; y1 = center._y + vTemp._y; - y2 = y1 - -4.0; + y2 = y1 + 4.0; x1 = x2 - 4.0; - x3 = x2 - -4.0; + x3 = x2 + 4.0; y3 = y1 - 4.0; - surfaceArea->drawLine(Common::Point(x1, y1), Common::Point(x2, y2)); - surfaceArea->drawLine(Common::Point(x2, y2), Common::Point(x3, y1)); - surfaceArea->drawLine(Common::Point(x3, y1), Common::Point(x2, y3)); - surfaceArea->drawLine(Common::Point(x2, y3), Common::Point(x1, y1)); + surfaceArea->drawLine(FPoint(x1, y1), FPoint(x2, y2)); + surfaceArea->drawLine(FPoint(x2, y2), FPoint(x3, y1)); + surfaceArea->drawLine(FPoint(x3, y1), FPoint(x2, y3)); + surfaceArea->drawLine(FPoint(x2, y3), FPoint(x1, y1)); } } diff --git a/engines/titanic/star_control/star_points1.cpp b/engines/titanic/star_control/star_points1.cpp index 8b5bdd14ed..92f74bdefa 100644 --- a/engines/titanic/star_control/star_points1.cpp +++ b/engines/titanic/star_control/star_points1.cpp @@ -72,7 +72,7 @@ void CStarPoints1::draw(CSurfaceArea *surface, CStarCamera *camera) { surface->_pixel = 0xff0000; uint oldPixel = surface->_pixel; surface->setColorFromPixel(); - SurfaceAreaMode oldMode = surface->setMode(SA_NONE); + SurfaceAreaMode oldMode = surface->setMode(SA_SOLID); vector1._z = vTemp._x * pose._row1._z + vTemp._y * pose._row2._z + vTemp._z * pose._row3._z + pose._vector._z; vector1._x = vTemp._x * pose._row1._x + vTemp._y * pose._row2._x + vTemp._z * pose._row3._x + pose._vector._x; diff --git a/engines/titanic/star_control/star_points2.cpp b/engines/titanic/star_control/star_points2.cpp index 8a2a3becb4..787ba8a90b 100644 --- a/engines/titanic/star_control/star_points2.cpp +++ b/engines/titanic/star_control/star_points2.cpp @@ -76,7 +76,7 @@ void CStarPoints2::draw(CSurfaceArea *surface, CStarCamera *camera) { surface->_pixel = 0xffff00; uint oldPixel = surface->_pixel; surface->setColorFromPixel(); - SurfaceAreaMode oldMode = surface->setMode(SA_NONE); + SurfaceAreaMode oldMode = surface->setMode(SA_SOLID); for (uint rootCtr = 0; rootCtr < _data.size(); ++rootCtr) { const RootEntry &re = _data[rootCtr]; diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp index 1590855c14..d93e7aa22b 100644 --- a/engines/titanic/star_control/star_view.cpp +++ b/engines/titanic/star_control/star_view.cpp @@ -344,9 +344,9 @@ void CStarView::fn11() { _starField->fn9(); } -void CStarView::toggleCrosshairs() { +void CStarView::toggleBox() { if (_starField) - _starField->toggleCrosshairs(); + _starField->toggleBox(); } void CStarView::fn13() { @@ -425,7 +425,7 @@ void CStarView::fn18(CStarCamera *camera) { if (_photoSurface) { int oldVal = _starField->get54(); - bool oldCrosshairs = _starField->setCrosshairs(false); + bool oldCrosshairs = _starField->setBoxVisible(false); // Render the starfield for the photograph view _photoSurface->clear(); @@ -433,7 +433,7 @@ void CStarView::fn18(CStarCamera *camera) { _starField->render(_photoSurface, camera); // Render any previously set crosshairs - _starField->setCrosshairs(oldCrosshairs); + _starField->setBoxVisible(oldCrosshairs); _starField->set54(oldVal); _starField->fn6(_photoSurface, camera); _photoSurface->unlock(); diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h index 1a24293230..ce082a45a3 100644 --- a/engines/titanic/star_control/star_view.h +++ b/engines/titanic/star_control/star_view.h @@ -146,9 +146,9 @@ public: void fn11(); /** - * Toggles whether the crosshairs box is visible + * Toggles whether the viewpoint box is visible in the starfield */ - void toggleCrosshairs(); + void toggleBox(); void fn13(); void fn14(); diff --git a/engines/titanic/star_control/surface_area.cpp b/engines/titanic/star_control/surface_area.cpp index 2517461c37..be45f6bf75 100644 --- a/engines/titanic/star_control/surface_area.cpp +++ b/engines/titanic/star_control/surface_area.cpp @@ -31,7 +31,7 @@ CSurfaceArea::CSurfaceArea(CVideoSurface *surface) { _pitch = surface->getPitch(); _field0 = 0; _colorMask = _color = 0; - _mode = SA_NONE; + _mode = SA_SOLID; _surface = nullptr; // Original supported other pixel depths @@ -49,7 +49,7 @@ void CSurfaceArea::initialize() { _field27 = _field26 = _field25 = 0; _field24 = 0; _rgb = _field2C = 0; - _mode = SA_NONE; + _mode = SA_SOLID; } void CSurfaceArea::setColor(uint rgb) { @@ -184,25 +184,31 @@ double CSurfaceArea::drawLine(const FRect &rect) { switch (_bpp) { case 0: s.format = Graphics::PixelFormat::createFormatCLUT8(); - if (_mode != SA_NONE) + if (_mode != SA_SOLID) { Graphics::drawLine(rr.left, rr.top, rr.right, rr.bottom, 0, plotPoint<byte>, this); - return r.top; + return r.top; + } + break; case 1: case 2: s.format = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); - if (_mode != SA_NONE) + if (_mode != SA_SOLID) { Graphics::drawLine(rr.left, rr.top, rr.right, rr.bottom, 0, plotPoint<uint16>, this); - return r.top; + return r.top; + } + break; case 4: s.format = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0); - if (_mode != SA_NONE) + if (_mode != SA_SOLID) { Graphics::drawLine(rr.left, rr.top, rr.right, rr.bottom, 0, plotPoint<uint32>, this); - return r.top; + return r.top; + } + break; default: error("Unknown bpp"); } - s.drawLine(rr.left, rr.top, rr.right, rr.bottom, _color); + s.drawLine(rr.left, rr.top, rr.right, rr.bottom, _rgb); return r.top; } diff --git a/engines/titanic/star_control/surface_area.h b/engines/titanic/star_control/surface_area.h index 07aae36205..2605634357 100644 --- a/engines/titanic/star_control/surface_area.h +++ b/engines/titanic/star_control/surface_area.h @@ -31,7 +31,7 @@ namespace Titanic { enum SurfaceAreaMode { - SA_NONE = 0, SA_MODE1 = 1, SA_MODE2 = 2, SA_XOR = 3, SA_MODE4 = 4 + SA_SOLID = 0, SA_MODE1 = 1, SA_MODE2 = 2, SA_XOR = 3, SA_MODE4 = 4 }; class CSurfaceArea { @@ -96,8 +96,8 @@ public: /** * Draws a line on the surface */ - double drawLine(const Common::Point &pt1, const Common::Point &pt2) { - return drawLine(FRect(pt1.x, pt1.y, pt2.x, pt2.y)); + double drawLine(const FPoint &pt1, const FPoint &pt2) { + return drawLine(FRect(pt1._x, pt1._y, pt2._x, pt2._y)); } }; |