aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/star_control/star_control.cpp2
-rw-r--r--engines/titanic/star_control/star_field.cpp22
-rw-r--r--engines/titanic/star_control/star_field.h20
-rw-r--r--engines/titanic/star_control/star_view.cpp8
-rw-r--r--engines/titanic/star_control/star_view.h7
-rw-r--r--engines/titanic/star_control/surface_fader.cpp2
-rw-r--r--engines/titanic/star_control/surface_fader.h2
7 files changed, 40 insertions, 23 deletions
diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp
index 289527b8e7..abdbf194b5 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.fn12();
+ _view.toggleCrosshairs();
break;
case STAR_12:
diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp
index 5f6c883171..f071f16de2 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),
- _val4(true), _val5(0), _isSolved(false) {
+ _showCrosshairs(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();
- _val4 = file->readNumber();
+ _showCrosshairs = 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(_val4, indent);
+ file->writeNumberLine(_showCrosshairs, indent);
file->writeNumberLine(_isSolved, indent);
}
@@ -66,8 +66,8 @@ bool CStarField::initDocument() {
void CStarField::render(CVideoSurface *surface, CStarControlSub12 *sub12) {
CSurfaceArea surfaceArea(surface);
draw(&surfaceArea, sub12, &_sub5);
- if (_val4)
- fn3(&surfaceArea);
+ if (_showCrosshairs)
+ drawCrosshairs(&surfaceArea);
_sub7.draw(&surfaceArea, sub12, nullptr);
_sub8.draw(&surfaceArea);
@@ -112,13 +112,13 @@ void CStarField::setMode(StarMode mode) {
_mode = mode;
}
-void CStarField::toggle4() {
- _val4 = !_val4;
+void CStarField::toggleCrosshairs() {
+ _showCrosshairs = !_showCrosshairs;
}
-bool CStarField::set4(bool val) {
- bool oldVal = _val4;
- _val4 = val;
+bool CStarField::setCrosshairs(bool isVisible) {
+ bool oldVal = _showCrosshairs;
+ _showCrosshairs = isVisible;
return oldVal;
}
@@ -142,7 +142,7 @@ void CStarField::fn1(CErrorCode *errorCode) {
_sub5.proc3(errorCode);
}
-void CStarField::fn3(CSurfaceArea *surfaceArea) {
+void CStarField::drawCrosshairs(CSurfaceArea *surfaceArea) {
uint oldPixel = surfaceArea->_pixel;
surfaceArea->_pixel = 0x323232;
surfaceArea->setColorFromPixel();
diff --git a/engines/titanic/star_control/star_field.h b/engines/titanic/star_control/star_field.h
index 6046ce2486..40ec9fa6c5 100644
--- a/engines/titanic/star_control/star_field.h
+++ b/engines/titanic/star_control/star_field.h
@@ -42,11 +42,15 @@ private:
bool _points1On;
bool _points2On;
StarMode _mode;
- bool _val4;
+ bool _showCrosshairs;
int _val5;
bool _isSolved;
private:
- void fn3(CSurfaceArea *surfaceArea);
+ /**
+ * Draws the square box crosshairs in the middle of the screen
+ */
+ void drawCrosshairs(CSurfaceArea *surfaceArea);
+
void fn4(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12);
public:
CStarField();
@@ -85,8 +89,16 @@ public:
*/
void setMode(StarMode mode);
- void toggle4();
- bool set4(bool val);
+ /**
+ * Toggles whether the crosshairs box is visible
+ */
+ void toggleCrosshairs();
+
+ /**
+ * Sets whether the crosshairs box is visible
+ */
+ bool setCrosshairs(bool isVisible);
+
int get88() const;
int get5() const;
diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp
index 92f64c46c5..169b5d4bd6 100644
--- a/engines/titanic/star_control/star_view.cpp
+++ b/engines/titanic/star_control/star_view.cpp
@@ -343,9 +343,9 @@ void CStarView::fn11() {
_starField->fn9();
}
-void CStarView::fn12() {
+void CStarView::toggleCrosshairs() {
if (_starField)
- _starField->toggle4();
+ _starField->toggleCrosshairs();
}
void CStarView::fn13() {
@@ -424,13 +424,13 @@ void CStarView::fn18(CStarControlSub12 *sub12) {
if (_videoSurface2) {
int oldVal = _starField->get54();
- bool old4 = _starField->set4(false);
+ bool oldCrosshairs = _starField->setCrosshairs(false);
_videoSurface2->clear();
_videoSurface2->lock();
_starField->render(_videoSurface2, sub12);
- _starField->set4(old4);
+ _starField->setCrosshairs(oldCrosshairs);
_starField->set54(oldVal);
_starField->fn6(_videoSurface2, sub12);
_videoSurface2->unlock();
diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h
index 1262f3c88b..f52dffea78 100644
--- a/engines/titanic/star_control/star_view.h
+++ b/engines/titanic/star_control/star_view.h
@@ -132,7 +132,12 @@ public:
void toggleMode();
void fn11();
- void fn12();
+
+ /**
+ * Toggles whether the crosshairs box is visible
+ */
+ void toggleCrosshairs();
+
void fn13();
void fn14();
diff --git a/engines/titanic/star_control/surface_fader.cpp b/engines/titanic/star_control/surface_fader.cpp
index 7cc39dc429..e2ef828574 100644
--- a/engines/titanic/star_control/surface_fader.cpp
+++ b/engines/titanic/star_control/surface_fader.cpp
@@ -62,7 +62,7 @@ bool CSurfaceFader::setupSurface(CScreenManager *screenManager, CVideoSurface *s
}
CVideoSurface *CSurfaceFader::draw(CScreenManager *screenManager, CVideoSurface *srcSurface) {
- if (_index == -1 || _index >= _count)
+ if (_index < 0 || _index >= _count)
return srcSurface;
// On the first iteration, set up a temporary surface
diff --git a/engines/titanic/star_control/surface_fader.h b/engines/titanic/star_control/surface_fader.h
index f562197f15..3d962b2729 100644
--- a/engines/titanic/star_control/surface_fader.h
+++ b/engines/titanic/star_control/surface_fader.h
@@ -70,7 +70,7 @@ public:
/**
* Returns true if a fade is in progress
*/
- bool isActive() const { return _index != -1 && _index < _count; }
+ bool isActive() const { return _index >= 0 && _index < _count; }
};
} // End of namespace Titanic