diff options
author | Strangerke | 2013-09-06 23:51:04 +0200 |
---|---|---|
committer | Strangerke | 2013-09-07 00:03:59 +0200 |
commit | f1bac0f193c7fe39d0241e0c3db60bc10642edfc (patch) | |
tree | 419664e36a65f61fe0f1536bd2b9cb4421f2aa7b /engines | |
parent | 200670d32703179a0cd2746981bdc1992a86d17b (diff) | |
download | scummvm-rg350-f1bac0f193c7fe39d0241e0c3db60bc10642edfc.tar.gz scummvm-rg350-f1bac0f193c7fe39d0241e0c3db60bc10642edfc.tar.bz2 scummvm-rg350-f1bac0f193c7fe39d0241e0c3db60bc10642edfc.zip |
AVALANCHE: (Hopefully) fix some warnings reported by GCC and Clang
Diffstat (limited to 'engines')
-rw-r--r-- | engines/avalanche/acci2.cpp | 4 | ||||
-rw-r--r-- | engines/avalanche/dropdown2.cpp | 3 | ||||
-rw-r--r-- | engines/avalanche/graphics.cpp | 59 | ||||
-rw-r--r-- | engines/avalanche/lucerna2.cpp | 18 | ||||
-rw-r--r-- | engines/avalanche/scrolls2.cpp | 2 |
5 files changed, 47 insertions, 39 deletions
diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 7b3e84fd60..1661ad27b9 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1527,9 +1527,9 @@ void Acci::doThat() { for (byte i = 0; i < 7; i++) toDisplay += _vm->_scrolls->kControlNewLine; toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine - + "The medi‘val descendant of" + _vm->_scrolls->kControlNewLine + + "The medi\x91val descendant of" + _vm->_scrolls->kControlNewLine + "Denarius Avaricius Sextus" + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine - + "version " + _vm->_gyro->kVersionNum + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Copyright ï " + + "version " + _vm->_gyro->kVersionNum + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Copyright \XEF " + _vm->_gyro->kCopyright + ", Mark, Mike and Thomas Thurman." + _vm->_scrolls->kControlRegister + 'Y' + _vm->_scrolls->kControlIcon; _vm->_scrolls->display(toDisplay); _vm->_scrolls->aboutscroll = false; diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 7424d82974..10cefa13b2 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -349,7 +349,8 @@ void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text, return; else { byte i; - for (i = 0; text[i] != trigger; i++); // Search for the character in the string. + for (i = 0; text[i] != trigger; i++) + ; // Search for the character in the string. byte pixel = ander; for (byte bit = 0; bit < 8; bit++) { diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index eeb15ddb31..df310500f8 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -91,8 +91,7 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, yRadius++; // Check for an ellipse with negligable x and y radius. - if ((xRadius <= 1) && (yRadius <= 1)) - { + if ((xRadius <= 1) && (yRadius <= 1)) { *(byte *)_scrolls.getBasePtr(x, y) = color; endPoint.x = x; endPoint.y = y; @@ -104,15 +103,14 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, endAngle = endAngle % 361; // If impossible angles, then swap them! - if (endAngle < stAngle) - { + if (endAngle < stAngle) { uint16 tmpAngle=endAngle; endAngle=stAngle; stAngle=tmpAngle; } // Approximate the number of pixels required by using the circumference equation of an ellipse. - uint16 numOfPixels=floor(sqrt(3.0)*sqrt(pow(double(xRadius), 2)+pow(double(yRadius), 2)) + 0.5); + 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; @@ -127,8 +125,8 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, // Set the end point. double tempTerm = endAngle * convfac; - endPoint.x = floor(xRadius * cos(tempTerm) + 0.5) + x; - endPoint.y = floor(yRadius * sin(tempTerm + pi) + 0.5) + y; + endPoint.x = (int16)floor(xRadius * cos(tempTerm) + 0.5) + x; + endPoint.y = (int16)floor(yRadius * sin(tempTerm + pi) + 0.5) + y; // Calculate points. int16 xNext = xRadius; @@ -139,8 +137,8 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, // This is used by both sin and cos. tempTerm = (j + delta) * convfac; - xNext = floor(xRadius*cos(tempTerm) + 0.5); - yNext = floor(yRadius*sin(tempTerm + pi) + 0.5); + xNext = (int16)floor(xRadius * cos(tempTerm) + 0.5); + yNext = (int16)floor(yRadius * sin(tempTerm + pi) + 0.5); int16 xp = x + xTemp; int16 xm = x - xTemp; @@ -208,7 +206,7 @@ void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte } void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, byte color) { - for (byte i = 0; i < text.size(); i++) + for (byte i = 0; i < text.size(); i++) { for (byte j = 0; j < fontHeight; j++) { byte pixel = font[(byte)text[i]][j]; for (byte bit = 0; bit < 8; bit++) { @@ -217,6 +215,7 @@ void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text *(byte *)surface.getBasePtr(x + i * 8 + 7 - bit, y + j) = color; } } + } } ::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) { @@ -229,8 +228,8 @@ void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text picture.create(width, height, ::Graphics::PixelFormat::createFormatCLUT8()); // Produce the picture. We read it in row-by-row, and every row has 4 planes. - for (byte y = 0; y < height; y++) - for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. + for (byte y = 0; y < height; y++) { + for (int8 plane = 3; plane >= 0; plane--) { // The planes are in the opposite way. for (uint16 x = 0; x < width; x += 8) { byte pixel = file.readByte(); for (byte bit = 0; bit < 8; bit++) { @@ -239,7 +238,8 @@ void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text *(byte *)picture.getBasePtr(x + 7 - bit, y) += (pixelBit << plane); } } - + } + } return picture; } @@ -251,8 +251,8 @@ void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text ::Graphics::Surface picture; picture.create(width, height, ::Graphics::PixelFormat::createFormatCLUT8()); - for (byte plane = 0; plane < 4; plane++) - for (uint16 y = 0; y < height; y++) + for (byte plane = 0; plane < 4; plane++) { + for (uint16 y = 0; y < height; y++) { for (uint16 x = 0; x < width; x += 8) { byte pixel = file.readByte(); for (byte i = 0; i < 8; i++) { @@ -260,22 +260,26 @@ void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text *(byte *)picture.getBasePtr(x + 7 - i, y) += (pixelBit << plane); } } + } + } return picture; } void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { // First we make the pixels of the spirte blank. - for (byte j = 0; j < sprite._yLength; j++) - for (byte i = 0; i < sprite._xLength; i++) + for (byte j = 0; j < sprite._yLength; j++) { + for (byte i = 0; i < sprite._xLength; i++) { if (((*sprite._sil[picnum])[j][i / 8] >> ((7 - i % 8)) & 1) == 0) *(byte *)_surface.getBasePtr(x + i, y + j) = 0; + } + } // Then we draw the picture to the blank places. uint16 maniPos = 0; // Because the original manitype starts at 5!!! See Graphics.h for definition. - for (byte j = 0; j < sprite._yLength; j++) - for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way. + for (byte j = 0; j < sprite._yLength; j++) { + for (int8 plane = 3; plane >= 0; plane--) { // The planes are in the opposite way. for (uint16 i = 0; i < sprite._xLength; i += 8) { byte pixel = (*sprite._mani[picnum])[maniPos++]; for (byte bit = 0; bit < 8; bit++) { @@ -283,22 +287,27 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 *(byte *)_surface.getBasePtr(x + i + 7 - bit, y + j) += (pixelBit << plane); } } + } + } } void Graphics::drawPicture(::Graphics::Surface &target, ::Graphics::Surface &picture, uint16 destX, uint16 destY) { // Copy the picture to the given place on the screen. - for (uint16 y = 0; y < picture.h; y++) - for (uint16 x = 0; x < picture.w; x++) - *(byte *)target.getBasePtr(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y); + for (uint16 y = 0; y < picture.h; y++) { + for (uint16 x = 0; x < picture.w; x++) { + *(byte *)target.getBasePtr(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y); + } + } } void Graphics::refreshScreen() { // These cycles are for doubling the screen height. - for (uint16 y = 0; y < _screen.h / 2; y++) - for (uint16 x = 0; x < _screen.w; x++) + for (uint16 y = 0; y < _screen.h / 2; y++) { + for (uint16 x = 0; x < _screen.w; x++) { for (byte j = 0; j < 2; j++) *(byte *)_screen.getBasePtr(x, y * 2 + j) = *(byte *)_surface.getBasePtr(x, y); - + } + } // Now we copy the stretched picture to the screen. g_system->copyRectToScreen(_screen.pixels, _screen.pitch, 0, 0, kScreenWidth, kScreenHeight * 2); g_system->updateScreen(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 425cab0858..81dc45875d 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -1336,20 +1336,18 @@ void Lucerna::major_redraw() { } uint16 Lucerna::bearing(byte whichped) { - whichped--; // Different array indexes in Pascal and C. + byte pedId = whichped - 1; // Different array indexes in Pascal and C. const double rad2deg = 180 / 3.14; // Pi - if (_vm->_trip->tr[0].x == _vm->_gyro->_peds[whichped]._x) + if (_vm->_trip->tr[0].x == _vm->_gyro->_peds[pedId]._x) return 0; - else { - if (_vm->_trip->tr[0].x < _vm->_gyro->_peds[whichped]._x) { - return (atan(double((_vm->_trip->tr[0].y - _vm->_gyro->_peds[whichped]._y)) - / (_vm->_trip->tr[0].x - _vm->_gyro->_peds[whichped]._x)) * rad2deg) + 90; - } else { - return (atan(double((_vm->_trip->tr[0].y - _vm->_gyro->_peds[whichped]._y)) - / (_vm->_trip->tr[0].x - _vm->_gyro->_peds[whichped]._x)) * rad2deg) + 270; - } + else if (_vm->_trip->tr[0].x < _vm->_gyro->_peds[pedId]._x) { + return (uint16)((atan(double((_vm->_trip->tr[0].y - _vm->_gyro->_peds[pedId]._y)) + / (_vm->_trip->tr[0].x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 90); + } else { + return (uint16)((atan(double((_vm->_trip->tr[0].y - _vm->_gyro->_peds[pedId]._y)) + / (_vm->_trip->tr[0].x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 270); } } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 1392454663..531794c770 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -588,7 +588,7 @@ Common::String Scrolls::lsd() { else x = x + _vm->_gyro->intToStr(_vm->_gyro->_dna._money % 12); } else // L, s & d - x = Common::String('œ') + _vm->_gyro->intToStr(_vm->_gyro->_dna._money / 240) + '.' + _vm->_gyro->intToStr((_vm->_gyro->_dna._money / 12) % 20) + x = Common::String('\x9C') + _vm->_gyro->intToStr(_vm->_gyro->_dna._money / 240) + '.' + _vm->_gyro->intToStr((_vm->_gyro->_dna._money / 12) % 20) + '.' + _vm->_gyro->intToStr(_vm->_gyro->_dna._money % 12); if (_vm->_gyro->_dna._money > 12) x = x + " (that's " + _vm->_gyro->intToStr(_vm->_gyro->_dna._money) + "d)"; |