From c77c84f5c52deb34930ed4e7f627ad672579c74c Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Sun, 11 Jul 2010 10:11:31 +0000 Subject: SCI: also sync palette after playing movies, fixes kq6 intro svn-id: r50798 --- engines/sci/engine/kgraphics.cpp | 4 +++- engines/sci/graphics/palette.cpp | 4 ++++ engines/sci/graphics/palette.h | 2 ++ engines/sci/graphics/screen.cpp | 14 +++++++++++++- engines/sci/graphics/screen.h | 3 ++- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 0e7930275a..13f2bd4875 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -1192,8 +1192,10 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) { // We also won't be copying the screen to the SCI screen... if (g_system->getScreenFormat().bytesPerPixel != 1) initGraphics(screenWidth, screenHeight, screenWidth > 320); - else + else { g_sci->_gfxScreen->kernelSyncWithFramebuffer(); + g_sci->_gfxPalette->kernelSyncScreenPalette(); + } } if (reshowCursor) diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp index 7e9dc0ed31..957199f8b9 100644 --- a/engines/sci/graphics/palette.cpp +++ b/engines/sci/graphics/palette.cpp @@ -498,6 +498,10 @@ void GfxPalette::kernelAssertPalette(GuiResourceId resourceId) { } } +void GfxPalette::kernelSyncScreenPalette() { + _screen->getPalette(&_sysPalette); +} + // palVary // init - only does, if palVaryOn == false // target, start, new palette allocation diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h index 1fa8c16d26..6af1d5a490 100644 --- a/engines/sci/graphics/palette.h +++ b/engines/sci/graphics/palette.h @@ -65,6 +65,8 @@ public: void kernelAnimateSet(); void kernelAssertPalette(GuiResourceId resourceId); + void kernelSyncScreenPalette(); + bool kernelPalVaryInit(GuiResourceId resourceId, uint16 ticks, uint16 stepStop, uint16 direction); int16 kernelPalVaryReverse(int16 ticks, uint16 stepStop, int16 direction); int16 kernelPalVaryGetCurrentStep(); diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp index 1d3a4ea1f7..488bb83ab3 100644 --- a/engines/sci/graphics/screen.cpp +++ b/engines/sci/graphics/screen.cpp @@ -499,7 +499,19 @@ void GfxScreen::bitsRestoreDisplayScreen(Common::Rect rect, byte *&memoryPtr) { } } -void GfxScreen::setPalette(Palette*pal) { +void GfxScreen::getPalette(Palette *pal) { + // just copy palette to system + byte bpal[4 * 256]; + // Get current palette, update it and put back + g_system->grabPalette(bpal, 0, 256); + for (int16 i = 1; i < 255; i++) { + pal->colors[i].r = bpal[i * 4]; + pal->colors[i].g = bpal[i * 4 + 1]; + pal->colors[i].b = bpal[i * 4 + 2]; + } +} + +void GfxScreen::setPalette(Palette *pal) { // just copy palette to system byte bpal[4 * 256]; // Get current palette, update it and put back diff --git a/engines/sci/graphics/screen.h b/engines/sci/graphics/screen.h index 900c338bb2..f1e3d028a8 100644 --- a/engines/sci/graphics/screen.h +++ b/engines/sci/graphics/screen.h @@ -106,7 +106,8 @@ public: void bitsGetRect(byte *memoryPtr, Common::Rect *destRect); void bitsRestore(byte *memoryPtr); - void setPalette(Palette*pal); + void getPalette(Palette *pal); + void setPalette(Palette *pal); void setVerticalShakePos(uint16 shakePos); -- cgit v1.2.3