From fcdb7807a456f5a6cb94932977a1b0e4f0e11089 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 20 Jun 2010 07:04:58 +0000 Subject: Implemented explicit transparency index support - the previous hardcoded index of 0 wasn't correct, since some sprites need that index svn-id: r50070 --- engines/m4/sprite.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'engines/m4/sprite.cpp') diff --git a/engines/m4/sprite.cpp b/engines/m4/sprite.cpp index 0ff4bec855..da043c695f 100644 --- a/engines/m4/sprite.cpp +++ b/engines/m4/sprite.cpp @@ -131,6 +131,9 @@ void M4Sprite::loadMadsSprite(Common::SeekableReadStream* source) { byte cmd1, cmd2, count, pixel; if (newLine) { + if (outp < (lineStart + w)) + Common::set_to(outp, lineStart + w, TRANSPARENT_COLOUR_INDEX); + outp = lineStart + w; lineStart = outp; newLine = false; @@ -150,7 +153,7 @@ void M4Sprite::loadMadsSprite(Common::SeekableReadStream* source) { } else { pixel = source->readByte(); while (count--) - *outp++ = (pixel == 0xFD) ? 0 : pixel; + *outp++ = (pixel == 0xFD) ? TRANSPARENT_COLOUR_INDEX : pixel; } } } else { @@ -162,19 +165,17 @@ void M4Sprite::loadMadsSprite(Common::SeekableReadStream* source) { count = source->readByte(); pixel = source->readByte(); while (count--) - *outp++ = (pixel == 0xFD) ? 0 : pixel; + *outp++ = (pixel == 0xFD) ? TRANSPARENT_COLOUR_INDEX : pixel; } else { - *outp++ = (cmd2 == 0xFD) ? 0 : cmd2; + *outp++ = (cmd2 == 0xFD) ? TRANSPARENT_COLOUR_INDEX : cmd2; } } } } } -byte M4Sprite::getTransparentColor() const { - // FIXME: We assume that the transparent color is the color of the - // top left pixel. - return *getBasePtr(0, 0); +byte M4Sprite::getTransparencyIndex() const { + return TRANSPARENT_COLOUR_INDEX; } } // End of namespace M4 -- cgit v1.2.3