aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage/graphics.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2011-11-01 21:06:57 +1100
committerPaul Gilbert2011-11-01 21:06:57 +1100
commitacdeb1fb31021f0d563318639b4a261e3b370476 (patch)
treeaf9225010a4b4b38fdfb8872e526fdce3d0d26f8 /engines/tsage/graphics.cpp
parenta1d30786e50224b5dbefa8a6bcd94fd0c0c57154 (diff)
downloadscummvm-rg350-acdeb1fb31021f0d563318639b4a261e3b370476.tar.gz
scummvm-rg350-acdeb1fb31021f0d563318639b4a261e3b370476.tar.bz2
scummvm-rg350-acdeb1fb31021f0d563318639b4a261e3b370476.zip
TSAGE: Added support for semi-transparent dialogs used in R2RW
Diffstat (limited to 'engines/tsage/graphics.cpp')
-rw-r--r--engines/tsage/graphics.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp
index 4b2da0b456..6d95d09d29 100644
--- a/engines/tsage/graphics.cpp
+++ b/engines/tsage/graphics.cpp
@@ -676,7 +676,36 @@ void GfxElement::drawFrame() {
Rect tempRect = _bounds;
tempRect.collapse(g_globals->_gfxEdgeAdjust, g_globals->_gfxEdgeAdjust);
tempRect.collapse(-1, -1);
- gfxManager.fillRect(tempRect, _colors.background);
+
+ if (g_vm->getGameID() == GType_Ringworld2) {
+ // For Return to Ringworld, use palette shading
+
+ // Get the current palette and determining a shading translation list
+ ScenePalette tempPalette;
+ tempPalette.getPalette(0, 256);
+ int transList[256];
+
+ for (int i = 0; i < 256; ++i) {
+ uint r, g, b, v;
+ tempPalette.getEntry(i, &r, &g, &b);
+ v = ((r >> 1) + (g >> 1) + (b >> 1)) / 4;
+
+ transList[i] = tempPalette.indexOf(v, v, v);
+ }
+
+ // Loop through the surface area to replace each pixel with it's proper shaded replacement
+ Graphics::Surface surface = gfxManager.lockSurface();
+ for (int y = tempRect.top; y < tempRect.bottom; ++y) {
+ byte *lineP = (byte *)surface.getBasePtr(tempRect.left, y);
+ for (int x = 0; x < tempRect.width(); ++x)
+ *lineP++ = transList[*lineP];
+ }
+ gfxManager.unlockSurface();
+
+ } else {
+ // Fill dialog content with specified background colour
+ gfxManager.fillRect(tempRect, _colors.background);
+ }
--tempRect.bottom; --tempRect.right;
gfxManager.fillArea(tempRect.left, tempRect.top, bgColor);