aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2016-11-01 20:07:27 -0400
committerPaul Gilbert2016-11-01 20:07:27 -0400
commit3990eb22771da74ce0e65d1fbe40fb69dda0bb64 (patch)
tree96f6f2e020ce6968f96056d5b6b3c810351d68dd /engines
parentc55aeec6fe3be160711a9ff2ab19143954264bd1 (diff)
downloadscummvm-rg350-3990eb22771da74ce0e65d1fbe40fb69dda0bb64.tar.gz
scummvm-rg350-3990eb22771da74ce0e65d1fbe40fb69dda0bb64.tar.bz2
scummvm-rg350-3990eb22771da74ce0e65d1fbe40fb69dda0bb64.zip
TITANIC: Fix transparency handling for PET glyph selection
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/support/mouse_cursor.cpp2
-rw-r--r--engines/titanic/support/transparency_surface.cpp13
-rw-r--r--engines/titanic/support/transparency_surface.h14
-rw-r--r--engines/titanic/support/video_surface.cpp4
4 files changed, 20 insertions, 13 deletions
diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp
index e9381ddb80..6300f65a3b 100644
--- a/engines/titanic/support/mouse_cursor.cpp
+++ b/engines/titanic/support/mouse_cursor.cpp
@@ -136,7 +136,7 @@ void CMouseCursor::setCursor(CursorId cursorId) {
Graphics::ManagedSurface surface(CURSOR_SIZE, CURSOR_SIZE, g_system->getScreenFormat());
const uint16 *srcP = srcSurface.getPixels();
- CTransparencySurface transSurface(&ce._transSurface->rawSurface(), TRANS_DEFAULT);
+ CTransparencySurface transSurface(&ce._transSurface->rawSurface(), TRANS_ALPHA0);
uint16 *destP = (uint16 *)surface.getPixels();
for (int y = 0; y < CURSOR_SIZE; ++y) {
diff --git a/engines/titanic/support/transparency_surface.cpp b/engines/titanic/support/transparency_surface.cpp
index eb3fc28b52..8b5cbecc5f 100644
--- a/engines/titanic/support/transparency_surface.cpp
+++ b/engines/titanic/support/transparency_surface.cpp
@@ -66,8 +66,17 @@ int CTransparencySurface::moveX() {
}
uint CTransparencySurface::getPixel() const {
- const byte *pixelP = (const byte *)_surface->getBasePtr(_pos.x, _pos.y);
- return *pixelP;
+ byte pixel = *(const byte *)_surface->getBasePtr(_pos.x, _pos.y);
+ return pixel;
+}
+
+uint CTransparencySurface::getAlpha() const {
+ byte pixel = getPixel();
+ return _flag1 ? 0xFF - pixel : pixel;
+}
+
+bool CTransparencySurface::isPixelTransparent() {
+ return getAlpha() == 0xff;
}
} // End of namespace Titanic
diff --git a/engines/titanic/support/transparency_surface.h b/engines/titanic/support/transparency_surface.h
index 0391b6d5b7..1b4587a9db 100644
--- a/engines/titanic/support/transparency_surface.h
+++ b/engines/titanic/support/transparency_surface.h
@@ -42,6 +42,11 @@ private:
bool _flag;
bool _flag1;
bool _flag2;
+private:
+ /**
+ * Returns a a pixel from the transparency surface
+ */
+ uint getPixel() const;
public:
/**
* Constructor
@@ -64,19 +69,14 @@ public:
int moveX();
/**
- * Returns a byte from the transparency surface
- */
- uint getPixel() const;
-
- /**
* Returns the alpha value for the pixel (0-31)
*/
- uint getAlpha() const { return 31 - (getPixel() >> 3); }
+ uint getAlpha() const;
/**
* Returns true if the pixel is completely transparent
*/
- bool isPixelTransparent() const { return getAlpha() == 31; }
+ bool isPixelTransparent();
};
} // End of namespace Titanic
diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp
index 293232860c..52610379b5 100644
--- a/engines/titanic/support/video_surface.cpp
+++ b/engines/titanic/support/video_surface.cpp
@@ -246,9 +246,7 @@ void CVideoSurface::transBlitRect(const Rect &srcRect, const Rect &destRect, CVi
transSurface.setCol(srcRect.left);
for (int srcX = srcRect.left; srcX < srcRect.right; ++srcX) {
- if (!transSurface.isPixelTransparent()) {
- copyPixel(lineDestP, lineSrcP, transSurface.getAlpha(), srcSurface->format, isAlpha);
- }
+ copyPixel(lineDestP, lineSrcP, transSurface.getAlpha() >> 3, srcSurface->format, isAlpha);
++lineSrcP;
++lineDestP;