aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2017-04-02 10:12:52 -0400
committerPaul Gilbert2017-04-02 10:12:52 -0400
commitfb10aec9cd961565f115c57ffe6ad9102cdac9e6 (patch)
tree58c234ea585779804aaae2f0db4cbc068e1f4f46
parent6a5c4d382e03836c15aeda00cb605beda9de23a3 (diff)
downloadscummvm-rg350-fb10aec9cd961565f115c57ffe6ad9102cdac9e6.tar.gz
scummvm-rg350-fb10aec9cd961565f115c57ffe6ad9102cdac9e6.tar.bz2
scummvm-rg350-fb10aec9cd961565f115c57ffe6ad9102cdac9e6.zip
TITANIC: Further cleanup of star drawing methods
-rw-r--r--engines/titanic/star_control/base_star.cpp35
1 files changed, 16 insertions, 19 deletions
diff --git a/engines/titanic/star_control/base_star.cpp b/engines/titanic/star_control/base_star.cpp
index fd99c2012b..ad94912107 100644
--- a/engines/titanic/star_control/base_star.cpp
+++ b/engines/titanic/star_control/base_star.cpp
@@ -169,20 +169,19 @@ void CBaseStar::draw1(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStar
int width1 = surfaceArea->_width - 1;
int height1 = surfaceArea->_height - 1;
double *v1Ptr = &_value1, *v2Ptr = &_value2;
- FVector vector;
- double tempZ;
+ double tempX, tempY, tempZ, total2;
for (uint idx = 0; idx < _data.size(); ++idx) {
CBaseStarEntry &entry = _data[idx];
- vector = entry._position;
+ const FVector &vector = entry._position;
tempZ = vector._x * sub6._row1._z + vector._y * sub6._row2._z
+ vector._z * sub6._row3._z + sub6._vector._z;
if (tempZ <= minVal)
continue;
- double tempY = vector._x * sub6._row1._y + vector._y * sub6._row2._y + vector._z * sub6._row3._y + sub6._vector._y;
- double tempX = vector._x * sub6._row1._x + vector._y * sub6._row2._x + vector._z * sub6._row3._x + sub6._vector._x;
- double total2 = tempY * tempY + tempX * tempX + tempZ * tempZ;
+ tempY = vector._x * sub6._row1._y + vector._y * sub6._row2._y + vector._z * sub6._row3._y + sub6._vector._y;
+ tempX = vector._x * sub6._row1._x + vector._y * sub6._row2._x + vector._z * sub6._row3._x + sub6._vector._x;
+ total2 = tempY * tempY + tempX * tempX + tempZ * tempZ;
if (total2 < 1.0e12) {
sub5->proc2(&sub6, vector, centroid._x, centroid._y, total2,
@@ -255,20 +254,19 @@ void CBaseStar::draw2(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStar
int width1 = surfaceArea->_width - 1;
int height1 = surfaceArea->_height - 1;
double *v1Ptr = &_value1, *v2Ptr = &_value2;
- FVector vector;
- double tempZ;
+ double tempX, tempY, tempZ, total2;
for (uint idx = 0; idx < _data.size(); ++idx) {
CBaseStarEntry &entry = _data[idx];
- vector = entry._position;
+ const FVector &vector = entry._position;
tempZ = vector._x * sub6._row1._z + vector._y * sub6._row2._z
+ vector._z * sub6._row3._z + sub6._vector._z;
if (tempZ <= minVal)
continue;
- double tempY = vector._x * sub6._row1._y + vector._y * sub6._row2._y + vector._z * sub6._row3._y + vector._y;
- double tempX = vector._x * sub6._row1._x + vector._y * sub6._row2._x + vector._z * sub6._row3._x + vector._x;
- double total2 = tempY * tempY + tempX * tempX + tempZ * tempZ;
+ tempY = vector._x * sub6._row1._y + vector._y * sub6._row2._y + vector._z * sub6._row3._y + vector._y;
+ tempX = vector._x * sub6._row1._x + vector._y * sub6._row2._x + vector._z * sub6._row3._x + vector._x;
+ total2 = tempY * tempY + tempX * tempX + tempZ * tempZ;
if (total2 < 1.0e12) {
sub5->proc2(&sub6, vector, centroid._x, centroid._y, total2,
@@ -342,12 +340,11 @@ void CBaseStar::draw3(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStar
int width1 = surfaceArea->_width - 1;
int height1 = surfaceArea->_height - 1;
double *v1Ptr = &_value1, *v2Ptr = &_value2, *v3Ptr = &_value3;
- FVector vector;
- double tempZ;
+ double tempX, tempY, tempZ, total2;
for (uint idx = 0; idx < _data.size(); ++idx) {
CBaseStarEntry &entry = _data[idx];
- vector = entry._position;
+ const FVector &vector = entry._position;
tempZ = vector._x * sub6._row1._z + vector._y * sub6._row2._z
+ vector._z * sub6._row3._z + sub6._vector._z;
if (tempZ <= minVal)
@@ -413,7 +410,7 @@ void CBaseStar::draw4(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStar
int width1 = surfaceArea->_width - 1;
int height1 = surfaceArea->_height - 1;
double *v1Ptr = &_value1, *v2Ptr = &_value2, *v3Ptr = &_value3;
- double tempZ;
+ double tempX, tempY, tempZ, total2;
for (uint idx = 0; idx < _data.size(); ++idx) {
const CBaseStarEntry &entry = _data[idx];
@@ -423,9 +420,9 @@ void CBaseStar::draw4(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStar
if (tempZ <= minVal)
continue;
- double tempY = vector._x * sub6._row1._y + vector._y * sub6._row2._y + vector._z * sub6._row3._y + sub6._vector._y;
- double tempX = vector._x * sub6._row1._x + vector._y * sub6._row2._x + vector._z * sub6._row3._x + sub6._vector._x;
- double total2 = tempY * tempY + tempX * tempX + tempZ * tempZ;
+ tempY = vector._x * sub6._row1._y + vector._y * sub6._row2._y + vector._z * sub6._row3._y + sub6._vector._y;
+ tempX = vector._x * sub6._row1._x + vector._y * sub6._row2._x + vector._z * sub6._row3._x + sub6._vector._x;
+ total2 = tempY * tempY + tempX * tempX + tempZ * tempZ;
if (total2 < 1.0e12) {
sub5->proc2(&sub6, vector, centroid._x, centroid._y, total2,