[Scummvm-git-logs] scummvm master -> 31c2aa8d246d7b5792007422f8cc17d97e78371b
dreammaster
dreammaster at scummvm.org
Wed May 24 04:32:05 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:
31c2aa8d24 TITANIC: Rename DMatrix fn3 to loadTransform
Commit: 31c2aa8d246d7b5792007422f8cc17d97e78371b
https://github.com/scummvm/scummvm/commit/31c2aa8d246d7b5792007422f8cc17d97e78371b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-05-23T22:31:55-04:00
Commit Message:
TITANIC: Rename DMatrix fn3 to loadTransform
Changed paths:
engines/titanic/star_control/dmatrix.cpp
engines/titanic/star_control/dmatrix.h
engines/titanic/star_control/dvector.h
engines/titanic/star_control/orientation_changer.cpp
engines/titanic/star_control/star_control_sub24.cpp
diff --git a/engines/titanic/star_control/dmatrix.cpp b/engines/titanic/star_control/dmatrix.cpp
index 547758a..93268d1 100644
--- a/engines/titanic/star_control/dmatrix.cpp
+++ b/engines/titanic/star_control/dmatrix.cpp
@@ -174,43 +174,34 @@ DMatrix DMatrix::fn1() const {
return m;
}
-void DMatrix::fn3(const CMatrixTransform &src) {
- double v3, v4, v5, v6, v7, v8, v9, v10;
- double v11, v12, v13, v14, v15, v16, v17, v18, v19, v20;
-
- v3 = src.fn1();
- if (v3 <= 0.0)
- v20 = 0.0;
- else
- v20 = 2.0 / v3;
- v4 = v20 * src._vector._x;
- v5 = v20 * src._vector._y;
- v6 = v20 * src._vector._z;
- v7 = v4 * src._vector._x;
- v8 = v4;
- v9 = v5;
- v10 = v5 * src._vector._x;
- v11 = v5 * src._vector._y;
- v12 = v6;
- v13 = v8 * src._field0;
- v14 = v12 + v11;
- v15 = v6 * src._vector._y;
- v16 = v6 * src._field0;
- v17 = v11 + v7;
- v18 = v6 * src._vector._x;
- v19 = v9 * src._field0;
- _row1._x = 1.0 - v14;
- _row1._y = v10 + v16;
- _row1._z = v18 - v19;
- _row2._x = v10 - v16;
- _row2._y = 1.0 - (v12 + v7);
- _row2._z = v15 + v13;
- _row3._x = v18 + v19;
- _row3._y = v15 - v13;
- _row3._z = 1.0 - v17;
- _row4._x = 0.0;
- _row4._y = 0.0;
- _row4._z = 0.0;
+void DMatrix::loadTransform(const CMatrixTransform &src) {
+ double total = src.fn1();
+ double factor = (total <= 0.0) ? 0.0 : 2.0 / total;
+ DVector tempV = src._vector * factor;
+
+ double val1 = tempV._x * src._vector._x;
+ double val2 = tempV._y * src._vector._x;
+ double val3 = tempV._y * src._vector._y;
+ double val4 = tempV._x * src._field0;
+ double val5 = tempV._z + val3;
+ double val6 = tempV._z * src._vector._y;
+ double val7 = tempV._z * src._field0;
+ double val8 = val3 + val1;
+ double val9 = tempV._z * src._vector._x;
+ double val10 = tempV._y * src._field0;
+
+ _row1._x = 1.0 - val5;
+ _row1._y = val2 + val7;
+ _row1._z = val9 - val10;
+ _row2._x = val2 - val7;
+ _row2._y = 1.0 - (tempV._z + val1);
+ _row2._z = val6 + val4;
+ _row3._x = val9 + val10;
+ _row3._y = val6 - val4;
+ _row3._z = 1.0 - val8;
+ _row4._x = 0;
+ _row4._y = 0;
+ _row4._z = 0;
}
DMatrix DMatrix::fn4(const DMatrix &m) {
diff --git a/engines/titanic/star_control/dmatrix.h b/engines/titanic/star_control/dmatrix.h
index a41fc86..1cc3616 100644
--- a/engines/titanic/star_control/dmatrix.h
+++ b/engines/titanic/star_control/dmatrix.h
@@ -58,7 +58,8 @@ public:
void setRotationMatrix(Axis axis, double amount);
DMatrix fn1() const;
- void fn3(const CMatrixTransform &src);
+
+ void loadTransform(const CMatrixTransform &src);
DMatrix fn4(const DMatrix &m);
};
diff --git a/engines/titanic/star_control/dvector.h b/engines/titanic/star_control/dvector.h
index d3638cf..e64933a 100644
--- a/engines/titanic/star_control/dvector.h
+++ b/engines/titanic/star_control/dvector.h
@@ -87,6 +87,10 @@ public:
_y -= delta._y;
_z -= delta._z;
}
+
+ const DVector operator*(double right) const {
+ return DVector(_x * right, _y * right, _z * right);
+ }
};
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/orientation_changer.cpp b/engines/titanic/star_control/orientation_changer.cpp
index b71ad07..1aff475 100644
--- a/engines/titanic/star_control/orientation_changer.cpp
+++ b/engines/titanic/star_control/orientation_changer.cpp
@@ -42,7 +42,7 @@ FMatrix COrientationChanger::getOrientation(double percent) {
CMatrixTransform tfm = _sub1.fn5(percent, _sub2);
DMatrix m1;
- m1.fn3(tfm);
+ m1.loadTransform(tfm);
return m1;
}
}
diff --git a/engines/titanic/star_control/star_control_sub24.cpp b/engines/titanic/star_control/star_control_sub24.cpp
index 48ed807..d7f6b7e 100644
--- a/engines/titanic/star_control/star_control_sub24.cpp
+++ b/engines/titanic/star_control/star_control_sub24.cpp
@@ -86,6 +86,8 @@ int CStarControlSub24::proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orien
if (!_active)
return 0;
+ // Firstly we have to do a transition of the camera orientation from
+ // it's current position to one where the destination star is centered
if (_transitionPercent < 1.0) {
_transitionPercent += _transitionPercentInc;
orientation = _orientationChanger.getOrientation(_transitionPercent);
@@ -93,6 +95,7 @@ int CStarControlSub24::proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orien
return 1;
}
+ // From here on, we handle the movement to the given destination
if (!_field34) {
_active = false;
return 2;
More information about the Scummvm-git-logs
mailing list