aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2012-03-05 21:25:07 +1100
committerStrangerke2012-04-06 08:22:42 +0200
commitd5c02ab69c482523dbce82007385363cc8da142c (patch)
tree0f08308b0aedd99e357454607755e21074325926 /engines
parent1ee4429601c0e009196d66d3e676deeb85b11b49 (diff)
downloadscummvm-rg350-d5c02ab69c482523dbce82007385363cc8da142c.tar.gz
scummvm-rg350-d5c02ab69c482523dbce82007385363cc8da142c.tar.bz2
scummvm-rg350-d5c02ab69c482523dbce82007385363cc8da142c.zip
MORTEVIELLE: Properly implement transparency when drawing images
Diffstat (limited to 'engines')
-rw-r--r--engines/mortevielle/graphics.cpp25
-rw-r--r--engines/mortevielle/graphics.h2
2 files changed, 18 insertions, 9 deletions
diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp
index ce02915208..775075c35f 100644
--- a/engines/mortevielle/graphics.cpp
+++ b/engines/mortevielle/graphics.cpp
@@ -83,6 +83,8 @@ void PaletteManager::setDefaultPalette() {
void GfxSurface::decode(const byte *pSrc) {
_width = _height = 0;
+ // If no transparency, use invalid (for EGA) palette index of 16. Otherwise get index to use
+ _transparency = (*pSrc == 0) ? 16 : *(pSrc + 2);
bool offsetFlag = *pSrc++ == 0;
int entryCount = *pSrc++;
pSrc += 2;
@@ -114,7 +116,7 @@ void GfxSurface::decode(const byte *pSrc) {
// Temporary output buffer
byte outputBuffer[65536];
- Common::fill(&outputBuffer[0], &outputBuffer[65536], 0);
+ Common::fill(&outputBuffer[0], &outputBuffer[65536], _transparency);
byte *pDest = &outputBuffer[0];
const byte *pSrcStart = pSrc;
@@ -922,15 +924,20 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) {
byte *pDest = (byte *)destSurface.getBasePtr(0, yp * 2);
for (int xp = 0; xp < surface.w; ++xp, ++pSrc) {
- // Draw the pixel using the specified index in the palette map
- *pDest = paletteMap[*pSrc * 2];
- *(pDest + SCREEN_WIDTH) = paletteMap[*pSrc * 2];
- ++pDest;
+ if (*pSrc == surface._transparency) {
+ // Transparent point, so skip pixels
+ pDest += 2;
+ } else {
+ // Draw the pixel using the specified index in the palette map
+ *pDest = paletteMap[*pSrc * 2];
+ *(pDest + SCREEN_WIDTH) = paletteMap[*pSrc * 2];
+ ++pDest;
- // Use the secondary mapping value to draw the secondary column pixel
- *pDest = paletteMap[*pSrc * 2 + 1];
- *(pDest + SCREEN_WIDTH) = paletteMap[*pSrc * 2 + 1];
- ++pDest;
+ // Use the secondary mapping value to draw the secondary column pixel
+ *pDest = paletteMap[*pSrc * 2 + 1];
+ *(pDest + SCREEN_WIDTH) = paletteMap[*pSrc * 2 + 1];
+ ++pDest;
+ }
}
}
}
diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h
index 28a9d64b7c..253b708d70 100644
--- a/engines/mortevielle/graphics.h
+++ b/engines/mortevielle/graphics.h
@@ -67,6 +67,8 @@ private:
public:
// Specifies offset when drawing the image
Common::Point _offset;
+ // Transparency palette index
+ int _transparency;
public:
~GfxSurface();