diff options
author | uruk | 2013-10-06 00:03:49 +0200 |
---|---|---|
committer | uruk | 2013-10-06 00:03:49 +0200 |
commit | 0f42dd4511ed4cc279acb075344fb62bc25300a9 (patch) | |
tree | 0a397fc9cdde0d1daa753e121fd48bee524830f5 /engines/avalanche/graphics.cpp | |
parent | bf41366fd7e042c1ef48ffc4ff5366fee27e756f (diff) | |
download | scummvm-rg350-0f42dd4511ed4cc279acb075344fb62bc25300a9.tar.gz scummvm-rg350-0f42dd4511ed4cc279acb075344fb62bc25300a9.tar.bz2 scummvm-rg350-0f42dd4511ed4cc279acb075344fb62bc25300a9.zip |
AVALANCHE: Use floats instead of double. Use M_PI where it is possible.
Diffstat (limited to 'engines/avalanche/graphics.cpp')
-rw-r--r-- | engines/avalanche/graphics.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 62ac1653ba..d442c13d51 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -199,8 +199,7 @@ void GraphicManager::fleshColors() { Common::Point GraphicManager::drawArc(Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color) { Common::Point endPoint; - const double pi = 3.14; - const double convfac = pi / 180.0; + const float convfac = M_PI / 180.0; int32 xRadius = radius; int32 yRadius = radius * kScreenWidth / (8 * kScreenHeight); // Just don't ask why... @@ -233,20 +232,20 @@ Common::Point GraphicManager::drawArc(Graphics::Surface &surface, int16 x, int16 uint16 numOfPixels = (uint16)floor(sqrt(3.0) * sqrt(pow(double(xRadius), 2) + pow(double(yRadius), 2)) + 0.5); // Calculate the angle precision required. - double delta = 90.0 / numOfPixels; + float delta = 90.0 / numOfPixels; // Always just go over the first 90 degrees. Could be optimized a // bit if startAngle and endAngle lie in the same quadrant, left as an // exercise for the reader. :) - double j = 0; + float j = 0; // Calculate stop position, go 1 further than 90 because otherwise 1 pixel is sometimes not drawn. uint16 deltaEnd = 91; // Set the end point. - double tempTerm = endAngle * convfac; + float tempTerm = endAngle * convfac; endPoint.x = (int16)floor(xRadius * cos(tempTerm) + 0.5) + x; - endPoint.y = (int16)floor(yRadius * sin(tempTerm + pi) + 0.5) + y; + endPoint.y = (int16)floor(yRadius * sin(tempTerm + M_PI) + 0.5) + y; // Calculate points. int16 xNext = xRadius; @@ -258,7 +257,7 @@ Common::Point GraphicManager::drawArc(Graphics::Surface &surface, int16 x, int16 tempTerm = (j + delta) * convfac; xNext = (int16)floor(xRadius * cos(tempTerm) + 0.5); - yNext = (int16)floor(yRadius * sin(tempTerm + pi) + 0.5); + yNext = (int16)floor(yRadius * sin(tempTerm + M_PI) + 0.5); int16 xp = x + xTemp; int16 xm = x - xTemp; |