diff options
Diffstat (limited to 'engines/m4/graphics.cpp')
| -rw-r--r-- | engines/m4/graphics.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp index 5fc46d3881..786c975850 100644 --- a/engines/m4/graphics.cpp +++ b/engines/m4/graphics.cpp @@ -18,16 +18,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ -#include "common/file.h" -#include "common/endian.h" #include "common/system.h" #include "common/util.h" #include "common/ptr.h" +#include "common/textconsole.h" + +#include "graphics/palette.h" #include "m4/globals.h" #include "m4/graphics.h" @@ -96,7 +94,7 @@ void M4Surface::loadCodesM4(Common::SeekableReadStream *source) { uint16 widthVal = source->readUint16LE(); uint16 heightVal = source->readUint16LE(); - create(widthVal, heightVal, 1); + create(widthVal, heightVal, Graphics::PixelFormat::createFormatCLUT8()); source->read(pixels, widthVal * heightVal); } @@ -110,7 +108,7 @@ void M4Surface::loadCodesMads(Common::SeekableReadStream *source) { uint16 heightVal = 156; byte *walkMap = new byte[source->size()]; - create(widthVal, heightVal, 1); + create(widthVal, heightVal, Graphics::PixelFormat::createFormatCLUT8()); source->read(walkMap, source->size()); byte *ptr = (byte *)getBasePtr(0, 0); @@ -300,7 +298,7 @@ void M4Surface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &c r = CLIP((info.palette[destPixel].r * pixel) >> 10, 0, 31); g = CLIP((info.palette[destPixel].g * pixel) >> 10, 0, 31); b = CLIP((info.palette[destPixel].b * pixel) >> 10, 0, 31); - pixel = info.inverseColourTable[(b << 10) | (g << 5) | r]; + pixel = info.inverseColorTable[(b << 10) | (g << 5) | r]; } } @@ -361,7 +359,7 @@ void M4Surface::fillRect(const Common::Rect &r, uint8 color) { } void M4Surface::copyFrom(M4Surface *src, const Common::Rect &srcBounds, int destX, int destY, - int transparentColour) { + int transparentColor) { // Validation of the rectangle and position if ((destX >= w) || (destY >= h)) return; @@ -390,13 +388,13 @@ void M4Surface::copyFrom(M4Surface *src, const Common::Rect &srcBounds, int dest byte *destPtr = (byte *)pixels + (destY * width()) + destX; for (int rowCtr = 0; rowCtr < copyRect.height(); ++rowCtr) { - if (transparentColour == -1) + if (transparentColor == -1) // No transparency, so copy line over Common::copy(srcPtr, srcPtr + copyRect.width(), destPtr); else { // Copy each byte one at a time checking for the transparency color for (int xCtr = 0; xCtr < copyRect.width(); ++xCtr) - if (srcPtr[xCtr] != transparentColour) destPtr[xCtr] = srcPtr[xCtr]; + if (srcPtr[xCtr] != transparentColor) destPtr[xCtr] = srcPtr[xCtr]; } srcPtr += src->width(); @@ -411,7 +409,7 @@ void M4Surface::copyFrom(M4Surface *src, const Common::Rect &srcBounds, int dest * the specified depth requirement on a secondary surface contain depth information */ void M4Surface::copyFrom(M4Surface *src, int destX, int destY, int depth, - M4Surface *depthsSurface, int scale, int transparentColour) { + M4Surface *depthsSurface, int scale, int transparentColor) { if (scale == 100) { // Copy the specified area @@ -443,7 +441,7 @@ void M4Surface::copyFrom(M4Surface *src, int destX, int destY, int depth, for (int rowCtr = 0; rowCtr < copyRect.height(); ++rowCtr) { // Copy each byte one at a time checking against the depth for (int xCtr = 0; xCtr < copyRect.width(); ++xCtr) { - if ((depth <= (depthsPtr[xCtr] & 0x7f)) && (srcPtr[xCtr] != transparentColour)) + if ((depth <= (depthsPtr[xCtr] & 0x7f)) && (srcPtr[xCtr] != transparentColor)) destPtr[xCtr] = srcPtr[xCtr]; } @@ -557,7 +555,7 @@ void M4Surface::copyFrom(M4Surface *src, int destX, int destY, int depth, // Not a display pixel continue; - if ((*srcP != transparentColour) && (depth <= (*depthP & 0x7f))) + if ((*srcP != transparentColor) && (depth <= (*depthP & 0x7f))) *destP = *srcP; ++destP; @@ -760,7 +758,7 @@ void M4Surface::rexLoadBackground(Common::SeekableReadStream *source, RGBList ** sourceUnc = packData.getItemStream(1); assert((int)sourceUnc->size() >= sceneSize); - create(sceneWidth, sceneHeight, 1); + create(sceneWidth, sceneHeight, Graphics::PixelFormat::createFormatCLUT8()); byte *pData = (byte *)pixels; sourceUnc->read(pData, sceneSize); @@ -813,7 +811,7 @@ void M4Surface::m4LoadBackground(Common::SeekableReadStream *source) { assert(width() == (int)widthVal); //debugCN(kDebugGraphics, "width(): %d, widthVal: %d, height(): %d, heightVal: %d\n", width(), widthVal, height(), heightVal); - tileBuffer->create(tileWidth, tileHeight, 1); + tileBuffer->create(tileWidth, tileHeight, Graphics::PixelFormat::createFormatCLUT8()); for (curTileY = 0; curTileY < tilesY; curTileY++) { clipY = MIN(heightVal, (1 + curTileY) * tileHeight) - (curTileY * tileHeight); @@ -854,7 +852,7 @@ void M4Surface::madsLoadInterface(const Common::String &filename) { // Chunk 1, data intStream = intFile.getItemStream(1); - create(320, 44, 1); + create(320, 44, Graphics::PixelFormat::createFormatCLUT8()); intStream->read(pixels, 320 * 44); delete intStream; @@ -933,7 +931,7 @@ void M4Surface::translate(RGBList *list, bool isTransparent) { byte *palIndexes = list->palIndexes(); for (int i = 0; i < width() * height(); ++i, ++p) { - if (!isTransparent || (*p != TRANSPARENT_COLOUR_INDEX)) { + if (!isTransparent || (*p != TRANSPARENT_COLOR_INDEX)) { if (*p < list->size()) *p = palIndexes[*p]; else |
