mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 06:08:35 +00:00
TSAGE: Added support for semi-transparent dialogs used in R2RW
This commit is contained in:
parent
a1d30786e5
commit
acdeb1fb31
@ -496,7 +496,6 @@ OptionsDialog::OptionsDialog() {
|
||||
setCenter(160, 90);
|
||||
}
|
||||
|
||||
|
||||
} // End of namespace BlueForce
|
||||
|
||||
} // End of namespace TsAGE
|
||||
|
@ -1298,6 +1298,15 @@ void ScenePalette::setPalette(int index, int count) {
|
||||
g_system->getPaletteManager()->setPalette((const byte *)&_palette[index * 3], index, 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
|
||||
*/
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user