[Scummvm-git-logs] scummvm master -> 77703ed31652e6ebacc377560a79ae02d23262b0

dreammaster dreammaster at scummvm.org
Mon May 29 04:25:25 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:
77703ed316 TITANIC: Renamed CStarControlSub7 to CStarMarkers


Commit: 77703ed31652e6ebacc377560a79ae02d23262b0
    https://github.com/scummvm/scummvm/commit/77703ed31652e6ebacc377560a79ae02d23262b0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-05-28T22:25:13-04:00

Commit Message:
TITANIC: Renamed CStarControlSub7 to CStarMarkers

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


diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index c90fb91..dc6b9b7 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -447,13 +447,13 @@ MODULE_OBJS := \
 	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_sub21.o \
 	star_control/star_control_sub22.o \
 	star_control/star_control_sub23.o \
 	star_control/star_control_sub24.o \
 	star_control/star_control_sub27.o \
 	star_control/star_field.o \
+	star_control/star_markers.o \
 	star_control/star_points1.o \
 	star_control/star_points2.o \
 	star_control/star_ref.o \
diff --git a/engines/titanic/star_control/photo_crosshairs.cpp b/engines/titanic/star_control/photo_crosshairs.cpp
index 061bd35..b28164e 100644
--- a/engines/titanic/star_control/photo_crosshairs.cpp
+++ b/engines/titanic/star_control/photo_crosshairs.cpp
@@ -21,7 +21,7 @@
  */
 
 #include "titanic/star_control/photo_crosshairs.h"
-#include "titanic/star_control/star_control_sub7.h"
+#include "titanic/star_control/star_markers.h"
 #include "titanic/star_control/star_camera.h"
 #include "titanic/star_control/star_field.h"
 #include "titanic/star_control/star_ref.h"
