diff options
author | D G Turner | 2018-08-09 21:35:57 +0100 |
---|---|---|
committer | D G Turner | 2018-08-09 21:35:57 +0100 |
commit | 237fb44ec0de88d2e6b9a3faf8efe58575bf09a6 (patch) | |
tree | 6bdd78c36b91e495ba4625ccb762ecfaf1f19c2a /engines/startrek | |
parent | 8c4b448d31ca10d7cb46a238fe9882c0531f01e0 (diff) | |
download | scummvm-rg350-237fb44ec0de88d2e6b9a3faf8efe58575bf09a6.tar.gz scummvm-rg350-237fb44ec0de88d2e6b9a3faf8efe58575bf09a6.tar.bz2 scummvm-rg350-237fb44ec0de88d2e6b9a3faf8efe58575bf09a6.zip |
STARTREK: Reorder Math Code to Simplify and Fix Compiler Warnings.
Diffstat (limited to 'engines/startrek')
-rw-r--r-- | engines/startrek/math.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/engines/startrek/math.cpp b/engines/startrek/math.cpp index 70b9ddb081..9f47309a1f 100644 --- a/engines/startrek/math.cpp +++ b/engines/startrek/math.cpp @@ -37,7 +37,7 @@ Fixed14 StarTrekEngine::sin(Angle angle) { else if (i == 0x300) return -1.0; - float f; + float f = 0.0; if (i < 0x100) f = _sineTable.getTable()[i & 0xff]; else if (i < 0x200) @@ -104,23 +104,23 @@ Angle StarTrekEngine::atan2(int32 deltaX, int32 deltaY) { } if (deltaY > deltaX) { - if (!deltaYNegative && !deltaXNegative) - angle = angle; - else if (!deltaYNegative && deltaXNegative) - angle = -angle; + if (deltaYNegative && deltaXNegative) + angle = angle - 512; else if (deltaYNegative && !deltaXNegative) angle = 512 - angle; - else - angle = angle - 512; + else if (!deltaYNegative && deltaXNegative) + angle = -angle; + // else if (!deltaYNegative && !deltaXNegative) + // angle remains the same i.e. angle = angle } else { - if (!deltaYNegative && !deltaXNegative) - angle = 256 - angle; + if (deltaYNegative && deltaXNegative) + angle = -256 - angle; else if (deltaYNegative && !deltaXNegative) angle = 256 + angle; - else if (deltaYNegative && deltaXNegative) - angle = -256 - angle; - else + else if (!deltaYNegative && deltaXNegative) angle = -256 + angle; + else // if (!deltaYNegative && !deltaXNegative) + angle = 256 - angle; } return Angle::fromRaw(angle); |