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

dreammaster dreammaster at scummvm.org
Thu Jun 8 03:50:11 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:
c105be916e TITANIC: Renamings for automatic camera mover classes


Commit: c105be916ed2ee5cb0207ecfa69703ea89a61655
    https://github.com/scummvm/scummvm/commit/c105be916ed2ee5cb0207ecfa69703ea89a61655
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-06-07T21:50:03-04:00

Commit Message:
TITANIC: Renamings for automatic camera mover classes

Changed paths:
  A engines/titanic/star_control/camera_auto_mover.cpp
  A engines/titanic/star_control/camera_auto_mover.h
  A engines/titanic/star_control/marked_auto_mover.cpp
  A engines/titanic/star_control/marked_auto_mover.h
  A engines/titanic/star_control/unmarked_auto_mover.cpp
  A engines/titanic/star_control/unmarked_auto_mover.h
  R engines/titanic/star_control/star_control_sub23.cpp
  R engines/titanic/star_control/star_control_sub23.h
  R engines/titanic/star_control/star_control_sub24.cpp
  R engines/titanic/star_control/star_control_sub24.h
  R engines/titanic/star_control/star_control_sub27.cpp
  R engines/titanic/star_control/star_control_sub27.h
    engines/titanic/module.mk
    engines/titanic/star_control/star_control_sub21.cpp
    engines/titanic/star_control/star_control_sub21.h
    engines/titanic/star_control/star_control_sub22.cpp
    engines/titanic/star_control/star_control_sub22.h


diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index 1e85874..d6c8396 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -432,6 +432,7 @@ MODULE_OBJS := \
 	sound/wave_file.o \
 	star_control/star_control.o \
 	star_control/base_stars.o \
+	star_control/camera_auto_mover.o \
 	star_control/camera_mover.o \
 	star_control/dmatrix.o \
 	star_control/dvector.o \
@@ -441,6 +442,7 @@ MODULE_OBJS := \
 	star_control/frange.o \
 	star_control/frect.o \
 	star_control/fvector.o \
+	star_control/marked_auto_mover.o \
 	star_control/matrix_transform.o \
 	star_control/orientation_changer.o \
 	star_control/star_camera.o \
@@ -448,9 +450,6 @@ MODULE_OBJS := \
 	star_control/star_control_sub2.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_crosshairs.o \
 	star_control/star_field.o \
 	star_control/star_markers.o \
@@ -460,6 +459,7 @@ MODULE_OBJS := \
 	star_control/star_view.o \
 	star_control/surface_area.o \
 	star_control/surface_fader.o \
+	star_control/unmarked_auto_mover.o \
 	star_control/viewport.o \
 	support/avi_surface.o \
 	support/direct_draw.o \
