diff options
Diffstat (limited to 'engines/hugo/display.cpp')
-rw-r--r-- | engines/hugo/display.cpp | 43 |
1 files changed, 9 insertions, 34 deletions
diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp index da821c5d3a..0210eb8f04 100644 --- a/engines/hugo/display.cpp +++ b/engines/hugo/display.cpp @@ -130,26 +130,12 @@ viewdib_t &Screen::getGUIBuffer() { */ void Screen::createPal() { debugC(1, kDebugDisplay, "createPal"); - - byte pal[3 * 256]; - for (uint i = 0; i < _paletteSize; ++i) { - pal[3 * i + 0] = _mainPalette[4 * i + 0]; - pal[3 * i + 1] = _mainPalette[4 * i + 1]; - pal[3 * i + 2] = _mainPalette[4 * i + 2]; - } - - g_system->getPaletteManager()->setPalette(pal, 0, _paletteSize / 4); + g_system->getPaletteManager()->setPalette(_mainPalette, 0, _paletteSize / 3); } void Screen::setCursorPal() { - byte pal[3 * 256]; - for (uint i = 0; i < _paletteSize; ++i) { - pal[3 * i + 0] = _curPalette[4 * i + 0]; - pal[3 * i + 1] = _curPalette[4 * i + 1]; - pal[3 * i + 2] = _curPalette[4 * i + 2]; - } - - CursorMan.replaceCursorPalette(pal, 0, _paletteSize / 4); + debugC(1, kDebugDisplay, "setCursorPal"); + CursorMan.replaceCursorPalette(_curPalette, 0, _paletteSize / 3); } /** @@ -205,14 +191,11 @@ void Screen::displayRect(const int16 x, const int16 y, const int16 dx, const int void Screen::remapPal(const uint16 oldIndex, const uint16 newIndex) { debugC(1, kDebugDisplay, "Remap_pal(%d, %d)", oldIndex, newIndex); - byte pal[3]; + _curPalette[3 * oldIndex + 0] = _mainPalette[newIndex * 3 + 0]; + _curPalette[3 * oldIndex + 1] = _mainPalette[newIndex * 3 + 1]; + _curPalette[3 * oldIndex + 2] = _mainPalette[newIndex * 3 + 2]; - pal[0] = _curPalette[4 * oldIndex + 0] = _mainPalette[newIndex * 4 + 0]; - pal[1] = _curPalette[4 * oldIndex + 1] = _mainPalette[newIndex * 4 + 1]; - pal[2] = _curPalette[4 * oldIndex + 2] = _mainPalette[newIndex * 4 + 2]; - //pal[3] = _curPalette[4 * oldIndex + 3] = _mainPalette[newIndex * 4 + 3]; - - g_system->getPaletteManager()->setPalette(pal, oldIndex, 1); + g_system->getPaletteManager()->setPalette(_curPalette, oldIndex, 1); } /** @@ -231,17 +214,9 @@ void Screen::savePal(Common::WriteStream *f) const { void Screen::restorePal(Common::ReadStream *f) { debugC(1, kDebugDisplay, "restorePal()"); - byte pal[3]; - - for (int i = 0; i < _paletteSize; i++) + for (int i = 0; i < _paletteSize; i++) { _curPalette[i] = f->readByte(); - - for (int i = 0; i < _paletteSize / 4; i++) { - pal[0] = _curPalette[i * 4 + 0]; - pal[1] = _curPalette[i * 4 + 1]; - pal[2] = _curPalette[i * 4 + 2]; - //pal[3] = _curPalette[i * 4 + 3]; - g_system->getPaletteManager()->setPalette(pal, i, 1); + g_system->getPaletteManager()->setPalette(_curPalette, i, 1); } } |