aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2017-05-30 20:50:59 -0400
committerPaul Gilbert2017-05-30 20:50:59 -0400
commitd56124e6246eb2224b97802ca9960de2764e5944 (patch)
tree1148e1e18e64f39642ce673b4ba3c564048c1c20 /engines
parentede1965e65e51c4124ca3a683a5c66eeef284ff6 (diff)
downloadscummvm-rg350-d56124e6246eb2224b97802ca9960de2764e5944.tar.gz
scummvm-rg350-d56124e6246eb2224b97802ca9960de2764e5944.tar.bz2
scummvm-rg350-d56124e6246eb2224b97802ca9960de2764e5944.zip
TITANIC: Renamings & cleanup for markers drawing
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/star_control/star_camera.cpp3
-rw-r--r--engines/titanic/star_control/star_camera.h7
-rw-r--r--engines/titanic/star_control/star_closeup.cpp12
-rw-r--r--engines/titanic/star_control/star_field.cpp2
-rw-r--r--engines/titanic/star_control/star_markers.cpp24
-rw-r--r--engines/titanic/star_control/star_points1.cpp4
-rw-r--r--engines/titanic/star_control/star_points2.cpp4
-rw-r--r--engines/titanic/star_control/star_ref.cpp2
8 files changed, 32 insertions, 26 deletions
diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp
index 1fac6efe29..fae519e1f1 100644
--- a/engines/titanic/star_control/star_camera.cpp
+++ b/engines/titanic/star_control/star_camera.cpp
@@ -199,8 +199,9 @@ int CStarCamera::proc27() const {
return _viewport._field24;
}
-FVector CStarCamera::proc28(int index, const FVector &src) {
+FVector CStarCamera::getRelativePos(int index, const FVector &src) {
FVector dest;
+
dest._x = ((_viewport._valArray[index] + src._x) * _viewport._centerVector._x)
/ (_viewport._centerVector._y * src._z);
dest._y = src._y * _viewport._centerVector._x / (_viewport._centerVector._z * src._z);
diff --git a/engines/titanic/star_control/star_camera.h b/engines/titanic/star_control/star_camera.h
index cc37e47f99..feeb73ae3f 100644
--- a/engines/titanic/star_control/star_camera.h
+++ b/engines/titanic/star_control/star_camera.h
@@ -140,7 +140,12 @@ public:
virtual double proc26() const;
virtual int proc27() const;
- virtual FVector proc28(int index, const FVector &src);
+
+ /**
+ * Return the passed vector relative to the center of the viewpoint
+ */
+ virtual FVector getRelativePos(int index, const FVector &src);
+
virtual FVector proc29(int index, const FVector &src);
virtual FVector proc30(int index, const FVector &v);
virtual FVector proc31(int index, const FVector &v);
diff --git a/engines/titanic/star_control/star_closeup.cpp b/engines/titanic/star_control/star_closeup.cpp
index 3af7d556cc..d5d1aaf54c 100644
--- a/engines/titanic/star_control/star_closeup.cpp
+++ b/engines/titanic/star_control/star_closeup.cpp
@@ -298,7 +298,7 @@ void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector
for (int ctr2 = 0; ctr2 < size2; ++ctr2) {
GridEntry &gridEntry = _grid[ctr2];
- tempV = camera->proc28(2, gridEntry);
+ tempV = camera->getRelativePos(2, gridEntry);
gridEntry._position._x = tempV._x;
gridEntry._position._y = tempV._y + vector2._y;
}
@@ -320,7 +320,7 @@ void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector
for (int ctr2 = 0; ctr2 < size2; ++ctr2) {
GridEntry &gridEntry = _grid[ctr2];
- tempV = camera->proc28(0, gridEntry);
+ tempV = camera->getRelativePos(0, gridEntry);
gridEntry._position._x = tempV._x + vector2._x;
gridEntry._position._y = tempV._y + vector2._y;
}
@@ -342,7 +342,7 @@ void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector
for (int ctr2 = 0; ctr2 < size2; ++ctr2) {
GridEntry &gridEntry = _grid[ctr2];
- tempV = camera->proc28(1, gridEntry);
+ tempV = camera->getRelativePos(1, gridEntry);
gridEntry._position._x = tempV._x + vector2._x;
gridEntry._position._y = tempV._y + vector2._y;
}
@@ -402,7 +402,7 @@ void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector
for (uint ctr = 0; ctr < entry._data2.size(); ++ctr) {
GridEntry &gridEntry = _grid[ctr];
- tempV = camera->proc28(2, gridEntry);
+ tempV = camera->getRelativePos(2, gridEntry);
gridEntry._position._x = tempV._x + vector2._x;
gridEntry._position._y = tempV._y + vector2._y;
}
@@ -424,7 +424,7 @@ void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector
for (uint ctr = 0; ctr < entry._data2.size(); ++ctr) {
GridEntry &gridEntry = _grid[ctr];
- tempV = camera->proc28(2, gridEntry);
+ tempV = camera->getRelativePos(2, gridEntry);
gridEntry._position._x = tempV._x + vector2._x;
gridEntry._position._y = tempV._y + vector2._y;
}
@@ -446,7 +446,7 @@ void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector
for (uint ctr = 0; ctr < entry._data2.size(); ++ctr) {
GridEntry &gridEntry = _grid[ctr];
- tempV = camera->proc28(2, gridEntry);
+ tempV = camera->getRelativePos(2, gridEntry);
gridEntry._position._x = tempV._x + vector2._x;
gridEntry._position._y = tempV._y + vector2._y;
}
diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp
index 13afb59c49..486cc50c60 100644
--- a/engines/titanic/star_control/star_field.cpp
+++ b/engines/titanic/star_control/star_field.cpp
@@ -193,7 +193,7 @@ double CStarField::fn5(CSurfaceArea *surfaceArea, CStarCamera *camera,
if (camera->getThreshold() >= tv._z)
return -1.0;
- tv = camera->proc28(2, tv);
+ tv = camera->getRelativePos(2, tv);
v1 = FVector(tv._x + surfaceArea->_centroid._x,
tv._y + surfaceArea->_centroid._y, tv._z);
diff --git a/engines/titanic/star_control/star_markers.cpp b/engines/titanic/star_control/star_markers.cpp
index 5fa059c6f0..5dea6bc01a 100644
--- a/engines/titanic/star_control/star_markers.cpp
+++ b/engines/titanic/star_control/star_markers.cpp
@@ -34,7 +34,7 @@ void CStarMarkers::draw(CSurfaceArea *surfaceArea, CStarCamera *camera, CStarClo
FPoint center((double)surfaceArea->_width * 0.5,
surfaceArea->_height * 0.5);
FVector newV;
- double x1, x2, x3, y1, y2, y3;
+ double xl, xc, xr, yt, yc, yb;
uint savedPixel = surfaceArea->_pixel;
surfaceArea->_pixel = 0xffff;
@@ -50,18 +50,18 @@ void CStarMarkers::draw(CSurfaceArea *surfaceArea, CStarCamera *camera, CStarClo
+ pose._row2._z * star._position._y + pose._vector._z;
if (newV._z > threshold) {
- FVector vTemp = camera->proc28(2, newV);
+ FVector vTemp = camera->getRelativePos(2, newV);
- x2 = center._x + vTemp._x;
- y1 = center._y + vTemp._y;
- y2 = y1 + 4.0;
- x1 = x2 - 4.0;
- x3 = x2 + 4.0;
- y3 = y1 - 4.0;
- surfaceArea->drawLine(FPoint(x1, y1), FPoint(x2, y2));
- surfaceArea->drawLine(FPoint(x2, y2), FPoint(x3, y1));
- surfaceArea->drawLine(FPoint(x3, y1), FPoint(x2, y3));
- surfaceArea->drawLine(FPoint(x2, y3), FPoint(x1, y1));
+ xc = center._x + vTemp._x;
+ yc = center._y + vTemp._y;
+ yb = yc + 4.0;
+ xl = xc - 4.0;
+ xr = xc + 4.0;
+ yt = yc - 4.0;
+ surfaceArea->drawLine(FPoint(xl, yc), FPoint(xc, yb)); // bottom-left
+ surfaceArea->drawLine(FPoint(xc, yb), FPoint(xr, yc)); // bottom-right
+ surfaceArea->drawLine(FPoint(xr, yc), FPoint(xc, yt)); // top-right
+ surfaceArea->drawLine(FPoint(xc, yt), FPoint(xl, yc)); // top-left
}
}
diff --git a/engines/titanic/star_control/star_points1.cpp b/engines/titanic/star_control/star_points1.cpp
index 92f74bdefa..91bcf953a8 100644
--- a/engines/titanic/star_control/star_points1.cpp
+++ b/engines/titanic/star_control/star_points1.cpp
@@ -88,8 +88,8 @@ void CStarPoints1::draw(CSurfaceArea *surface, CStarCamera *camera) {
vector3._z = vTemp._x * pose._row1._z + vTemp._y * pose._row2._z + vTemp._z * pose._row3._z + pose._vector._z;
if (flag && vector1._z > threshold && vector3._z > threshold) {
- vector2 = camera->proc28(2, vector1);
- vector4 = camera->proc28(2, vector3);
+ vector2 = camera->getRelativePos(2, vector1);
+ vector4 = camera->getRelativePos(2, vector3);
r.bottom = vector4._y + vHeight2;
r.right = vector4._x + vWidth2;
diff --git a/engines/titanic/star_control/star_points2.cpp b/engines/titanic/star_control/star_points2.cpp
index 787ba8a90b..2d239038bd 100644
--- a/engines/titanic/star_control/star_points2.cpp
+++ b/engines/titanic/star_control/star_points2.cpp
@@ -99,8 +99,8 @@ void CStarPoints2::draw(CSurfaceArea *surface, CStarCamera *camera) {
+ pose._row1._y * se._v2._x + pose._vector._y;
if (vector1._z > threshold && vector3._z > threshold) {
- vector2 = camera->proc28(2, vector1);
- vector4 = camera->proc28(2, vector3);
+ vector2 = camera->getRelativePos(2, vector1);
+ vector4 = camera->getRelativePos(2, vector3);
r.bottom = vector4._y + vHeight2;
r.right = vector4._x + vWidth2;
diff --git a/engines/titanic/star_control/star_ref.cpp b/engines/titanic/star_control/star_ref.cpp
index 6f68a6c8ae..5d1bf9abe5 100644
--- a/engines/titanic/star_control/star_ref.cpp
+++ b/engines/titanic/star_control/star_ref.cpp
@@ -45,7 +45,7 @@ void CBaseStarRef::process(CSurfaceArea *surface, CStarCamera *camera) {
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 = camera->proc28(2, vector1);
+ vector2 = camera->getRelativePos(2, vector1);
const Common::Point pt((int)(vector2._x + vWidth2 - -0.5),
(int)(vector2._y + vHeight2 - -0.5));