[Scummvm-git-logs] scummvm master -> 59cd3cf8719b98681032aa749854327671cf14a1

dreammaster dreammaster at scummvm.org
Sat Mar 18 22:31:36 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:
59cd3cf871 TITANIC: Implementing CStarControlSub8 class


Commit: 59cd3cf8719b98681032aa749854327671cf14a1
    https://github.com/scummvm/scummvm/commit/59cd3cf8719b98681032aa749854327671cf14a1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-03-18T17:31:29-04:00

Commit Message:
TITANIC: Implementing CStarControlSub8 class

Changed paths:
    engines/titanic/star_control/base_star.h
    engines/titanic/star_control/star_control_sub8.cpp
    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 1c75efd..e75f7cc 100644
--- a/engines/titanic/star_control/base_star.h
+++ b/engines/titanic/star_control/base_star.h
@@ -53,8 +53,7 @@ struct CBaseStarEntry {
 	bool operator==(const CBaseStarEntry &s) const;
 };
 
-struct CStarPosition {
-	Common::Point _position;
+struct CStarPosition : public Common::Point {
 	int _index1;
 	int _index2;
 	CStarPosition() : _index1(0), _index2(0) {}
diff --git a/engines/titanic/star_control/star_control_sub8.cpp b/engines/titanic/star_control/star_control_sub8.cpp
index 19be7f9..d4addc8 100644
--- a/engines/titanic/star_control/star_control_sub8.cpp
+++ b/engines/titanic/star_control/star_control_sub8.cpp
@@ -59,7 +59,18 @@ bool CStarControlSub8::fn1(CStarField *starField, CSurfaceArea *surfaceArea, CSt
 }
 
 void CStarControlSub8::fn2(CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7) {
-	// TODO
+	if (_field8 <= -1) {
+		if (_entryIndex > -1) {
+			fn5(_entryIndex, surface, starField, sub7);
+			--_entryIndex;
+		}
+	} else {
+		--_field8;
+		if (_entryIndex - _field8 > 1) {
+			fn5(_entryIndex, surface, starField, sub7);
+			--_entryIndex;
+		}
+	}
 }
 
 void CStarControlSub8::fn3() {
@@ -74,21 +85,24 @@ FPoint CStarControlSub8::getPosition() const {
 
 void CStarControlSub8::draw(CSurfaceArea *surfaceArea) {
 	if (!_positions.empty()) {
-		uint oldPixel = surfaceArea->_pixel;
-		surfaceArea->_pixel = 0xFF;
+		uint savedPixel = surfaceArea->_pixel;
+		surfaceArea->_pixel = 0xff;
 		surfaceArea->setColorFromPixel();
-		SurfaceAreaMode oldMode = surfaceArea->setMode(SA_NONE);
+		SurfaceAreaMode savedMode = surfaceArea->setMode(SA_NONE);
 
-		// TODO: Loop
-		/*
 		for (int idx = 0; idx < _entryIndex; ++idx) {
-			Common::Rect &r = _entries[idx];
+			const Common::Rect &src = _entries[idx];
+			double xp = src.left, yp = src.top;
 
+			surfaceArea->fn1(FRect(xp - 8.0, yp, xp - 4.0, yp));
+			surfaceArea->fn1(FRect(xp + 4.0, yp, xp + 8.0, yp));
+			surfaceArea->fn1(FRect(xp, yp - 8.0, xp, yp - 4.0));
+			surfaceArea->fn1(FRect(xp, yp + 4.0, xp, yp + 8.0));
 		}
-		*/
 
-		surfaceArea->_pixel = oldPixel;
-		surfaceArea->setMode(oldMode);
+		surfaceArea->_pixel = savedPixel;
+		surfaceArea->setColorFromPixel();
+		surfaceArea->setMode(savedMode);
 	}
 }
 
@@ -112,7 +126,7 @@ int CStarControlSub8::indexOf(const Common::Point &pt) const {
 	Common::Rect r(pt.x - 2, pt.y - 2, pt.x + 2, pt.y + 2);
 
 	for (int idx = 0; idx < (int)_positions.size(); ++idx) {
-		if (r.contains(_positions[idx]._position))
+		if (r.contains(_positions[idx]))
 			return idx;
 	}
 
@@ -120,7 +134,10 @@ int CStarControlSub8::indexOf(const Common::Point &pt) const {
 }
 
 void CStarControlSub8::fn4(int index, CSurfaceArea *surfaceArea) {
-	// TODO
+	if (index >= 0 && index < (int)_positions.size()) {
+		const CStarPosition &pt = _positions[index];
+		fn7(pt, surfaceArea);
+	}
 }
 
 void CStarControlSub8::fn5(int index, CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7) {
@@ -128,11 +145,25 @@ void CStarControlSub8::fn5(int index, CVideoSurface *surface, CStarField *starFi
 }
 
 void CStarControlSub8::fn6(CSurfaceArea *surfaceArea) {
-	// TODO
+	const CStarPosition &pt = _positions[_entryIndex];
+	fn7(pt, surfaceArea);
 }
 
 void CStarControlSub8::fn7(const FPoint &pt, CSurfaceArea *surfaceArea) {
-	// TODO
+	uint savedPixel = surfaceArea->_pixel;
+	surfaceArea->_pixel = 255;
+	surfaceArea->setColorFromPixel();
+	SurfaceAreaMode savedMode = surfaceArea->setMode(SA_MODE3);
+
+
+	surfaceArea->fn1(FRect(pt._x - 8.0, pt._y, pt._x - 4.0, pt._y));
+	surfaceArea->fn1(FRect(pt._x - -4.0, pt._y, pt._x + 8.0, pt._y));
+	surfaceArea->fn1(FRect(pt._x, pt._y - 8.0, pt._x, pt._y - 4.0));
+	surfaceArea->fn1(FRect(pt._x, pt._y + 4.0, pt._x, pt._y + 8.0));
+
+	surfaceArea->_pixel = savedPixel;
+	surfaceArea->setColorFromPixel();
+	surfaceArea->setMode(savedMode);
 }
 
 } // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_ref.cpp b/engines/titanic/star_control/star_ref.cpp
index 0b98980..7f36ae7 100644
--- a/engines/titanic/star_control/star_ref.cpp
+++ b/engines/titanic/star_control/star_ref.cpp
@@ -47,7 +47,8 @@ bool CStarRef2::check(const Common::Point &pt, int index) {
 		return false;
 
 	CStarPosition &sp = (*_positions)[index];
-	sp._position = pt;
+	sp.x = pt.x;
+	sp.y = pt.y;
 	sp._index1 = sp._index2 = index;
 	return true;
 }





More information about the Scummvm-git-logs mailing list