@@ -32,7 +32,7 @@ CPhotoCrosshairs::CPhotoCrosshairs() : _field8(-1), _entryIndex(-1) {
 }
 
 void CPhotoCrosshairs::selectStar(int index, CVideoSurface *surface,
-		CStarField *starField, CStarControlSub7 *sub7) {
+		CStarField *starField, CStarMarkers *markers) {
 	if (_entryIndex >= 0) {
 		if (_entryIndex == _field8) {
 			if (_field8 != 2) {
@@ -48,7 +48,7 @@ void CPhotoCrosshairs::selectStar(int index, CVideoSurface *surface,
 					newP = _positions[index];
 
 					const CBaseStarEntry *starP = starField->getDataPtr(_positions[index]._index1);
-					sub7->addStar(starP);
+					markers->addStar(starP);
 				}
 			}
 		} else if (_entryIndex == _field8 + 1) {
@@ -60,7 +60,7 @@ void CPhotoCrosshairs::selectStar(int index, CVideoSurface *surface,
 
 				--_entryIndex;
 				const CBaseStarEntry *starP = starField->getDataPtr(_positions[index]._index1);
-				sub7->addStar(starP);
+				markers->addStar(starP);
 			} else {
 				surface->lock();
 				CSurfaceArea surfaceArea(surface);
@@ -70,9 +70,9 @@ void CPhotoCrosshairs::selectStar(int index, CVideoSurface *surface,
 
 				const CBaseStarEntry *starP;
 				starP = starField->getDataPtr(_positions[_entryIndex]._index1);
-				sub7->addStar(starP);
+				markers->addStar(starP);
 				starP = starField->getDataPtr(_positions[index]._index1);
-				sub7->addStar(starP);
+				markers->addStar(starP);
 
 				CStarPosition &newP = _positions[_entryIndex + 1];
 				newP = _positions[index];
@@ -89,7 +89,7 @@ void CPhotoCrosshairs::selectStar(int index, CVideoSurface *surface,
 		newP = _positions[index];
 
 		const CBaseStarEntry *starP = starField->getDataPtr(_positions[index]._index1);
-		sub7->addStar(starP);
+		markers->addStar(starP);
 	}
 }
 
@@ -107,16 +107,16 @@ bool CPhotoCrosshairs::fn1(CStarField *starField, CSurfaceArea *surfaceArea, CSt
 	}
 }
 
-void CPhotoCrosshairs::fn2(CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7) {
+void CPhotoCrosshairs::fn2(CVideoSurface *surface, CStarField *starField, CStarMarkers *markers) {
 	if (_field8 <= -1) {
 		if (_entryIndex > -1) {
-			fn5(_entryIndex, surface, starField, sub7);
+			fn5(_entryIndex, surface, starField, markers);
 			--_entryIndex;
 		}
 	} else {
 		--_field8;
 		if (_entryIndex - _field8 > 1) {
-			fn5(_entryIndex, surface, starField, sub7);
+			fn5(_entryIndex, surface, starField, markers);
 			--_entryIndex;
 		}
 	}
@@ -189,14 +189,14 @@ void CPhotoCrosshairs::fn4(int index, CSurfaceArea *surfaceArea) {
 	}
 }
 
-void CPhotoCrosshairs::fn5(int index, CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7) {
+void CPhotoCrosshairs::fn5(int index, CVideoSurface *surface, CStarField *starField, CStarMarkers *markers) {
 	surface->lock();
 	CSurfaceArea surfaceArea(surface);
 	fn7(_positions[index + 1], &surfaceArea);
 	surface->unlock();
 
 	const CBaseStarEntry *starP = starField->getDataPtr(_positions[index + 1]._index1);
-	sub7->addStar(starP);
+	markers->addStar(starP);
 }
 
 void CPhotoCrosshairs::fn6(CSurfaceArea *surfaceArea) {
diff --git a/engines/titanic/star_control/photo_crosshairs.h b/engines/titanic/star_control/photo_crosshairs.h
index 469c425..82dade2 100644
--- a/engines/titanic/star_control/photo_crosshairs.h
+++ b/engines/titanic/star_control/photo_crosshairs.h
@@ -34,7 +34,7 @@
 namespace Titanic {
 
 class CStarField;
-class CStarControlSub7;
+class CStarMarkers;
 class CStarCamera;
 
 class CPhotoCrosshairs {
@@ -70,15 +70,15 @@ public:
 	void save(SimpleFile *file, int indent) {}
 
 	void selectStar(int starNum, CVideoSurface *surface, CStarField *starField,
-		CStarControlSub7 *sub7);
+		CStarMarkers *markers);
 
 	void draw(CSurfaceArea *surfaceArea);
 
 	bool fn1(CStarField *starField, CSurfaceArea *surfaceArea, CStarCamera *camera);
-	void fn2(CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7);
+	void fn2(CVideoSurface *surface, CStarField *starField, CStarMarkers *markers);
 	void fn3();
 	void fn4(int index, CSurfaceArea *surfaceArea);
-	void fn5(int index, CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7);
+	void fn5(int index, CVideoSurface *surface, CStarField *starField, CStarMarkers *markers);
 	void fn6(CSurfaceArea *surfaceArea);
 	void fn7(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 bce12ef..b836ed2 100644
--- a/engines/titanic/star_control/star_control.cpp
+++ b/engines/titanic/star_control/star_control.cpp
@@ -141,7 +141,7 @@ void CStarControl::newFrame() {
 
 		if (_starField.getMode() == MODE_STARFIELD) {
 			val2 = _starField.get5();
-			if ((val1 + 2) == _starField.get7Count())
+			if ((val1 + 2) == _starField.getMarkerCount())
 				val2 = 0;
 		}
 
diff --git a/engines/titanic/star_control/star_control_sub7.cpp b/engines/titanic/star_control/star_control_sub7.cpp
deleted file mode 100644
index c5e267e..0000000
--- a/engines/titanic/star_control/star_control_sub7.cpp
+++ /dev/null
@@ -1,95 +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_sub7.h"
-#include "titanic/star_control/star_camera.h"
-
-namespace Titanic {
-
-void CStarControlSub7::draw(CSurfaceArea *surfaceArea, CStarCamera *camera, CStarCloseup *closeup) {
-	if (_data.empty())
-		return;
-
-	FPose pose = camera->getPose();
-	double threshold = camera->getThreshold();
-	FPoint center((double)surfaceArea->_width * 0.5,
-		surfaceArea->_height * 0.5);
-	FVector newV;
-
-	uint savedPixel = surfaceArea->_pixel;
-	surfaceArea->_pixel = 0xffff;
-	surfaceArea->setColorFromPixel();
-
-	for (uint idx = 0; idx < _data.size(); ++idx) {
-		const CBaseStarEntry &star = _data[idx];
-
-		newV._x = pose._row1._x * star._position._x + pose._row3._x * star._position._z
-			+ pose._row2._x * star._position._y + pose._vector._x;
-		newV._y = pose._row1._y * star._position._x + pose._row3._y * star._position._z
-			+ pose._row2._y * star._position._x + pose._vector._y;
-		newV._z = pose._row1._z * star._position._x + pose._row3._z * star._position._z
-			+ pose._row2._z * star._position._y + pose._vector._z; 
-
-		if (newV._z > threshold) {
-			FVector vTemp = camera->proc28(2, newV);
-
-			FRect r1(center._x + vTemp._x, center._y + vTemp._y,
-				center._x + vTemp._x + 4.0, center._y + vTemp._y + 4.0);
-			surfaceArea->fillRect(r1);
-
-			FRect r2(r1.right, r1.bottom, r1.right + 4.0, r1.top);
-			surfaceArea->fillRect(r2);
-
-			FRect r3(r2.right, r1.top, r1.right, r1.top - 4.0);
-			surfaceArea->fillRect(r3);
-
-			FRect r4(r1.right, r1.top - 4.0, r1.left, r1.top);
-			surfaceArea->fillRect(r4);
-		}
-	}
-
-	surfaceArea->_pixel = savedPixel;
-	surfaceArea->setColorFromPixel();
-}
-
-bool CStarControlSub7::addStar(const CBaseStarEntry *entry) {
-	// iterate through the existing stars
-	for (uint idx = 0; idx < _data.size(); ++idx) {
-		CBaseStarEntry &star = _data[idx];
-		if (star == *entry) {
-			// Found a matching star at the exact same position, so remove it instead
-			_data.remove_at(idx);
-			return true;
-		}
-	}
-
-	// No existing match
-	if (_data.size() == 32)
-		// Out of space, so delete oldest star
-		_data.remove_at(0);
-
-	// Add new star
-	_data.push_back(*entry);
-	return true;
-}
-
-} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control_sub7.h b/engines/titanic/star_control/star_control_sub7.h
deleted file mode 100644
index e751ae0..0000000
--- a/engines/titanic/star_control/star_control_sub7.h
+++ /dev/null
@@ -1,46 +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_SUB7_H
-#define TITANIC_STAR_CONTROL_SUB7_H
-
-#include "titanic/star_control/base_stars.h"
-namespace Titanic {
-
-class CStarControlSub7 : public CBaseStars {
-public:
-	virtual ~CStarControlSub7() { clear(); }
-
-	/**
-	 * Draw the item
-	 */
-	virtual void draw(CSurfaceArea *surfaceArea, CStarCamera *camera, CStarCloseup *closeup);
-
-	/**
-	 * Adds a new star, or removes one if already present at the given co-ordinates
-	 */
-	virtual bool addStar(const CBaseStarEntry *entry);
-};
-
-} // End of namespace Titanic
-
-#endif /* TITANIC_STAR_CONTROL_SUB7_H */
diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp
index 54ad3f6..a8949b1 100644
--- a/engines/titanic/star_control/star_field.cpp
+++ b/engines/titanic/star_control/star_field.cpp
@@ -32,7 +32,7 @@ CStarField::CStarField() : _points1On(false), _points2On(false), _mode(MODE_STAR
 }
 
 void CStarField::load(SimpleFile *file) {
-	_sub7.load(file);
+	_markers.load(file);
 	_crosshairs.load(file);
 	_points1On = file->readNumber();
 	_points2On = file->readNumber();
@@ -42,7 +42,7 @@ void CStarField::load(SimpleFile *file) {
 }
 
 void CStarField::save(SimpleFile *file, int indent) {
-	_sub7.save(file, indent);
+	_markers.save(file, indent);
 	_crosshairs.save(file, indent);
 	file->writeNumberLine(_points1On, indent);
 	file->writeNumberLine(_points2On, indent);
@@ -69,7 +69,7 @@ void CStarField::render(CVideoSurface *surface, CStarCamera *camera) {
 	if (_showCrosshairs)
 		drawCrosshairs(&surfaceArea);
 
-	_sub7.draw(&surfaceArea, camera, nullptr);
+	_markers.draw(&surfaceArea, camera, nullptr);
 	_crosshairs.draw(&surfaceArea);
 
 	if (_points2On)
@@ -186,7 +186,7 @@ double CStarField::fn5(CSurfaceArea *surfaceArea, CStarCamera *camera,
 	if (_crosshairs._fieldC < 0)
 		return -1.0;
 
-	const CBaseStarEntry *dataP = _sub7.getDataPtr(_crosshairs._fieldC);
+	const CBaseStarEntry *dataP = _markers.getDataPtr(_crosshairs._fieldC);
 	v2 = dataP->_position;
 	FVector tv = camera->proc29(2, v2);
 
@@ -221,7 +221,7 @@ void CStarField::fn7() {
 }
 
 void CStarField::fn8(CVideoSurface *surface) {
-	_crosshairs.fn2(surface, this, &_sub7);
+	_crosshairs.fn2(surface, this, &_markers);
 	setSolved();
 }
 
@@ -233,7 +233,7 @@ bool CStarField::mouseButtonDown(CVideoSurface *surface, CStarCamera *camera,
 	} else {
 		int starNum = _crosshairs.indexOf(pt);
 		if (starNum >= 0) {
-			_crosshairs.selectStar(starNum, surface, this, &_sub7);
+			_crosshairs.selectStar(starNum, surface, this, &_markers);
 			return true;
 		}
 
diff --git a/engines/titanic/star_control/star_field.h b/engines/titanic/star_control/star_field.h
index aed5cec..489e24c 100644
--- a/engines/titanic/star_control/star_field.h
+++ b/engines/titanic/star_control/star_field.h
@@ -25,7 +25,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_markers.h"
 #include "titanic/star_control/photo_crosshairs.h"
 #include "titanic/star_control/star_points1.h"
 #include "titanic/star_control/star_points2.h"
@@ -34,7 +34,7 @@ namespace Titanic {
 
 class CStarField : public CStarControlSub2 {
 private:
-	CStarControlSub7 _sub7;
+	CStarMarkers _markers;
 	CPhotoCrosshairs _crosshairs;
 	CStarPoints1 _points1;
 	CStarPoints2 _points2;
@@ -112,8 +112,11 @@ public:
 	 */
 	bool isSolved() const;
 
-	int get7Count() const {
-		return _sub7.size();
+	/**
+	 * Returns the number of markers placed in the starfield
+	 */
+	int getMarkerCount() const {
+		return _markers.size();
 	}
 
 	void fn1(CErrorCode *errorCode);
diff --git a/engines/titanic/star_control/star_markers.cpp b/engines/titanic/star_control/star_markers.cpp
new file mode 100644
index 0000000..a65b611
--- /dev/null
+++ b/engines/titanic/star_control/star_markers.cpp
@@ -0,0 +1,95 @@
+/* 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_markers.h"
+#include "titanic/star_control/star_camera.h"
+
+namespace Titanic {
+
+void CStarMarkers::draw(CSurfaceArea *surfaceArea, CStarCamera *camera, CStarCloseup *closeup) {
+	if (_data.empty())
+		return;
+
+	FPose pose = camera->getPose();
+	double threshold = camera->getThreshold();
+	FPoint center((double)surfaceArea->_width * 0.5,
+		surfaceArea->_height * 0.5);
+	FVector newV;
+
+	uint savedPixel = surfaceArea->_pixel;
+	surfaceArea->_pixel = 0xffff;
+	surfaceArea->setColorFromPixel();
+
+	for (uint idx = 0; idx < _data.size(); ++idx) {
+		const CBaseStarEntry &star = _data[idx];
+
+		newV._x = pose._row1._x * star._position._x + pose._row3._x * star._position._z
+			+ pose._row2._x * star._position._y + pose._vector._x;
+		newV._y = pose._row1._y * star._position._x + pose._row3._y * star._position._z
+			+ pose._row2._y * star._position._x + pose._vector._y;
+		newV._z = pose._row1._z * star._position._x + pose._row3._z * star._position._z
+			+ pose._row2._z * star._position._y + pose._vector._z; 
+
+		if (newV._z > threshold) {
+			FVector vTemp = camera->proc28(2, newV);
+
+			FRect r1(center._x + vTemp._x, center._y + vTemp._y,
+				center._x + vTemp._x + 4.0, center._y + vTemp._y + 4.0);
+			surfaceArea->fillRect(r1);
+
+			FRect r2(r1.right, r1.bottom, r1.right + 4.0, r1.top);
+			surfaceArea->fillRect(r2);
+
+			FRect r3(r2.right, r1.top, r1.right, r1.top - 4.0);
+			surfaceArea->fillRect(r3);
+
+			FRect r4(r1.right, r1.top - 4.0, r1.left, r1.top);
+			surfaceArea->fillRect(r4);
+		}
+	}
+
+	surfaceArea->_pixel = savedPixel;
+	surfaceArea->setColorFromPixel();
+}
+
+bool CStarMarkers::addStar(const CBaseStarEntry *entry) {
+	// iterate through the existing stars
+	for (uint idx = 0; idx < _data.size(); ++idx) {
+		CBaseStarEntry &star = _data[idx];
+		if (star == *entry) {
+			// Found a matching star at the exact same position, so remove it instead
+			_data.remove_at(idx);
+			return true;
+		}
+	}
+
+	// No existing match
+	if (_data.size() == 32)
+		// Out of space, so delete oldest star
+		_data.remove_at(0);
+
+	// Add new star
+	_data.push_back(*entry);
+	return true;
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_markers.h b/engines/titanic/star_control/star_markers.h
new file mode 100644
index 0000000..96b76d3
--- /dev/null
+++ b/engines/titanic/star_control/star_markers.h
@@ -0,0 +1,46 @@
+/* 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_MARKERS_H
+#define TITANIC_STAR_MARKERS_H
+
+#include "titanic/star_control/base_stars.h"
+namespace Titanic {
+
+class CStarMarkers : public CBaseStars {
+public:
+	virtual ~CStarMarkers() { clear(); }
+
+	/**
+	 * Draw the item
+	 */
+	virtual void draw(CSurfaceArea *surfaceArea, CStarCamera *camera, CStarCloseup *closeup);
+
+	/**
+	 * Adds a new star, or removes one if already present at the given co-ordinates
+	 */
+	virtual bool addStar(const CBaseStarEntry *entry);
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_STAR_MARKERS_H */





More information about the Scummvm-git-logs mailing list