From d0b8a8e468017ce9096729a78fe3b19ff4f89a68 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Sun, 24 Jan 2010 10:06:27 +0000 Subject: SCI: supporting .used bit 1 in palettes (force direct palette setting) and clipping palette intensity results fixes fade in/out in sq5 intro (some timing problems remain) svn-id: r47495 --- engines/sci/graphics/palette.cpp | 4 ++-- engines/sci/graphics/screen.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'engines') diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp index ed2fa0c003..94980609d5 100644 --- a/engines/sci/graphics/palette.cpp +++ b/engines/sci/graphics/palette.cpp @@ -199,8 +199,8 @@ void SciPalette::merge(Palette *pFrom, Palette *pTo, uint16 flag) { for (i = 1 ; i < 255; i++) { if (!pFrom->colors[i].used)// color is not used - so skip it continue; - // forced palette merging or dest color is not used yet - if (flag == 2 || (!pTo->colors[i].used)) { + // forced palette merging or dest color is not used yet or bit 1 of new color is set + if (flag == 2 || (!pTo->colors[i].used) || (pFrom->colors[i].used & 2)) { pTo->colors[i].used = pFrom->colors[i].used; pTo->colors[i].r = pFrom->colors[i].r; pTo->colors[i].g = pFrom->colors[i].g; diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp index a3131dec02..64155f4570 100644 --- a/engines/sci/graphics/screen.cpp +++ b/engines/sci/graphics/screen.cpp @@ -394,9 +394,9 @@ void Screen::setPalette(Palette*pal) { for (int16 i = 0; i < 256; i++) { if (!pal->colors[i].used) continue; - bpal[i * 4] = pal->colors[i].r * pal->intensity[i] / 100; - bpal[i * 4 + 1] = pal->colors[i].g * pal->intensity[i] / 100; - bpal[i * 4 + 2] = pal->colors[i].b * pal->intensity[i] / 100; + bpal[i * 4] = CLIP(pal->colors[i].r * pal->intensity[i] / 100, 0, 255); + bpal[i * 4 + 1] = CLIP(pal->colors[i].g * pal->intensity[i] / 100, 0, 255); + bpal[i * 4 + 2] = CLIP(pal->colors[i].b * pal->intensity[i] / 100, 0, 255); bpal[i * 4 + 3] = 100; } g_system->setPalette(bpal, 0, 256); -- cgit v1.2.3