[Scummvm-git-logs] scummvm master -> e33716e11d3752b74e94eb7ba49639aca27e3f02

dreammaster paulfgilbert at gmail.com
Sun Jan 12 04:49:28 UTC 2020


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

Summary:
e580ff30a9 TITANIC: Clarifying the StarAction enum and called methods
75739abe01 TITANIC: Cleanup of CStarView
e33716e11d TITANIC: Finally re-enable randomized initial view for star control


Commit: e580ff30a9712d2d682ba6cf3a9253854db0e909
    https://github.com/scummvm/scummvm/commit/e580ff30a9712d2d682ba6cf3a9253854db0e909
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-01-11T20:47:25-08:00

Commit Message:
TITANIC: Clarifying the StarAction enum and called methods

Changed paths:
  A engines/titanic/star_control/const_boundaries.cpp
  A engines/titanic/star_control/const_boundaries.h
  A engines/titanic/star_control/constellations.cpp
  A engines/titanic/star_control/constellations.h
  R engines/titanic/star_control/star_points1.cpp
  R engines/titanic/star_control/star_points1.h
  R engines/titanic/star_control/star_points2.cpp
  R engines/titanic/star_control/star_points2.h
    engines/titanic/core/game_object.h
    engines/titanic/game/nav_helmet.cpp
    engines/titanic/module.mk
    engines/titanic/star_control/star_camera.cpp
    engines/titanic/star_control/star_camera.h
    engines/titanic/star_control/star_control.cpp
    engines/titanic/star_control/star_field.cpp
    engines/titanic/star_control/star_field.h
    engines/titanic/star_control/star_view.cpp
    engines/titanic/star_control/star_view.h


diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index f699d3a..ebe1c66 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -43,10 +43,28 @@ namespace Titanic {
 enum Find { FIND_GLOBAL = 1, FIND_ROOM = 2, FIND_PET = 4, FIND_MAILMAN = 8 };
 enum Found { FOUND_NONE = 0, FOUND_GLOBAL = 1, FOUND_ROOM = 2, FOUND_PET = 3, FOUND_MAILMAN = 4 };
 enum RoomFlagsComparison { RFC_LOCATION = 1, RFC_CLASS_ELEVATOR = 2, RFC_TITANIA = 3 };
+
 enum StarControlAction {
-	STAR_SHOW = 0, STAR_HIDE, STAR_2, STAR_RESET_POS, STAR_4, STAR_5, STAR_6, STAR_FULL_SPEED,
-	STAR_8, STAR_TOGGLE_MODE, STAR_10, STAR_11, STAR_12, STAR_13, STAR_SET_REFERENCE, STAR_FADE_IN,
-	STAR_FADE_OUT, LOCK_STAR, UNLOCK_STAR, STAR_19
+	STAR_SHOW = 0,			///< Show the starfield
+	STAR_HIDE,				///< Hide the starfield
+	STAR_VIEW_EARTH,		///< View the solar system
+	STAR_VIEW_FROM_EARTH,	///< View from the solar system
+	STAR_VIEW_BOUNDARIES,		///< Turn on constellation boundaries
+	STAR_VIEW_CONSTELLATIONS,	///< Turn on the constellation lines
+	STAR_VIEW_RANDOM_STAR,		///< Look at a random star
+	STAR_FULL_SPEED,			///< Accellerate to full speed
+	STAR_TOGGLE_STEREO_PAIR,	///< Enable stero pair vision	
+	STAR_TOGGLE_HOME_PHOTO,		///< Turn on/off the home photo
+	STAR_TOGGLE_SOLAR_RENDERING,///< Turn on/off the solar object rendering
+	STAR_TOGGLE_POS_FRAME,		///< Turn on/off the pilot's position frame
+	STAR_STEREO_PAIR_ON,		///< Turn on Stereo Pair imaging
+	STAR_STEREO_PAIR_OFF,		///< Turn off Stero Pair imaging
+	STAR_SET_REFERENCE,			///< Take a photo of the current star line
+	STAR_FADE_IN,				///< Fade in
+	STAR_FADE_OUT,				///< Fade out
+	LOCK_STAR,					///< Lock in the currently selected sar
+	UNLOCK_STAR,				///< Unlock the last locked star
+	STAR_CLEAR_MODIFIED			///< Clear the modified flag
 };
 
 class CDontSaveFileItem;
diff --git a/engines/titanic/game/nav_helmet.cpp b/engines/titanic/game/nav_helmet.cpp
index ba3be2b..a13b180 100644
--- a/engines/titanic/game/nav_helmet.cpp
+++ b/engines/titanic/game/nav_helmet.cpp
@@ -61,7 +61,7 @@ bool CNavHelmet::MovieEndMsg(CMovieEndMsg *msg) {
 		pet->incAreaLocks();
 
 		starFn(STAR_SHOW);
-		starFn(STAR_12);
+		starFn(STAR_STEREO_PAIR_ON);
 	}
 
 	return true;
@@ -109,7 +109,7 @@ bool CNavHelmet::PETHelmetOnOffMsg(CPETHelmetOnOffMsg *msg) {
 
 bool CNavHelmet::PETPhotoOnOffMsg(CPETPhotoOnOffMsg *msg) {
 	if (_helmetOn)
-		starFn(STAR_TOGGLE_MODE);
+		starFn(STAR_TOGGLE_HOME_PHOTO);
 
 	return true;
 }
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index 617e262..5a18f42 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -434,6 +434,8 @@ MODULE_OBJS := \
 	star_control/base_stars.o \
 	star_control/camera_auto_mover.o \
 	star_control/camera_mover.o \
+	star_control/const_boundaries.o \
+	star_control/constellations.o \
 	star_control/fmatrix.o \
 	star_control/fpoint.o \
 	star_control/fpose.o \
@@ -450,8 +452,6 @@ MODULE_OBJS := \
 	star_control/star_field_base.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 \
 	star_control/star_view.o \
 	star_control/surface_area.o \
diff --git a/engines/titanic/star_control/const_boundaries.cpp b/engines/titanic/star_control/const_boundaries.cpp
new file mode 100644
index 0000000..0aa5b71
--- /dev/null
+++ b/engines/titanic/star_control/const_boundaries.cpp
@@ -0,0 +1,113 @@
+/* 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/const_boundaries.h"
+#include "titanic/star_control/star_camera.h"
+#include "titanic/star_control/surface_area.h"
+#include "titanic/support/files_manager.h"
+#include "titanic/titanic.h"
+
+#include "common/math.h"
+
+namespace Titanic {
+
+#define ARRAY_COUNT 876
+
+CConstBoundaries::CConstBoundaries() {
+}
+
+bool CConstBoundaries::initialize() {
+	// Get a reference to the starfield points resource
+	Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS");
+	assert(stream && stream->size() == (12 * ARRAY_COUNT));
+
+	_data.resize(ARRAY_COUNT);
+	for (int idx = 0; idx < ARRAY_COUNT; ++idx) {
+		CStarPointEntry &entry = _data[idx];
+
+		// Get the next set of values
+		double v1 = stream->readSint32LE();
+		double v2 = stream->readSint32LE();
+		entry._flag = stream->readUint32LE() != 0;
+
+		v1 *= Common::deg2rad<double>(0.015);
+		v2 *= Common::deg2rad<double>(0.0099999998);
+
+		entry._x = cos(v2) * 3000000.0 * cos(v1);
+		entry._y = sin(v1) * 3000000.0 * cos(v2);
+		entry._z = sin(v2) * 3000000.0;
+	}
+
+	delete stream;
+	return true;
+}
+
+void CConstBoundaries::draw(CSurfaceArea *surface, CStarCamera *camera) {
+	if (_data.empty())
+		return;
+
+	FPose pose = camera->getPose();
+	double threshold = camera->getThreshold();
+	FVector vector1, vector2, vector3, vector4;
+	FVector vTemp = _data[0];
+	double vWidth2 = (double)surface->_width * 0.5;
+	double vHeight2 = (double)surface->_height * 0.5;
+	FRect r;
+
+	surface->_pixel = 0xff0000;
+	uint oldPixel = surface->_pixel;
+	surface->setColorFromPixel();
+	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;
+	vector1._y = vTemp._x * pose._row1._y + vTemp._y * pose._row2._y + vTemp._z * pose._row3._y + pose._vector._y; 
+
+	for (uint idx = 1; idx < _data.size(); ++idx) {
+		const FVector &sv = _data[idx];
+		bool flag = _data[idx - 1]._flag;
+		vTemp = sv;
+
+		vector3._x = vTemp._x * pose._row1._x + vTemp._y * pose._row2._x + vTemp._z * pose._row3._x * pose._vector._x;
+		vector3._y = vTemp._x * pose._row1._y + vTemp._y * pose._row2._y + vTemp._z * pose._row3._y * pose._vector._y;
+		vector3._z = vTemp._x * pose._row1._z + vTemp._y * pose._row2._z + vTemp._z * pose._row3._z + pose._vector._z;
+
+		if (flag && vector1._z > threshold && vector3._z > threshold) {
+			vector2 = camera->getRelativePos(2, vector1);
+			vector4 = camera->getRelativePos(2, vector3);
+
+			r.bottom = vector4._y + vHeight2;
+			r.right = vector4._x + vWidth2;
+			r.top = vector2._y + vHeight2;
+			r.left = vector2._x + vWidth2;
+			surface->drawLine(r);
+		}
+
+		vector1 = vector3;
+	}
+
+	surface->_pixel = oldPixel;
+	surface->setColorFromPixel();
+	surface->setMode(oldMode);
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/star_control/const_boundaries.h b/engines/titanic/star_control/const_boundaries.h
new file mode 100644
index 0000000..5dece0d
--- /dev/null
+++ b/engines/titanic/star_control/const_boundaries.h
@@ -0,0 +1,57 @@
+/* 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_CONST_BOUNDARIES_H
+#define TITANIC_CONST_BOUNDARIES_H
+
+#include "titanic/star_control/fvector.h"
+#include "common/array.h"
+
+namespace Titanic {
+
+class CStarCamera;
+class CSurfaceArea;
+
+class CConstBoundaries {
+	struct CStarPointEntry : public FVector {
+		bool _flag;
+		CStarPointEntry() : FVector(), _flag(false) {}
+	};
+private:
+	Common::Array<CStarPointEntry> _data;
+public:
+	CConstBoundaries();
+
+	/**
+	 * Initialize the array
+	 */
+	bool initialize();
+
+	/**
+	 * Draw the starfield points
+	 */
+	void draw(CSurfaceArea *surface, CStarCamera *camera);
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_STAR_POINTS1_H */
diff --git a/engines/titanic/star_control/constellations.cpp b/engines/titanic/star_control/constellations.cpp
new file mode 100644
index 0000000..4608074
--- /dev/null
+++ b/engines/titanic/star_control/constellations.cpp
@@ -0,0 +1,123 @@
+/* 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/constellations.h"
+#include "titanic/star_control/star_camera.h"
+#include "titanic/star_control/surface_area.h"
+#include "titanic/support/files_manager.h"
+#include "titanic/titanic.h"
+
+#include "common/math.h"
+
+namespace Titanic {
+
+#define ARRAY_COUNT 80
+
+bool CConstellations::initialize() {
+	// Get a reference to the starfield points resource
+	Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS2");
+
+	_data.resize(ARRAY_COUNT);
+	for (int rootCtr = 0; rootCtr < ARRAY_COUNT; ++rootCtr) {
+		// Get the number of sub-entries for this entry
+		int count = stream->readUint32LE();
+		double v1, v2;
+
+		// Read in the sub-entries
+		RootEntry &rootEntry = _data[rootCtr];
+		rootEntry.resize(count);
+		for (int idx = 0; idx < count; ++idx) {
+			CStarPointEntry &se = rootEntry[idx];
+			FVector *vectors[2] = { &se._v1, &se._v2 };
+
+			for (int fctr = 0; fctr < 2; ++fctr) {
+				v1 = stream->readSint32LE();
+				v2 = stream->readSint32LE();
+				v1 *= Common::deg2rad<double>(0.015);
+				v2 *= Common::deg2rad<double>(0.01);
+
+				vectors[fctr]->_x = cos(v1) * 3000000.0 * cos(v2);
+				vectors[fctr]->_y = sin(v1) * 3000000.0 * cos(v2);
+				vectors[fctr]->_z = sin(v2) * 3000000.0;
+			}
+		}
+	}
+
+	delete stream;
+	return true;
+}
+
+void CConstellations::draw(CSurfaceArea *surface, CStarCamera *camera) {
+	if (_data.empty())
+		return;
+
+	FPose pose = camera->getPose();
+	double threshold = camera->getThreshold();
+	FVector vector1, vector2, vector3, vector4;
+	double vWidth2 = (double)surface->_width * 0.5;
+	double vHeight2 = (double)surface->_height * 0.5;
+	FRect r;
+
+	surface->_pixel = 0xffff00;
+	uint oldPixel = surface->_pixel;
+	surface->setColorFromPixel();
+	SurfaceAreaMode oldMode = surface->setMode(SA_SOLID);
+
+	for (uint rootCtr = 0; rootCtr < _data.size(); ++rootCtr) {
+		const RootEntry &re = _data[rootCtr];
+		if (!re._visible || re.empty())
+			continue;
+
+		for (uint idx = 0; idx < re.size(); ++idx) {
+			const CStarPointEntry &se = re[idx];
+			vector1._z = pose._row2._z * se._v1._y + pose._row3._z * se._v1._z
+				+ pose._row1._z * se._v1._x + pose._vector._z;
+			vector1._x = pose._row2._x * se._v1._y + pose._row3._x * se._v1._z
+				+ pose._row1._x * se._v1._x + pose._vector._x;
+			vector1._y = pose._row2._y * se._v1._y + pose._row3._y * se._v1._z
+				+ pose._row1._y * se._v1._x + pose._vector._y;
+			vector3._z = pose._row2._z * se._v2._y + pose._row2._x * se._v2._z
+				+ pose._row1._z * se._v2._x + pose._vector._y;
+			vector3._x = pose._row3._z * se._v2._y + pose._row3._x * se._v2._z
+				+ pose._row1._x * se._v2._x + pose._vector._y;
+			vector3._y = pose._row2._y * se._v2._y + pose._row3._y * se._v2._z
+				+ pose._row1._y * se._v2._x + pose._vector._y;
+
+			if (vector1._z > threshold && vector3._z > threshold) {
+				vector2 = camera->getRelativePos(2, vector1);
+				vector4 = camera->getRelativePos(2, vector3);
+
+				r.bottom = vector4._y + vHeight2;
+				r.right = vector4._x + vWidth2;
+				r.top = vector2._y + vHeight2;
+				r.left = vector2._x + vWidth2;
+				surface->drawLine(r);
+			}
+		}
+	}
+
+	surface->_pixel = oldPixel;
+	surface->setColorFromPixel();
+	surface->setMode(oldMode);
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/star_control/constellations.h b/engines/titanic/star_control/constellations.h
new file mode 100644
index 0000000..a5a2788
--- /dev/null
+++ b/engines/titanic/star_control/constellations.h
@@ -0,0 +1,59 @@
+/* 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_POINTS2_H
+#define TITANIC_STAR_POINTS2_H
+
+#include "titanic/star_control/fvector.h"
+#include "common/array.h"
+
+namespace Titanic {
+
+class CStarCamera;
+class CSurfaceArea;
+
+class CConstellations {
+	struct CStarPointEntry {
+		FVector _v1, _v2;
+	};
+	class RootEntry : public Common::Array<CStarPointEntry> {
+	public:
+		bool _visible;
+		RootEntry() : _visible(false) {}
+	};
+private:
+	Common::Array<RootEntry> _data;
+public:
+	/**
+	 * Initializes the data
+	 */
+	bool initialize();
+
+	/**
+	 * Draw the starfield points
+	 */
+	void draw(CSurfaceArea *surface, CStarCamera *camera);
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_STAR_POINTS2_H */
diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp
index fa1c8f2..220a244 100644
--- a/engines/titanic/star_control/star_camera.cpp
+++ b/engines/titanic/star_control/star_camera.cpp
@@ -127,9 +127,9 @@ void CStarCamera::randomizeOrientation() {
 		_viewport.randomizeOrientation();
 }
 
-void CStarCamera::proc12(StarMode mode, double v2) {
+void CStarCamera::setFields(StarMode mode, double val) {
 	if (!isLocked())
-		_viewport.changeStarColorPixel(mode, v2);
+		_viewport.changeStarColorPixel(mode, val);
 }
 
 void CStarCamera::proc13(CViewport *dest) {
diff --git a/engines/titanic/star_control/star_camera.h b/engines/titanic/star_control/star_camera.h
index 9d0c954..678f7b0 100644
--- a/engines/titanic/star_control/star_camera.h
+++ b/engines/titanic/star_control/star_camera.h
@@ -102,7 +102,7 @@ public:
 	virtual void setCenterYAngle(int v);
 	virtual void setCenterZAngle(int v);
 	virtual void randomizeOrientation();
-	virtual void proc12(StarMode mode, double v2);
+	virtual void setFields(StarMode mode, double val);
 	virtual void proc13(CViewport *dest);
 
 	/**
diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp
index 95ae388..ed0fc39 100644
--- a/engines/titanic/star_control/star_control.cpp
+++ b/engines/titanic/star_control/star_control.cpp
@@ -169,7 +169,7 @@ void CStarControl::doAction(StarControlAction action) {
 			detach();
 			addUnder(view);
 			_view.fn2();
-			_view.fn3(true);
+			_view.triggerFade(true);
 			_visible = true;
 		}
 		break;
@@ -186,52 +186,52 @@ void CStarControl::doAction(StarControlAction action) {
 		break;
 	}
 
-	case STAR_2:
-		_view.fn4();
+	case STAR_VIEW_EARTH:
+		_view.viewEarth();
 		break;
 
-	case STAR_RESET_POS:
-		_view.resetPosition();
+	case STAR_VIEW_FROM_EARTH:
+		_view.viewFromEarth();
 		break;
 
-	case STAR_4:
-		_view.fn5();
+	case STAR_VIEW_BOUNDARIES:
+		_view.viewBoundaries();
 		break;
 
-	case STAR_5:
-		_view.fn6();
+	case STAR_VIEW_CONSTELLATIONS:
+		_view.viewConstellations();
 		break;
 
-	case STAR_6:
-		_view.fn7();
+	case STAR_VIEW_RANDOM_STAR:
+		_view.viewRandomStar();
 		break;
 
 	case STAR_FULL_SPEED:
 		_view.fullSpeed();
 		break;
 
-	case STAR_8:
-		_view.fn9();
+	case STAR_TOGGLE_STEREO_PAIR:
+		_view.toggleSteroPair();
 		break;
 
-	case STAR_TOGGLE_MODE:
-		_view.toggleMode();
+	case STAR_TOGGLE_HOME_PHOTO:
+		_view.toggleHomePhoto();
 		break;
 
-	case STAR_10:
-		_view.fn11();
+	case STAR_TOGGLE_SOLAR_RENDERING:
+		_view.toggleSolarRendering();
 		break;
 
-	case STAR_11:
-		_view.toggleBox();
+	case STAR_TOGGLE_POS_FRAME:
+		_view.TogglePosFrame();
 		break;
 
-	case STAR_12:
-		_view.fn13();
+	case STAR_STEREO_PAIR_ON:
+		_view.stereoPairOn();
 		break;
 
-	case STAR_13:
-		_view.fn14();
+	case STAR_STEREO_PAIR_OFF:
+		_view.stereoPairOff();
 		break;
 
 	case STAR_SET_REFERENCE: {
@@ -243,11 +243,11 @@ void CStarControl::doAction(StarControlAction action) {
 	}
 
 	case STAR_FADE_IN:
-		_view.fn3(true);
+		_view.triggerFade(true);
 		break;
 
 	case STAR_FADE_OUT:
-		_view.fn3(false);
+		_view.triggerFade(false);
 		break;
 
 	case LOCK_STAR:
@@ -258,7 +258,7 @@ void CStarControl::doAction(StarControlAction action) {
 		_view.unlockStar();
 		break;
 
-	case STAR_19:
+	case STAR_CLEAR_MODIFIED:
 		_view.starDestinationSet();
 		break;
 
diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp
index 8a4450e..8c7fbfd 100644
--- a/engines/titanic/star_control/star_field.cpp
+++ b/engines/titanic/star_control/star_field.cpp
@@ -27,15 +27,15 @@
 
 namespace Titanic {
 
-CStarField::CStarField() : _points1On(false), _points2On(false), _mode(MODE_STARFIELD),
+CStarField::CStarField() : _renderBoundaries(false), _renderConstMap(false), _mode(MODE_STARFIELD),
 		_showBox(true), _closeToMarker(false), _isSolved(false) {
 }
 
 void CStarField::load(SimpleFile *file) {
 	_markers.load(file);
 	_crosshairs.load(file);
-	_points1On = file->readNumber();
-	_points2On = file->readNumber();
+	_renderBoundaries = file->readNumber();
+	_renderConstMap = file->readNumber();
 	_mode = (StarMode)file->readNumber();
 	_showBox = file->readNumber();
 	_isSolved = file->readNumber();
@@ -44,21 +44,21 @@ void CStarField::load(SimpleFile *file) {
 void CStarField::save(SimpleFile *file, int indent) {
 	_markers.save(file, indent);
 	_crosshairs.save(file, indent);
-	file->writeNumberLine(_points1On, indent);
-	file->writeNumberLine(_points2On, indent);
+	file->writeNumberLine(_renderBoundaries, indent);
+	file->writeNumberLine(_renderConstMap, indent);
 	file->writeNumberLine(_mode, indent);
 	file->writeNumberLine(_showBox, indent);
 	file->writeNumberLine(_isSolved, indent);
 }
 
 bool CStarField::initDocument() {
-	bool valid = setup() && _points1.initialize();
+	bool valid = setup() && _constBounds.initialize();
 	if (valid)
 		valid = _starCloseup.setup();
 	if (valid)
-		valid = _points1.initialize();
+		valid = _constBounds.initialize();
 	if (valid)
-		valid = _points2.initialize();
+		valid = _constMap.initialize();
 
 	return valid;
 }
@@ -72,28 +72,28 @@ void CStarField::render(CVideoSurface *surface, CStarCamera *camera) {
 	_markers.draw(&surfaceArea, camera, nullptr);
 	_crosshairs.draw(&surfaceArea);
 
-	if (_points2On)
-		_points2.draw(&surfaceArea, camera);
-	if (_points1On)
-		_points1.draw(&surfaceArea, camera);
+	if (_renderConstMap)
+		_constMap.draw(&surfaceArea, camera);
+	if (_renderBoundaries)
+		_constBounds.draw(&surfaceArea, camera);
 
 	fn4(&surfaceArea, camera);
 }
 
-int CStarField::get1() const {
-	return _points1On;
+bool CStarField::getBoundaryState() const {
+	return _renderBoundaries;
 }
 
-void CStarField::set1(int val) {
-	_points1On = val;
+void CStarField::setBoundaryState(bool state) {
+	_renderBoundaries = state;
 }
 
-int CStarField::get2() const {
-	return _points2On;
+bool CStarField::getConstMapState() const {
+	return _renderConstMap;
 }
 
-void CStarField::set2(int val) {
-	_points2On = val;
+void CStarField::setConstMapState(bool state) {
+	_renderConstMap = state;
 }
 
 int CStarField::get54() const {
diff --git a/engines/titanic/star_control/star_field.h b/engines/titanic/star_control/star_field.h
index 3b1c3db..6648d47 100644
--- a/engines/titanic/star_control/star_field.h
+++ b/engines/titanic/star_control/star_field.h
@@ -27,8 +27,8 @@
 #include "titanic/star_control/star_closeup.h"
 #include "titanic/star_control/star_markers.h"
 #include "titanic/star_control/star_crosshairs.h"
-#include "titanic/star_control/star_points1.h"
-#include "titanic/star_control/star_points2.h"
+#include "titanic/star_control/const_boundaries.h"
+#include "titanic/star_control/constellations.h"
 
 namespace Titanic {
 
@@ -36,11 +36,11 @@ class CStarField : public CStarFieldBase {
 private:
 	CStarMarkers _markers;
 	CStarCrosshairs _crosshairs;
-	CStarPoints1 _points1;
-	CStarPoints2 _points2;
+	CConstBoundaries _constBounds;
+	CConstellations _constMap;
 	CStarCloseup _starCloseup;
-	bool _points1On;
-	bool _points2On;
+	bool _renderBoundaries;
+	bool _renderConstMap;
 	StarMode _mode;
 	bool _showBox;
 	bool _closeToMarker;
@@ -72,10 +72,14 @@ public:
 	 */
 	void render(CVideoSurface *surface, CStarCamera *camera);
 
-	int get1() const;
-	void set1(int val);
-	int get2() const;
-	void set2(int val);
+	bool getBoundaryState() const;
+
+	void setBoundaryState(bool state);
+
+	bool getConstMapState() const;
+
+	void setConstMapState(bool state);
+
 	int get54() const;
 	void set54(int val);
 
@@ -147,6 +151,7 @@ public:
 	void incMatches();
 
 	void fn8(CVideoSurface *surface);
+
 	void fn9() { _starCloseup.fn1(); }
 
 	/**
diff --git a/engines/titanic/star_control/star_points1.cpp b/engines/titanic/star_control/star_points1.cpp
deleted file mode 100644
index 7aabe21..0000000
--- a/engines/titanic/star_control/star_points1.cpp
+++ /dev/null
@@ -1,113 +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_points1.h"
-#include "titanic/star_control/star_camera.h"
-#include "titanic/star_control/surface_area.h"
-#include "titanic/support/files_manager.h"
-#include "titanic/titanic.h"
-
-#include "common/math.h"
-
-namespace Titanic {
-
-#define ARRAY_COUNT 876
-
-CStarPoints1::CStarPoints1() {
-}
-
-bool CStarPoints1::initialize() {
-	// Get a reference to the starfield points resource
-	Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS");
-	assert(stream && stream->size() == (12 * ARRAY_COUNT));
-
-	_data.resize(ARRAY_COUNT);
-	for (int idx = 0; idx < ARRAY_COUNT; ++idx) {
-		CStarPointEntry &entry = _data[idx];
-
-		// Get the next set of values
-		double v1 = stream->readSint32LE();
-		double v2 = stream->readSint32LE();
-		entry._flag = stream->readUint32LE() != 0;
-
-		v1 *= Common::deg2rad<double>(0.015);
-		v2 *= Common::deg2rad<double>(0.0099999998);
-
-		entry._x = cos(v2) * 3000000.0 * cos(v1);
-		entry._y = sin(v1) * 3000000.0 * cos(v2);
-		entry._z = sin(v2) * 3000000.0;
-	}
-
-	delete stream;
-	return true;
-}
-
-void CStarPoints1::draw(CSurfaceArea *surface, CStarCamera *camera) {
-	if (_data.empty())
-		return;
-
-	FPose pose = camera->getPose();
-	double threshold = camera->getThreshold();
-	FVector vector1, vector2, vector3, vector4;
-	FVector vTemp = _data[0];
-	double vWidth2 = (double)surface->_width * 0.5;
-	double vHeight2 = (double)surface->_height * 0.5;
-	FRect r;
-
-	surface->_pixel = 0xff0000;
-	uint oldPixel = surface->_pixel;
-	surface->setColorFromPixel();
-	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;
-	vector1._y = vTemp._x * pose._row1._y + vTemp._y * pose._row2._y + vTemp._z * pose._row3._y + pose._vector._y; 
-
-	for (uint idx = 1; idx < _data.size(); ++idx) {
-		const FVector &sv = _data[idx];
-		bool flag = _data[idx - 1]._flag;
-		vTemp = sv;
-
-		vector3._x = vTemp._x * pose._row1._x + vTemp._y * pose._row2._x + vTemp._z * pose._row3._x * pose._vector._x;
-		vector3._y = vTemp._x * pose._row1._y + vTemp._y * pose._row2._y + vTemp._z * pose._row3._y * pose._vector._y;
-		vector3._z = vTemp._x * pose._row1._z + vTemp._y * pose._row2._z + vTemp._z * pose._row3._z + pose._vector._z;
-
-		if (flag && vector1._z > threshold && vector3._z > threshold) {
-			vector2 = camera->getRelativePos(2, vector1);
-			vector4 = camera->getRelativePos(2, vector3);
-
-			r.bottom = vector4._y + vHeight2;
-			r.right = vector4._x + vWidth2;
-			r.top = vector2._y + vHeight2;
-			r.left = vector2._x + vWidth2;
-			surface->drawLine(r);
-		}
-
-		vector1 = vector3;
-	}
-
-	surface->_pixel = oldPixel;
-	surface->setColorFromPixel();
-	surface->setMode(oldMode);
-}
-
-} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_points1.h b/engines/titanic/star_control/star_points1.h
deleted file mode 100644
index 28b7f68..0000000
--- a/engines/titanic/star_control/star_points1.h
+++ /dev/null
@@ -1,57 +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_POINTS1_H
-#define TITANIC_STAR_POINTS1_H
-
-#include "titanic/star_control/fvector.h"
-#include "common/array.h"
-
-namespace Titanic {
-
-class CStarCamera;
-class CSurfaceArea;
-
-class CStarPoints1 {
-	struct CStarPointEntry : public FVector {
-		bool _flag;
-		CStarPointEntry() : FVector(), _flag(false) {}
-	};
-private:
-	Common::Array<CStarPointEntry> _data;
-public:
-	CStarPoints1();
-
-	/**
-	 * Initialize the array
-	 */
-	bool initialize();
-
-	/**
-	 * Draw the starfield points
-	 */
-	void draw(CSurfaceArea *surface, CStarCamera *camera);
-};
-
-} // End of namespace Titanic
-
-#endif /* TITANIC_STAR_POINTS1_H */
diff --git a/engines/titanic/star_control/star_points2.cpp b/engines/titanic/star_control/star_points2.cpp
deleted file mode 100644
index 6e91a6e..0000000
--- a/engines/titanic/star_control/star_points2.cpp
+++ /dev/null
@@ -1,123 +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_points2.h"
-#include "titanic/star_control/star_camera.h"
-#include "titanic/star_control/surface_area.h"
-#include "titanic/support/files_manager.h"
-#include "titanic/titanic.h"
-
-#include "common/math.h"
-
-namespace Titanic {
-
-#define ARRAY_COUNT 80
-
-bool CStarPoints2::initialize() {
-	// Get a reference to the starfield points resource
-	Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS2");
-
-	_data.resize(ARRAY_COUNT);
-	for (int rootCtr = 0; rootCtr < ARRAY_COUNT; ++rootCtr) {
-		// Get the number of sub-entries for this entry
-		int count = stream->readUint32LE();
-		double v1, v2;
-
-		// Read in the sub-entries
-		RootEntry &rootEntry = _data[rootCtr];
-		rootEntry.resize(count);
-		for (int idx = 0; idx < count; ++idx) {
-			CStarPointEntry &se = rootEntry[idx];
-			FVector *vectors[2] = { &se._v1, &se._v2 };
-
-			for (int fctr = 0; fctr < 2; ++fctr) {
-				v1 = stream->readSint32LE();
-				v2 = stream->readSint32LE();
-				v1 *= Common::deg2rad<double>(0.015);
-				v2 *= Common::deg2rad<double>(0.01);
-
-				vectors[fctr]->_x = cos(v1) * 3000000.0 * cos(v2);
-				vectors[fctr]->_y = sin(v1) * 3000000.0 * cos(v2);
-				vectors[fctr]->_z = sin(v2) * 3000000.0;
-			}
-		}
-	}
-
-	delete stream;
-	return true;
-}
-
-void CStarPoints2::draw(CSurfaceArea *surface, CStarCamera *camera) {
-	if (_data.empty())
-		return;
-
-	FPose pose = camera->getPose();
-	double threshold = camera->getThreshold();
-	FVector vector1, vector2, vector3, vector4;
-	double vWidth2 = (double)surface->_width * 0.5;
-	double vHeight2 = (double)surface->_height * 0.5;
-	FRect r;
-
-	surface->_pixel = 0xffff00;
-	uint oldPixel = surface->_pixel;
-	surface->setColorFromPixel();
-	SurfaceAreaMode oldMode = surface->setMode(SA_SOLID);
-
-	for (uint rootCtr = 0; rootCtr < _data.size(); ++rootCtr) {
-		const RootEntry &re = _data[rootCtr];
-		if (!re._field0 || re.empty())
-			continue;
-
-		for (uint idx = 0; idx < re.size(); ++idx) {
-			const CStarPointEntry &se = re[idx];
-			vector1._z = pose._row2._z * se._v1._y + pose._row3._z * se._v1._z
-				+ pose._row1._z * se._v1._x + pose._vector._z;
-			vector1._x = pose._row2._x * se._v1._y + pose._row3._x * se._v1._z
-				+ pose._row1._x * se._v1._x + pose._vector._x;
-			vector1._y = pose._row2._y * se._v1._y + pose._row3._y * se._v1._z
-				+ pose._row1._y * se._v1._x + pose._vector._y;
-			vector3._z = pose._row2._z * se._v2._y + pose._row2._x * se._v2._z
-				+ pose._row1._z * se._v2._x + pose._vector._y;
-			vector3._x = pose._row3._z * se._v2._y + pose._row3._x * se._v2._z
-				+ pose._row1._x * se._v2._x + pose._vector._y;
-			vector3._y = pose._row2._y * se._v2._y + pose._row3._y * se._v2._z
-				+ pose._row1._y * se._v2._x + pose._vector._y;
-
-			if (vector1._z > threshold && vector3._z > threshold) {
-				vector2 = camera->getRelativePos(2, vector1);
-				vector4 = camera->getRelativePos(2, vector3);
-
-				r.bottom = vector4._y + vHeight2;
-				r.right = vector4._x + vWidth2;
-				r.top = vector2._y + vHeight2;
-				r.left = vector2._x + vWidth2;
-				surface->drawLine(r);
-			}
-		}
-	}
-
-	surface->_pixel = oldPixel;
-	surface->setColorFromPixel();
-	surface->setMode(oldMode);
-}
-
-} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_points2.h b/engines/titanic/star_control/star_points2.h
deleted file mode 100644
index e57ea12..0000000
--- a/engines/titanic/star_control/star_points2.h
+++ /dev/null
@@ -1,59 +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_POINTS2_H
-#define TITANIC_STAR_POINTS2_H
-
-#include "titanic/star_control/fvector.h"
-#include "common/array.h"
-
-namespace Titanic {
-
-class CStarCamera;
-class CSurfaceArea;
-
-class CStarPoints2 {
-	struct CStarPointEntry {
-		FVector _v1, _v2;
-	};
-	class RootEntry : public Common::Array<CStarPointEntry> {
-	public:
-		int _field0;
-		RootEntry() : _field0(0) {}
-	};
-private:
-	Common::Array<RootEntry> _data;
-public:
-	/**
-	 * Initializes the data
-	 */
-	bool initialize();
-
-	/**
-	 * Draw the starfield points
-	 */
-	void draw(CSurfaceArea *surface, CStarCamera *camera);
-};
-
-} // End of namespace Titanic
-
-#endif /* TITANIC_STAR_POINTS2_H */
diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp
index f66512e..f166e02 100644
--- a/engines/titanic/star_control/star_view.cpp
+++ b/engines/titanic/star_control/star_view.cpp
@@ -37,7 +37,7 @@ namespace Titanic {
 CStarView::CStarView() : _camera((const CNavigationInfo *)nullptr), _owner(nullptr),
 		_starField(nullptr), _videoSurface(nullptr), _hasReference(0),
 		_photoSurface(nullptr), _homePhotoMask(nullptr),
-		_field218(false), _showingPhoto(false) {
+		_stereoPair(false), _showingPhoto(false) {
 	CNavigationInfo data = { 0, 0, 100000.0, 0, 20.0, 1.0, 1.0, 1.0 };
 
 	_camera.proc3(&data);
@@ -56,7 +56,7 @@ void CStarView::load(SimpleFile *file, int param) {
 		if (_hasReference)
 			_photoViewport.load(file, 0);
 
-		_field218 = file->readNumber();
+		_stereoPair = file->readNumber();
 		_showingPhoto = file->readNumber();
 	}
 }
@@ -68,7 +68,7 @@ void CStarView::save(SimpleFile *file, int indent) {
 	if (_hasReference)
 		_photoViewport.save(file, indent);
 
-	file->writeNumberLine(_field218, indent);
+	file->writeNumberLine(_stereoPair, indent);
 	file->writeNumberLine(_showingPhoto, indent);
 }
 
@@ -161,7 +161,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
 	switch (tolower(key)) {
 	case Common::KEYCODE_TAB:
 		if (_starField) {
-			toggleMode();
+			toggleHomePhoto();
 			return true;
 		}
 		break;
@@ -259,10 +259,6 @@ void CStarView::starDestinationSet() {
 	_camera.clearIsMoved();
 }
 
-void CStarView::resetPosition() {
-	_camera.setPosition(FVector(0.0, 0.0, 0.0));
-}
-
 bool CStarView::updateCamera() {
 	if (_fader.isActive() || _showingPhoto)
 		return false;
@@ -289,38 +285,42 @@ void CStarView::fn2() {
 			resizeSurface(scrManager, 600, 340, &_videoSurface);
 
 		if (_videoSurface) {
-			fn13();
+			stereoPairOn();
 			fn19(244);
 			draw(scrManager);
 		}
 	}
 }
 
-void CStarView::fn3(bool fadeIn) {
+void CStarView::triggerFade(bool fadeIn) {
 	_fader.reset();
 	_fader.setFadeIn(fadeIn);
 }
 
-void CStarView::fn4() {
-	FVector v1, v2;
-	randomizeVectors1(v1, v2);
-	_camera.setPosition(v1);
-	_camera.setOrientation(v2);
+void CStarView::viewFromEarth() {
+	_camera.setPosition(FVector(0.0, 0.0, 0.0));
+}
+
+void CStarView::viewEarth() {
+	FVector pos, dir;
+	getRandomViewpoint(pos, dir);
+	_camera.setPosition(pos);
+	_camera.setOrientation(dir);
 }
 
-void CStarView::fn5() {
-	_starField->set1(!_starField->get1());
+void CStarView::viewBoundaries() {
+	_starField->setBoundaryState(!_starField->getBoundaryState());
 }
 
-void CStarView::fn6() {
-	_starField->set2(!_starField->get2());
+void CStarView::viewConstellations() {
+	_starField->setConstMapState(!_starField->getConstMapState());
 }
 
-void CStarView::fn7() {
+void CStarView::viewRandomStar() {
 	const CBaseStarEntry *star = _starField->getRandomStar();
 	if (star) {
 		FVector pos, orientation;
-		randomizeVectors1(pos, orientation);
+		getRandomViewpoint(pos, orientation);
 		pos += star->_position;
 		_camera.setPosition(pos);
 		_camera.setOrientation(orientation);
@@ -331,7 +331,7 @@ void CStarView::fn19(int index) {
 	const CBaseStarEntry *star = _starField->getStar(index);
 	if (star) {
 		FVector pos, orientation;
-		randomizeVectors1(pos, orientation);
+		getRandomViewpoint(pos, orientation);
 		pos += star->_position;
 		_camera.setPosition(pos);
 		_camera.setOrientation(orientation);
@@ -342,18 +342,18 @@ void CStarView::fullSpeed() {
 	_camera.fullSpeed();
 }
 
-void CStarView::fn9() {
-	_field218 = !_field218;
-	if (_field218) {
-		_camera.proc12(MODE_PHOTO, 30.0);
-		_camera.proc12(MODE_STARFIELD, 28000.0);
+void CStarView::toggleSteroPair() {
+	_stereoPair = !_stereoPair;
+	if (_stereoPair) {
+		_camera.setFields(MODE_PHOTO, 30.0);
+		_camera.setFields(MODE_STARFIELD, 28000.0);
 	} else {
-		_camera.proc12(MODE_PHOTO, 0.0);
-		_camera.proc12(MODE_STARFIELD, 0.0);
+		_camera.setFields(MODE_PHOTO, 0.0);
+		_camera.setFields(MODE_STARFIELD, 0.0);
 	}
 }
 
-void CStarView::toggleMode() {
+void CStarView::toggleHomePhoto() {
 	if (!_photoSurface)
 		return;
 
@@ -362,26 +362,26 @@ void CStarView::toggleMode() {
 		_starField->setMode(_showingPhoto ? MODE_PHOTO : MODE_STARFIELD);
 }
 
-void CStarView::fn11() {
+void CStarView::toggleSolarRendering() {
 	if (_starField)
 		_starField->fn9();
 }
 
-void CStarView::toggleBox() {
+void CStarView::TogglePosFrame() {
 	if (_starField)
 		_starField->toggleBox();
 }
 
-void CStarView::fn13() {
-	_field218 = true;
-	_camera.proc12(MODE_PHOTO, 30.0);
-	_camera.proc12(MODE_STARFIELD, 28000.0);
+void CStarView::stereoPairOn() {
+	_stereoPair = true;
+	_camera.setFields(MODE_PHOTO, 30.0);
+	_camera.setFields(MODE_STARFIELD, 28000.0);
 }
 
-void CStarView::fn14() {
-	_field218 = false;
-	_camera.proc12(MODE_PHOTO, 0.0);
-	_camera.proc12(MODE_STARFIELD, 0.0);
+void CStarView::stereoPairOff() {
+	_stereoPair = false;
+	_camera.setFields(MODE_PHOTO, 0.0);
+	_camera.setFields(MODE_STARFIELD, 0.0);
 }
 
 void CStarView::setHasReference() {
@@ -390,12 +390,12 @@ void CStarView::setHasReference() {
 
 	_photoViewport.setPosition(pos);
 	_photoViewport.setOrientation(orientation);
-	_field218 = false;
+	_stereoPair = false;
 	_photoViewport.changeStarColorPixel(MODE_PHOTO, 0.0);
 	_photoViewport.changeStarColorPixel(MODE_STARFIELD, 0.0);
 	_hasReference = true;
 	reset();
-	_field218 = true;
+	_stereoPair = true;
 }
 
 void CStarView::lockStar() {
@@ -471,7 +471,7 @@ void CStarView::fn18(CStarCamera *camera) {
 	}
 }
 
-void CStarView::randomizeVectors1(FVector &pos, FVector &orientation) {
+void CStarView::getRandomViewpoint(FVector &pos, FVector &orientation) {
 	/* ***DEBUG***
 	v1._x = 3072.0 - g_vm->getRandomFloat() * -4096.0;
 	v1._y = 3072.0 - g_vm->getRandomFloat() * -4096.0;
diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h
index 241efbc..1a2e7e9 100644
--- a/engines/titanic/star_control/star_view.h
+++ b/engines/titanic/star_control/star_view.h
@@ -48,7 +48,7 @@ private:
 	CSurfaceFader _fader;
 	CVideoSurface *_photoSurface;
 	CGameObject *_homePhotoMask;
-	bool _field218;
+	bool _stereoPair;
 	bool _showingPhoto;
 private:
 	void fn18(CStarCamera *camera);
@@ -57,7 +57,7 @@ private:
 	/**
 	 * Gets a random position and orientation
 	 */
-	void randomizeVectors1(FVector &pos, FVector &orientation);
+	void getRandomViewpoint(FVector &pos, FVector &orientation);
 
 	/**
 	 * Gets a random position and orientation
@@ -125,39 +125,68 @@ public:
 	 */
 	void starDestinationSet();
 
+	void fn2();
+	void triggerFade(bool fadeIn);
+
 	/**
-	 * Resets back to the origin position
+	 * View the solar system
 	 */
-	void resetPosition();
+	void viewEarth();
 
-	void fn2();
-	void fn3(bool fadeIn);
-	void fn4();
-	void fn5();
-	void fn6();
-	void fn7();
+	/**
+	 * Set the view to be from earth
+	 */
+	void viewFromEarth();
+
+	/**
+	 * Turn on constellation boundaries
+	 */
+	void viewBoundaries();
+
+	/**
+	 * Turn on the constellation lines
+	 */
+	void viewConstellations();
+
+	/**
+	 * Look at a random star
+	 */
+	void viewRandomStar();
 
 	/**
 	 * Increase starfield movement to full speed
 	 */
 	void fullSpeed();
 
-	void fn9();
+	/**
+	 * Enable stereo pair vision
+	 */
+	void toggleSteroPair();
 
 	/**
 	 * Toggles between starfield and photo modes
 	 */
-	void toggleMode();
+	void toggleHomePhoto();
 
-	void fn11();
+	/**
+	 * Toggles the solar object rendering
+	 */
+	void toggleSolarRendering();
 
 	/**
 	 * Toggles whether the viewpoint box is visible in the starfield
 	 */
-	void toggleBox();
+	void TogglePosFrame();
 
-	void fn13();
-	void fn14();
+	/**
+	 * Turn on Stereo Pair imaging
+	 */
+	void stereoPairOn();
+
+	/**
+	 * Turn off Stereo Pair imaging
+	 */
+	void stereoPairOff();
 
 	/**
 	 * Called when the photograph is used on the navigation computer


Commit: 75739abe01b9b98779f42f69eaf0093d21ea1422
    https://github.com/scummvm/scummvm/commit/75739abe01b9b98779f42f69eaf0093d21ea1422
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-01-11T20:47:25-08:00

Commit Message:
TITANIC: Cleanup of CStarView

Changed paths:
    engines/titanic/star_control/fvector.h
    engines/titanic/star_control/star_camera.cpp
    engines/titanic/star_control/star_control.cpp
    engines/titanic/star_control/star_crosshairs.cpp
    engines/titanic/star_control/star_crosshairs.h
    engines/titanic/star_control/star_field.cpp
    engines/titanic/star_control/star_field.h
    engines/titanic/star_control/star_view.cpp
    engines/titanic/star_control/star_view.h


diff --git a/engines/titanic/star_control/fvector.h b/engines/titanic/star_control/fvector.h
index 1e25c9a..6b562bc 100644
--- a/engines/titanic/star_control/fvector.h
+++ b/engines/titanic/star_control/fvector.h
@@ -69,12 +69,14 @@ public:
 	 * Attempts to normalizes the vector so the length from origin equals 1.0
 	 * Return value is whether or not it was successful in normalizing
 	 * First argument is scale value that normalizes the vector
-	 * TODO: split this function into 2. One that calculates the normalization
-	 * and another that does the normalization. The 2nd would assert if a
-	 * normalization of one was requested. This is cleaner than the current
-	 * implementation.
 	 */
-	bool normalize(float &);
+	bool normalize(float &hyp);
+
+	void normalize() {
+		float hyp;
+		bool result = normalize(hyp);
+		assert(result);
+	}
 
 	/**
 	 * Adds the current vector and a passed one together, normalizes them,
diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp
index 220a244..aa60bda 100644
--- a/engines/titanic/star_control/star_camera.cpp
+++ b/engines/titanic/star_control/star_camera.cpp
@@ -219,7 +219,6 @@ StarColor CStarCamera::getStarColor() const {
 	return _viewport._starColor;
 }
 
-// Similar to CViewport::fn17/fn18
 FVector CStarCamera::getRelativePos(int index, const FVector &src) {
 	FVector dest;
 
diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp
index ed0fc39..f8c9096 100644
--- a/engines/titanic/star_control/star_control.cpp
+++ b/engines/titanic/star_control/star_control.cpp
@@ -69,7 +69,7 @@ void CStarControl::load(SimpleFile *file) {
 			error("There's no screen manager during loading");
 
 		_view.setup(screenManager, &_starField, this);
-		_view.reset();
+		_view.takeCurrentHomePhoto();
 
 		_enabled = true;
 	}
@@ -168,7 +168,7 @@ void CStarControl::doAction(StarControlAction action) {
 		if (view) {
 			detach();
 			addUnder(view);
-			_view.fn2();
+			_view.resetView();
 			_view.triggerFade(true);
 			_visible = true;
 		}
@@ -235,7 +235,7 @@ void CStarControl::doAction(StarControlAction action) {
 		break;
 
 	case STAR_SET_REFERENCE: {
-		_view.setHasReference();
+		_view.takeCurrentHomePhoto();
 		CPetControl *pet = getPetControl();
 		if (pet)
 			pet->starsSetReference();
diff --git a/engines/titanic/star_control/star_crosshairs.cpp b/engines/titanic/star_control/star_crosshairs.cpp
index 0393da5..2da83b9 100644
--- a/engines/titanic/star_control/star_crosshairs.cpp
+++ b/engines/titanic/star_control/star_crosshairs.cpp
@@ -149,7 +149,7 @@ bool CStarCrosshairs::fn1(CStarField *starField, CSurfaceArea *surfaceArea, CSta
 	}
 }
 
-void CStarCrosshairs::fn2(CVideoSurface *surface, CStarField *starField, CStarMarkers *markers) {
+void CStarCrosshairs::decMatches(CVideoSurface *surface, CStarField *starField, CStarMarkers *markers) {
 	if (_matchIndex <= -1) {
 		if (_entryIndex > -1) {
 			drawEntry(_entryIndex, surface, starField, markers);
diff --git a/engines/titanic/star_control/star_crosshairs.h b/engines/titanic/star_control/star_crosshairs.h
index 3d060fd..e30572a 100644
--- a/engines/titanic/star_control/star_crosshairs.h
+++ b/engines/titanic/star_control/star_crosshairs.h
@@ -79,14 +79,18 @@ public:
 	void draw(CSurfaceArea *surfaceArea);
 
 	bool fn1(CStarField *starField, CSurfaceArea *surfaceArea, CStarCamera *camera);
-	void fn2(CVideoSurface *surface, CStarField *starField, CStarMarkers *markers);
 
 	/**
-	 * Increments the index for the number of matches
+	 * Increments the number of matches
 	 */
 	void incMatches();
 
 	/**
+	 * Decrements the number of matches
+	 */
+	void decMatches(CVideoSurface *surface, CStarField *starField, CStarMarkers *markers);
+
+	/**
 	 * Draw the crosshairs for a given star
 	 */
 	void drawStar(int index, CSurfaceArea *surfaceArea);
diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp
index 8c7fbfd..483dc37 100644
--- a/engines/titanic/star_control/star_field.cpp
+++ b/engines/titanic/star_control/star_field.cpp
@@ -178,20 +178,20 @@ void CStarField::drawBox(CSurfaceArea *surfaceArea) {
 }
 
 void CStarField::fn4(CSurfaceArea *surfaceArea, CStarCamera *camera) {
-	FVector v1, v2, v3;
+	FVector screenCoord, worldCoord, photoPos;
 	_closeToMarker = false;
 
 	if (_mode == MODE_STARFIELD) {
-		if (fn5(surfaceArea, camera, v1, v2, v3) > -1.0) {
+		if (lockDistance(surfaceArea, camera, screenCoord, worldCoord, photoPos) > -1.0) {
 			surfaceArea->_pixel = 0xA0A0;
 			surfaceArea->setColorFromPixel();
-			surfaceArea->drawLine(FRect(v1._x, v1._y, v3._x, v3._y));
+			surfaceArea->drawLine(FRect(screenCoord._x, screenCoord._y, photoPos._x, photoPos._y));
 		}
 	}
 }
 
-double CStarField::fn5(CSurfaceArea *surfaceArea, CStarCamera *camera,
-		FVector &v1, FVector &v2, FVector &v3) {
+double CStarField::lockDistance(CSurfaceArea *surfaceArea, CStarCamera *camera,
+		FVector &screenCoord, FVector &worldCoord, FVector &photoPos) {
 	if (_crosshairs.isEmpty())
 		// No crosshairs selection yet
 		return -1.0;
@@ -200,24 +200,24 @@ double CStarField::fn5(CSurfaceArea *surfaceArea, CStarCamera *camera,
 		return -1.0;
 
 	const CBaseStarEntry *dataP = _markers.getDataPtr(_crosshairs._entryIndex);
-	v2 = dataP->_position;
-	FVector tv = camera->getRelativePosNoCentering(2, v2); // First argument is not getting used in CViewport::fn16
+	worldCoord = dataP->_position;
+	FVector tv = camera->getRelativePosNoCentering(2, worldCoord); // First argument is not getting used in CViewport::fn16
 
 	if (camera->getThreshold() >= tv._z)
 		return -1.0;
 
 	tv = camera->getRelativePos(2, tv);
 
-	v1 = FVector(tv._x + surfaceArea->_centroid._x,
+	screenCoord = FVector(tv._x + surfaceArea->_centroid._x,
 		tv._y + surfaceArea->_centroid._y, tv._z);
 	FPoint pt = _crosshairs.getPosition();
-	v3 = FVector(pt._x, pt._y, 1.0);
+	photoPos = FVector(pt._x, pt._y, 1.0);
 
-	double incr = (v1._x - pt._x) * (v1._x - pt._x);
+	double incr = (screenCoord._x - pt._x) * (screenCoord._x - pt._x);
 	if (incr > 3600.0)
 		return -1.0;
 
-	incr += (v1._y - pt._y) * (v1._y - pt._y);
+	incr += (screenCoord._y - pt._y) * (screenCoord._y - pt._y);
 	if (incr > 3600.0)
 		return -1.0;
 
@@ -230,13 +230,13 @@ void CStarField::fn6(CVideoSurface *surface, CStarCamera *camera) {
 	_crosshairs.fn1(this, &surfaceArea, camera);
 }
 
-void CStarField::incMatches() {
+void CStarField::incLockLevel() {
 	_crosshairs.incMatches();
 	setSolved();
 }
 
-void CStarField::fn8(CVideoSurface *surface) {
-	_crosshairs.fn2(surface, this, &_markers);
+void CStarField::decLockLevel(CVideoSurface *surface) {
+	_crosshairs.decMatches(surface, this, &_markers);
 	setSolved();
 }
 
diff --git a/engines/titanic/star_control/star_field.h b/engines/titanic/star_control/star_field.h
index 6648d47..9450a13 100644
--- a/engines/titanic/star_control/star_field.h
+++ b/engines/titanic/star_control/star_field.h
@@ -32,6 +32,8 @@
 
 namespace Titanic {
 
+#define STAR_SCALE 1024.0F
+
 class CStarField : public CStarFieldBase {
 private:
 	CStarMarkers _markers;
@@ -141,18 +143,26 @@ public:
 	}
 
 	void fn1(CErrorCode *errorCode);
-	double fn5(CSurfaceArea *surfaceArea, CStarCamera *camera,
-		FVector &v1, FVector &v2, FVector &v3);
+
+	/**
+	  * Gets the lock distance to a star
+	  */
+	double lockDistance(CSurfaceArea *surfaceArea, CStarCamera *camera,
+		FVector &screenCoord, FVector &worldCoord, FVector &photoPos);
+
 	void fn6(CVideoSurface *surface, CStarCamera *camera);
 
 	/**
 	 * Increments the number of matched markers
 	 */
-	void incMatches();
+	void incLockLevel();
 
-	void fn8(CVideoSurface *surface);
+	/**
+	 * Decrements the number of matched markers
+	 */
+	void decLockLevel(CVideoSurface *surface);
 
-	void fn9() { _starCloseup.fn1(); }
+	void ToggleSolarRendering() { _starCloseup.fn1(); }
 
 	/**
 	 * Called when the starfield is clicked
diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp
index f166e02..083276d 100644
--- a/engines/titanic/star_control/star_view.cpp
+++ b/engines/titanic/star_control/star_view.cpp
@@ -31,11 +31,12 @@
 #include "titanic/core/game_object.h"
 #include "titanic/messages/pet_messages.h"
 #include "titanic/pet_control/pet_control.h"
+#include "titanic/titanic.h"
 
 namespace Titanic {
 
 CStarView::CStarView() : _camera((const CNavigationInfo *)nullptr), _owner(nullptr),
-		_starField(nullptr), _videoSurface(nullptr), _hasReference(0),
+		_starField(nullptr), _videoSurface(nullptr), _lensValid(0),
 		_photoSurface(nullptr), _homePhotoMask(nullptr),
 		_stereoPair(false), _showingPhoto(false) {
 	CNavigationInfo data = { 0, 0, 100000.0, 0, 20.0, 1.0, 1.0, 1.0 };
@@ -52,8 +53,8 @@ void CStarView::load(SimpleFile *file, int param) {
 	if (!param) {
 		_camera.load(file, param);
 
-		_hasReference = file->readNumber();
-		if (_hasReference)
+		_lensValid = file->readNumber();
+		if (_lensValid)
 			_photoViewport.load(file, 0);
 
 		_stereoPair = file->readNumber();
@@ -64,8 +65,8 @@ void CStarView::load(SimpleFile *file, int param) {
 void CStarView::save(SimpleFile *file, int indent) {
 	_camera.save(file, indent);
 
-	file->writeNumberLine(_hasReference, indent);
-	if (_hasReference)
+	file->writeNumberLine(_lensValid, indent);
+	if (_lensValid)
 		_photoViewport.save(file, indent);
 
 	file->writeNumberLine(_stereoPair, indent);
@@ -77,10 +78,10 @@ void CStarView::setup(CScreenManager *screenManager, CStarField *starField, CSta
 	_owner = starControl;
 }
 
-void CStarView::reset() {
-	if (_hasReference) {
+void CStarView::takeCurrentHomePhoto() {
+	if (_lensValid) {
 		CStarCamera camera(&_photoViewport);
-		fn18(&camera);
+		takeHomePhotoHelper(&camera);
 	}
 }
 
@@ -278,7 +279,7 @@ bool CStarView::updateCamera() {
 	return false;
 }
 
-void CStarView::fn2() {
+void CStarView::resetView() {
 	if (!_videoSurface) {
 		CScreenManager *scrManager = CScreenManager::setCurrent();
 		if (scrManager)
@@ -286,7 +287,7 @@ void CStarView::fn2() {
 
 		if (_videoSurface) {
 			stereoPairOn();
-			fn19(244);
+			viewRequiredStar(244);
 			draw(scrManager);
 		}
 	}
@@ -327,7 +328,7 @@ void CStarView::viewRandomStar() {
 	}
 }
 
-void CStarView::fn19(int index) {
+void CStarView::viewRequiredStar(int index) {
 	const CBaseStarEntry *star = _starField->getStar(index);
 	if (star) {
 		FVector pos, orientation;
@@ -364,7 +365,7 @@ void CStarView::toggleHomePhoto() {
 
 void CStarView::toggleSolarRendering() {
 	if (_starField)
-		_starField->fn9();
+		_starField->ToggleSolarRendering();
 }
 
 void CStarView::TogglePosFrame() {
@@ -384,7 +385,7 @@ void CStarView::stereoPairOff() {
 	_camera.setFields(MODE_STARFIELD, 0.0);
 }
 
-void CStarView::setHasReference() {
+void CStarView::takeHomePhoto() {
 	FVector pos, orientation;
 	getRandomPhotoViewpoint(pos, orientation);
 
@@ -393,42 +394,44 @@ void CStarView::setHasReference() {
 	_stereoPair = false;
 	_photoViewport.changeStarColorPixel(MODE_PHOTO, 0.0);
 	_photoViewport.changeStarColorPixel(MODE_STARFIELD, 0.0);
-	_hasReference = true;
-	reset();
+
+	_lensValid = true;
+	takeCurrentHomePhoto();
 	_stereoPair = true;
 }
 
 void CStarView::lockStar() {
 	if (_starField && !_showingPhoto) {
 		CSurfaceArea surfaceArea(_videoSurface);
-		FVector v1, v2, v3;
-		double val = _starField->fn5(&surfaceArea, &_camera, v1, v2, v3);
+		FVector screenCoord, worldCoord, photoPos;
+		double dist = _starField->lockDistance(&surfaceArea, &_camera,
+			screenCoord, worldCoord, photoPos);
 		bool lockSuccess = false;
 
-		if (val > -1.0) {
-			v1 -= surfaceArea._centroid;
-			v3 -= surfaceArea._centroid;
+		if (dist > -1.0) {
+			screenCoord -= surfaceArea._centroid;
+			photoPos -= surfaceArea._centroid;
 
 			switch (_starField->getMatchedIndex()) {
 			case -1:
 				// First star match
-				lockSuccess = _camera.lockMarker1(v1, v2, v3);
+				lockSuccess = _camera.lockMarker1(screenCoord, worldCoord, photoPos);
 				assert(lockSuccess); // lockMarker1 should always succeed
-				_starField->incMatches();
+				_starField->incLockLevel();
 				break;
 
 			case 0:
 				// Second star match
-				lockSuccess = _camera.lockMarker2(&_photoViewport, v2);
+				lockSuccess = _camera.lockMarker2(&_photoViewport, worldCoord);
 				if (lockSuccess) // lockMarker2 may have issues
-					_starField->incMatches();
+					_starField->incLockLevel();
 				break;
 
 			case 1:
 				// Third star match
-				lockSuccess = _camera.lockMarker3(&_photoViewport, v2);
+				lockSuccess = _camera.lockMarker3(&_photoViewport, worldCoord);
 				assert(lockSuccess); // lockMarker3 should always succeed
-				_starField->incMatches();
+				_starField->incLockLevel();
 				break;
 
 			default:
@@ -441,11 +444,11 @@ void CStarView::lockStar() {
 void CStarView::unlockStar() {
 	if (_starField && !_showingPhoto && _camera.isNotInLockingProcess()) {
 		_camera.removeLockedStar();
-		_starField->fn8(_photoSurface);
+		_starField->decLockLevel(_photoSurface);
 	}
 }
 
-void CStarView::fn18(CStarCamera *camera) {
+void CStarView::takeHomePhotoHelper(CStarCamera *camera) {
 	if (_starField) {
 		if (!_photoSurface) {
 			CScreenManager *scrManager = CScreenManager::setCurrent();
diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h
index 1a2e7e9..9e56e95 100644
--- a/engines/titanic/star_control/star_view.h
+++ b/engines/titanic/star_control/star_view.h
@@ -43,7 +43,7 @@ private:
 	CStarField *_starField;
 	CVideoSurface *_videoSurface;
 	CStarCamera _camera;
-	bool _hasReference;
+	bool _lensValid;
 	CViewport _photoViewport;
 	CSurfaceFader _fader;
 	CVideoSurface *_photoSurface;
@@ -51,8 +51,15 @@ private:
 	bool _stereoPair;
 	bool _showingPhoto;
 private:
-	void fn18(CStarCamera *camera);
-	void fn19(int v);
+	/**
+	 * Take a photograph of a view specified by the camera
+	 */
+	void takeHomePhotoHelper(CStarCamera *camera);
+
+	/**
+	 * View a specified star
+	 */
+	void viewRequiredStar(int index);
 
 	/**
 	 * Gets a random position and orientation
@@ -88,7 +95,10 @@ public:
 	 */
 	void setup(CScreenManager *screenManager, CStarField *starField, CStarControl *starControl);
 
-	void reset();
+	/**
+	 * Take a photograph of a view specified by the current home photo lens
+	 */
+	void takeCurrentHomePhoto();
 
 	/**
 	 * Allows the item to draw itself
@@ -125,7 +135,11 @@ public:
 	 */
 	void starDestinationSet();
 
-	void fn2();
+	/**
+	 * Reset the starfield view
+	 */
+	void resetView();
+
 	void triggerFade(bool fadeIn);
 
 	/**
@@ -189,9 +203,10 @@ public:
 	void stereoPairOff();
 
 	/**
-	 * Called when the photograph is used on the navigation computer
+	 * Called when the photograph is used on the navigation computer,
+	 * takes a photograph of the current view, writing it to the home photo surface
 	 */
-	void setHasReference();
+	void takeHomePhoto();
 
 	/**
 	 * Handles locking in a star
@@ -206,4 +221,4 @@ public:
 
 } // End of namespace Titanic
 
-#endif /* TITANIC_STAR_RENDERER_H */
+#endif /* TITANIC_STAR_VIEW_H */


Commit: e33716e11d3752b74e94eb7ba49639aca27e3f02
    https://github.com/scummvm/scummvm/commit/e33716e11d3752b74e94eb7ba49639aca27e3f02
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-01-11T20:47:25-08:00

Commit Message:
TITANIC: Finally re-enable randomized initial view for star control

Changed paths:
    engines/titanic/star_control/star_view.cpp


diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp
index 083276d..563c874 100644
--- a/engines/titanic/star_control/star_view.cpp
+++ b/engines/titanic/star_control/star_view.cpp
@@ -475,35 +475,31 @@ void CStarView::takeHomePhotoHelper(CStarCamera *camera) {
 }
 
 void CStarView::getRandomViewpoint(FVector &pos, FVector &orientation) {
-	/* ***DEBUG***
-	v1._x = 3072.0 - g_vm->getRandomFloat() * -4096.0;
-	v1._y = 3072.0 - g_vm->getRandomFloat() * -4096.0;
-	v1._z = 3072.0 - g_vm->getRandomFloat() * -4096.0;
+	const double MIN_RADIUS = 3.0F * STAR_SCALE;
+	const double RADIUS = 4.0F * STAR_SCALE;
 
-	v2._x = -v1._x;
-	v2._y = -v1._y;
-	v2._z = -v1._z;
-	v2.normalize();
-	*/
-	// Values temporarily hardcoded to match hacked values in original EXE
-	pos = FVector((float)69481544.0, (float)69481544.0, (float)69481544.0);
-	orientation = FVector((float)-0.577350259, (float)-0.577350259, (float)-0.577350259);
+	pos._x = MIN_RADIUS + g_vm->getRandomFloat() * RADIUS;
+	pos._y = MIN_RADIUS + g_vm->getRandomFloat() * RADIUS;
+	pos._z = MIN_RADIUS + g_vm->getRandomFloat() * RADIUS;
+
+	orientation._x = -pos._x;
+	orientation._y = -pos._y;
+	orientation._z = -pos._z;
+	orientation.normalize();
 }
 
 void CStarView::getRandomPhotoViewpoint(FVector &pos, FVector &orientation) {
-	/* ****DEBUG***
-	v1._x = 3072.0 - g_vm->getRandomFloat() * -4096.0;
-	v1._y = 3072.0 - g_vm->getRandomFloat() * -4096.0;
-	v1._z = 3072.0 - g_vm->getRandomFloat() * -4096.0;
-
-	v2._x = g_vm->getRandomFloat() * 8192.0 - v1._x;
-	v2._y = g_vm->getRandomFloat() * 1024.0 - v1._y;
-	v2._z = -v1._z;
-	v2.normalize();
-	*/
-	// Values temporarily hardcoded to match hacked values in original EXE
-	pos = FVector((float)69481544.0, (float)69481544.0, (float)69481544.0);
-	orientation = FVector((float)0.624659300, (float)-0.468542814, (float)-0.624714553);
+	const double MIN_RADIUS = 3.0F * STAR_SCALE;
+	const double RADIUS = 4.0F * STAR_SCALE;
+
+	pos._x = MIN_RADIUS + g_vm->getRandomFloat() * RADIUS;
+	pos._y = MIN_RADIUS + g_vm->getRandomFloat() * RADIUS;
+	pos._z = MIN_RADIUS + g_vm->getRandomFloat() * RADIUS;
+
+	orientation._x = g_vm->getRandomFloat() * (STAR_SCALE * 8) - pos._x;
+	orientation._y = g_vm->getRandomFloat() * STAR_SCALE - pos._y;
+	orientation._z = -pos._z;
+	orientation.normalize();
 }
 
 void CStarView::resizeSurface(CScreenManager *scrManager, int width, int height,




More information about the Scummvm-git-logs mailing list