From 9da52cb28280e0164db7073b0d3ea5abb4d20934 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 22 Jun 2009 02:35:04 +0000 Subject: Got rid of Screen::_currentPalette. svn-id: r41740 --- engines/kyra/gui_lok.cpp | 12 ++++----- engines/kyra/gui_lol.cpp | 4 +-- engines/kyra/kyra_hof.cpp | 8 +++--- engines/kyra/kyra_lok.cpp | 2 +- engines/kyra/lol.cpp | 26 +++++++++---------- engines/kyra/scene_lol.cpp | 36 +++++++++++++------------- engines/kyra/screen.cpp | 13 +++++----- engines/kyra/screen.h | 1 - engines/kyra/screen_lok.cpp | 8 +++--- engines/kyra/screen_lol.cpp | 2 +- engines/kyra/script_hof.cpp | 28 ++++++++++---------- engines/kyra/script_lol.cpp | 14 +++++----- engines/kyra/script_tim.cpp | 2 +- engines/kyra/seqplayer.cpp | 14 +++++----- engines/kyra/sequences_hof.cpp | 10 ++++---- engines/kyra/sequences_lok.cpp | 58 +++++++++++++++++++++--------------------- engines/kyra/sequences_lol.cpp | 2 +- engines/kyra/text_lok.cpp | 16 ++++++------ engines/kyra/vqa.cpp | 6 ++--- 19 files changed, 130 insertions(+), 132 deletions(-) (limited to 'engines/kyra') diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp index c3258b0882..255a5dcd74 100644 --- a/engines/kyra/gui_lok.cpp +++ b/engines/kyra/gui_lok.cpp @@ -1024,25 +1024,25 @@ void GUI_LoK::fadePalette() { static const int16 menuPalIndexes[] = {248, 249, 250, 251, 252, 253, 254, -1}; int index = 0; - memcpy(_screen->getPalette(2), _screen->_currentPalette, 768); + memcpy(_screen->getPalette(2), _screen->getPalette(0), 768); for (int i = 0; i < 768; i++) - _screen->_currentPalette[i] >>= 1; + _screen->getPalette(0)[i] >>= 1; while (menuPalIndexes[index] != -1) { - memcpy(&_screen->_currentPalette[menuPalIndexes[index]*3], &_screen->getPalette(2)[menuPalIndexes[index]*3], 3); + memcpy(&_screen->getPalette(0)[menuPalIndexes[index]*3], &_screen->getPalette(2)[menuPalIndexes[index]*3], 3); index++; } - _screen->fadePalette(_screen->_currentPalette, 2); + _screen->fadePalette(_screen->getPalette(0), 2); } void GUI_LoK::restorePalette() { if (_vm->gameFlags().platform == Common::kPlatformAmiga) return; - memcpy(_screen->_currentPalette, _screen->getPalette(2), 768); - _screen->fadePalette(_screen->_currentPalette, 2); + memcpy(_screen->getPalette(0), _screen->getPalette(2), 768); + _screen->fadePalette(_screen->getPalette(0), 2); } #pragma mark - diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp index a88310910f..5e03f3d9bb 100644 --- a/engines/kyra/gui_lol.cpp +++ b/engines/kyra/gui_lol.cpp @@ -1814,7 +1814,7 @@ int LoLEngine::clickedAutomap(Button *button) { displayAutomap(); gui_drawPlayField(); - setPaletteBrightness(_screen->_currentPalette, _brightness, _lampEffect); + setPaletteBrightness(_screen->getPalette(0), _brightness, _lampEffect); return 1; } @@ -1842,7 +1842,7 @@ int LoLEngine::clickedLamp(Button *button) { } if (_brightness) - setPaletteBrightness(_screen->_currentPalette, _brightness, _lampEffect); + setPaletteBrightness(_screen->getPalette(0), _brightness, _lampEffect); return 1; } diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp index 518755839b..6fafbbc224 100644 --- a/engines/kyra/kyra_hof.cpp +++ b/engines/kyra/kyra_hof.cpp @@ -415,7 +415,7 @@ void KyraEngine_HoF::startup() { setupLangButtonShapes(); loadInventoryShapes(); - _res->loadFileToBuf("PALETTE.COL", _screen->_currentPalette, 0x300); + _res->loadFileToBuf("PALETTE.COL", _screen->getPalette(0), 0x300); _screen->loadBitmap("_PLAYFLD.CPS", 3, 3, 0); _screen->copyPage(3, 0); _screen->showMouse(); @@ -919,9 +919,9 @@ void KyraEngine_HoF::showMessage(const char *string, int16 palIndex) { if (string) { if (palIndex != -1 || _fadeMessagePalette) { palIndex *= 3; - memcpy(_messagePal, _screen->_currentPalette + palIndex, 3); - memmove(_screen->_currentPalette + 765, _screen->_currentPalette + palIndex, 3); - _screen->setScreenPalette(_screen->_currentPalette); + memcpy(_messagePal, _screen->getPalette(0) + palIndex, 3); + memmove(_screen->getPalette(0) + 765, _screen->getPalette(0) + palIndex, 3); + _screen->setScreenPalette(_screen->getPalette(0)); } int x = _text->getCenterStringX(string, 0, 320); diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp index fcd35e7282..4d3b3e75c1 100644 --- a/engines/kyra/kyra_lok.cpp +++ b/engines/kyra/kyra_lok.cpp @@ -358,7 +358,7 @@ void KyraEngine_LoK::startup() { loadButtonShapes(); initMainButtonList(); loadMainScreen(); - _screen->loadPalette("PALETTE.COL", _screen->_currentPalette); + _screen->loadPalette("PALETTE.COL", _screen->getPalette(0)); // XXX _animator->initAnimStateList(); diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index f3635768ff..82c5e2c28c 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -778,16 +778,16 @@ int LoLEngine::mainMenu() { void LoLEngine::startup() { _screen->clearPage(0); - _screen->loadBitmap("PLAYFLD.CPS", 3, 3, _screen->_currentPalette); + _screen->loadBitmap("PLAYFLD.CPS", 3, 3, _screen->getPalette(0)); uint8 *tmpPal = new uint8[0x300]; - memcpy(tmpPal, _screen->_currentPalette, 0x300); - memset(_screen->_currentPalette, 0x3f, 0x180); - memcpy(_screen->_currentPalette + 3, tmpPal + 3, 3); - memset(_screen->_currentPalette + 0x240, 0x3f, 12); - _screen->generateOverlay(_screen->_currentPalette, _screen->_paletteOverlay1, 1, 96); - _screen->generateOverlay(_screen->_currentPalette, _screen->_paletteOverlay2, 144, 65); - memcpy(_screen->_currentPalette, tmpPal, 0x300); + memcpy(tmpPal, _screen->getPalette(0), 0x300); + memset(_screen->getPalette(0), 0x3f, 0x180); + memcpy(_screen->getPalette(0) + 3, tmpPal + 3, 3); + memset(_screen->getPalette(0) + 0x240, 0x3f, 12); + _screen->generateOverlay(_screen->getPalette(0), _screen->_paletteOverlay1, 1, 96); + _screen->generateOverlay(_screen->getPalette(0), _screen->_paletteOverlay2, 144, 65); + memcpy(_screen->getPalette(0), tmpPal, 0x300); delete[] tmpPal; memset(_screen->getPalette(1), 0, 0x300); @@ -1541,7 +1541,7 @@ void LoLEngine::restoreAfterSceneWindowDialogue(int redraw) { if (_screen->_fadeFlag != 2) _screen->fadeClearSceneWindow(10); gui_drawPlayField(); - setPaletteBrightness(_screen->_currentPalette, _brightness, _lampEffect); + setPaletteBrightness(_screen->getPalette(0), _brightness, _lampEffect); _screen->_fadeFlag = 0; } @@ -2189,7 +2189,7 @@ int LoLEngine::processMagicIce(int charNum, int spellLevel) { uint8 *swampCol = new uint8[768]; if (_currentLevel == 11 && !(_flagsTable[52] & 0x04)) { - uint8 *sc = _screen->_currentPalette; + uint8 *sc = _screen->getPalette(0); uint8 *dc = _screen->getPalette(2); for (int i = 1; i < 768; i++) SWAP(sc[i], dc[i]); @@ -2217,7 +2217,7 @@ int LoLEngine::processMagicIce(int charNum, int spellLevel) { generateBrightnessPalette(swampCol, swampCol, _brightness, _lampEffect); swampCol[0] = swampCol[1] = swampCol[2] = tpal[0] = tpal[1] = tpal[2] = 0; - generateBrightnessPalette(_screen->_currentPalette, s, _brightness, _lampEffect); + generateBrightnessPalette(_screen->getPalette(0), s, _brightness, _lampEffect); int sX = 112; int sY = 0; @@ -2306,7 +2306,7 @@ int LoLEngine::processMagicIce(int charNum, int spellLevel) { enableSysTimer(2); if (_currentLevel != 11) - generateBrightnessPalette(_screen->_currentPalette, swampCol, _brightness, _lampEffect); + generateBrightnessPalette(_screen->getPalette(0), swampCol, _brightness, _lampEffect); playSpellAnimation(0, 0, 0, 2, 0, 0, 0, tpal, swampCol, 40, 0); @@ -3660,7 +3660,7 @@ void LoLEngine::restoreSwampPalette() { return; uint8 *s = _screen->getPalette(2); - uint8 *d = _screen->_currentPalette; + uint8 *d = _screen->getPalette(0); uint8 *d2 = _screen->getPalette(1); for (int i = 1; i < 768; i++) diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index 42ac7ad7e5..28bd87ecc4 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -86,7 +86,7 @@ void LoLEngine::loadLevel(int index) { addLevelItems(); deleteMonstersFromBlock(_currentBlock); - _screen->generateGrayOverlay(_screen->_currentPalette, _screen->_grayOverlay, 32, 16, 0, 0, 128, true); + _screen->generateGrayOverlay(_screen->getPalette(0), _screen->_grayOverlay, 32, 16, 0, 0, 128, true); _sceneDefaultUpdate = 0; if (_screen->_fadeFlag == 3) @@ -94,7 +94,7 @@ void LoLEngine::loadLevel(int index) { gui_drawPlayField(); - setPaletteBrightness(_screen->_currentPalette, _brightness, _lampEffect); + setPaletteBrightness(_screen->getPalette(0), _brightness, _lampEffect); setMouseCursorToItemInHand(); snd_playTrack(_curMusicTheme); @@ -380,26 +380,26 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight if (_lastOverridePalFilePtr) { uint8 *tpal = _res->fileData(_lastOverridePalFilePtr, 0); - memcpy(_screen->_currentPalette, tpal, 384); + memcpy(_screen->getPalette(0), tpal, 384); delete[] tpal; } else { - memcpy(_screen->_currentPalette, v, 384); + memcpy(_screen->getPalette(0), v, 384); } v += 384; /*uint8 tmpPal = new uint8[384]; - memcpy(tmpPal, _screen->_currentPalette + 384, 384); - memset(_screen->_currentPalette + 384, 0xff, 384); - memcpy(_screen->_currentPalette + 384, tmpPal, 384);*/ + memcpy(tmpPal, _screen->getPalette(0) + 384, 384); + memset(_screen->getPalette(0) + 384, 0xff, 384); + memcpy(_screen->getPalette(0) + 384, tmpPal, 384);*/ if (_currentLevel == 11) { uint8 *swampPal = _res->fileData("SWAMPICE.COL", 0); memcpy(_screen->getPalette(2), swampPal, 384); - memcpy(_screen->getPalette(2) + 384, _screen->_currentPalette + 384, 384); + memcpy(_screen->getPalette(2) + 384, _screen->getPalette(0) + 384, 384); delete[] swampPal; if (_flagsTable[52] & 0x04) { - uint8 *pal0 = _screen->_currentPalette; + uint8 *pal0 = _screen->getPalette(0); uint8 *pal2 = _screen->getPalette(2); for (int i = 1; i < 768; i++) SWAP(pal0[i], pal2[i]); @@ -427,7 +427,7 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight for (int i = 0; i < 7; i++) { weight = 100 - (i * _lastSpecialColorWeight); weight = (weight > 0) ? (weight * 255) / 100 : 0; - _screen->generateLevelOverlay(_screen->_currentPalette, _screen->getLevelOverlay(i), _lastSpecialColor, weight); + _screen->generateLevelOverlay(_screen->getPalette(0), _screen->getLevelOverlay(i), _lastSpecialColor, weight); for (int ii = 0; ii < 128; ii++) { if (_screen->getLevelOverlay(i)[ii] == 255) @@ -442,7 +442,7 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight _screen->getLevelOverlay(7)[i] = i & 0xff; _loadSuppFilesFlag = 0; - generateBrightnessPalette(_screen->_currentPalette, _screen->getPalette(1), _brightness, _lampEffect); + generateBrightnessPalette(_screen->getPalette(0), _screen->getPalette(1), _brightness, _lampEffect); char tname[13]; snprintf(tname, sizeof(tname), "LEVEL%.02d.TLC", _currentLevel); @@ -548,14 +548,14 @@ void LoLEngine::updateLampStatus() { if (!_brightness || !_lampOilStatus) { newLampEffect = 8; if (newLampEffect != _lampEffect && _screen->_fadeFlag == 0) - setPaletteBrightness(_screen->_currentPalette, _brightness, newLampEffect); + setPaletteBrightness(_screen->getPalette(0), _brightness, newLampEffect); } else { tmpOilStatus = (_lampOilStatus < 100) ? _lampOilStatus : 100; newLampEffect = (3 - ((tmpOilStatus - 1) / 25)) << 1; if (_lampEffect == -1) { if (_screen->_fadeFlag == 0) - setPaletteBrightness(_screen->_currentPalette, _brightness, newLampEffect); + setPaletteBrightness(_screen->getPalette(0), _brightness, newLampEffect); _lampStatusTimer = _system->getMillis() + (10 + _rnd.getRandomNumberRng(1, 30)) * _tickLength; } else { if ((_lampEffect & 0xfe) == (newLampEffect & 0xfe)) { @@ -567,7 +567,7 @@ void LoLEngine::updateLampStatus() { } } else { if (_screen->_fadeFlag == 0) - setPaletteBrightness(_screen->_currentPalette, _lampEffect, newLampEffect); + setPaletteBrightness(_screen->getPalette(0), _lampEffect, newLampEffect); } } } @@ -1331,11 +1331,11 @@ void LoLEngine::processGasExplosion(int soundId) { p2[i * 3] = 0x3f; uint32 ctime = _system->getMillis(); - while (_screen->fadePaletteStep(_screen->_currentPalette, p2, _system->getMillis() - ctime, 10)) + while (_screen->fadePaletteStep(_screen->getPalette(0), p2, _system->getMillis() - ctime, 10)) updateInput(); ctime = _system->getMillis(); - while (_screen->fadePaletteStep(p2, _screen->_currentPalette, _system->getMillis() - ctime, 50)) + while (_screen->fadePaletteStep(p2, _screen->getPalette(0), _system->getMillis() - ctime, 50)) updateInput(); } @@ -1437,7 +1437,7 @@ void LoLEngine::prepareSpecialScene(int fieldType, int hasDialogue, int suspendG gui_disableControls(controlMode); if (fadeFlag) { - memcpy(_screen->getPalette(3) + 384, _screen->_currentPalette + 384, 384); + memcpy(_screen->getPalette(3) + 384, _screen->getPalette(0) + 384, 384); _screen->loadSpecialColors(_screen->getPalette(3)); _screen->fadePalette(_screen->getPalette(3), 10); _screen->_fadeFlag = 0; @@ -1495,7 +1495,7 @@ int LoLEngine::restoreAfterSpecialScene(int fadeFlag, int redrawPlayField, int r if (redrawPlayField) gui_drawPlayField(); - setPaletteBrightness(_screen->_currentPalette, _brightness, _lampEffect); + setPaletteBrightness(_screen->getPalette(0), _brightness, _lampEffect); } else { _currentControlMode = 0; diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 2442286bd2..fc530d684b 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -139,8 +139,7 @@ bool Screen::init() { } } - _currentPalette = _palettes[0]->getData(); - setScreenPalette(_currentPalette); + setScreenPalette(getPalette(0)); _curDim = 0; _charWidth = 0; @@ -491,7 +490,7 @@ void Screen::setPagePixel(int pageNum, int x, int y, uint8 color) { } void Screen::fadeFromBlack(int delay, const UpdateFunctor *upFunc) { - fadePalette(_currentPalette, delay, upFunc); + fadePalette(getPalette(0), delay, upFunc); } void Screen::fadeToBlack(int delay, const UpdateFunctor *upFunc) { @@ -590,10 +589,10 @@ int Screen::fadePalStep(const uint8 *palette, int diff) { } void Screen::setPaletteIndex(uint8 index, uint8 red, uint8 green, uint8 blue) { - _currentPalette[index * 3 + 0] = red; - _currentPalette[index * 3 + 1] = green; - _currentPalette[index * 3 + 2] = blue; - setScreenPalette(_currentPalette); + getPalette(0)[index * 3 + 0] = red; + getPalette(0)[index * 3 + 1] = green; + getPalette(0)[index * 3 + 2] = blue; + setScreenPalette(getPalette(0)); } void Screen::getRealPalette(int num, uint8 *dst) { diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index aee8e955c3..a7605037ca 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -305,7 +305,6 @@ public: int _charWidth; int _charOffset; int _curPage; - uint8 *_currentPalette; uint8 *_shapePages[2]; int _maskMinY, _maskMaxY; FontId _currentFont; diff --git a/engines/kyra/screen_lok.cpp b/engines/kyra/screen_lok.cpp index 6d97db2f28..7796b5d27c 100644 --- a/engines/kyra/screen_lok.cpp +++ b/engines/kyra/screen_lok.cpp @@ -80,13 +80,13 @@ const ScreenDim *Screen_LoK::getScreenDim(int dim) { void Screen_LoK::fadeSpecialPalette(int palIndex, int startIndex, int size, int fadeTime) { assert(_vm->palTable1()[palIndex]); - assert(_currentPalette); + assert(getPalette(0)); uint8 tempPal[768]; - memcpy(tempPal, _currentPalette, 768); + memcpy(tempPal, getPalette(0), 768); memcpy(&tempPal[startIndex*3], _vm->palTable1()[palIndex], size*3); fadePalette(tempPal, fadeTime*18); - memcpy(&_currentPalette[startIndex*3], &tempPal[startIndex*3], size*3); - setScreenPalette(_currentPalette); + memcpy(&getPalette(0)[startIndex*3], &tempPal[startIndex*3], size*3); + setScreenPalette(getPalette(0)); _system->updateScreen(); } diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index a7e3c3a1bb..8ff1437a46 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -284,7 +284,7 @@ void Screen_LoL::fadeClearSceneWindow(int delay) { uint8 *tpal = new uint8[768]; - memcpy(tpal, _currentPalette, 768); + memcpy(tpal, getPalette(0), 768); memset(tpal, 0, 384); loadSpecialColors(tpal); fadePalette(tpal, delay); diff --git a/engines/kyra/script_hof.cpp b/engines/kyra/script_hof.cpp index b2a581cece..bcdd5045a8 100644 --- a/engines/kyra/script_hof.cpp +++ b/engines/kyra/script_hof.cpp @@ -146,7 +146,7 @@ int KyraEngine_HoF::o2_meanWhileScene(EMCState *script) { const char *palfile = stackPosString(1); _screen->loadBitmap(cpsfile, 3, 3, 0); - memcpy(_screen->getPalette(2), _screen->_currentPalette, 768); + memcpy(_screen->getPalette(2), _screen->getPalette(0), 768); _screen->loadPalette(palfile, _screen->getPalette(2)); _screen->fillRect(0, 0, 319, 199, 207); _screen->setScreenPalette(_screen->getPalette(2)); @@ -1125,25 +1125,25 @@ int KyraEngine_HoF::o2_resetInputColorCode(EMCState *script) { int KyraEngine_HoF::o2_mushroomEffect(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_mushroomEffect(%p)", (const void *)script); - memcpy(_screen->getPalette(2), _screen->_currentPalette, 768); + memcpy(_screen->getPalette(2), _screen->getPalette(0), 768); for (int i = 1; i < 768; i += 3) - _screen->_currentPalette[i] = 0; + _screen->getPalette(0)[i] = 0; snd_playSoundEffect(106); - _screen->fadePalette(_screen->_currentPalette, 90, &_updateFunctor); - memcpy(_screen->_currentPalette, _screen->getPalette(2), 768); + _screen->fadePalette(_screen->getPalette(0), 90, &_updateFunctor); + memcpy(_screen->getPalette(0), _screen->getPalette(2), 768); for (int i = 0; i < 768; i += 3) { - _screen->_currentPalette[i] = _screen->_currentPalette[i + 1] = 0; - _screen->_currentPalette[i + 2] += (((int8)_screen->_currentPalette[i + 2]) >> 1); - if (_screen->_currentPalette[i + 2] > 63) - _screen->_currentPalette[i + 2] = 63; + _screen->getPalette(0)[i] = _screen->getPalette(0)[i + 1] = 0; + _screen->getPalette(0)[i + 2] += (((int8)_screen->getPalette(0)[i + 2]) >> 1); + if (_screen->getPalette(0)[i + 2] > 63) + _screen->getPalette(0)[i + 2] = 63; } snd_playSoundEffect(106); - _screen->fadePalette(_screen->_currentPalette, 90, &_updateFunctor); + _screen->fadePalette(_screen->getPalette(0), 90, &_updateFunctor); - memcpy(_screen->_currentPalette, _screen->getPalette(2), 768); - _screen->fadePalette(_screen->_currentPalette, 30, &_updateFunctor); + memcpy(_screen->getPalette(0), _screen->getPalette(2), 768); + _screen->fadePalette(_screen->getPalette(0), 30, &_updateFunctor); return 0; } @@ -1396,7 +1396,7 @@ int KyraEngine_HoF::o2_demoFinale(EMCState *script) { assert(strings); _screen->clearPage(0); - _screen->loadPalette("THANKS.COL", _screen->_currentPalette); + _screen->loadPalette("THANKS.COL", _screen->getPalette(0)); _screen->loadBitmap("THANKS.CPS", 3, 3, 0); _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0); @@ -1406,7 +1406,7 @@ int KyraEngine_HoF::o2_demoFinale(EMCState *script) { for (int i = 0; i < 6; i++) _text->printText(strings[i], _text->getCenterStringX(strings[i], 1, 319), y + i * 10, 255, 207, 0); - _screen->setScreenPalette(_screen->_currentPalette); + _screen->setScreenPalette(_screen->getPalette(0)); _screen->updateScreen(); _eventList.clear(); diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index ad1041e7cf..b2cf152270 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -864,7 +864,7 @@ int LoLEngine::olol_fadeClearSceneWindow(EMCState *script) { int LoLEngine::olol_fadeSequencePalette(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_fadeSequencePalette(%p)", (const void *)script); - memcpy(_screen->getPalette(3) + 0x180, _screen->_currentPalette + 0x180, 0x180); + memcpy(_screen->getPalette(3) + 0x180, _screen->getPalette(0) + 0x180, 0x180); _screen->loadSpecialColors(_screen->getPalette(3)); _screen->fadePalette(_screen->getPalette(3), 10); _screen->_fadeFlag = 0; @@ -876,7 +876,7 @@ int LoLEngine::olol_redrawPlayfield(EMCState *script) { if (_screen->_fadeFlag != 2) _screen->fadeClearSceneWindow(10); gui_drawPlayField(); - setPaletteBrightness(_screen->_currentPalette, _brightness, _lampEffect); + setPaletteBrightness(_screen->getPalette(0), _brightness, _lampEffect); _screen->_fadeFlag = 0; return 1; } @@ -1428,7 +1428,7 @@ int LoLEngine::olol_setPaletteBrightness(EMCState *script) { uint16 old = _brightness; _brightness = stackPos(0); if (stackPos(1) == 1) - setPaletteBrightness(_screen->_currentPalette, stackPos(0), _lampEffect); + setPaletteBrightness(_screen->getPalette(0), stackPos(0), _lampEffect); return old; } @@ -2002,8 +2002,8 @@ int LoLEngine::olol_drinkBezelCup(EMCState *script) { int LoLEngine::olol_restoreFadePalette(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_restoreFadePalette(%p)", (const void *)script); - memcpy(_screen->_currentPalette, _screen->getPalette(1), 384); - _screen->fadePalette(_screen->_currentPalette, 10); + memcpy(_screen->getPalette(0), _screen->getPalette(1), 384); + _screen->fadePalette(_screen->getPalette(0), 10); _screen->_fadeFlag = 0; return 1; } @@ -2390,7 +2390,7 @@ int LoLEngine::tlol_fadeClearWindow(const TIM *tim, const uint16 *param) { case 1: tmp = _screen->getPalette(3); - memcpy(tmp + 0x180, _screen->_currentPalette + 0x180, 0x180); + memcpy(tmp + 0x180, _screen->getPalette(0) + 0x180, 0x180); _screen->loadSpecialColors(tmp); _screen->fadePalette(tmp, 10); _screen->_fadeFlag = 0; @@ -2411,7 +2411,7 @@ int LoLEngine::tlol_fadeClearWindow(const TIM *tim, const uint16 *param) { if (_screen->_fadeFlag != 2) _screen->fadeClearSceneWindow(10); gui_drawPlayField(); - setPaletteBrightness(_screen->_currentPalette, _brightness, _lampEffect); + setPaletteBrightness(_screen->getPalette(0), _brightness, _lampEffect); _screen->_fadeFlag = 0; break; diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp index fc80e39197..1d3e1e0d32 100644 --- a/engines/kyra/script_tim.cpp +++ b/engines/kyra/script_tim.cpp @@ -953,7 +953,7 @@ TIMInterpreter::Animation *TIMInterpreter_LoL::initAnimStruct(int index, const c if (wsaFlags & 1) { if (_screen->_fadeFlag != 1) _screen->fadeClearSceneWindow(10); - memcpy(_screen->getPalette(3) + 384, _screen->_currentPalette + 384, 384); + memcpy(_screen->getPalette(3) + 384, _screen->getPalette(0) + 384, 384); } else if (wsaFlags & 2) { _screen->fadeToBlack(10); } diff --git a/engines/kyra/seqplayer.cpp b/engines/kyra/seqplayer.cpp index 713a2251b0..214acb6240 100644 --- a/engines/kyra/seqplayer.cpp +++ b/engines/kyra/seqplayer.cpp @@ -92,7 +92,7 @@ uint8 *SeqPlayer::setPanPages(int pageNum, int shape) { } void SeqPlayer::makeHandShapes() { - _screen->loadBitmap("WRITING.CPS", 3, 3, _screen->_currentPalette); + _screen->loadBitmap("WRITING.CPS", 3, 3, _screen->getPalette(0)); if (_vm->gameFlags().platform == Common::kPlatformMacintosh || _vm->gameFlags().platform == Common::kPlatformAmiga) { freeHandShapes(); @@ -241,25 +241,25 @@ void SeqPlayer::s1_loadPalette() { if (_vm->gameFlags().platform == Common::kPlatformAmiga) { if (!colNum) - memcpy(_screen->_currentPalette, _screen->_currentPalette + 576, 3*32); + memcpy(_screen->getPalette(0), _screen->getPalette(0) + 576, 3*32); else if (colNum == 3) - memcpy(_screen->_currentPalette, _screen->_currentPalette + 672, 3*32); + memcpy(_screen->getPalette(0), _screen->getPalette(0) + 672, 3*32); else if (colNum == 4) - memcpy(_screen->_currentPalette, _screen->_currentPalette + 288, 3*32); + memcpy(_screen->getPalette(0), _screen->getPalette(0) + 288, 3*32); - _screen->setScreenPalette(_screen->_currentPalette); + _screen->setScreenPalette(_screen->getPalette(0)); } else { uint32 fileSize; uint8 *srcData; srcData = _res->fileData(_vm->seqCOLTable()[colNum], &fileSize); - memcpy(_screen->_currentPalette, srcData, fileSize); + memcpy(_screen->getPalette(0), srcData, fileSize); delete[] srcData; } } void SeqPlayer::s1_loadBitmap() { uint8 cpsNum = *_seqData++; - _screen->loadBitmap(_vm->seqCPSTable()[cpsNum], 3, 3, _screen->_currentPalette); + _screen->loadBitmap(_vm->seqCPSTable()[cpsNum], 3, 3, _screen->getPalette(0)); } void SeqPlayer::s1_fadeToBlack() { diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp index bc5bb7f307..2b5f3df89a 100644 --- a/engines/kyra/sequences_hof.cpp +++ b/engines/kyra/sequences_hof.cpp @@ -1501,7 +1501,7 @@ void KyraEngine_HoF::seq_finaleActorScreen() { static const uint8 colormap[] = {0, 0, 102, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; static const ScreenDim d = { 0x00, 0x0C, 0x28, 0xB4, 0xFF, 0x00, 0x00, 0x00 }; - _screen->loadBitmap("finale.cps", 3, 3, _screen->_currentPalette); + _screen->loadBitmap("finale.cps", 3, 3, _screen->getPalette(0)); _screen->setFont(Screen::FID_GOLDFONT_FNT); int talkieCreditsSize, talkieCreditsSpecialSize; @@ -2663,9 +2663,9 @@ void KyraEngine_HoF::seq_displayScrollText(uint8 *data, const ScreenDim *d, int if (palCycle) { for (int col = 133; col > 112; col--) - memcpy(_screen->_currentPalette + (col * 3), _screen->_currentPalette + ((col - 1) * 3), 3); - memcpy(_screen->_currentPalette + 336, _screen->_currentPalette + 399, 3); - _screen->setScreenPalette(_screen->_currentPalette); + memcpy(_screen->getPalette(0) + (col * 3), _screen->getPalette(0) + ((col - 1) * 3), 3); + memcpy(_screen->getPalette(0) + 336, _screen->getPalette(0) + 399, 3); + _screen->setScreenPalette(_screen->getPalette(0)); } delayUntil(_seqSubFrameEndTimeInternal); @@ -2725,7 +2725,7 @@ void KyraEngine_HoF::seq_showStarcraftLogo() { assert(ci); _screen->clearPage(2); _res->loadPakFile("INTROGEN.PAK"); - int endframe = ci->open("ci.wsa", 0, _screen->_currentPalette); + int endframe = ci->open("ci.wsa", 0, _screen->getPalette(0)); _res->unloadPakFile("INTROGEN.PAK"); if (!ci->opened()) { delete ci; diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp index a380849fe0..10591e0912 100644 --- a/engines/kyra/sequences_lok.cpp +++ b/engines/kyra/sequences_lok.cpp @@ -42,7 +42,7 @@ namespace Kyra { void KyraEngine_LoK::seq_demo() { snd_playTheme(0, 2); - _screen->loadBitmap("START.CPS", 7, 7, _screen->_currentPalette); + _screen->loadBitmap("START.CPS", 7, 7, _screen->getPalette(0)); _screen->copyRegion(0, 0, 0, 0, 320, 200, 6, 0, Screen::CR_NO_P_CHECK); _screen->updateScreen(); _screen->fadeFromBlack(); @@ -51,7 +51,7 @@ void KyraEngine_LoK::seq_demo() { _screen->clearPage(0); _screen->loadBitmap("TOP.CPS", 7, 7, NULL); - _screen->loadBitmap("BOTTOM.CPS", 5, 5, _screen->_currentPalette); + _screen->loadBitmap("BOTTOM.CPS", 5, 5, _screen->getPalette(0)); _screen->copyRegion(0, 91, 0, 8, 320, 103, 6, 0); _screen->copyRegion(0, 0, 0, 111, 320, 64, 6, 0); _screen->updateScreen(); @@ -77,7 +77,7 @@ void KyraEngine_LoK::seq_demo() { _seq->playSequence(_seq_Demo4, true); _screen->clearPage(0); - _screen->loadBitmap("FINAL.CPS", 7, 7, _screen->_currentPalette); + _screen->loadBitmap("FINAL.CPS", 7, 7, _screen->getPalette(0)); _screen->_curPage = 0; _screen->copyRegion(0, 0, 0, 0, 320, 200, 6, 0); _screen->updateScreen(); @@ -128,7 +128,7 @@ void KyraEngine_LoK::seq_intro() { void KyraEngine_LoK::seq_introLogos() { if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) { - _screen->loadBitmap("LOGO.CPS", 3, 3, _screen->_currentPalette); + _screen->loadBitmap("LOGO.CPS", 3, 3, _screen->getPalette(0)); _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0); _screen->updateScreen(); _screen->fadeFromBlack(); @@ -141,7 +141,7 @@ void KyraEngine_LoK::seq_introLogos() { _screen->clearPage(0); if (_flags.platform == Common::kPlatformAmiga) { - _screen->loadPalette("INTRO.PAL", _screen->_currentPalette); + _screen->loadPalette("INTRO.PAL", _screen->getPalette(0)); _screen->loadBitmap("BOTTOM.CPS", 3, 5, 0); _screen->loadBitmap("TOP.CPS", 3, 3, 0); _screen->copyRegion(0, 0, 0, 111, 320, 64, 2, 0); @@ -149,7 +149,7 @@ void KyraEngine_LoK::seq_introLogos() { _screen->copyRegion(0, 0, 0, 0, 320, 190, 0, 2); } else { _screen->loadBitmap("TOP.CPS", 7, 7, 0); - _screen->loadBitmap("BOTTOM.CPS", 5, 5, _screen->_currentPalette); + _screen->loadBitmap("BOTTOM.CPS", 5, 5, _screen->getPalette(0)); _screen->copyRegion(0, 91, 0, 8, 320, 103, 6, 0); _screen->copyRegion(0, 0, 0, 111, 320, 64, 6, 0); } @@ -166,8 +166,8 @@ void KyraEngine_LoK::seq_introLogos() { delay(60 * _tickLength); if (_flags.platform == Common::kPlatformAmiga) { - memcpy(_screen->_currentPalette, _screen->_currentPalette + 3*32, 3*32); - _screen->setScreenPalette(_screen->_currentPalette); + memcpy(_screen->getPalette(0), _screen->getPalette(0) + 3*32, 3*32); + _screen->setScreenPalette(_screen->getPalette(0)); } if ((_seq->playSequence(_seq_KyrandiaLogo, skipFlag()) && !seq_skipSequence()) || shouldQuit()) { @@ -181,7 +181,7 @@ void KyraEngine_LoK::seq_introLogos() { return; if (_flags.platform == Common::kPlatformAmiga) { - memcpy(_screen->_currentPalette, _screen->_currentPalette + 3*64, 3*32); + memcpy(_screen->getPalette(0), _screen->getPalette(0) + 3*64, 3*32); _screen->fadeToBlack(); _screen->copyRegion(0, 0, 0, 0, 320, 200, 4, 0); _screen->fadeFromBlack(); @@ -236,22 +236,22 @@ void KyraEngine_LoK::seq_introStory() { return; if (_flags.lang == Common::EN_ANY && !_flags.isTalkie && (_flags.platform == Common::kPlatformPC || _flags.platform == Common::kPlatformAmiga)) - _screen->loadBitmap("TEXT.CPS", 3, 3, _screen->_currentPalette); + _screen->loadBitmap("TEXT.CPS", 3, 3, _screen->getPalette(0)); else if (_flags.lang == Common::EN_ANY || _flags.lang == Common::JA_JPN) - _screen->loadBitmap("TEXT_ENG.CPS", 3, 3, _screen->_currentPalette); + _screen->loadBitmap("TEXT_ENG.CPS", 3, 3, _screen->getPalette(0)); else if (_flags.lang == Common::DE_DEU) - _screen->loadBitmap("TEXT_GER.CPS", 3, 3, _screen->_currentPalette); + _screen->loadBitmap("TEXT_GER.CPS", 3, 3, _screen->getPalette(0)); else if (_flags.lang == Common::FR_FRA) - _screen->loadBitmap("TEXT_FRE.CPS", 3, 3, _screen->_currentPalette); + _screen->loadBitmap("TEXT_FRE.CPS", 3, 3, _screen->getPalette(0)); else if (_flags.lang == Common::ES_ESP) - _screen->loadBitmap("TEXT_SPA.CPS", 3, 3, _screen->_currentPalette); + _screen->loadBitmap("TEXT_SPA.CPS", 3, 3, _screen->getPalette(0)); else if (_flags.lang == Common::IT_ITA && !_flags.isTalkie) - _screen->loadBitmap("TEXT_ITA.CPS", 3, 3, _screen->_currentPalette); + _screen->loadBitmap("TEXT_ITA.CPS", 3, 3, _screen->getPalette(0)); else if (_flags.lang == Common::IT_ITA && _flags.isTalkie) - _screen->loadBitmap("TEXT_ENG.CPS", 3, 3, _screen->_currentPalette); + _screen->loadBitmap("TEXT_ENG.CPS", 3, 3, _screen->getPalette(0)); else warning("no story graphics file found"); - _screen->setScreenPalette(_screen->_currentPalette); + _screen->setScreenPalette(_screen->getPalette(0)); _screen->copyRegion(0, 0, 0, 0, 320, 200, 3, 0); if (_flags.lang == Common::JA_JPN) { @@ -570,11 +570,11 @@ void KyraEngine_LoK::seq_winterScroll1() { _animator->sprites()[i].active = 0; } uint8 tmpPal[768]; - memcpy(tmpPal, _screen->_currentPalette, 768); + memcpy(tmpPal, _screen->getPalette(0), 768); memcpy(&tmpPal[684], palTable2()[0], 60); _screen->fadePalette(tmpPal, 72); - memcpy(&_screen->_currentPalette[684], palTable2()[0], 60); - _screen->setScreenPalette(_screen->_currentPalette); + memcpy(&_screen->getPalette(0)[684], palTable2()[0], 60); + _screen->setScreenPalette(_screen->getPalette(0)); setGameFlag(0xB3); } else { delayWithTicks(120); @@ -950,8 +950,8 @@ int KyraEngine_LoK::seq_playEnd() { _screen->hideMouse(); _screen->fadeSpecialPalette(32, 228, 20, 60); delay(60 * _tickLength); - _screen->loadBitmap("GEMHEAL.CPS", 3, 3, _screen->_currentPalette); - _screen->setScreenPalette(_screen->_currentPalette); + _screen->loadBitmap("GEMHEAL.CPS", 3, 3, _screen->getPalette(0)); + _screen->setScreenPalette(_screen->getPalette(0)); _screen->shuffleScreen(8, 8, 304, 128, 2, 0, 1, 0); uint32 nextTime = _system->getMillis() + 120 * _tickLength; _finalA = new WSAMovie_v1(this); @@ -1004,7 +1004,7 @@ void KyraEngine_LoK::seq_playEnding() { _screen->hideMouse(); _screen->_curPage = 0; _screen->fadeToBlack(); - _screen->loadBitmap("REUNION.CPS", 3, 3, _screen->_currentPalette); + _screen->loadBitmap("REUNION.CPS", 3, 3, _screen->getPalette(0)); _screen->copyRegion(8, 8, 8, 8, 304, 128, 2, 0); _screen->_curPage = 0; // XXX @@ -1045,7 +1045,7 @@ void KyraEngine_LoK::seq_playCredits() { } else _screen->setFont(Screen::FID_8_FNT); - _screen->loadBitmap("CHALET.CPS", 4, 4, _screen->_currentPalette); + _screen->loadBitmap("CHALET.CPS", 4, 4, _screen->getPalette(0)); _screen->setCurPage(0); _screen->clearCurPage(); @@ -1126,7 +1126,7 @@ void KyraEngine_LoK::seq_playCredits() { memset(_screen->getPalette(2), 0, sizeof(uint8)*768); _screen->setScreenPalette(_screen->getPalette(2)); _screen->copyRegion(8, 32, 8, 32, 312, 128, 4, 0, Screen::CR_NO_P_CHECK); - _screen->fadePalette(_screen->_currentPalette, 0x5A); + _screen->fadePalette(_screen->getPalette(0), 0x5A); Common::Event event; bool finished = false; @@ -1679,11 +1679,11 @@ void KyraEngine_LoK::updateKyragemFading() { _kyragemFadingState.timerCount = _system->getMillis() + 4 * _tickLength; int palPos = 684; for (int i = 0; i < 20; ++i) { - _screen->_currentPalette[palPos++] = kyraGemPalette[i + _kyragemFadingState.rOffset]; - _screen->_currentPalette[palPos++] = kyraGemPalette[i + _kyragemFadingState.gOffset]; - _screen->_currentPalette[palPos++] = kyraGemPalette[i + _kyragemFadingState.bOffset]; + _screen->getPalette(0)[palPos++] = kyraGemPalette[i + _kyragemFadingState.rOffset]; + _screen->getPalette(0)[palPos++] = kyraGemPalette[i + _kyragemFadingState.gOffset]; + _screen->getPalette(0)[palPos++] = kyraGemPalette[i + _kyragemFadingState.bOffset]; } - _screen->setScreenPalette(_screen->_currentPalette); + _screen->setScreenPalette(_screen->getPalette(0)); _animator->_updateScreen = true; switch (_kyragemFadingState.nextOperation) { case 0: diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp index b1bde04773..c288113496 100644 --- a/engines/kyra/sequences_lol.cpp +++ b/engines/kyra/sequences_lol.cpp @@ -650,7 +650,7 @@ void LoLEngine::showStarcraftLogo() { _screen->clearPage(0); _screen->clearPage(2); - int endframe = ci->open("ci01.wsa", 0, _screen->_currentPalette); + int endframe = ci->open("ci01.wsa", 0, _screen->getPalette(0)); if (!ci->opened()) { delete ci; return; diff --git a/engines/kyra/text_lok.cpp b/engines/kyra/text_lok.cpp index a61bd1950a..baae4547e5 100644 --- a/engines/kyra/text_lok.cpp +++ b/engines/kyra/text_lok.cpp @@ -329,11 +329,11 @@ void KyraEngine_LoK::drawSentenceCommand(const char *sentence, int color) { _screen->fillRect(8, 143, 311, 152, 12); if (_startSentencePalIndex != color || _fadeText != false) { - _currSentenceColor[0] = _screen->_currentPalette[765] = _screen->_currentPalette[color*3]; - _currSentenceColor[1] = _screen->_currentPalette[766] = _screen->_currentPalette[color*3+1]; - _currSentenceColor[2] = _screen->_currentPalette[767] = _screen->_currentPalette[color*3+2]; + _currSentenceColor[0] = _screen->getPalette(0)[765] = _screen->getPalette(0)[color*3]; + _currSentenceColor[1] = _screen->getPalette(0)[766] = _screen->getPalette(0)[color*3+1]; + _currSentenceColor[2] = _screen->getPalette(0)[767] = _screen->getPalette(0)[color*3+2]; - _screen->setScreenPalette(_screen->_currentPalette); + _screen->setScreenPalette(_screen->getPalette(0)); _startSentencePalIndex = 0; } @@ -368,10 +368,10 @@ void KyraEngine_LoK::updateTextFade() { } } - _screen->_currentPalette[765] = _currSentenceColor[0]; - _screen->_currentPalette[766] = _currSentenceColor[1]; - _screen->_currentPalette[767] = _currSentenceColor[2]; - _screen->setScreenPalette(_screen->_currentPalette); + _screen->getPalette(0)[765] = _currSentenceColor[0]; + _screen->getPalette(0)[766] = _currSentenceColor[1]; + _screen->getPalette(0)[767] = _currSentenceColor[2]; + _screen->setScreenPalette(_screen->getPalette(0)); if (finished) { _fadeText = false; diff --git a/engines/kyra/vqa.cpp b/engines/kyra/vqa.cpp index 2604c5b484..5e0b22a715 100644 --- a/engines/kyra/vqa.cpp +++ b/engines/kyra/vqa.cpp @@ -474,13 +474,13 @@ void VQAMovie::displayFrame(uint frameNum) { case MKID_BE('CPL0'): // Palette assert(size <= 3 * 256); - _file->read(_vm->screen()->_currentPalette, size); + _file->read(_vm->screen()->getPalette(0), size); break; case MKID_BE('CPLZ'): // Palette inbuf = (byte *)allocBuffer(0, size); _file->read(inbuf, size); - Screen::decodeFrame4(inbuf, _vm->screen()->_currentPalette, 768); + Screen::decodeFrame4(inbuf, _vm->screen()->getPalette(0), 768); break; case MKID_BE('VPT0'): // Frame data @@ -521,7 +521,7 @@ void VQAMovie::displayFrame(uint frameNum) { // The frame has been decoded if (_frameInfo[frameNum] & 0x80000000) { - _vm->screen()->setScreenPalette(_vm->screen()->_currentPalette); + _vm->screen()->setScreenPalette(_vm->screen()->getPalette(0)); } int blockPitch = _header.width / _header.blockW; -- cgit v1.2.3