diff options
author | Johannes Schickel | 2009-08-10 01:32:39 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-08-10 01:32:39 +0000 |
commit | 48e86a9e22859aaa7c31ec3a3f2e17670a991c6a (patch) | |
tree | 9c59db3471286b03e89228887f3ecdd1758d62e7 /engines/kyra | |
parent | f16ca2ee19f3c5cf02cdd48782e900899c1df8fc (diff) | |
download | scummvm-rg350-48e86a9e22859aaa7c31ec3a3f2e17670a991c6a.tar.gz scummvm-rg350-48e86a9e22859aaa7c31ec3a3f2e17670a991c6a.tar.bz2 scummvm-rg350-48e86a9e22859aaa7c31ec3a3f2e17670a991c6a.zip |
Initial support for correct colors in the interface of Kyra1 AMIGA.
svn-id: r43192
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/screen.cpp | 46 | ||||
-rw-r--r-- | engines/kyra/screen.h | 7 | ||||
-rw-r--r-- | engines/kyra/staticres.cpp | 9 |
3 files changed, 58 insertions, 4 deletions
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 11467231ad..7547643071 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -113,6 +113,8 @@ bool Screen::init() { const int paletteCount = (_vm->gameFlags().platform == Common::kPlatformAmiga) ? 12 : 4; const int numColors = _use16ColorMode ? 16 : ((_vm->gameFlags().platform == Common::kPlatformAmiga) ? 32 : 256); + _interfacePaletteEnabled = false; + _screenPalette = new Palette(numColors); assert(_screenPalette); @@ -217,8 +219,23 @@ void Screen::updateScreen() { } void Screen::updateDirtyRects() { - if (_forceFullUpdate) { - _system->copyRectToScreen(getCPagePtr(0), SCREEN_W, 0, 0, SCREEN_W, SCREEN_H); + // TODO: Enable dirty rect handling for the AMIGA version + if (_forceFullUpdate || _vm->gameFlags().platform == Common::kPlatformAmiga) { + if (_interfacePaletteEnabled) { + _system->copyRectToScreen(getCPagePtr(0), SCREEN_W, 0, 0, SCREEN_W, 136); + + // Page 8 is not used by Kyra 1 AMIGA, thus we can use it to adjust the colors + copyRegion(0, 136, 0, 0, 320, 64, 0, 8, CR_NO_P_CHECK); + + uint8 *dst = getPagePtr(8); + for (int y = 0; y < 64; ++y) + for (int x = 0; x < 320; ++x) + *dst++ += 32; + + _system->copyRectToScreen(getCPagePtr(8), SCREEN_W, 0, 136, SCREEN_W, 64); + } else { + _system->copyRectToScreen(getCPagePtr(0), SCREEN_W, 0, 0, SCREEN_W, SCREEN_H); + } } else { const byte *page0 = getCPagePtr(0); Common::List<Common::Rect>::iterator it; @@ -620,6 +637,31 @@ void Screen::setScreenPalette(const Palette &pal) { _system->setPalette(screenPal, 0, pal.getNumColors()); } +void Screen::enableInterfacePalette(bool e) { + _interfacePaletteEnabled = e; + + _forceFullUpdate = true; + _dirtyRects.clear(); + + updateScreen(); +} + +void Screen::setInterfacePalette(const Palette &pal) { + if (_vm->gameFlags().platform != Common::kPlatformAmiga) + return; + + uint8 screenPal[256 * 4]; + + for (int i = 0; i < pal.getNumColors(); ++i) { + screenPal[4 * i + 0] = (pal[i * 3 + 0] * 0xFF) / 0x3F; + screenPal[4 * i + 1] = (pal[i * 3 + 1] * 0xFF) / 0x3F; + screenPal[4 * i + 2] = (pal[i * 3 + 2] * 0xFF) / 0x3F; + screenPal[4 * i + 3] = 0; + } + + _system->setPalette(screenPal, 32, pal.getNumColors()); +} + void Screen::copyToPage0(int y, int h, uint8 page, uint8 *seqBuf) { assert(y + h <= SCREEN_H); const uint8 *src = getPagePtr(page) + y * SCREEN_W; diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index f947d2b9a9..07b4562ffa 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -355,6 +355,10 @@ public: void setPaletteIndex(uint8 index, uint8 red, uint8 green, uint8 blue); virtual void setScreenPalette(const Palette &pal); + // AMIGA version only + void enableInterfacePalette(bool e); + void setInterfacePalette(const Palette &pal); + void getRealPalette(int num, uint8 *dst); Palette &getPalette(int num); void copyPalette(const int dst, const int src); @@ -568,6 +572,9 @@ protected: int _drawShapeVar4; int _drawShapeVar5; + // AMIGA version + bool _interfacePaletteEnabled; + // debug bool _debugEnabled; }; diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 86680a7b76..a65c99434b 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -1598,10 +1598,15 @@ void KyraEngine_LoK::loadMainScreen(int page) { else warning("no main graphics file found"); - if (_flags.platform == Common::kPlatformAmiga) + _screen->copyRegion(0, 0, 0, 0, 320, 200, page, 0, Screen::CR_NO_P_CHECK); + + if (_flags.platform == Common::kPlatformAmiga) { _screen->copyPalette(1, 0); + _screen->setInterfacePalette(_screen->getPalette(1)); - _screen->copyRegion(0, 0, 0, 0, 320, 200, page, 0); + // TODO: Move this to a better place + _screen->enableInterfacePalette(true); + } } void KyraEngine_HoF::initStaticResource() { |