diff options
author | Dmitry Iskrich | 2016-06-18 21:05:01 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | a5b69ca37d7f493d3d8f9380a4a4d0b78ab16b79 (patch) | |
tree | 4fa1230c36f1cbb02ce294c74888f790733b98aa /engines/director/score.cpp | |
parent | 952c2ceabdfe52105147d4625a820f97c64819f1 (diff) | |
download | scummvm-rg350-a5b69ca37d7f493d3d8f9380a4a4d0b78ab16b79.tar.gz scummvm-rg350-a5b69ca37d7f493d3d8f9380a4a4d0b78ab16b79.tar.bz2 scummvm-rg350-a5b69ca37d7f493d3d8f9380a4a4d0b78ab16b79.zip |
DIRECTOR: Handle Ghost, Reverse ink types
Diffstat (limited to 'engines/director/score.cpp')
-rw-r--r-- | engines/director/score.cpp | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 14965d4a7e..74285a6866 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -1076,6 +1076,12 @@ void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Co case kInkTypeMatte: drawMatteSprite(surface, *img.getSurface(), drawRect); break; + case kInkTypeGhost: + drawGhostSprite(surface, *img.getSurface(), drawRect); + break; + case kInkTypeReverse: + drawReverseSprite(surface, *img.getSurface(), drawRect); + break; default: warning("Unhandled ink type %d", _sprites[i]->_ink); surface.blitFrom(*img.getSurface(), Common::Point(x, y)); @@ -1086,7 +1092,7 @@ void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Co } void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) { - uint8 skipColor = 15; //FIXME is it always white (last entry in pallette) ? + uint8 skipColor = _vm->getPaletteColorCount() - 1; //FIXME is it always white (last entry in pallette) ? for (int ii = 0; ii < sprite.h; ii++) { const byte *src = (const byte *)sprite.getBasePtr(0, ii); @@ -1102,6 +1108,39 @@ void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graph } } +void Frame::drawGhostSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) { + uint8 skipColor = _vm->getPaletteColorCount() - 1; + for (int ii = 0; ii < sprite.h; ii++) { + const byte *src = (const byte *)sprite.getBasePtr(0, ii); + byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + ii); + + for (int j = 0; j < drawRect.width(); j++) { + if ((getSpriteIDFromPos(Common::Point(drawRect.left + j, drawRect.top + ii)) != 0) && (*src != skipColor)) + *dst = (_vm->getPaletteColorCount() - 1) - *src; //Oposite color + + src++; + dst++; + } + } +} + +void Frame::drawReverseSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) { + uint8 skipColor = _vm->getPaletteColorCount() - 1; + for (int ii = 0; ii < sprite.h; ii++) { + const byte *src = (const byte *)sprite.getBasePtr(0, ii); + byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + ii); + + for (int j = 0; j < drawRect.width(); j++) { + if ((getSpriteIDFromPos(Common::Point(drawRect.left + j, drawRect.top + ii)) != 0)) + *dst = (_vm->getPaletteColorCount() - 1) - *src; + else if (*src != skipColor) + *dst = *src; + src++; + dst++; + } + } +} + void Frame::drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) { //Like background trans, but all white pixels NOT ENCLOSED by coloured pixels are transparent Graphics::Surface tmp; |