Skip to content

Commit

Permalink
TITANIC: Renamings & cleanup for markers drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed May 31, 2017
1 parent ede1965 commit d56124e
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 26 deletions.
3 changes: 2 additions & 1 deletion engines/titanic/star_control/star_camera.cpp
Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion engines/titanic/star_control/star_camera.h
Expand Up @@ -140,7 +140,12 @@ class CStarCamera {

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);
Expand Down
12 changes: 6 additions & 6 deletions engines/titanic/star_control/star_closeup.cpp
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion engines/titanic/star_control/star_field.cpp
Expand Up @@ -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);
Expand Down
24 changes: 12 additions & 12 deletions engines/titanic/star_control/star_markers.cpp
Expand Up @@ -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;
Expand All @@ -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
}
}

Expand Down
4 changes: 2 additions & 2 deletions engines/titanic/star_control/star_points1.cpp
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions engines/titanic/star_control/star_points2.cpp
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion engines/titanic/star_control/star_ref.cpp
Expand Up @@ -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));
Expand Down

0 comments on commit d56124e

Please sign in to comment.