diff options
author | lukaslw | 2014-08-11 00:40:32 +0200 |
---|---|---|
committer | lukaslw | 2014-08-11 00:40:32 +0200 |
commit | 6471a354f4f8a42876f9f9b7d44de50dca31a9f6 (patch) | |
tree | 52a71c1b0acf34ee4aaf9289d01beb9646713923 /engines/prince | |
parent | c941c5e2fdcc137a72d142261c1ad5df1f0291de (diff) | |
download | scummvm-rg350-6471a354f4f8a42876f9f9b7d44de50dca31a9f6.tar.gz scummvm-rg350-6471a354f4f8a42876f9f9b7d44de50dca31a9f6.tar.bz2 scummvm-rg350-6471a354f4f8a42876f9f9b7d44de50dca31a9f6.zip |
PRINCE: drawTransparent functions - update
Diffstat (limited to 'engines/prince')
-rw-r--r-- | engines/prince/graphics.cpp | 9 | ||||
-rw-r--r-- | engines/prince/graphics.h | 4 | ||||
-rw-r--r-- | engines/prince/prince.cpp | 16 |
3 files changed, 15 insertions, 14 deletions
diff --git a/engines/prince/graphics.cpp b/engines/prince/graphics.cpp index f200949ec2..bb6d7f7292 100644 --- a/engines/prince/graphics.cpp +++ b/engines/prince/graphics.cpp @@ -91,7 +91,8 @@ void GraphicsMan::draw(Graphics::Surface *screen, const Graphics::Surface *s) { change(); } -void GraphicsMan::drawTransparentSurface(Graphics::Surface *screen, int32 posX, int32 posY, const Graphics::Surface *s, int transColor) { +// Black (value = 0) as a primary transparent color, fix for FLC animations +void GraphicsMan::drawTransparentSurface(Graphics::Surface *screen, int32 posX, int32 posY, const Graphics::Surface *s, int secondTransColor) { byte *src1 = (byte *)s->getBasePtr(0, 0); byte *dst1 = (byte *)screen->getBasePtr(posX, posY); for (int y = 0; y < s->h; y++) { @@ -99,7 +100,7 @@ void GraphicsMan::drawTransparentSurface(Graphics::Surface *screen, int32 posX, byte *src2 = src1; byte *dst2 = dst1; for (int x = 0; x < s->w; x++, src2++, dst2++) { - if (*src2 != transColor) { + if (*src2 && *src2 != secondTransColor) { if (x + posX < screen->w && x + posX >= 0) { *dst2 = *src2; } @@ -132,7 +133,7 @@ void GraphicsMan::drawAsShadowSurface(Graphics::Surface *screen, int32 posX, int } } -void GraphicsMan::drawTransparentWithBlendSurface(Graphics::Surface *screen, int32 posX, int32 posY, const Graphics::Surface *s, int transColor) { +void GraphicsMan::drawTransparentWithBlendSurface(Graphics::Surface *screen, int32 posX, int32 posY, const Graphics::Surface *s) { byte *src1 = (byte *)s->getBasePtr(0, 0); byte *dst1 = (byte *)screen->getBasePtr(posX, posY); byte *blendTable = (byte *)malloc(256); @@ -144,7 +145,7 @@ void GraphicsMan::drawTransparentWithBlendSurface(Graphics::Surface *screen, int byte *src2 = src1; byte *dst2 = dst1; for (int x = 0; x < s->w; x++, src2++, dst2++) { - if (*src2 != transColor) { + if (*src2) { if (x + posX < screen->w && x + posX >= 0) { *dst2 = getBlendTableColor(*src2, *dst2, blendTable); } diff --git a/engines/prince/graphics.h b/engines/prince/graphics.h index d83a43dcd1..b6f002b7da 100644 --- a/engines/prince/graphics.h +++ b/engines/prince/graphics.h @@ -44,9 +44,9 @@ public: void makeShadowTable(int brightness, byte *shadowTable); void draw(Graphics::Surface *screen, const Graphics::Surface *s); - void drawTransparentSurface(Graphics::Surface *screen, int32 posX, int32 posY, const Graphics::Surface *s, int transColor); + void drawTransparentSurface(Graphics::Surface *screen, int32 posX, int32 posY, const Graphics::Surface *s, int secondTransColor = 0); void drawAsShadowSurface(Graphics::Surface *screen, int32 posX, int32 posY, const Graphics::Surface *s, byte *shadowTable); - void drawTransparentWithBlendSurface(Graphics::Surface *screen, int32 posX, int32 posY, const Graphics::Surface *s, int transColor); + void drawTransparentWithBlendSurface(Graphics::Surface *screen, int32 posX, int32 posY, const Graphics::Surface *s); static void drawTransparentDrawNode(Graphics::Surface *screen, DrawNode *drawNode); static void drawTransparentWithTransDrawNode(Graphics::Surface *screen, DrawNode *drawNode); diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index 2e695d122d..6659ec743e 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -1996,7 +1996,7 @@ void PrinceEngine::addInvObj() { while (_mst_shadow2 < 512) { rememberScreenInv(); - _graph->drawTransparentSurface(_graph->_screenForInventory, 0, 0, suitcase, 0); + _graph->drawTransparentSurface(_graph->_screenForInventory, 0, 0, suitcase); drawInvItems(); _graph->update(_graph->_screenForInventory); _mst_shadow2 += 50; @@ -2010,7 +2010,7 @@ void PrinceEngine::addInvObj() { } while (_mst_shadow2 > 256) { rememberScreenInv(); - _graph->drawTransparentSurface(_graph->_screenForInventory, 0, 0, suitcase, 0); + _graph->drawTransparentSurface(_graph->_screenForInventory, 0, 0, suitcase); drawInvItems(); _graph->update(_graph->_screenForInventory); _mst_shadow2 -= 42; @@ -2028,7 +2028,7 @@ void PrinceEngine::addInvObj() { _mst_shadow2 = 256; while (_mst_shadow2 < 512) { rememberScreenInv(); - _graph->drawTransparentSurface(_graph->_screenForInventory, 0, 0, suitcase, 0); + _graph->drawTransparentSurface(_graph->_screenForInventory, 0, 0, suitcase); drawInvItems(); _graph->update(_graph->_screenForInventory); _mst_shadow2 += 50; @@ -2042,7 +2042,7 @@ void PrinceEngine::addInvObj() { } while (_mst_shadow2 > 256) { rememberScreenInv(); - _graph->drawTransparentSurface(_graph->_screenForInventory, 0, 0, suitcase, 0); + _graph->drawTransparentSurface(_graph->_screenForInventory, 0, 0, suitcase); drawInvItems(); _graph->update(_graph->_screenForInventory); _mst_shadow2 -= 50; @@ -2059,7 +2059,7 @@ void PrinceEngine::addInvObj() { _mst_shadow2 = 0; for (int i = 0; i < 20; i++) { rememberScreenInv(); - _graph->drawTransparentSurface(_graph->_screenForInventory, 0, 0, suitcase, 0); + _graph->drawTransparentSurface(_graph->_screenForInventory, 0, 0, suitcase); drawInvItems(); _graph->update(_graph->_screenForInventory); Common::Event event; @@ -2182,10 +2182,10 @@ void PrinceEngine::drawInvItems() { drawX += (_maxInvW - itemSurface->w) / 2; } if (!_mst_shadow) { - _graph->drawTransparentSurface(_graph->_screenForInventory, drawX, drawY, itemSurface, 0); + _graph->drawTransparentSurface(_graph->_screenForInventory, drawX, drawY, itemSurface); } else { _mst_shadow = _mst_shadow2; - _graph->drawTransparentWithBlendSurface(_graph->_screenForInventory, drawX, drawY, itemSurface, 0); + _graph->drawTransparentWithBlendSurface(_graph->_screenForInventory, drawX, drawY, itemSurface); } } currInvX += _invLineW + _invLineSkipX; @@ -2652,7 +2652,7 @@ void PrinceEngine::displayInventory() { rememberScreenInv(); Graphics::Surface *suitcase = _suitcaseBmp->getSurface(); - _graph->drawTransparentSurface(_graph->_screenForInventory, 0, 0, suitcase, 0); + _graph->drawTransparentSurface(_graph->_screenForInventory, 0, 0, suitcase); drawInvItems(); |