aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2017-03-17 21:01:15 -0400
committerPaul Gilbert2017-03-17 21:01:15 -0400
commit9b77dc9420befe2f51141c1df381876cb1d7fc59 (patch)
tree78c271a9717c6d6f45983d4c3bf9cfe72e89d223
parent1b7a847e6318d50aea8a4fe72e33c31a08f24998 (diff)
downloadscummvm-rg350-9b77dc9420befe2f51141c1df381876cb1d7fc59.tar.gz
scummvm-rg350-9b77dc9420befe2f51141c1df381876cb1d7fc59.tar.bz2
scummvm-rg350-9b77dc9420befe2f51141c1df381876cb1d7fc59.zip
TITANIC: Finished CStarControlSub6 class
-rw-r--r--engines/titanic/star_control/star_control_sub13.cpp2
-rw-r--r--engines/titanic/star_control/star_control_sub6.cpp63
-rw-r--r--engines/titanic/star_control/star_control_sub6.h2
3 files changed, 63 insertions, 4 deletions
diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/star_control_sub13.cpp
index 72badde76e..2b5776cefd 100644
--- a/engines/titanic/star_control/star_control_sub13.cpp
+++ b/engines/titanic/star_control/star_control_sub13.cpp
@@ -263,7 +263,7 @@ void CStarControlSub13::reset() {
_sub2._vector._x = _position._x;
_sub2._vector._y = _position._y;
_sub2._vector._z = _position._z;
- _sub2.fn3(_sub1);
+ _sub2.fn4(&_sub1);
double widthV = (double)_width * 0.5;
double heightV = (double)_height * 0.5;
diff --git a/engines/titanic/star_control/star_control_sub6.cpp b/engines/titanic/star_control/star_control_sub6.cpp
index a93f128f59..21fb42c1da 100644
--- a/engines/titanic/star_control/star_control_sub6.cpp
+++ b/engines/titanic/star_control/star_control_sub6.cpp
@@ -159,8 +159,67 @@ CStarControlSub6 *CStarControlSub6::setup(CStarControlSub6 *dest, const CStarCon
return dest;
}
-void CStarControlSub6::fn1(CStarControlSub6 *sub6) {
- // TODO
+void CStarControlSub6::fn4(CStarControlSub6 *sub6) {
+ double v2, v3, v6, v7, v8, v9, v10, v11;
+ double v12, v13, v14, v15, v16, v17, v18;
+
+ v16 = _row3._z * _row2._y;
+ v2 = _row1._x * v16;
+ v3 = 0.0;
+ v18 = v2;
+ if (v2 < 0.0) {
+ v3 = v18;
+ v2 = 0.0;
+ }
+ v6 = _row3._x * _row1._y * _row2._z;
+ if (v6 < 0.0)
+ v3 = v3 + v6;
+ else
+ v2 = v2 + v6;
+ v7 = _row3._y * _row1._z * _row2._x;
+ if (v7 < 0.0)
+ v3 = v3 + v7;
+ else
+ v2 = v2 + v7;
+ if (-(_row3._x * _row1._z * _row2._y) < 0.0)
+ v3 = v3 - _row3._x * _row1._z * _row2._y;
+ else
+ v2 = v2 - _row3._x * _row1._z * _row2._y;
+ if (-(_row1._y * _row2._x * _row3._z) < 0.0)
+ v3 = v3 - _row1._y * _row2._x * _row3._z;
+ else
+ v2 = v2 - _row1._y * _row2._x * _row3._z;
+ v17 = _row2._z * _row3._y;
+ if (-(_row1._x * v17) < 0.0)
+ v3 = v3 - _row1._x * v17;
+ else
+ v2 = v2 - _row1._x * v17;
+ v18 = v3 + v2;
+ assert(!(v18 == 0.0 || fabs(v18 / (v2 - v3)) < 1.0e-10));
+
+ v8 = 1.0 / v18;
+ v18 = v8;
+ sub6->_row1._x = (v16 - v17) * v8;
+ sub6->_row2._x = -(_row2._x * _row3._z - _row3._x * _row2._z) * v8;
+ sub6->_row3._x = (_row3._y * _row2._x - _row3._x * _row2._y) * v8;
+ sub6->_row1._y = -(_row1._y * _row3._z - _row3._y * _row1._z) * v8;
+ sub6->_row2._y = (_row1._x * _row3._z - _row3._x * _row1._z) * v8;
+ sub6->_row3._y = -(_row1._x * _row3._y - _row3._x * _row1._y) * v8;
+ sub6->_row1._z = (_row1._y * _row2._z - _row1._z * _row2._y) * v8;
+ sub6->_row2._z = -(_row1._x * _row2._z - _row1._z * _row2._x) * v8;
+ v9 = sub6->_row1._x;
+ v10 = sub6->_row2._y;
+ v11 = sub6->_row3._y;
+ v12 = sub6->_row1._z;
+ v13 = sub6->_row2._z;
+ sub6->_row3._z = (_row1._x * _row2._y - _row1._y * _row2._x) * v18;
+ v14 = v9;
+ v15 = sub6->_row3._z;
+ sub6->_vector._x = -(v14 * _vector._x
+ + _vector._y * sub6->_row2._x
+ + _vector._z * sub6->_row3._x);
+ sub6->_vector._y = -(_vector._x * sub6->_row1._y + v10 * _vector._y + v11 * _vector._z);
+ sub6->_vector._z = -(v12 * _vector._x + v13 * _vector._y + v15 * _vector._z);
}
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control_sub6.h b/engines/titanic/star_control/star_control_sub6.h
index 27b91628ba..61548d11a7 100644
--- a/engines/titanic/star_control/star_control_sub6.h
+++ b/engines/titanic/star_control/star_control_sub6.h
@@ -62,7 +62,7 @@ public:
*/
void copyFrom(const FMatrix &src);
- void fn1(CStarControlSub6 *sub6);
+ void fn4(CStarControlSub6 *sub6);
};
} // End of namespace Titanic