diff options
author | Strangerke | 2017-01-17 07:18:32 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2017-01-25 22:42:23 +0100 |
commit | 77a79e8da33d1bfca73790023fcd49a320b6c688 (patch) | |
tree | afdcdcb504f5c3ac6253ea9559baafc1e46a1ffd | |
parent | 1e7779edd3f63b35d54c6ae83c9b99acba728f32 (diff) | |
download | scummvm-rg350-77a79e8da33d1bfca73790023fcd49a320b6c688.tar.gz scummvm-rg350-77a79e8da33d1bfca73790023fcd49a320b6c688.tar.bz2 scummvm-rg350-77a79e8da33d1bfca73790023fcd49a320b6c688.zip |
CRYO: Split sinus and cosinus tables
-rw-r--r-- | engines/cryo/eden.cpp | 34 | ||||
-rw-r--r-- | engines/cryo/eden.h | 5 |
2 files changed, 20 insertions, 19 deletions
diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index 6f8fec1e92..190f36f9b9 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -8566,10 +8566,10 @@ void EdenGame::actionNop() { //// cube.c // Original name: make_tabcos -void EdenGame::initCosTable() { +void EdenGame::initSinCosTable() { for (int i = 0; i < 361; i++) { - _cosSinTable[i * 2] = (int)(cos(3.1416 * i / 180.0) * 255.0); - _cosSinTable[i * 2 + 1] = (int)(sin(3.1416 * i / 180.0) * 255.0); + _cosTable[i] = (int)(cos(3.1416 * i / 180.0) * 255.0); + _sinTable[i] = (int)(sin(3.1416 * i / 180.0) * 255.0); } } @@ -8578,19 +8578,19 @@ void EdenGame::makeMatriceFix() { int16 rotAnglePhi = _rotationAngleY; int16 rotAnglePsi = _rotationAngleZ; - _passMat31 = (_cosSinTable[rotAnglePhi * 2] * _cosSinTable[rotAngleTheta * 2]) >> 8; - _passMat32 = (_cosSinTable[rotAnglePhi * 2 + 1] * _cosSinTable[rotAngleTheta * 2]) >> 8; - _passMat33 = -_cosSinTable[rotAngleTheta * 2 + 1]; - _passMat21 = ((-_cosSinTable[rotAnglePhi * 2 + 1] * _cosSinTable[rotAnglePsi * 2]) >> 8) - + ((_cosSinTable[rotAnglePsi * 2 + 1] * ((_cosSinTable[rotAnglePhi * 2] * _cosSinTable[rotAngleTheta * 2 + 1]) >> 8)) >> 8); - _passMat22 = ((_cosSinTable[rotAnglePhi * 2] * _cosSinTable[rotAnglePsi * 2]) >> 8) - + ((_cosSinTable[rotAnglePsi * 2 + 1] * ((_cosSinTable[rotAnglePhi * 2 + 1] * _cosSinTable[rotAngleTheta * 2 + 1]) >> 8)) >> 8); - _passMat23 = (_cosSinTable[rotAngleTheta * 2] * _cosSinTable[rotAnglePsi * 2 + 1]) >> 8; - _passMat11 = ((_cosSinTable[rotAnglePhi * 2 + 1] * _cosSinTable[rotAnglePsi * 2 + 1]) >> 8) - + ((_cosSinTable[rotAnglePsi * 2] * ((_cosSinTable[rotAnglePhi * 2] * _cosSinTable[rotAngleTheta * 2 + 1]) >> 8)) >> 8); - _passMat12 = ((-_cosSinTable[rotAnglePhi * 2] * _cosSinTable[rotAnglePsi * 2 + 1]) >> 8) - + ((_cosSinTable[rotAnglePsi * 2] * ((_cosSinTable[rotAnglePhi * 2 + 1] * _cosSinTable[rotAngleTheta * 2 + 1]) >> 8)) >> 8); - _passMat13 = (_cosSinTable[rotAngleTheta * 2] * _cosSinTable[rotAnglePsi * 2]) >> 8; + _passMat31 = (_cosTable[rotAnglePhi] * _cosTable[rotAngleTheta]) >> 8; + _passMat32 = (_sinTable[rotAnglePhi] * _cosTable[rotAngleTheta]) >> 8; + _passMat33 = -_sinTable[rotAngleTheta]; + _passMat21 = ((-_sinTable[rotAnglePhi] * _cosTable[rotAnglePsi]) >> 8) + + ((_sinTable[rotAnglePsi] * ((_cosTable[rotAnglePhi] * _sinTable[rotAngleTheta]) >> 8)) >> 8); + _passMat22 = ((_cosTable[rotAnglePhi] * _cosTable[rotAnglePsi]) >> 8) + + ((_sinTable[rotAnglePsi] * ((_sinTable[rotAnglePhi] * _sinTable[rotAngleTheta]) >> 8)) >> 8); + _passMat23 = (_cosTable[rotAngleTheta] * _sinTable[rotAnglePsi]) >> 8; + _passMat11 = ((_sinTable[rotAnglePhi] * _sinTable[rotAnglePsi]) >> 8) + + ((_cosTable[rotAnglePsi] * ((_cosTable[rotAnglePhi] * _sinTable[rotAngleTheta]) >> 8)) >> 8); + _passMat12 = ((-_cosTable[rotAnglePhi] * _sinTable[rotAnglePsi]) >> 8) + + ((_cosTable[rotAnglePsi] * ((_sinTable[rotAnglePhi] * _sinTable[rotAngleTheta]) >> 8)) >> 8); + _passMat13 = (_cosTable[rotAngleTheta] * _cosTable[rotAnglePsi]) >> 8; } void EdenGame::projectionFix(cube_t *cubep, int n) { @@ -8616,7 +8616,7 @@ void EdenGame::projectionFix(cube_t *cubep, int n) { void EdenGame::initCubeMac() { loadMap(2493, _cubeTexture); NEWcharge_objet_mob(&_cube, 2494, _cubeTexture); - initCosTable(); + initSinCosTable(); } void EdenGame::engineMac() { diff --git a/engines/cryo/eden.h b/engines/cryo/eden.h index f1a9df6517..0946c8968b 100644 --- a/engines/cryo/eden.h +++ b/engines/cryo/eden.h @@ -487,7 +487,7 @@ private: uint16 operation(byte op, uint16 v1, uint16 v2); uint16 fetchValue(); void actionNop(); - void initCosTable(); + void initSinCosTable(); void makeMatriceFix(); void projectionFix(cube_t *cube, int n); void initCubeMac(); @@ -717,7 +717,8 @@ private: int _roomIconsBase; //// cube.c - int16 _cosSinTable[361 * 2]; + int16 _cosTable[361]; + int16 _sinTable[361]; int _passMat31, _passMat21, _passMat11; int _passMat32, _passMat22, _passMat12; int _passMat33, _passMat23, _passMat13; |