[Scummvm-git-logs] scummvm master -> 320cdbeac3da4ecad8464ed068921f0b9fce0844

dreammaster dreammaster at scummvm.org
Sun Apr 2 23:05:00 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:
320cdbeac3 TITANIC: Add missing code from CBaseStar draw3


Commit: 320cdbeac3da4ecad8464ed068921f0b9fce0844
    https://github.com/scummvm/scummvm/commit/320cdbeac3da4ecad8464ed068921f0b9fce0844
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-04-02T17:04:51-04:00

Commit Message:
TITANIC: Add missing code from CBaseStar draw3

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


diff --git a/engines/titanic/star_control/base_star.cpp b/engines/titanic/star_control/base_star.cpp
index fc61eb7..dfd7343 100644
--- a/engines/titanic/star_control/base_star.cpp
+++ b/engines/titanic/star_control/base_star.cpp
@@ -339,8 +339,11 @@ void CBaseStar::draw3(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStar
 	double minVal = threshold - 9216.0;
 	int width1 = surfaceArea->_width - 1;
 	int height1 = surfaceArea->_height - 1;
-	double *v1Ptr = &_value1, *v2Ptr = &_value2, *v3Ptr = &_value3;
-	double tempX, tempY, tempZ, total2;
+	double *v1Ptr = &_value1, *v2Ptr = &_value2;
+	double *v3Ptr = &_value3, *v4Ptr = &_value4;
+	double tempX, tempY, tempZ, total2, sVal;
+	int xStart, yStart, rgb;
+	uint16 *pixelP;
 
 	for (uint idx = 0; idx < _data.size(); ++idx) {
 		CBaseStarEntry &entry = _data[idx];
@@ -363,13 +366,47 @@ void CBaseStar::draw3(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStar
 		if (tempZ <= threshold || total2 >= MAX_VAL)
 			continue;
 
-		int xStart = (int)((tempX + *v3Ptr) * *v1Ptr / tempZ + centroid._x);
-		int yStart = (int)(tempY * *v2Ptr / tempZ + centroid._y);
+		// First pixel
+		xStart = (int)((tempX + *v3Ptr) * *v1Ptr / tempZ + centroid._x);
+		yStart = (int)(tempY * *v2Ptr / tempZ + centroid._y);
+		if (xStart < 0 || xStart >= width1 || yStart < 0 || yStart >= height1)
+			continue;
+
+		sVal = sqrt(total2);
+		sVal = (sVal < 100000.0) ? 1.0 : 1.0 - ((sVal - 100000.0) / 1.0e9);
+		sVal *= 255.0;
+
+		if (sVal > 255.0)
+			sVal = 255.0;
 
+		if (sVal > 2.0) {
+			pixelP = (uint16 *)(surfaceArea->_pixelsPtr + surfaceArea->_pitch * yStart + xStart * 2);
+			rgb = ((int)(sVal - 0.5) & 0xf8) << 7;
+
+			switch (entry._thickness) {
+			case 0:
+				*pixelP = rgb;
+				break;
+
+			case 1:
+				*pixelP = rgb;
+				*(pixelP + 1) = rgb;
+				*(pixelP + surfaceArea->_pitch / 2) = rgb;
+				*(pixelP + surfaceArea->_pitch / 2 + 1) = rgb;
+				break;
+
+			default:
+				break;
+			}
+		}
+
+		// Second pixel
+		xStart = (int)((tempX + *v4Ptr) * *v1Ptr / tempZ + centroid._x);
+		yStart = (int)(tempY * *v2Ptr / tempZ + centroid._y);
 		if (xStart < 0 || xStart >= width1 || yStart < 0 || yStart >= height1)
 			continue;
 
-		double sVal = sqrt(total2);
+		sVal = sqrt(total2);
 		sVal = (sVal < 100000.0) ? 1.0 : 1.0 - ((sVal - 100000.0) / 1.0e9);
 		sVal *= 255.0;
 
@@ -377,8 +414,8 @@ void CBaseStar::draw3(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStar
 			sVal = 255.0;
 
 		if (sVal > 2.0) {
-			uint16 *pixelP = (uint16 *)(surfaceArea->_pixelsPtr + surfaceArea->_pitch * yStart + xStart * 2);
-			int rgb = ((int)(sVal - 0.5) & 0xf8) << 7;
+			pixelP = (uint16 *)(surfaceArea->_pixelsPtr + surfaceArea->_pitch * yStart + xStart * 2);
+			rgb = ((int)(sVal - 0.5) & 0xf8) << 7;
 
 			switch (entry._thickness) {
 			case 0:





More information about the Scummvm-git-logs mailing list