aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2017-05-30 12:11:35 -0400
committerPaul Gilbert2017-05-30 12:11:35 -0400
commit867f06a2b4ff8bae65c0249f5d8c16ca55f8bbfb (patch)
tree992e17d141ba7907b90af68dc9ebb8f855158be0 /engines
parent713f6e84fc046563bc3fcfd13a83b8e00dd0f6ee (diff)
downloadscummvm-rg350-867f06a2b4ff8bae65c0249f5d8c16ca55f8bbfb.tar.gz
scummvm-rg350-867f06a2b4ff8bae65c0249f5d8c16ca55f8bbfb.tar.bz2
scummvm-rg350-867f06a2b4ff8bae65c0249f5d8c16ca55f8bbfb.zip
TITANIC: Renamings and further fixes for CPhotoCrosshairs
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/star_control/photo_crosshairs.cpp53
-rw-r--r--engines/titanic/star_control/photo_crosshairs.h35
-rw-r--r--engines/titanic/star_control/star_control.cpp2
-rw-r--r--engines/titanic/star_control/star_field.cpp8
-rw-r--r--engines/titanic/star_control/star_field.h6
-rw-r--r--engines/titanic/star_control/star_view.cpp16
6 files changed, 74 insertions, 46 deletions
diff --git a/engines/titanic/star_control/photo_crosshairs.cpp b/engines/titanic/star_control/photo_crosshairs.cpp
index 62a081cdd8..9df14d3729 100644
--- a/engines/titanic/star_control/photo_crosshairs.cpp
+++ b/engines/titanic/star_control/photo_crosshairs.cpp
@@ -28,19 +28,19 @@
namespace Titanic {
-CPhotoCrosshairs::CPhotoCrosshairs() : _field8(-1), _entryIndex(-1) {
+CPhotoCrosshairs::CPhotoCrosshairs() : _matchIndex(-1), _entryIndex(-1) {
}
void CPhotoCrosshairs::selectStar(int index, CVideoSurface *surface,
CStarField *starField, CStarMarkers *markers) {
if (_entryIndex >= 0) {
- if (_entryIndex == _field8) {
- if (_field8 != 2) {
+ if (_entryIndex == _matchIndex) {
+ if (_matchIndex != 2) {
if (_positions[index] != _entries[_entryIndex]) {
surface->lock();
CSurfaceArea surfaceArea(surface);
- fn4(index, &surfaceArea);
+ drawStar(index, &surfaceArea);
surface->unlock();
++_entryIndex;
@@ -51,11 +51,11 @@ void CPhotoCrosshairs::selectStar(int index, CVideoSurface *surface,
markers->addStar(starP);
}
}
- } else if (_entryIndex == _field8 + 1) {
+ } else if (_entryIndex == _matchIndex + 1) {
if (_positions[index] == _entries[_entryIndex]) {
surface->lock();
CSurfaceArea surfaceArea(surface);
- fn6(&surfaceArea);
+ drawCurrent(&surfaceArea);
surface->unlock();
--_entryIndex;
@@ -64,8 +64,8 @@ void CPhotoCrosshairs::selectStar(int index, CVideoSurface *surface,
} else {
surface->lock();
CSurfaceArea surfaceArea(surface);
- fn6(&surfaceArea);
- fn4(index, &surfaceArea);
+ drawCurrent(&surfaceArea);
+ drawStar(index, &surfaceArea);
surface->unlock();
const CBaseStarEntry *starP;
@@ -81,7 +81,7 @@ void CPhotoCrosshairs::selectStar(int index, CVideoSurface *surface,
} else {
surface->lock();
CSurfaceArea surfaceArea(surface);
- fn4(index, &surfaceArea);
+ drawStar(index, &surfaceArea);
surface->unlock();
++_entryIndex;
@@ -109,23 +109,23 @@ bool CPhotoCrosshairs::fn1(CStarField *starField, CSurfaceArea *surfaceArea, CSt
}
void CPhotoCrosshairs::fn2(CVideoSurface *surface, CStarField *starField, CStarMarkers *markers) {
- if (_field8 <= -1) {
+ if (_matchIndex <= -1) {
if (_entryIndex > -1) {
- fn5(_entryIndex, surface, starField, markers);
+ drawEntry(_entryIndex, surface, starField, markers);
--_entryIndex;
}
} else {
- --_field8;
- if (_entryIndex - _field8 > 1) {
- fn5(_entryIndex, surface, starField, markers);
+ --_matchIndex;
+ if (_entryIndex - _matchIndex > 1) {
+ drawEntry(_entryIndex, surface, starField, markers);
--_entryIndex;
}
}
}
-void CPhotoCrosshairs::fn3() {
- if (_field8 < 3)
- ++_field8;
+void CPhotoCrosshairs::incMatches() {
+ if (_matchIndex < 3)
+ ++_matchIndex;
}
FPoint CPhotoCrosshairs::getPosition() const {
@@ -169,7 +169,7 @@ void CPhotoCrosshairs::allocate(int count) {
void CPhotoCrosshairs::clear() {
_positions.clear();
- _field8 = _entryIndex = -1;
+ _matchIndex = _entryIndex = -1;
}
int CPhotoCrosshairs::indexOf(const Common::Point &pt) const {
@@ -183,29 +183,30 @@ int CPhotoCrosshairs::indexOf(const Common::Point &pt) const {
return -1;
}
-void CPhotoCrosshairs::fn4(int index, CSurfaceArea *surfaceArea) {
+void CPhotoCrosshairs::drawStar(int index, CSurfaceArea *surfaceArea) {
if (index >= 0 && index < (int)_positions.size()) {
const CStarPosition &pt = _positions[index];
- fn7(pt, surfaceArea);
+ drawAt(pt, surfaceArea);
}
}
-void CPhotoCrosshairs::fn5(int index, CVideoSurface *surface, CStarField *starField, CStarMarkers *markers) {
+void CPhotoCrosshairs::drawEntry(int index, CVideoSurface *surface, CStarField *starField, CStarMarkers *markers) {
surface->lock();
CSurfaceArea surfaceArea(surface);
- fn7(_positions[index + 1], &surfaceArea);
+ drawAt(_entries[index], &surfaceArea);
surface->unlock();
- const CBaseStarEntry *starP = starField->getDataPtr(_positions[index + 1]._index1);
+ const CBaseStarEntry *starP = starField->getDataPtr(_entries[index]._index1);
markers->addStar(starP);
}
-void CPhotoCrosshairs::fn6(CSurfaceArea *surfaceArea) {
+void CPhotoCrosshairs::drawCurrent(CSurfaceArea *surfaceArea) {
+ assert(_entryIndex >= 0);
const CStarPosition &pt = _entries[_entryIndex];
- fn7(pt, surfaceArea);
+ drawAt(pt, surfaceArea);
}
-void CPhotoCrosshairs::fn7(const FPoint &pt, CSurfaceArea *surfaceArea) {
+void CPhotoCrosshairs::drawAt(const FPoint &pt, CSurfaceArea *surfaceArea) {
uint savedPixel = surfaceArea->_pixel;
surfaceArea->_pixel = 255;
surfaceArea->setColorFromPixel();
diff --git a/engines/titanic/star_control/photo_crosshairs.h b/engines/titanic/star_control/photo_crosshairs.h
index 6462aeead1..de896d7b3c 100644
--- a/engines/titanic/star_control/photo_crosshairs.h
+++ b/engines/titanic/star_control/photo_crosshairs.h
@@ -52,7 +52,7 @@ private:
*/
void clear();
public:
- int _field8;
+ int _matchIndex;
int _entryIndex;
public:
CPhotoCrosshairs();
@@ -80,11 +80,34 @@ public:
bool fn1(CStarField *starField, CSurfaceArea *surfaceArea, CStarCamera *camera);
void fn2(CVideoSurface *surface, CStarField *starField, CStarMarkers *markers);
- void fn3();
- void fn4(int index, CSurfaceArea *surfaceArea);
- void fn5(int index, CVideoSurface *surface, CStarField *starField, CStarMarkers *markers);
- void fn6(CSurfaceArea *surfaceArea);
- void fn7(const FPoint &pt, CSurfaceArea *surfaceArea);
+
+ /**
+ * Increments the index for the number of matches
+ */
+ void incMatches();
+
+ /**
+ * Draw the crosshairs for a given star
+ */
+ void drawStar(int index, CSurfaceArea *surfaceArea);
+
+ /**
+ * Draws the crosshairs for a specified entry, and adds the star
+ * to the starfield markers
+ */
+ void drawEntry(int index, CVideoSurface *surface, CStarField *starField, CStarMarkers *markers);
+
+ /**
+ * Draw crosshairs for the most recently selected star
+ */
+ void drawCurrent(CSurfaceArea *surfaceArea);
+
+ /**
+ * Draw crosshairs at the given position
+ */
+ void drawAt(const FPoint &pt, CSurfaceArea *surfaceArea);
+
+
FPoint getPosition() const;
/**
diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp
index b836ed236b..05e37ca96f 100644
--- a/engines/titanic/star_control/star_control.cpp
+++ b/engines/titanic/star_control/star_control.cpp
@@ -136,7 +136,7 @@ void CStarControl::newFrame() {
_petControl = getPetControl();
if (_petControl) {
- int val1 = _starField.get88();
+ int val1 = _starField.getMatchedIndex();
int val2 = 0;
if (_starField.getMode() == MODE_STARFIELD) {
diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp
index 1db4c44e85..b0d677ef77 100644
--- a/engines/titanic/star_control/star_field.cpp
+++ b/engines/titanic/star_control/star_field.cpp
@@ -122,8 +122,8 @@ bool CStarField::setCrosshairs(bool isVisible) {
return oldVal;
}
-int CStarField::get88() const {
- return _crosshairs._field8;
+int CStarField::getMatchedIndex() const {
+ return _crosshairs._matchIndex;
}
int CStarField::get5() const {
@@ -131,7 +131,7 @@ int CStarField::get5() const {
}
void CStarField::setSolved() {
- _isSolved = _crosshairs._field8 == 2;
+ _isSolved = _crosshairs._matchIndex == 2;
}
bool CStarField::isSolved() const {
@@ -216,7 +216,7 @@ void CStarField::fn6(CVideoSurface *surface, CStarCamera *camera) {
}
void CStarField::fn7() {
- _crosshairs.fn3();
+ _crosshairs.incMatches();
setSolved();
}
diff --git a/engines/titanic/star_control/star_field.h b/engines/titanic/star_control/star_field.h
index 489e24c45a..a014894ef4 100644
--- a/engines/titanic/star_control/star_field.h
+++ b/engines/titanic/star_control/star_field.h
@@ -99,7 +99,11 @@ public:
*/
bool setCrosshairs(bool isVisible);
- int get88() const;
+ /**
+ * Returns the index for the number of star matches
+ */
+ int getMatchedIndex() const;
+
int get5() const;
/**
diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp
index c98fb42f42..1590855c14 100644
--- a/engines/titanic/star_control/star_view.cpp
+++ b/engines/titanic/star_control/star_view.cpp
@@ -147,7 +147,7 @@ bool CStarView::MouseMoveMsg(int unused, const Point &pt) {
bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
FPose pose;
- int v = _starField ? _starField->get88() : -1;
+ int matchedIndex = _starField ? _starField->getMatchedIndex() : -1;
switch (key) {
case Common::KEYCODE_TAB:
@@ -177,7 +177,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
case Common::KEYCODE_z:
case Common::KEYCODE_c:
- if (v == -1) {
+ if (matchedIndex == -1) {
pose.setRotationMatrix(key == Common::KEYCODE_z ? Y_AXIS : X_AXIS, 1.0);
_camera.proc22(pose);
_camera.updatePosition(errorCode);
@@ -186,7 +186,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
break;
case Common::KEYCODE_SEMICOLON:
- if (v == -1) {
+ if (matchedIndex == -1) {
_camera.increaseSpeed();
errorCode->set();
return true;
@@ -194,7 +194,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
break;
case Common::KEYCODE_PERIOD:
- if (v == -1) {
+ if (matchedIndex == -1) {
_camera.decreaseSpeed();
errorCode->set();
return true;
@@ -202,7 +202,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
break;
case Common::KEYCODE_SPACE:
- if (v == -1) {
+ if (matchedIndex == -1) {
_camera.stop();
errorCode->set();
return true;
@@ -210,7 +210,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
break;
case Common::KEYCODE_x:
- if (v == -1) {
+ if (matchedIndex == -1) {
pose.setRotationMatrix(Y_AXIS, -1.0);
_camera.proc22(pose);
_camera.updatePosition(errorCode);
@@ -219,7 +219,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
break;
case Common::KEYCODE_QUOTE:
- if (v == -1) {
+ if (matchedIndex == -1) {
pose.setRotationMatrix(X_AXIS, -1.0);
_camera.proc22(pose);
_camera.updatePosition(errorCode);
@@ -385,7 +385,7 @@ void CStarView::fn16() {
v1 += surfaceArea._centroid;
v3 += surfaceArea._centroid;
- switch (_starField->get88()) {
+ switch (_starField->getMatchedIndex()) {
case -1:
_camera.fn2(v1, v2, v3);
_starField->fn7();