diff --git a/engines/titanic/star_control/camera_auto_mover.cpp b/engines/titanic/star_control/camera_auto_mover.cpp
new file mode 100644
index 0000000..45e5a9e
--- /dev/null
+++ b/engines/titanic/star_control/camera_auto_mover.cpp
@@ -0,0 +1,106 @@
+/* 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/camera_auto_mover.h"
+#include "common/textconsole.h"
+
+namespace Titanic {
+
+CCameraAutoMover::CCameraAutoMover() : _srcPos(0.0, 1000000.0, 0.0) {
+	_field4 = 0;
+	_active = false;
+	_distance = 0.0;
+	_field34 = false;
+	_field38 = 0.0;
+	_field3C = 0;
+	_field40 = 0;
+	_field44 = 0;
+	_field48 = 0;
+	_field4C = 0;
+	_field54 = 0;
+	_transitionPercent = 0.0;
+	_transitionPercentInc = 0.0;
+}
+
+void CCameraAutoMover::proc2(const FVector &oldPos, const FVector &newPos,
+	const FMatrix &oldOrientation, const FMatrix &newOrientation) {
+	_srcPos = oldPos;
+	_destPos = newPos;
+	_posDelta = _destPos - _srcPos;
+	_distance = _posDelta.normalize();
+
+	_active = false;
+	_field34 = false;
+	_transitionPercent = 1.0;
+	_field40 = -1;
+	_field44 = -1;
+	_field48 = -1;
+	_field4C = 0;
+}
+
+void CCameraAutoMover::proc3(const FMatrix &srcOrient, const FMatrix &destOrient) {
+	_srcPos.clear();
+	_destPos.clear();
+	_transitionPercent = 1.0;
+	_distance = 0.0;
+	_active = false;
+	_field34 = false;
+}
+
+void CCameraAutoMover::setPath(const FVector &srcV, const FVector &destV, const FMatrix &orientation) {
+	_srcPos = srcV;
+	_destPos = destV;
+	_posDelta = _destPos - _srcPos;
+	_distance = _posDelta.normalize();
+
+	_active = false;
+	_field34 = false;
+	_field40 = -1;
+	_field44 = -1;
+	_field48 = -1;
+	_field4C = -1;
+	_transitionPercent = 1.0;
+}
+
+void CCameraAutoMover::proc6(int val1, int val2, float val) {
+	_field44 = val1;
+	_field4C = val1 + 62;
+	_field38 = val / (double)(val1 + val2 * 2);
+	_field40 = 31;
+	_field48 = 31;
+	_field3C = (double)val2 * _field38;
+	
+	// Calculate the speeds for a graduated movement between stars
+	double base = 0.0, total = 0.0;
+	_speeds.resize(32);
+	for (int idx = 31; idx >= 0; --idx) {
+		_speeds[idx] = pow(base, 4.0);
+		total += _speeds[idx];
+		base += 0.03125;
+	}
+	
+	for (int idx = 0; idx < 32; ++idx) {
+		_speeds[idx] = _speeds[idx] * _field3C / total;
+	}
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/star_control/camera_auto_mover.h b/engines/titanic/star_control/camera_auto_mover.h
new file mode 100644
index 0000000..5293828
--- /dev/null
+++ b/engines/titanic/star_control/camera_auto_mover.h
@@ -0,0 +1,71 @@
+/* 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_CAMERA_AUTO_MOVER_H
+#define TITANIC_CAMERA_AUTO_MOVER_H
+
+#include "titanic/star_control/error_code.h"
+#include "titanic/star_control/fmatrix.h"
+#include "titanic/star_control/fvector.h"
+#include "titanic/star_control/orientation_changer.h"
+
+namespace Titanic {
+
+/**
+ * Base class for automatic movement of the starview camera
+ */
+class CCameraAutoMover {
+protected:
+	int _field4;
+	bool _active;
+	FVector _srcPos, _destPos;
+	double _distance;
+	FVector _posDelta;
+	bool _field34;
+	double _field38;
+	double _field3C;
+	int _field40;
+	int _field44;
+	int _field48;
+	int _field4C;
+	Common::Array<double> _speeds;
+	int _field54;
+	double _transitionPercent;
+	double _transitionPercentInc;
+	COrientationChanger _orientationChanger;
+public:
+	CCameraAutoMover();
+	virtual ~CCameraAutoMover() {}
+
+	virtual void proc2(const FVector &oldPos, const FVector &newPos,
+		const FMatrix &oldOrientation, const FMatrix &newOrientation);
+	virtual void proc3(const FMatrix &srcOrient, const FMatrix &destOrient);
+	virtual void setPath(const FVector &srcV, const FVector &destV, const FMatrix &orientation);
+	virtual int proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) { return 2; }
+	virtual void proc6(int val1, int val2, float val);
+
+	bool isActive() const { return _active; }
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_CAMERA_AUTO_MOVER_H */
diff --git a/engines/titanic/star_control/marked_auto_mover.cpp b/engines/titanic/star_control/marked_auto_mover.cpp
new file mode 100644
index 0000000..828fe03
--- /dev/null
+++ b/engines/titanic/star_control/marked_auto_mover.cpp
@@ -0,0 +1,107 @@
+/* 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/marked_auto_mover.h"
+#include "common/textconsole.h"
+
+namespace Titanic {
+
+void CMarkedAutoMover::proc2(const FVector &oldPos, const FVector &newPos,
+	const FMatrix &oldOrientation, const FMatrix &newOrientation) {
+	CCameraAutoMover::proc2(oldPos, newPos, oldOrientation, newOrientation);
+
+	double distance = _distance;
+	if (distance > 0.0) {
+		_active = true;
+		_field34 = true;
+		proc6(120, 4, distance);
+	}
+
+	if (newPos != oldPos) {
+		_orientationChanger.load(oldOrientation, newOrientation);
+		_transitionPercent = 0.0;
+
+		if (_field4C == 0) {
+			_transitionPercentInc = 0.1;
+			_active = true;
+		} else {
+			_transitionPercentInc = 1.0 / _field4C;
+			_active = true;
+		}
+	}
+}
+
+int CMarkedAutoMover::proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) {
+	if (!_active)
+		return 0;
+
+	_transitionPercent += _transitionPercentInc;
+	orientation = _orientationChanger.getOrientation(_transitionPercent);
+	errorCode.set();
+
+	if (_field40 >= 0) {
+		double speedVal = _speeds[_field40];
+		pos += _posDelta * speedVal;
+		getVectorOnPath(pos);
+
+		--_field40;
+		errorCode.set();
+		return 1;
+	} else if (_field44 > 0) {
+		pos += _posDelta * _field38;
+		getVectorOnPath(pos);
+
+		--_field44;
+		errorCode.set();
+		return 1;
+	} else if (_field48 >= 0) {
+		double speedVal = _speeds[31 - _field48];
+		pos += _posDelta * speedVal;
+		getVectorOnPath(pos);
+
+		--_field48;
+		errorCode.set();
+		return 1;
+	} else {
+		_active = false;
+		return 2;
+	}
+}
+
+void CMarkedAutoMover::getVectorOnPath(FVector &pos) const {
+	double distance = _posDelta.getDistance(pos);
+	distance /= _distance;
+
+	if (distance <= 0.0) {
+		pos = _srcPos;
+	} else if (distance >= 1.0) {
+		pos = _destPos;
+	} else {
+		pos = FVector(
+			(_destPos._x - _srcPos._x) * distance + _srcPos._x,
+			(_destPos._y - _srcPos._y) * distance + _srcPos._y,
+			(_destPos._z - _srcPos._z) * distance + _srcPos._z
+		);
+	}
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/star_control/marked_auto_mover.h b/engines/titanic/star_control/marked_auto_mover.h
new file mode 100644
index 0000000..5127496
--- /dev/null
+++ b/engines/titanic/star_control/marked_auto_mover.h
@@ -0,0 +1,51 @@
+/* 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_MARKED_AUTO_MOVER_H
+#define TITANIC_MARKED_AUTO_MOVER_H
+
+#include "titanic/star_control/camera_auto_mover.h"
+
+namespace Titanic {
+
+/**
+ * Automatic camera mover used when one or more markers have been set
+ */
+class CMarkedAutoMover : public CCameraAutoMover {
+private:
+	/**
+	 * Given a vector, figures out how far is from the movement source, and
+	 * returns a vector on the proper point along the path to the destination
+	 * with that same distance from the source.
+	 */
+	void getVectorOnPath(FVector &pos) const;
+public:
+	virtual ~CMarkedAutoMover() {}
+
+	virtual void proc2(const FVector &oldPos, const FVector &newPos,
+		const FMatrix &oldOrientation, const FMatrix &newOrientation);
+	virtual int proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orientation);
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_MARKED_AUTO_MOVER_H */
diff --git a/engines/titanic/star_control/star_control_sub21.cpp b/engines/titanic/star_control/star_control_sub21.cpp
index bf5af80..4b7a6c3 100644
--- a/engines/titanic/star_control/star_control_sub21.cpp
+++ b/engines/titanic/star_control/star_control_sub21.cpp
@@ -38,7 +38,7 @@ void CStarControlSub21::moveTo(const FVector &srcV, const FVector &destV, const
 
 	debugC(DEBUG_BASIC, kDebugStarfield, "Starfield move %s to %s", srcV.toString().c_str(),
 		destV.toString().c_str());
-	_sub24.setPath(srcV, destV, orientation);
+	_autoMover.setPath(srcV, destV, orientation);
 }
 
 void CStarControlSub21::proc10(const FVector &v1, const FVector &v2, const FVector &v3, const FMatrix &m) {
@@ -50,14 +50,14 @@ void CStarControlSub21::proc10(const FVector &v1, const FVector &v2, const FVect
 	DMatrix matrix1 = vector2.fn4(vector1);
 	DMatrix matrix2 = matrix1.fn4(m);
 
-	_sub24.proc3(m, matrix2);
+	_autoMover.proc3(m, matrix2);
 	incLockCount();
 }
 
 void CStarControlSub21::updatePosition(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) {
-	if (_sub24.isActive()) {
+	if (_autoMover.isActive()) {
 		decLockCount();
-		int val = _sub24.proc5(errorCode, pos, orientation);
+		int val = _autoMover.proc5(errorCode, pos, orientation);
 		if (val == 1)
 			incLockCount();
 		if (val == 2) {
diff --git a/engines/titanic/star_control/star_control_sub21.h b/engines/titanic/star_control/star_control_sub21.h
index 3b804d9..bd876e5 100644
--- a/engines/titanic/star_control/star_control_sub21.h
+++ b/engines/titanic/star_control/star_control_sub21.h
@@ -24,13 +24,13 @@
 #define TITANIC_STAR_CONTROL_SUB21_H
 
 #include "titanic/star_control/camera_mover.h"
-#include "titanic/star_control/star_control_sub24.h"
+#include "titanic/star_control/unmarked_auto_mover.h"
 
 namespace Titanic {
 
 class CStarControlSub21 : public CCameraMover {
 private:
-	CStarControlSub24 _sub24;
+	CUnmarkedAutoMover _autoMover;
 public:
 	CStarControlSub21(const CNavigationInfo *src);
 	virtual ~CStarControlSub21() {}
diff --git a/engines/titanic/star_control/star_control_sub22.cpp b/engines/titanic/star_control/star_control_sub22.cpp
index f3d9b6d..f26fbb5 100644
--- a/engines/titanic/star_control/star_control_sub22.cpp
+++ b/engines/titanic/star_control/star_control_sub22.cpp
@@ -34,14 +34,14 @@ void CStarControlSub22::proc8(const FVector &oldPos, const FVector &newPos,
 	if (isLocked())
 		decLockCount();
 
-	_sub27.proc2(oldPos, newPos, oldOrientation, newOrientation);
+	_autoMover.proc2(oldPos, newPos, oldOrientation, newOrientation);
 	incLockCount();
 }
 
 void CStarControlSub22::updatePosition(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) {
-	if (_sub27.isActive()) {
+	if (_autoMover.isActive()) {
 		decLockCount();
-		int val = _sub27.proc5(errorCode, pos, orientation);
+		int val = _autoMover.proc5(errorCode, pos, orientation);
 		if (val == 1)
 			incLockCount();
 		if (val == 2) {
diff --git a/engines/titanic/star_control/star_control_sub22.h b/engines/titanic/star_control/star_control_sub22.h
index 876e06d..91b9c40 100644
--- a/engines/titanic/star_control/star_control_sub22.h
+++ b/engines/titanic/star_control/star_control_sub22.h
@@ -24,13 +24,13 @@
 #define TITANIC_STAR_CONTROL_SUB22_H
 
 #include "titanic/star_control/camera_mover.h"
-#include "titanic/star_control/star_control_sub27.h"
+#include "titanic/star_control/marked_auto_mover.h"
 
 namespace Titanic {
 
 class CStarControlSub22 : public CCameraMover {
 private:
-	CStarControlSub27 _sub27;
+	CMarkedAutoMover _autoMover;
 public:
 	CStarControlSub22(const CNavigationInfo *src);
 	virtual ~CStarControlSub22() {}
diff --git a/engines/titanic/star_control/star_control_sub23.cpp b/engines/titanic/star_control/star_control_sub23.cpp
deleted file mode 100644
index f72d5c8..0000000
--- a/engines/titanic/star_control/star_control_sub23.cpp
+++ /dev/null
@@ -1,106 +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_sub23.h"
-#include "common/textconsole.h"
-
-namespace Titanic {
-
-CStarControlSub23::CStarControlSub23() : _srcPos(0.0, 1000000.0, 0.0) {
-	_field4 = 0;
-	_active = false;
-	_distance = 0.0;
-	_field34 = false;
-	_field38 = 0.0;
-	_field3C = 0;
-	_field40 = 0;
-	_field44 = 0;
-	_field48 = 0;
-	_field4C = 0;
-	_field54 = 0;
-	_transitionPercent = 0.0;
-	_transitionPercentInc = 0.0;
-}
-
-void CStarControlSub23::proc2(const FVector &oldPos, const FVector &newPos,
-	const FMatrix &oldOrientation, const FMatrix &newOrientation) {
-	_srcPos = oldPos;
-	_destPos = newPos;
-	_posDelta = _destPos - _srcPos;
-	_distance = _posDelta.normalize();
-
-	_active = false;
-	_field34 = false;
-	_transitionPercent = 1.0;
-	_field40 = -1;
-	_field44 = -1;
-	_field48 = -1;
-	_field4C = 0;
-}
-
-void CStarControlSub23::proc3(const FMatrix &srcOrient, const FMatrix &destOrient) {
-	_srcPos.clear();
-	_destPos.clear();
-	_transitionPercent = 1.0;
-	_distance = 0.0;
-	_active = false;
-	_field34 = false;
-}
-
-void CStarControlSub23::setPath(const FVector &srcV, const FVector &destV, const FMatrix &orientation) {
-	_srcPos = srcV;
-	_destPos = destV;
-	_posDelta = _destPos - _srcPos;
-	_distance = _posDelta.normalize();
-
-	_active = false;
-	_field34 = false;
-	_field40 = -1;
-	_field44 = -1;
-	_field48 = -1;
-	_field4C = -1;
-	_transitionPercent = 1.0;
-}
-
-void CStarControlSub23::proc6(int val1, int val2, float val) {
-	_field44 = val1;
-	_field4C = val1 + 62;
-	_field38 = val / (double)(val1 + val2 * 2);
-	_field40 = 31;
-	_field48 = 31;
-	_field3C = (double)val2 * _field38;
-	
-	// Calculate the speeds for a graduated movement between stars
-	double base = 0.0, total = 0.0;
-	_speeds.resize(32);
-	for (int idx = 31; idx >= 0; --idx) {
-		_speeds[idx] = pow(base, 4.0);
-		total += _speeds[idx];
-		base += 0.03125;
-	}
-	
-	for (int idx = 0; idx < 32; ++idx) {
-		_speeds[idx] = _speeds[idx] * _field3C / total;
-	}
-}
-
-} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control_sub23.h b/engines/titanic/star_control/star_control_sub23.h
deleted file mode 100644
index af6d9de..0000000
--- a/engines/titanic/star_control/star_control_sub23.h
+++ /dev/null
@@ -1,68 +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_SUB23_H
-#define TITANIC_STAR_CONTROL_SUB23_H
-
-#include "titanic/star_control/error_code.h"
-#include "titanic/star_control/fmatrix.h"
-#include "titanic/star_control/fvector.h"
-#include "titanic/star_control/orientation_changer.h"
-
-namespace Titanic {
-
-class CStarControlSub23 {
-protected:
-	int _field4;
-	bool _active;
-	FVector _srcPos, _destPos;
-	double _distance;
-	FVector _posDelta;
-	bool _field34;
-	double _field38;
-	double _field3C;
-	int _field40;
-	int _field44;
-	int _field48;
-	int _field4C;
-	Common::Array<double> _speeds;
-	int _field54;
-	double _transitionPercent;
-	double _transitionPercentInc;
-	COrientationChanger _orientationChanger;
-public:
-	CStarControlSub23();
-	virtual ~CStarControlSub23() {}
-
-	virtual void proc2(const FVector &oldPos, const FVector &newPos,
-		const FMatrix &oldOrientation, const FMatrix &newOrientation);
-	virtual void proc3(const FMatrix &srcOrient, const FMatrix &destOrient);
-	virtual void setPath(const FVector &srcV, const FVector &destV, const FMatrix &orientation);
-	virtual int proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) { return 2; }
-	virtual void proc6(int val1, int val2, float val);
-
-	bool isActive() const { return _active; }
-};
-
-} // End of namespace Titanic
-
-#endif /* TITANIC_STAR_CONTROL_SUB23_H */
diff --git a/engines/titanic/star_control/star_control_sub24.cpp b/engines/titanic/star_control/star_control_sub24.cpp
deleted file mode 100644
index 7b2588e..0000000
--- a/engines/titanic/star_control/star_control_sub24.cpp
+++ /dev/null
@@ -1,161 +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_sub24.h"
-#include "common/textconsole.h"
-
-namespace Titanic {
-
-void CStarControlSub24::proc3(const FMatrix &srcOrient, const FMatrix &destOrient) {
-	CStarControlSub23::proc3(srcOrient, destOrient);
-	_orientationChanger.load(srcOrient, destOrient);
-	_transitionPercentInc = 0.1;
-	_transitionPercent = 0.0;
-	_field40 = _field44 = _field48 = -1;
-	_active = true;
-}
-
-void CStarControlSub24::setPath(const FVector &srcV, const FVector &destV, const FMatrix &orientation) {
-	CStarControlSub23::setPath(srcV, destV, orientation);
-
-	if (_distance > 8000.0) {
-		_active = true;
-		_field34 = 1;
-		proc6(120, 4, _distance - 8000.0);
-	}
-
-	FVector row3 = orientation._row3;
-	double mult = _posDelta._x * row3._x + _posDelta._y * row3._y + _posDelta._z * row3._z;
-	_transitionPercent = 1.0;
-
-	bool flag = false;
-	if (mult < 1.0) {
-		if (mult >= 1.0 - 1.0e-10)
-			flag = true;
-	} else {
-		if (mult <= 1.0 + 1.0e-10)
-			flag = true;
-	}
-
-	if (!flag) {
-		FVector tempV1;
-		tempV1 = row3.addAndNormalize(_posDelta);
-		tempV1 = row3.addAndNormalize(tempV1);
-		tempV1 = row3.addAndNormalize(tempV1);
-		tempV1 = row3.addAndNormalize(tempV1);
-
-		FMatrix newOrient;
-		newOrient.set(tempV1);
-		_orientationChanger.load(orientation, newOrient);
-
-		_transitionPercent = 0.0;
-		_transitionPercentInc = 0.1;
-		_active = true;
-	}
-}
-
-int CStarControlSub24::proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) {
-	FVector v1, v2, v3, v4;
-
-	if (!_active)
-		return 0;
-
-	// Firstly we have to do a transition of the camera orientation from
-	// it's current position to one where the destination star is centered
-	if (_transitionPercent < 1.0) {
-		_transitionPercent += _transitionPercentInc;
-		orientation = _orientationChanger.getOrientation(_transitionPercent);
-		errorCode.set();
-		return 1;
-	}
-
-	// From here on, we handle the movement to the given destination
-	if (!_field34) {
-		_active = false;
-		return 2;
-	}
-
-	v2 = orientation._row3;
-	v3 = _destPos - pos;
-	v3.normalize();
-
-	double val = orientation._row3._x * v3._x + orientation._row3._y * v3._y + orientation._row3._z * v3._z;
-	bool flag = false;
-	if (val < 1.0) {
-		if (val >= 1.0 - 1.0e-10)
-			flag = true;
-	} else {
-		if (val <= 1.0 + 1.0e-10)
-			flag = true;
-	}
-
-	if (!flag) {
-		v1 = v2.addAndNormalize(v3);
-		v1 = v2.addAndNormalize(v1);
-		v1 = v2.addAndNormalize(v1);
-		v1 = v2.addAndNormalize(v1);
-
-		orientation.set(v1);
-		v2 = v1;
-	}
-
-	if (_field40 >= 0) {
-		double speedVal = _speeds[_field40];
-		v1 = v2 * speedVal;
-		pos += v1;
-
-		--_field40;
-		errorCode.set();
-		return 1;
-	}
-
-	if (_field44 > 0) {
-		v1._z = v2._z * _field38;
-		v1._x = v2._x * _field38;
-		pos._x = v1._x + pos._x;
-		pos._y = v2._y * _field38 + pos._y;
-		pos._z = v1._z + pos._z;
-
-		--_field44;
-		errorCode.set();
-		return 1;
-	}
-
-	if (_field48 >= 0) {
-		double speedVal = _speeds[31 - _field48];
-		v1._y = v2._y * speedVal;
-		v1._z = v2._z * speedVal;
-		v1._x = v2._x * speedVal;
-		pos._y = v1._y + pos._y;
-		pos._z = v1._z + pos._z;
-		pos._x = pos._x + v1._x;
-
-		--_field48;
-		errorCode.set();
-		return 1;
-	}
-
-	_active = false;
-	return 2;
-}
-
-} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control_sub24.h b/engines/titanic/star_control/star_control_sub24.h
deleted file mode 100644
index 4b810ed..0000000
--- a/engines/titanic/star_control/star_control_sub24.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_SUB24_H
-#define TITANIC_STAR_CONTROL_SUB24_H
-
-#include "titanic/star_control/star_control_sub23.h"
-
-namespace Titanic {
-
-class CStarControlSub24 : public CStarControlSub23 {
-public:
-	virtual ~CStarControlSub24() {}
-
-	virtual void proc3(const FMatrix &srcOrient, const FMatrix &destOrient);
-
-	/**
-	 * Sets the path to animate movement between
-	 */
-	virtual void setPath(const FVector &srcV, const FVector &destV, const FMatrix &orientation);
-
-	virtual int proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orientation);
-};
-
-} // End of namespace Titanic
-
-#endif /* TITANIC_STAR_CONTROL_SUB24_H */
diff --git a/engines/titanic/star_control/star_control_sub27.cpp b/engines/titanic/star_control/star_control_sub27.cpp
deleted file mode 100644
index d45bee6..0000000
--- a/engines/titanic/star_control/star_control_sub27.cpp
+++ /dev/null
@@ -1,107 +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_sub27.h"
-#include "common/textconsole.h"
-
-namespace Titanic {
-
-void CStarControlSub27::proc2(const FVector &oldPos, const FVector &newPos,
-	const FMatrix &oldOrientation, const FMatrix &newOrientation) {
-	CStarControlSub23::proc2(oldPos, newPos, oldOrientation, newOrientation);
-
-	double distance = _distance;
-	if (distance > 0.0) {
-		_active = true;
-		_field34 = true;
-		proc6(120, 4, distance);
-	}
-
-	if (newPos != oldPos) {
-		_orientationChanger.load(oldOrientation, newOrientation);
-		_transitionPercent = 0.0;
-
-		if (_field4C == 0) {
-			_transitionPercentInc = 0.1;
-			_active = true;
-		} else {
-			_transitionPercentInc = 1.0 / _field4C;
-			_active = true;
-		}
-	}
-}
-
-int CStarControlSub27::proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) {
-	if (!_active)
-		return 0;
-
-	_transitionPercent += _transitionPercentInc;
-	orientation = _orientationChanger.getOrientation(_transitionPercent);
-	errorCode.set();
-
-	if (_field40 >= 0) {
-		double speedVal = _speeds[_field40];
-		pos += _posDelta * speedVal;
-		getVectorOnPath(pos);
-
-		--_field40;
-		errorCode.set();
-		return 1;
-	} else if (_field44 > 0) {
-		pos += _posDelta * _field38;
-		getVectorOnPath(pos);
-
-		--_field44;
-		errorCode.set();
-		return 1;
-	} else if (_field48 >= 0) {
-		double speedVal = _speeds[31 - _field48];
-		pos += _posDelta * speedVal;
-		getVectorOnPath(pos);
-
-		--_field48;
-		errorCode.set();
-		return 1;
-	} else {
-		_active = false;
-		return 2;
-	}
-}
-
-void CStarControlSub27::getVectorOnPath(FVector &pos) const {
-	double distance = _posDelta.getDistance(pos);
-	distance /= _distance;
-
-	if (distance <= 0.0) {
-		pos = _srcPos;
-	} else if (distance >= 1.0) {
-		pos = _destPos;
-	} else {
-		pos = FVector(
-			(_destPos._x - _srcPos._x) * distance + _srcPos._x,
-			(_destPos._y - _srcPos._y) * distance + _srcPos._y,
-			(_destPos._z - _srcPos._z) * distance + _srcPos._z
-		);
-	}
-}
-
-} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control_sub27.h b/engines/titanic/star_control/star_control_sub27.h
deleted file mode 100644
index c6d29b1..0000000
--- a/engines/titanic/star_control/star_control_sub27.h
+++ /dev/null
@@ -1,48 +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_SUB27_H
-#define TITANIC_STAR_CONTROL_SUB27_H
-
-#include "titanic/star_control/star_control_sub23.h"
-
-namespace Titanic {
-
-class CStarControlSub27 : public CStarControlSub23 {
-private:
-	/**
-	 * Given a vector, figures out how far is from the movement source, and
-	 * returns a vector on the proper point along the path to the destination
-	 * with that same distance from the source.
-	 */
-	void getVectorOnPath(FVector &pos) const;
-public:
-	virtual ~CStarControlSub27() {}
-
-	virtual void proc2(const FVector &oldPos, const FVector &newPos,
-		const FMatrix &oldOrientation, const FMatrix &newOrientation);
-	virtual int proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orientation);
-};
-
-} // End of namespace Titanic
-
-#endif /* TITANIC_STAR_CONTROL_SUB27_H */
diff --git a/engines/titanic/star_control/unmarked_auto_mover.cpp b/engines/titanic/star_control/unmarked_auto_mover.cpp
new file mode 100644
index 0000000..4f38f68
--- /dev/null
+++ b/engines/titanic/star_control/unmarked_auto_mover.cpp
@@ -0,0 +1,161 @@
+/* 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/unmarked_auto_mover.h"
+#include "common/textconsole.h"
+
+namespace Titanic {
+
+void CUnmarkedAutoMover::proc3(const FMatrix &srcOrient, const FMatrix &destOrient) {
+	CCameraAutoMover::proc3(srcOrient, destOrient);
+	_orientationChanger.load(srcOrient, destOrient);
+	_transitionPercentInc = 0.1;
+	_transitionPercent = 0.0;
+	_field40 = _field44 = _field48 = -1;
+	_active = true;
+}
+
+void CUnmarkedAutoMover::setPath(const FVector &srcV, const FVector &destV, const FMatrix &orientation) {
+	CCameraAutoMover::setPath(srcV, destV, orientation);
+
+	if (_distance > 8000.0) {
+		_active = true;
+		_field34 = 1;
+		proc6(120, 4, _distance - 8000.0);
+	}
+
+	FVector row3 = orientation._row3;
+	double mult = _posDelta._x * row3._x + _posDelta._y * row3._y + _posDelta._z * row3._z;
+	_transitionPercent = 1.0;
+
+	bool flag = false;
+	if (mult < 1.0) {
+		if (mult >= 1.0 - 1.0e-10)
+			flag = true;
+	} else {
+		if (mult <= 1.0 + 1.0e-10)
+			flag = true;
+	}
+
+	if (!flag) {
+		FVector tempV1;
+		tempV1 = row3.addAndNormalize(_posDelta);
+		tempV1 = row3.addAndNormalize(tempV1);
+		tempV1 = row3.addAndNormalize(tempV1);
+		tempV1 = row3.addAndNormalize(tempV1);
+
+		FMatrix newOrient;
+		newOrient.set(tempV1);
+		_orientationChanger.load(orientation, newOrient);
+
+		_transitionPercent = 0.0;
+		_transitionPercentInc = 0.1;
+		_active = true;
+	}
+}
+
+int CUnmarkedAutoMover::proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) {
+	FVector v1, v2, v3, v4;
+
+	if (!_active)
+		return 0;
+
+	// Firstly we have to do a transition of the camera orientation from
+	// it's current position to one where the destination star is centered
+	if (_transitionPercent < 1.0) {
+		_transitionPercent += _transitionPercentInc;
+		orientation = _orientationChanger.getOrientation(_transitionPercent);
+		errorCode.set();
+		return 1;
+	}
+
+	// From here on, we handle the movement to the given destination
+	if (!_field34) {
+		_active = false;
+		return 2;
+	}
+
+	v2 = orientation._row3;
+	v3 = _destPos - pos;
+	v3.normalize();
+
+	double val = orientation._row3._x * v3._x + orientation._row3._y * v3._y + orientation._row3._z * v3._z;
+	bool flag = false;
+	if (val < 1.0) {
+		if (val >= 1.0 - 1.0e-10)
+			flag = true;
+	} else {
+		if (val <= 1.0 + 1.0e-10)
+			flag = true;
+	}
+
+	if (!flag) {
+		v1 = v2.addAndNormalize(v3);
+		v1 = v2.addAndNormalize(v1);
+		v1 = v2.addAndNormalize(v1);
+		v1 = v2.addAndNormalize(v1);
+
+		orientation.set(v1);
+		v2 = v1;
+	}
+
+	if (_field40 >= 0) {
+		double speedVal = _speeds[_field40];
+		v1 = v2 * speedVal;
+		pos += v1;
+
+		--_field40;
+		errorCode.set();
+		return 1;
+	}
+
+	if (_field44 > 0) {
+		v1._z = v2._z * _field38;
+		v1._x = v2._x * _field38;
+		pos._x = v1._x + pos._x;
+		pos._y = v2._y * _field38 + pos._y;
+		pos._z = v1._z + pos._z;
+
+		--_field44;
+		errorCode.set();
+		return 1;
+	}
+
+	if (_field48 >= 0) {
+		double speedVal = _speeds[31 - _field48];
+		v1._y = v2._y * speedVal;
+		v1._z = v2._z * speedVal;
+		v1._x = v2._x * speedVal;
+		pos._y = v1._y + pos._y;
+		pos._z = v1._z + pos._z;
+		pos._x = pos._x + v1._x;
+
+		--_field48;
+		errorCode.set();
+		return 1;
+	}
+
+	_active = false;
+	return 2;
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/star_control/unmarked_auto_mover.h b/engines/titanic/star_control/unmarked_auto_mover.h
new file mode 100644
index 0000000..fa1aa95
--- /dev/null
+++ b/engines/titanic/star_control/unmarked_auto_mover.h
@@ -0,0 +1,49 @@
+/* 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_UNMARKED_AUTO_MOVER_H
+#define TITANIC_UNMARKED_AUTO_MOVER_H
+
+#include "titanic/star_control/camera_auto_mover.h"
+
+namespace Titanic {
+
+/**
+ * Automatic camera mover used when no markers have been set
+ */
+class CUnmarkedAutoMover : public CCameraAutoMover {
+public:
+	virtual ~CUnmarkedAutoMover() {}
+
+	virtual void proc3(const FMatrix &srcOrient, const FMatrix &destOrient);
+
+	/**
+	 * Sets the path to animate movement between
+	 */
+	virtual void setPath(const FVector &srcV, const FVector &destV, const FMatrix &orientation);
+
+	virtual int proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orientation);
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_UNMARKED_AUTO_MOVER_H */





More information about the Scummvm-git-logs mailing list