aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage
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
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')
-rw-r--r--engines/tsage/blue_force/blueforce_dialogs.cpp1
-rw-r--r--engines/tsage/core.cpp9
-rw-r--r--engines/tsage/core.h1
-rw-r--r--engines/tsage/globals.cpp15
-rw-r--r--engines/tsage/graphics.cpp31
5 files changed, 49 insertions, 8 deletions
diff --git a/engines/tsage/blue_force/blueforce_dialogs.cpp b/engines/tsage/blue_force/blueforce_dialogs.cpp
index 8428086865..b9b3ad6c22 100644
--- a/engines/tsage/blue_force/blueforce_dialogs.cpp
+++ b/engines/tsage/blue_force/blueforce_dialogs.cpp
@@ -496,7 +496,6 @@ OptionsDialog::OptionsDialog() {
setCenter(160, 90);
}
-
} // End of namespace BlueForce
} // End of namespace TsAGE
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index cd8e07e44e..4061705707 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -1299,6 +1299,15 @@ void ScenePalette::setPalette(int index, int count) {
}
/**
+ * Get a palette entry
+ */
+void ScenePalette::getEntry(int index, uint *r, uint *g, uint *b) {
+ *r = _palette[index * 3];
+ *g = _palette[index * 3 + 1];
+ *b = _palette[index * 3 + 2];
+}
+
+/**
* Set a palette entry
*/
void ScenePalette::setEntry(int index, uint r, uint g, uint b) {
diff --git a/engines/tsage/core.h b/engines/tsage/core.h
index 87d4a02123..95ff1c145c 100644
--- a/engines/tsage/core.h
+++ b/engines/tsage/core.h
@@ -372,6 +372,7 @@ public:
bool loadPalette(int paletteNum);
void refresh();
void setPalette(int index, int count);
+ void getEntry(int index, uint *r, uint *g, uint *b);
void setEntry(int index, uint r, uint g, uint b);
uint8 indexOf(uint r, uint g, uint b, int threshold = 0xffff);
void getPalette(int start = 0, int count = 256);
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index a76e03ae69..b667924aef 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -79,12 +79,15 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface
_dialogCenter.y = 140;
} else if (g_vm->getGameID() == GType_Ringworld2) {
// Return to Ringworld
- _gfxFontNumber = 2;
- _gfxColors.background = 89;
- _gfxColors.foreground = 83;
- _fontColors.background = 88;
- _fontColors.foreground = 92;
- _dialogCenter.y = 140;
+ _gfxFontNumber = 50;
+ _gfxColors.background = 0;
+ _gfxColors.foreground = 59;
+ _fontColors.background = 4;
+ _fontColors.foreground = 15;
+ _color1 = 59;
+ _color2 = 15;
+ _color3 = 4;
+ _dialogCenter.y = 100;
} else if (g_vm->getGameID() == GType_Geekwad) {
// Blue Force
_gfxFontNumber = 0;
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);