Skip to content

Commit

Permalink
TITANIC: Change some constants to more sensible ones
Browse files Browse the repository at this point in the history
  • Loading branch information
darkstar authored and dreammaster committed Mar 16, 2017
1 parent 8901224 commit a75e386
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion engines/titanic/star_control/star_control_sub13.cpp
Expand Up @@ -257,7 +257,7 @@ void CStarControlSub13::fn19(double *v1, double *v2, double *v3, double *v4) {
}

void CStarControlSub13::reset() {
const double FACTOR = 3.1415927 * 0.0055555557;
const double FACTOR = 2 * M_PI / 360.0;

_sub2.copyFrom(_matrix);
_sub2._vector._x = _position._x;
Expand Down
8 changes: 4 additions & 4 deletions engines/titanic/star_control/star_control_sub5.cpp
Expand Up @@ -37,7 +37,7 @@ bool CStarControlSub5::SineTable::setup() {
if (_data.empty()) {
_data.resize(1024);
for (int idx = 0; idx < 1024; ++idx)
_data[idx] = sin((double)idx * 6.283185307179586 * 0.001953125);
_data[idx] = sin((double)idx * 2 * M_PI / 512.0);
}

return true;
Expand All @@ -63,7 +63,7 @@ bool CStarControlSub5::setup() {
bool CStarControlSub5::setup2(int val1, int val2) {
// TODO: Original set an explicit random seed here. Could be
// problematic if following random values need to be deterministic
const double FACTOR = 3.1415927 * 0.0055555557;
const double FACTOR = 2 * M_PI / 360.0;
const int VALUES1[] = { 0x800, 0xC00, 0x1000, 0x1400, 0x1800 };
const int VALUES2[] = {
0xF95BCD, 0xA505A0, 0xFFAD43, 0x98F4EB, 0xF3EFA5, 0,
Expand Down Expand Up @@ -162,7 +162,7 @@ bool CStarControlSub5::setup2(int val1, int val2) {
e->_field8 = g_vm->getRandomNumber(3) + 3;
e->_fieldC = g_vm->getRandomNumber(255);
e->_field10 = FACTOR * 17.0;
e->_field14 = 0.00390625;
e->_field14 = 1 / 256.0;
} else {
for (int ctr = 0; ctr < 5; ++ctr) {
e->_field0 = static_cast<int>(g_vm->getRandomFloat() * 1350.0
Expand All @@ -176,7 +176,7 @@ bool CStarControlSub5::setup2(int val1, int val2) {
e->_fieldC = g_vm->getRandomNumber(255);
e->_field10 = FACTOR * (double)g_vm->getRandomNumber(15);
e->_field14 = ((double)g_vm->getRandomNumber(0xfffffffe)
* 50.0 * 0.000015259022) * 0.00390625;
* 50.0 / 65536.0) / 256.0;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion engines/titanic/star_control/star_control_sub6.cpp
Expand Up @@ -53,7 +53,7 @@ void CStarControlSub6::identity() {
}

void CStarControlSub6::setRotationMatrix(Axis axis, double amount) {
const double ROTATION = 3.1415927 * 0.0055555557;
const double ROTATION = 2 * M_PI / 360.0;
double sinVal = sin(amount * ROTATION);
double cosVal = cos(amount * ROTATION);

Expand Down
2 changes: 1 addition & 1 deletion engines/titanic/star_control/star_points1.cpp
Expand Up @@ -27,7 +27,7 @@
namespace Titanic {

#define ARRAY_COUNT 876
const double FACTOR = 3.1415927 * 0.0055555557;
const double FACTOR = 2 * M_PI / 360.0;

CStarPoints1::CStarPoints1() {
}
Expand Down
4 changes: 2 additions & 2 deletions engines/titanic/star_control/star_points2.cpp
Expand Up @@ -27,7 +27,7 @@
namespace Titanic {

#define ARRAY_COUNT 80
const double FACTOR = 3.1415927 * 0.0055555557;
const double FACTOR = 2 * M_PI / 360.0;

bool CStarPoints2::initialize() {
// Get a reference to the starfield points resource
Expand All @@ -47,7 +47,7 @@ bool CStarPoints2::initialize() {
v1 = stream->readSint32LE();
v2 = stream->readSint32LE();
v1 *= 0.015 * FACTOR;
v2 *= 0.0099999998 * FACTOR;
v2 *= FACTOR / 100.0;

entry._x = cos(v1) * 3000000.0 * cos(v2);
entry._y = sin(v1) * 3000000.0 * cos(v2);
Expand Down

0 comments on commit a75e386

Please sign in to comment.