[Scummvm-git-logs] scummvm master -> 6587cacabd0ccf4414ab1e4e72ab33897b44e441

dreammaster dreammaster at scummvm.org
Sun May 28 22:27:51 CEST 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
6587cacabd TITANIC: Rename CStarControlSub8 to CPhotoCrosshairs


Commit: 6587cacabd0ccf4414ab1e4e72ab33897b44e441
    https://github.com/scummvm/scummvm/commit/6587cacabd0ccf4414ab1e4e72ab33897b44e441
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-05-28T16:27:39-04:00

Commit Message:
TITANIC: Rename CStarControlSub8 to CPhotoCrosshairs

Changed paths:
  A engines/titanic/star_control/photo_crosshairs.cpp
  A engines/titanic/star_control/photo_crosshairs.h
  R engines/titanic/star_control/star_control_sub8.cpp
  R engines/titanic/star_control/star_control_sub8.h
    engines/titanic/module.mk
    engines/titanic/star_control/star_field.cpp
    engines/titanic/star_control/star_field.h
    engines/titanic/star_control/star_view.cpp


diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index 2e53070..c90fb91 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/photo_crosshairs.cpp b/engines/titanic/star_control/photo_crosshairs.cpp
new file mode 100644
index 0000000..061bd35
--- /dev/null
+++ b/engines/titanic/star_control/photo_crosshairs.cpp
@@ -0,0 +1,224 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#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"
+#include "titanic/star_control/star_ref.h"
+
+namespace Titanic {
+
+CPhotoCrosshairs::CPhotoCrosshairs() : _field8(-1), _entryIndex(-1) {
+}
+
+void CPhotoCrosshairs::selectStar(int index, CVideoSurface *surface,
+		CStarField *starField, CStarControlSub7 *sub7) {
+	if (_entryIndex >= 0) {
+		if (_entryIndex == _field8) {
+			if (_field8 != 2) {
+				if (_positions[index] != _positions[_entryIndex + 1]) {
+					surface->lock();
+
+					CSurfaceArea surfaceArea(surface);
+					fn4(index, &surfaceArea);
+					surface->unlock();
+
+					++_entryIndex;
+					CStarPosition &newP = _positions[_entryIndex + 1];
+					newP = _positions[index];
+
+					const CBaseStarEntry *starP = starField->getDataPtr(_positions[index]._index1);
+					sub7->addStar(starP);
+				}
+			}
+		} else if (_entryIndex == _field8 + 1) {
+			if (_positions[index] == _positions[_entryIndex + 1]) {
+				surface->lock();
+				CSurfaceArea surfaceArea(surface);
+				fn6(&surfaceArea);
+				surface->unlock();
+
+				--_entryIndex;
+				const CBaseStarEntry *starP = starField->getDataPtr(_positions[index]._index1);
+				sub7->addStar(starP);
+			} else {
+				surface->lock();
+				CSurfaceArea surfaceArea(surface);
+				fn6(&surfaceArea);
+				fn4(index, &surfaceArea);
+				surface->unlock();
+
+				const CBaseStarEntry *starP;
+				starP = starField->getDataPtr(_positions[_entryIndex]._index1);
+				sub7->addStar(starP);
+				starP = starField->getDataPtr(_positions[index]._index1);
+				sub7->addStar(starP);
+
+				CStarPosition &newP = _positions[_entryIndex + 1];
+				newP = _positions[index];
+			}
+		}
+	} else {
+		surface->lock();
+		CSurfaceArea surfaceArea(surface);
+		fn4(index, &surfaceArea);
+		surface->unlock();
+
+		++_entryIndex;
+		CStarPosition &newP = _positions[_entryIndex + 1];
+		newP = _positions[index];
+
+		const CBaseStarEntry *starP = starField->getDataPtr(_positions[index]._index1);
+		sub7->addStar(starP);
+	}
+}
+
+bool CPhotoCrosshairs::fn1(CStarField *starField, CSurfaceArea *surfaceArea, CStarCamera *camera) {
+	int count = starField->baseFn2(surfaceArea, camera);
+
+	if (count > 0) {
+		allocate(count);
+		CStarRefArray starRef(starField, &_positions);
+		starRef.process(surfaceArea, camera);
+		return true;
+	} else {
+		clear();
+		return false;
+	}
+}
+
+void CPhotoCrosshairs::fn2(CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7) {
+	if (_field8 <= -1) {
+		if (_entryIndex > -1) {
+			fn5(_entryIndex, surface, starField, sub7);
+			--_entryIndex;
+		}
+	} else {
+		--_field8;
+		if (_entryIndex - _field8 > 1) {
+			fn5(_entryIndex, surface, starField, sub7);
+			--_entryIndex;
+		}
+	}
+}
+
+void CPhotoCrosshairs::fn3() {
+	if (_field8 < 3)
+		++_field8;
+}
+
+FPoint CPhotoCrosshairs::getPosition() const {
+	return (_entryIndex >= 0 && _entryIndex <= 2) ? 
+		FPoint(_entries[_entryIndex]) : FPoint();
+}
+
+void CPhotoCrosshairs::draw(CSurfaceArea *surfaceArea) {
+	if (!_positions.empty()) {
+		uint savedPixel = surfaceArea->_pixel;
+		surfaceArea->_pixel = 0xff;
+		surfaceArea->setColorFromPixel();
+		SurfaceAreaMode savedMode = surfaceArea->setMode(SA_NONE);
+
+		for (int idx = 0; idx < _entryIndex; ++idx) {
+			const CStarPosition &src = _entries[idx];
+			double xp = src.x, yp = src.y;
+
+			surfaceArea->fillRect(FRect(xp - 8.0, yp, xp - 4.0, yp));
+			surfaceArea->fillRect(FRect(xp + 4.0, yp, xp + 8.0, yp));
+			surfaceArea->fillRect(FRect(xp, yp - 8.0, xp, yp - 4.0));
+			surfaceArea->fillRect(FRect(xp, yp + 4.0, xp, yp + 8.0));
+		}
+
+		surfaceArea->_pixel = savedPixel;
+		surfaceArea->setColorFromPixel();
+		surfaceArea->setMode(savedMode);
+	}
+}
+
+void CPhotoCrosshairs::allocate(int count) {
+	if (!_positions.empty()) {
+		if ((int)_positions.size() == count)
+			return;
+
+		clear();
+	}
+
+	_positions.resize(count);
+}
+
+void CPhotoCrosshairs::clear() {
+	_positions.clear();
+	_field8 = _entryIndex = -1;
+}
+
+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) {
+		if (r.contains(_positions[idx]))
+			return idx;
+	}
+
+	return -1;
+}
+
+void CPhotoCrosshairs::fn4(int index, CSurfaceArea *surfaceArea) {
+	if (index >= 0 && index < (int)_positions.size()) {
+		const CStarPosition &pt = _positions[index];
+		fn7(pt, surfaceArea);
+	}
+}
+
+void CPhotoCrosshairs::fn5(int index, CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7) {
+	surface->lock();
+	CSurfaceArea surfaceArea(surface);
+	fn7(_positions[index + 1], &surfaceArea);
+	surface->unlock();
+
+	const CBaseStarEntry *starP = starField->getDataPtr(_positions[index + 1]._index1);
+	sub7->addStar(starP);
+}
+
+void CPhotoCrosshairs::fn6(CSurfaceArea *surfaceArea) {
+	const CStarPosition &pt = _positions[_entryIndex];
+	fn7(pt, surfaceArea);
+}
+
+void CPhotoCrosshairs::fn7(const FPoint &pt, CSurfaceArea *surfaceArea) {
+	uint savedPixel = surfaceArea->_pixel;
+	surfaceArea->_pixel = 255;
+	surfaceArea->setColorFromPixel();
+	SurfaceAreaMode savedMode = surfaceArea->setMode(SA_MODE3);
+
+
+	surfaceArea->fillRect(FRect(pt._x - 8.0, pt._y, pt._x - 4.0, pt._y));
+	surfaceArea->fillRect(FRect(pt._x - -4.0, pt._y, pt._x + 8.0, pt._y));
+	surfaceArea->fillRect(FRect(pt._x, pt._y - 8.0, pt._x, pt._y - 4.0));
+	surfaceArea->fillRect(FRect(pt._x, pt._y + 4.0, pt._x, pt._y + 8.0));
+
+	surfaceArea->_pixel = savedPixel;
+	surfaceArea->setColorFromPixel();
+	surfaceArea->setMode(savedMode);
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/star_control/photo_crosshairs.h b/engines/titanic/star_control/photo_crosshairs.h
new file mode 100644
index 0000000..469c425
--- /dev/null
+++ b/engines/titanic/star_control/photo_crosshairs.h
@@ -0,0 +1,94 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TITANIC_PHOTO_CROSSHAIRS_H
+#define TITANIC_PHOTO_CROSSHAIRS_H
+
+#include "common/array.h"
+#include "common/rect.h"
+#include "titanic/star_control/base_stars.h"
+#include "titanic/star_control/surface_area.h"
+#include "titanic/star_control/fpoint.h"
+#include "titanic/support/simple_file.h"
+#include "titanic/support/video_surface.h"
+
+namespace Titanic {
+
+class CStarField;
+class CStarControlSub7;
+class CStarCamera;
+
+class CPhotoCrosshairs {
+private:
+	Common::Array<CStarPosition> _positions;
+	int _entryIndex;
+	CStarPosition _entries[3];
+private:
+	/**
+	 * Allocates space in the _rects array
+	 */
+	void allocate(int count);
+
+	/**
+	 * Clears any current data
+	 */
+	void clear();
+public:
+	int _field8;
+	int _fieldC;
+public:
+	CPhotoCrosshairs();
+	~CPhotoCrosshairs() { clear(); }
+
+	/**
+	 * Load the data for the class from file
+	 */
+	void load(SimpleFile *file) {}
+
+	/**
+	 * Save the data for the class to file
+	 */
+	void save(SimpleFile *file, int indent) {}
+
+	void selectStar(int starNum, CVideoSurface *surface, CStarField *starField,
+		CStarControlSub7 *sub7);
+
+	void draw(CSurfaceArea *surfaceArea);
+
+	bool fn1(CStarField *starField, CSurfaceArea *surfaceArea, CStarCamera *camera);
+	void fn2(CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7);
+	void fn3();
+	void fn4(int index, CSurfaceArea *surfaceArea);
+	void fn5(int index, CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7);
+	void fn6(CSurfaceArea *surfaceArea);
+	void fn7(const FPoint &pt, CSurfaceArea *surfaceArea);
+	FPoint getPosition() const;
+
+	/**
+	 * Returns the index of an entry in the rects list a given point falls within
+	 */
+	int indexOf(const Common::Point &pt) const;
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_PHOTO_CROSSHAIRS_H */
diff --git a/engines/titanic/star_control/star_control_sub8.cpp b/engines/titanic/star_control/star_control_sub8.cpp
deleted file mode 100644
index 470b357..0000000
--- a/engines/titanic/star_control/star_control_sub8.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "titanic/star_control/star_control_sub8.h"
-#include "titanic/star_control/star_control_sub7.h"
-#include "titanic/star_control/star_camera.h"
-#include "titanic/star_control/star_field.h"
-#include "titanic/star_control/star_ref.h"
-
-namespace Titanic {
-
-CStarControlSub8::CStarControlSub8() : _field8(-1), _entryIndex(-1) {
-}
-
-void CStarControlSub8::selectStar(int index, CVideoSurface *surface,
-		CStarField *starField, CStarControlSub7 *sub7) {
-	if (_entryIndex >= 0) {
-		if (_entryIndex == _field8) {
-			if (_field8 != 2) {
-				if (_positions[index] != _positions[_entryIndex + 1]) {
-					surface->lock();
-
-					CSurfaceArea surfaceArea(surface);
-					fn4(index, &surfaceArea);
-					surface->unlock();
-
-					++_entryIndex;
-					CStarPosition &newP = _positions[_entryIndex + 1];
-					newP = _positions[index];
-
-					const CBaseStarEntry *starP = starField->getDataPtr(_positions[index]._index1);
-					sub7->addStar(starP);
-				}
-			}
-		} else if (_entryIndex == _field8 + 1) {
-			if (_positions[index] == _positions[_entryIndex + 1]) {
-				surface->lock();
-				CSurfaceArea surfaceArea(surface);
-				fn6(&surfaceArea);
-				surface->unlock();
-
-				--_entryIndex;
-				const CBaseStarEntry *starP = starField->getDataPtr(_positions[index]._index1);
-				sub7->addStar(starP);
-			} else {
-				surface->lock();
-				CSurfaceArea surfaceArea(surface);
-				fn6(&surfaceArea);
-				fn4(index, &surfaceArea);
-				surface->unlock();
-
-				const CBaseStarEntry *starP;
-				starP = starField->getDataPtr(_positions[_entryIndex]._index1);
-				sub7->addStar(starP);
-				starP = starField->getDataPtr(_positions[index]._index1);
-				sub7->addStar(starP);
-
-				CStarPosition &newP = _positions[_entryIndex + 1];
-				newP = _positions[index];
-			}
-		}
-	} else {
-		surface->lock();
-		CSurfaceArea surfaceArea(surface);
-		fn4(index, &surfaceArea);
-		surface->unlock();
-
-		++_entryIndex;
-		CStarPosition &newP = _positions[_entryIndex + 1];
-		newP = _positions[index];
-
-		const CBaseStarEntry *starP = starField->getDataPtr(_positions[index]._index1);
-		sub7->addStar(starP);
-	}
-}
-
-bool CStarControlSub8::fn1(CStarField *starField, CSurfaceArea *surfaceArea, CStarCamera *camera) {
-	int count = starField->baseFn2(surfaceArea, camera);
-
-	if (count > 0) {
-		allocate(count);
-		CStarRefArray starRef(starField, &_positions);
-		starRef.process(surfaceArea, camera);
-		return true;
-	} else {
-		clear();
-		return false;
-	}
-}
-
-void CStarControlSub8::fn2(CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7) {
-	if (_field8 <= -1) {
-		if (_entryIndex > -1) {
-			fn5(_entryIndex, surface, starField, sub7);
-			--_entryIndex;
-		}
-	} else {
-		--_field8;
-		if (_entryIndex - _field8 > 1) {
-			fn5(_entryIndex, surface, starField, sub7);
-			--_entryIndex;
-		}
-	}
-}
-
-void CStarControlSub8::fn3() {
-	if (_field8 < 3)
-		++_field8;
-}
-
-FPoint CStarControlSub8::getPosition() const {
-	return (_entryIndex >= 0 && _entryIndex <= 2) ? 
-		FPoint(_entries[_entryIndex]) : FPoint();
-}
-
-void CStarControlSub8::draw(CSurfaceArea *surfaceArea) {
-	if (!_positions.empty()) {
-		uint savedPixel = surfaceArea->_pixel;
-		surfaceArea->_pixel = 0xff;
-		surfaceArea->setColorFromPixel();
-		SurfaceAreaMode savedMode = surfaceArea->setMode(SA_NONE);
-
-		for (int idx = 0; idx < _entryIndex; ++idx) {
-			const CStarPosition &src = _entries[idx];
-			double xp = src.x, yp = src.y;
-
-			surfaceArea->fillRect(FRect(xp - 8.0, yp, xp - 4.0, yp));
-			surfaceArea->fillRect(FRect(xp + 4.0, yp, xp + 8.0, yp));
-			surfaceArea->fillRect(FRect(xp, yp - 8.0, xp, yp - 4.0));
-			surfaceArea->fillRect(FRect(xp, yp + 4.0, xp, yp + 8.0));
-		}
-
-		surfaceArea->_pixel = savedPixel;
-		surfaceArea->setColorFromPixel();
-		surfaceArea->setMode(savedMode);
-	}
-}
-
-void CStarControlSub8::allocate(int count) {
-	if (!_positions.empty()) {
-		if ((int)_positions.size() == count)
-			return;
-
-		clear();
-	}
-
-	_positions.resize(count);
-}
-
-void CStarControlSub8::clear() {
-	_positions.clear();
-	_field8 = _entryIndex = -1;
-}
-
-int CStarControlSub8::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) {
-		if (r.contains(_positions[idx]))
-			return idx;
-	}
-
-	return -1;
-}
-
-void CStarControlSub8::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) {
-	surface->lock();
-	CSurfaceArea surfaceArea(surface);
-	fn7(_positions[index + 1], &surfaceArea);
-	surface->unlock();
-
-	const CBaseStarEntry *starP = starField->getDataPtr(_positions[index + 1]._index1);
-	sub7->addStar(starP);
-}
-
-void CStarControlSub8::fn6(CSurfaceArea *surfaceArea) {
-	const CStarPosition &pt = _positions[_entryIndex];
-	fn7(pt, surfaceArea);
-}
-
-void CStarControlSub8::fn7(const FPoint &pt, CSurfaceArea *surfaceArea) {
-	uint savedPixel = surfaceArea->_pixel;
-	surfaceArea->_pixel = 255;
-	surfaceArea->setColorFromPixel();
-	SurfaceAreaMode savedMode = surfaceArea->setMode(SA_MODE3);
-
-
-	surfaceArea->fillRect(FRect(pt._x - 8.0, pt._y, pt._x - 4.0, pt._y));
-	surfaceArea->fillRect(FRect(pt._x - -4.0, pt._y, pt._x + 8.0, pt._y));
-	surfaceArea->fillRect(FRect(pt._x, pt._y - 8.0, pt._x, pt._y - 4.0));
-	surfaceArea->fillRect(FRect(pt._x, pt._y + 4.0, pt._x, pt._y + 8.0));
-
-	surfaceArea->_pixel = savedPixel;
-	surfaceArea->setColorFromPixel();
-	surfaceArea->setMode(savedMode);
-}
-
-} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control_sub8.h b/engines/titanic/star_control/star_control_sub8.h
deleted file mode 100644
index 7c96582..0000000
--- a/engines/titanic/star_control/star_control_sub8.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef TITANIC_STAR_CONTROL_SUB8_H
-#define TITANIC_STAR_CONTROL_SUB8_H
-
-#include "common/array.h"
-#include "common/rect.h"
-#include "titanic/star_control/base_stars.h"
-#include "titanic/star_control/surface_area.h"
-#include "titanic/star_control/fpoint.h"
-#include "titanic/support/simple_file.h"
-#include "titanic/support/video_surface.h"
-
-namespace Titanic {
-
-class CStarField;
-class CStarControlSub7;
-class CStarCamera;
-
-class CStarControlSub8 {
-private:
-	Common::Array<CStarPosition> _positions;
-	int _entryIndex;
-	CStarPosition _entries[3];
-private:
-	/**
-	 * Allocates space in the _rects array
-	 */
-	void allocate(int count);
-
-	/**
-	 * Clears any current data
-	 */
-	void clear();
-public:
-	int _field8;
-	int _fieldC;
-public:
-	CStarControlSub8();
-	~CStarControlSub8() { clear(); }
-
-	/**
-	 * Load the data for the class from file
-	 */
-	void load(SimpleFile *file) {}
-
-	/**
-	 * Save the data for the class to file
-	 */
-	void save(SimpleFile *file, int indent) {}
-
-	void selectStar(int starNum, CVideoSurface *surface, CStarField *starField,
-		CStarControlSub7 *sub7);
-
-	void draw(CSurfaceArea *surfaceArea);
-
-	bool fn1(CStarField *starField, CSurfaceArea *surfaceArea, CStarCamera *camera);
-	void fn2(CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7);
-	void fn3();
-	void fn4(int index, CSurfaceArea *surfaceArea);
-	void fn5(int index, CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7);
-	void fn6(CSurfaceArea *surfaceArea);
-	void fn7(const FPoint &pt, CSurfaceArea *surfaceArea);
-	FPoint getPosition() const;
-
-	/**
-	 * Returns the index of an entry in the rects list a given point falls within
-	 */
-	int indexOf(const Common::Point &pt) const;
-};
-
-} // End of namespace Titanic
-
-#endif /* TITANIC_STAR_CONTROL_SUB8_H */
diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp
index ea65495..54ad3f6 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 0d80e27..aed5cec 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 fad8591..6890203 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);





More information about the Scummvm-git-logs mailing list