Skip to content

Commit

Permalink
TITANIC: Minor cleanup and warning fixes to star control
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Sep 2, 2017
1 parent 2518de3 commit ba84efe
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
10 changes: 5 additions & 5 deletions engines/titanic/star_control/fpose.cpp
Expand Up @@ -91,7 +91,7 @@ void FPose::identity() {

// Source: https://en.wikipedia.org/wiki/Rotation_matrix
void FPose::setRotationMatrix(Axis axis, float amount) {
const float ROTATION = 2 * M_PI / 360.0;
const float ROTATION = (float)(2 * M_PI / 360.0);
float sinVal = sin(amount * ROTATION);
float cosVal = cos(amount * ROTATION);

Expand Down Expand Up @@ -230,10 +230,10 @@ FPose FPose::compose(const FMatrix &m) {

FPose FPose::compose2(const FPose &m) {
FPose dm;
dm._row1 = _row1.MatProdRowVect(m);
dm._row2 = _row2.MatProdRowVect(m);
dm._row3 = _row3.MatProdRowVect(m);
dm._vector = _vector.MatProdRowVect(m);
dm._row1 = _row1.matProdRowVect(m);
dm._row2 = _row2.matProdRowVect(m);
dm._row3 = _row3.matProdRowVect(m);
dm._vector = _vector.matProdRowVect(m);

return dm;
}
Expand Down
2 changes: 1 addition & 1 deletion engines/titanic/star_control/fvector.cpp
Expand Up @@ -103,7 +103,7 @@ float FVector::getDistance(const FVector &src) const {
return sqrt(xd * xd + yd * yd + zd * zd);
}

FVector FVector::MatProdRowVect(const FPose &pose) const {
FVector FVector::matProdRowVect(const FPose &pose) const {
FVector v;
v._x = pose._row2._x * _y + pose._row3._x * _z + pose._row1._x * _x + pose._vector._x;
v._y = pose._row2._y * _y + pose._row3._y * _z + pose._row1._y * _x + pose._vector._y;
Expand Down
2 changes: 1 addition & 1 deletion engines/titanic/star_control/fvector.h
Expand Up @@ -101,7 +101,7 @@ class FVector {
* Returns a vector that is this vector on the left as a row vector
* times the 3x4 affine matrix on the right.
*/
FVector MatProdRowVect(const FPose &pose) const;
FVector matProdRowVect(const FPose &pose) const;

/**
* Returns a matrix that contains the frame rotation based on this vector and
Expand Down
28 changes: 14 additions & 14 deletions engines/titanic/star_control/star_camera.cpp
Expand Up @@ -291,10 +291,10 @@ void CStarCamera::setViewportAngle(const FPoint &angles) {
tempV5 -= row1;
tempV6 -= row1;

tempV1 = tempV1.MatProdRowVect(pose);
tempV4 = tempV4.MatProdRowVect(pose);
tempV5 = tempV5.MatProdRowVect(pose);
tempV6 = tempV6.MatProdRowVect(pose);
tempV1 = tempV1.matProdRowVect(pose);
tempV4 = tempV4.matProdRowVect(pose);
tempV5 = tempV5.matProdRowVect(pose);
tempV6 = tempV6.matProdRowVect(pose);

tempV4 -= tempV1;
tempV5 -= tempV1;
Expand Down Expand Up @@ -362,15 +362,15 @@ void CStarCamera::setViewportAngle(const FPoint &angles) {
tempV7._x = m3._row3._x * rowScale2 + tempV3._x;

mrow3 = tempV7;
tempV3 = tempV3.MatProdRowVect(m12);
mrow1 = mrow1.MatProdRowVect(m12);
mrow2 = mrow2.MatProdRowVect(m12);
mrow3 = mrow3.MatProdRowVect(m12);
tempV3 = tempV3.matProdRowVect(m12);
mrow1 = mrow1.matProdRowVect(m12);
mrow2 = mrow2.matProdRowVect(m12);
mrow3 = mrow3.matProdRowVect(m12);

tempV3 = tempV3.MatProdRowVect(m11);
mrow1 = mrow1.MatProdRowVect(m11);
mrow2 = mrow2.MatProdRowVect(m11);
mrow3 = mrow3.MatProdRowVect(m11);
tempV3 = tempV3.matProdRowVect(m11);
mrow1 = mrow1.matProdRowVect(m11);
mrow2 = mrow2.matProdRowVect(m11);
mrow3 = mrow3.matProdRowVect(m11);

mrow1 -= tempV3;
mrow2 -= tempV3;
Expand Down Expand Up @@ -563,7 +563,7 @@ bool CStarCamera::lockMarker2(CViewport *viewport, const FVector &secondStarPosi
m4._vector = tempV3;


FVector viewPosition2 = oldPos.MatProdRowVect(m10);
FVector viewPosition2 = oldPos.matProdRowVect(m10);
m3 = m4.compose2(m10);

float minDistance;
Expand Down Expand Up @@ -627,7 +627,7 @@ bool CStarCamera::lockMarker3(CViewport *viewport, const FVector &thirdStarPosit

float CStarCamera::calcAngleForMinDist(FVector &x, FVector &y, float &minDistance) {
FVector tempPos;
minDistance = 1.0e20;
minDistance = (float)1.0e20;
float minDegree = 0.0;
float degInc = 1.0; // one degree steps
int nDegrees = floor(360.0/degInc);
Expand Down
8 changes: 4 additions & 4 deletions engines/titanic/star_control/viewport.cpp
Expand Up @@ -127,7 +127,7 @@ void CViewport::setPosition(const FVector &v) {
}

void CViewport::setPosition(const FPose &pose) {
_position = _position.MatProdRowVect(pose);
_position = _position.matProdRowVect(pose);
_poseUpToDate = false;
}

Expand Down Expand Up @@ -233,14 +233,14 @@ FPose CViewport::getRawPose() {
// 2 which corresponds to _isZero which has value 0.
FVector CViewport::getRelativePosNoCentering(int index, const FVector &src) {
FPose current_pose = getPose();
FVector dest = src.MatProdRowVect(current_pose);
FVector dest = src.matProdRowVect(current_pose);
return dest;
}

FVector CViewport::getRelativePosCentering(int index, const FVector &src) {
FVector dest;
FPose pose = getPose();
FVector tv = src.MatProdRowVect(pose);
FVector tv = src.matProdRowVect(pose);

double val;
if (index <2) {
Expand All @@ -264,7 +264,7 @@ FVector CViewport::getRelativePosCentering(int index, const FVector &src) {
FVector CViewport::getRelativePosCentering2(int index, const FVector &src) {
FVector dest;
FPose pose = getRawPose();
FVector tv = src.MatProdRowVect(pose);
FVector tv = src.matProdRowVect(pose);

double val;
if (index <2) {
Expand Down

0 comments on commit ba84efe

Please sign in to comment.