[Scummvm-git-logs] scummvm master -> 87d894f6f2fb0a230d51669531c2ac69bce6958f

dreammaster dreammaster at scummvm.org
Sat Mar 25 23:28:56 CET 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:
87d894f6f2 TITANIC: Added CBaseStarRef process method


Commit: 87d894f6f2fb0a230d51669531c2ac69bce6958f
    https://github.com/scummvm/scummvm/commit/87d894f6f2fb0a230d51669531c2ac69bce6958f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-03-25T18:28:48-04:00

Commit Message:
TITANIC: Added CBaseStarRef process method

Changed paths:
    engines/titanic/star_control/base_star.h
    engines/titanic/star_control/star_ref.cpp


diff --git a/engines/titanic/star_control/base_star.h b/engines/titanic/star_control/base_star.h
index ff09652..1b94b19 100644
--- a/engines/titanic/star_control/base_star.h
+++ b/engines/titanic/star_control/base_star.h
@@ -70,7 +70,6 @@ private:
 	void draw3(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStarControlSub5 *sub5);
 	void draw4(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStarControlSub5 *sub5);
 protected:
-	Common::Array<CBaseStarEntry> _data;
 	FRange _minMax;
 	double _minVal;
 	double _maxVal;
@@ -93,6 +92,8 @@ protected:
 	 */
 	void resetEntry(CBaseStarEntry &entry);
 public:
+	Common::Array<CBaseStarEntry> _data;
+public:
 	CBaseStar();
 	virtual ~CBaseStar() {}
 
diff --git a/engines/titanic/star_control/star_ref.cpp b/engines/titanic/star_control/star_ref.cpp
index 7f36ae7..6bb5dbe 100644
--- a/engines/titanic/star_control/star_ref.cpp
+++ b/engines/titanic/star_control/star_ref.cpp
@@ -25,7 +25,58 @@
 namespace Titanic {
 
 void CBaseStarRef::process(CSurfaceArea *surface, CStarControlSub12 *sub12) {
-	// TODO
+	if (_star->_data.empty())
+		return;
+
+	const double MAX_VAL = 1.0e9 * 1.0e9;
+	CStarControlSub6 sub6 = sub12->proc23();
+	double threshold = sub12->proc25();
+	double vWidth2 = (double)surface->_width * 0.5;
+	double vHeight2 = (double)surface->_height * 0.5;
+	FVector vTemp, vector1, vector2;
+	double val1, val2, val3, val4;
+
+	for (int idx = 0; idx < _star->size(); ++idx) {
+		const CBaseStarEntry &se = _star->_data[idx];
+		vTemp = se._position;
+		vector1._x = vTemp._x * sub6._row1._x + vTemp._y * sub6._row2._x + vTemp._z * sub6._row3._x + sub6._vector._x;
+		vector1._y = vTemp._x * sub6._row1._y + vTemp._y * sub6._row2._y + vTemp._z * sub6._row3._y + sub6._vector._y;
+		vector1._z = vTemp._x * sub6._row1._z + vTemp._y * sub6._row2._z + vTemp._z * sub6._row3._z + sub6._vector._z;
+		double hyp = vector1._x * vector1._x + vector1._y * vector1._y + vector1._z * vector1._z;
+
+		if (vector1._z > threshold && hyp >= 1.0e12 && hyp < MAX_VAL) {
+			vector2.clear();
+			sub12->proc28(2, vector1, vector2);
+
+			const Common::Point pt((int)(vector2._x + vWidth2 - -0.5),
+				(int)(vector2._y + vHeight2 - -0.5));
+			if (pt.y >= 0 && pt.y < (surface->_height - 1) &&
+					pt.x >= 0 && pt.x < (surface->_width - 1)) {
+				val1 = sqrt(hyp);
+				if (val1 >= 100000.0)
+					val1 = 1.0 - (val1 - 100000.0) / 1000000000.0;
+				else
+					val1 = 1.0;
+
+				val2 = val1 * (double)se._field1;
+				val3 = val1 * (double)se._field2;
+				val4 = val1 * (double)se._field0;
+
+				int count = 0;
+				if (val4 < 0.0)
+					++count;
+				if (val2 < 0.0)
+					++count;
+				if (val3 < 0.0)
+					++count;
+
+				if (count < 3) {
+					if (!check(pt, idx))
+						break;
+				}
+			}
+		}
+	}
 }
 
 /*------------------------------------------------------------------------*/





More information about the Scummvm-git-logs mailing list