diff options
author | Johannes Schickel | 2011-02-13 16:34:30 +0100 |
---|---|---|
committer | Johannes Schickel | 2011-02-14 17:08:32 +0100 |
commit | 68b17128c12b1e47ba56c014fa38de5632b0a810 (patch) | |
tree | 86a3c6c1a115f062455f59b59a2ac9c4a78697fe /engines | |
parent | 9216c7e3de6cca4b6e3857e6ba71b102e070705d (diff) | |
download | scummvm-rg350-68b17128c12b1e47ba56c014fa38de5632b0a810.tar.gz scummvm-rg350-68b17128c12b1e47ba56c014fa38de5632b0a810.tar.bz2 scummvm-rg350-68b17128c12b1e47ba56c014fa38de5632b0a810.zip |
LURE: Adapt to setPalette RGBA->RGB change.
This is currently done by converting the internal palette from RGBA(?) to RGB
when setPalette is called.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/lure/screen.cpp | 24 | ||||
-rw-r--r-- | engines/lure/screen.h | 2 |
2 files changed, 21 insertions, 5 deletions
diff --git a/engines/lure/screen.cpp b/engines/lure/screen.cpp index d00d969770..282e382bba 100644 --- a/engines/lure/screen.cpp +++ b/engines/lure/screen.cpp @@ -52,12 +52,26 @@ Screen::~Screen() { delete _palette; } +void Screen::setSystemPalette(Palette *p, uint16 start, uint16 num) { + byte pal[3 * 256]; + assert(start + num <= 256); + + const byte *rawData = p->data(); + for (uint i = 0; i < num; ++i) { + pal[i * 3 + 0] = rawData[(i + start) * 4 + 0]; + pal[i * 3 + 1] = rawData[(i + start) * 4 + 1]; + pal[i * 3 + 2] = rawData[(i + start) * 4 + 2]; + } + + _system.getPaletteManager()->setPalette(pal, start, num); +} + // setPaletteEmpty // Defaults the palette to an empty set void Screen::setPaletteEmpty(int numEntries) { Palette emptyPalette(numEntries, NULL, RGB64); - _system.getPaletteManager()->setPalette(emptyPalette.data(), 0, numEntries); + setSystemPalette(&emptyPalette, 0, numEntries); _palette->copyFrom(&emptyPalette); /* delete _palette; @@ -73,7 +87,7 @@ void Screen::setPaletteEmpty(int numEntries) { void Screen::setPalette(Palette *p) { _palette->copyFrom(p); - _system.getPaletteManager()->setPalette(_palette->data(), 0, GAME_COLOURS); + setSystemPalette(_palette, 0, GAME_COLOURS); _system.updateScreen(); } @@ -82,7 +96,7 @@ void Screen::setPalette(Palette *p) { void Screen::setPalette(Palette *p, uint16 start, uint16 num) { _palette->palette()->copyFrom(p->palette(), start * 4, start * 4, num * 4); - _system.getPaletteManager()->setPalette(_palette->data(), start, num); + setSystemPalette(_palette, start, num); _system.updateScreen(); } @@ -114,7 +128,7 @@ void Screen::paletteFadeIn(Palette *p) { } if (changed) { - _system.getPaletteManager()->setPalette(_palette->data(), 0, p->numEntries()); + setSystemPalette(_palette, 0, p->numEntries()); _system.updateScreen(); _system.delayMillis(20); while (events.pollEvent()) @@ -147,7 +161,7 @@ void Screen::paletteFadeOut(int numEntries) { } if (changed) { - _system.getPaletteManager()->setPalette(_palette->data(), 0, numEntries); + setSystemPalette(_palette, 0, numEntries); _system.updateScreen(); _system.delayMillis(20); while (events.pollEvent()) diff --git a/engines/lure/screen.h b/engines/lure/screen.h index 373683df2b..94bbab932e 100644 --- a/engines/lure/screen.h +++ b/engines/lure/screen.h @@ -42,6 +42,8 @@ private: Disk &_disk; Surface *_screen; Palette *_palette; + + void setSystemPalette(Palette *p, uint16 start, uint16 num); public: Screen(OSystem &system); ~Screen(); |