aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2009-06-22 02:36:54 +0000
committerJohannes Schickel2009-06-22 02:36:54 +0000
commit73ea378dee4e7ec31c7a898e7fcc3a65a9eb6cc1 (patch)
tree6d00cd2c533aeefb72d874f59aa01b9d0e918db5
parent4bb392b593c492299dd916784548dc56bc0b25cb (diff)
downloadscummvm-rg350-73ea378dee4e7ec31c7a898e7fcc3a65a9eb6cc1.tar.gz
scummvm-rg350-73ea378dee4e7ec31c7a898e7fcc3a65a9eb6cc1.tar.bz2
scummvm-rg350-73ea378dee4e7ec31c7a898e7fcc3a65a9eb6cc1.zip
- Changed the following Screen functions to take a reference to a Palette object:
-> setScreenPalette -> fadePalette -> getFadeParams -> fadePalStep - Fixed initialization of 256 color palettes svn-id: r41743
-rw-r--r--engines/kyra/debugger.cpp18
-rw-r--r--engines/kyra/gui_hof.cpp10
-rw-r--r--engines/kyra/gui_lok.cpp4
-rw-r--r--engines/kyra/gui_mr.cpp4
-rw-r--r--engines/kyra/kyra_hof.cpp16
-rw-r--r--engines/kyra/kyra_mr.cpp13
-rw-r--r--engines/kyra/lol.cpp15
-rw-r--r--engines/kyra/scene_hof.cpp6
-rw-r--r--engines/kyra/scene_lok.cpp8
-rw-r--r--engines/kyra/scene_lol.cpp4
-rw-r--r--engines/kyra/scene_mr.cpp4
-rw-r--r--engines/kyra/screen.cpp84
-rw-r--r--engines/kyra/screen.h10
-rw-r--r--engines/kyra/screen_lok.cpp8
-rw-r--r--engines/kyra/screen_lol.cpp27
-rw-r--r--engines/kyra/screen_v2.cpp7
-rw-r--r--engines/kyra/screen_v2.h2
-rw-r--r--engines/kyra/script_hof.cpp18
-rw-r--r--engines/kyra/script_lok.cpp19
-rw-r--r--engines/kyra/script_lol.cpp56
-rw-r--r--engines/kyra/script_tim.cpp14
-rw-r--r--engines/kyra/seqplayer.cpp2
-rw-r--r--engines/kyra/sequences_hof.cpp69
-rw-r--r--engines/kyra/sequences_lok.cpp21
-rw-r--r--engines/kyra/sequences_lol.cpp36
-rw-r--r--engines/kyra/text_lok.cpp4
-rw-r--r--engines/kyra/vqa.cpp5
27 files changed, 237 insertions, 247 deletions
diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp
index e0c2c0aa77..c06c13c9e8 100644
--- a/engines/kyra/debugger.cpp
+++ b/engines/kyra/debugger.cpp
@@ -69,7 +69,7 @@ bool Debugger::cmd_setScreenDebug(int argc, const char **argv) {
}
bool Debugger::cmd_loadPalette(int argc, const char **argv) {
- uint8 palette[768];
+ Palette palette(_vm->screen()->getPalette(0).getNumColors());
if (argc <= 1) {
DebugPrintf("Use load_palette <file> [start_col] [end_col]\n");
@@ -80,24 +80,24 @@ bool Debugger::cmd_loadPalette(int argc, const char **argv) {
uint8 buffer[320*200];
_vm->screen()->copyRegionToBuffer(5, 0, 0, 320, 200, buffer);
_vm->screen()->loadBitmap(argv[1], 5, 5, 0);
- memcpy(palette, _vm->screen()->getCPagePtr(5), 768);
+ palette.copy(_vm->screen()->getCPagePtr(5), 0, 256);
_vm->screen()->copyBlockToPage(5, 0, 0, 320, 200, buffer);
- } else if (!_vm->screen()->loadPalette(argv[1], palette)) {
+ } else if (!_vm->screen()->loadPalette(argv[1], palette.getData())) {
DebugPrintf("ERROR: Palette '%s' not found!\n", argv[1]);
return true;
}
int startCol = 0;
- int endCol = 255;
+ int endCol = palette.getNumColors();
if (argc > 2)
- startCol = MIN(255, MAX(0, atoi(argv[2])));
+ startCol = MIN(palette.getNumColors(), MAX(0, atoi(argv[2])));
if (argc > 3)
- endCol = MIN(255, MAX(0, atoi(argv[3])));
+ endCol = MIN(palette.getNumColors(), MAX(0, atoi(argv[3])));
if (startCol > 0)
- memcpy(palette, _vm->screen()->getScreenPalette(), startCol*3);
- if (endCol < 255)
- memcpy(palette + endCol * 3, _vm->screen()->getScreenPalette() + endCol * 3, (255-endCol)*3);
+ palette.copy(_vm->screen()->getPalette(0), 0, startCol);
+ if (endCol < palette.getNumColors())
+ palette.copy(_vm->screen()->getPalette(0), endCol);
_vm->screen()->setScreenPalette(palette);
_vm->screen()->updateScreen();
diff --git a/engines/kyra/gui_hof.cpp b/engines/kyra/gui_hof.cpp
index 254d58741d..3c3559b2e7 100644
--- a/engines/kyra/gui_hof.cpp
+++ b/engines/kyra/gui_hof.cpp
@@ -375,7 +375,7 @@ int KyraEngine_HoF::bookButton(Button *button) {
int oldItemInHand = _itemInHand;
removeHandItem();
- _screen->fadePalette(_screen->getPalette(0).getData(), 7);
+ _screen->fadePalette(_screen->getPalette(0), 7);
_screen->showMouse();
bookLoop();
@@ -394,7 +394,7 @@ int KyraEngine_HoF::bookButton(Button *button) {
setHandItem(_itemInHand);
_screen->copyPalette(0, 2);
- _screen->fadePalette(_screen->getPalette(0).getData(), 7, &_updateFunctor);
+ _screen->fadePalette(_screen->getPalette(0), 7, &_updateFunctor);
_screen->showMouse();
if (!queryGameFlag(4) && !queryGameFlag(0xB8)) {
@@ -812,14 +812,14 @@ void GUI_HoF::setupPalette() {
_screen->getPalette(0).copy(_screen->getPalette(1), guiPal[i], 1);
if (_isDeathMenu)
- _screen->fadePalette(_screen->getPalette(0).getData(), 0x64);
+ _screen->fadePalette(_screen->getPalette(0), 0x64);
else
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
}
void GUI_HoF::restorePalette() {
_screen->copyPalette(0, 1);
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
}
void GUI_HoF::resetState(int item) {
diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp
index a73707e8ee..9453232865 100644
--- a/engines/kyra/gui_lok.cpp
+++ b/engines/kyra/gui_lok.cpp
@@ -1034,7 +1034,7 @@ void GUI_LoK::fadePalette() {
++index;
}
- _screen->fadePalette(_screen->getPalette(0).getData(), 2);
+ _screen->fadePalette(_screen->getPalette(0), 2);
}
void GUI_LoK::restorePalette() {
@@ -1042,7 +1042,7 @@ void GUI_LoK::restorePalette() {
return;
_screen->copyPalette(0, 2);
- _screen->fadePalette(_screen->getPalette(0).getData(), 2);
+ _screen->fadePalette(_screen->getPalette(0), 2);
}
#pragma mark -
diff --git a/engines/kyra/gui_mr.cpp b/engines/kyra/gui_mr.cpp
index 340d30d663..f69337f52f 100644
--- a/engines/kyra/gui_mr.cpp
+++ b/engines/kyra/gui_mr.cpp
@@ -693,7 +693,7 @@ void KyraEngine_MR::showAlbum() {
printAlbumPageText();
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
- _screen->fadePalette(_screen->getPalette(0).getData(), 9);
+ _screen->fadePalette(_screen->getPalette(0), 9);
processAlbum();
@@ -708,7 +708,7 @@ void KyraEngine_MR::showAlbum() {
_screen->copyBlockToPage(4, 0, 0, 320, 200, _album.backUpPage);
_screen->copyPalette(0, 1);
- _screen->fadePalette(_screen->getPalette(0).getData(), 9);
+ _screen->fadePalette(_screen->getPalette(0), 9);
delete[] _album.backUpRect;
_album.backUpRect = 0;
diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp
index 28a42fabd9..0a98d635a5 100644
--- a/engines/kyra/kyra_hof.cpp
+++ b/engines/kyra/kyra_hof.cpp
@@ -921,7 +921,7 @@ void KyraEngine_HoF::showMessage(const char *string, int16 palIndex) {
palIndex *= 3;
memcpy(_messagePal, _screen->getPalette(0).getData() + palIndex, 3);
_screen->getPalette(0).copy(_screen->getPalette(0), palIndex / 3, 1, 255);
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
}
int x = _text->getCenterStringX(string, 0, 320);
@@ -979,7 +979,7 @@ void KyraEngine_HoF::fadeMessagePalette() {
if (updatePalette) {
_screen->getPalette(0).copy(_messagePal, 0, 1, 255);
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
} else {
_fadeMessagePalette = false;
}
@@ -1145,12 +1145,12 @@ void KyraEngine_HoF::updateCharPal(int unk1) {
++ptr;
++src;
}
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
unkVar1 = true;
_charPalEntry = palEntry;
} else if (unkVar1 || !unk1) {
_screen->getPalette(0).copy(_scenePal, palEntry << 4, 16, 112);
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
unkVar1 = false;
}
}
@@ -1667,9 +1667,9 @@ void KyraEngine_HoF::setCauldronState(uint8 state, bool paletteFade) {
if (paletteFade) {
snd_playSoundEffect((state == 0) ? 0x6B : 0x66);
- _screen->fadePalette(_screen->getPalette(2).getData(), 0x4B, &_updateFunctor);
+ _screen->fadePalette(_screen->getPalette(2), 0x4B, &_updateFunctor);
} else {
- _screen->setScreenPalette(_screen->getPalette(2).getData());
+ _screen->setScreenPalette(_screen->getPalette(2));
_screen->updateScreen();
}
@@ -1835,11 +1835,11 @@ void KyraEngine_HoF::cauldronRndPaletteFade() {
file->seek(index*18, SEEK_SET);
file->read(_screen->getPalette(0).getData()+723, 18);
snd_playSoundEffect(0x6A);
- _screen->fadePalette(_screen->getPalette(0).getData(), 0x1E, &_updateFunctor);
+ _screen->fadePalette(_screen->getPalette(0), 0x1E, &_updateFunctor);
file->seek(0, SEEK_SET);
file->read(_screen->getPalette(0).getData()+723, 18);
delete file;
- _screen->fadePalette(_screen->getPalette(0).getData(), 0x1E, &_updateFunctor);
+ _screen->fadePalette(_screen->getPalette(0), 0x1E, &_updateFunctor);
}
void KyraEngine_HoF::resetCauldronStateTable(int idx) {
diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp
index b50a42cb8a..e0c14b4853 100644
--- a/engines/kyra/kyra_mr.cpp
+++ b/engines/kyra/kyra_mr.cpp
@@ -231,7 +231,7 @@ Common::Error KyraEngine_MR::init() {
_screen->setScreenDim(0);
_res->loadFileToBuf("PALETTE.COL", _screen->getPalette(0).getData(), 768);
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
return Common::kNoError;
}
@@ -267,7 +267,7 @@ Common::Error KyraEngine_MR::go() {
_screen->_curPage = 0;
_screen->clearPage(0);
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
// XXX
playMenuAudioFile();
@@ -390,10 +390,9 @@ void KyraEngine_MR::playVQA(const char *name) {
_soundDigital->stopAllSounds();
_screen->showMouse();
- uint8 pal[768];
// Taken from original, it used '1' here too
- memset(pal, 1, sizeof(pal));
- _screen->setScreenPalette(pal);
+ memset(_screen->getPalette(0).getData(), 1, 768);
+ _screen->setScreenPalette(_screen->getPalette(0));
_screen->clearPage(0);
_screen->copyPalette(0, 1);
_wasPlayingVQA = true;
@@ -919,7 +918,7 @@ void KyraEngine_MR::updateCharPal(int unk1) {
}
}
_charPalUpdate = true;
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
_lastCharPalLayer = layer;
} else if (_charPalUpdate || !unk1) {
memcpy(dst, src, 72);
@@ -936,7 +935,7 @@ void KyraEngine_MR::updateCharPal(int unk1) {
}
}
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
_charPalUpdate = false;
}
}
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 052a805843..66668ce08e 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -1677,7 +1677,7 @@ void LoLEngine::transformRegion(int x1, int y1, int x2, int y2, int w, int h, in
void LoLEngine::setPaletteBrightness(uint8 *palette, int brightness, int modifier) {
generateBrightnessPalette(palette, _screen->getPalette(1).getData(), brightness, modifier);
- _screen->fadePalette(_screen->getPalette(1).getData(), 5, 0);
+ _screen->fadePalette(_screen->getPalette(1), 5, 0);
_screen->_fadeFlag = 0;
}
@@ -2617,7 +2617,7 @@ int LoLEngine::processMagicLightning(int charNum, int spellLevel) {
mov->close();
delete mov;
- _screen->setScreenPalette(_screen->getPalette(1).getData());
+ _screen->setScreenPalette(_screen->getPalette(1));
_screen->copyPage(12, 2);
_screen->copyPage(12, 0);
updateDrawPage2();
@@ -2836,20 +2836,22 @@ void LoLEngine::callbackProcessMagicSwarm(WSAMovie_v2 *mov, int x, int y) {
}
void LoLEngine::callbackProcessMagicLightning(WSAMovie_v2 *mov, int x, int y) {
- uint8 *tpal = new uint8[768];
if (_lightningDiv == 2)
shakeScene(1, 2, 3, 0);
- uint8 *p1 = _screen->getPalette(1).getData();
+ const Palette &p1 = _screen->getPalette(1);
if (_lightningSfxFrame % _lightningDiv) {
_screen->setScreenPalette(p1);
} else {
- memcpy(tpal, p1, 768);
+ Palette tpal(p1.getNumColors());
+ tpal.copy(p1);
+
for (int i = 6; i < 384; i++) {
uint16 v = (tpal[i] * 120) / 64;
tpal[i] = (v < 64) ? v : 63;
}
+
_screen->setScreenPalette(tpal);
}
@@ -2864,7 +2866,6 @@ void LoLEngine::callbackProcessMagicLightning(WSAMovie_v2 *mov, int x, int y) {
}
_lightningSfxFrame++;
- delete[] tpal;
}
void LoLEngine::drinkBezelCup(int numUses, int charNum) {
@@ -3871,7 +3872,7 @@ void LoLEngine::displayAutomap() {
_screen->copyPage(2, 0);
_screen->updateScreen();
- _screen->fadePalette(_screen->getPalette(3).getData(), 10);
+ _screen->fadePalette(_screen->getPalette(3), 10);
uint32 delayTimer = _system->getMillis() + 8 * _tickLength;
while (!exitAutomap && !shouldQuit()) {
diff --git a/engines/kyra/scene_hof.cpp b/engines/kyra/scene_hof.cpp
index 0300bf3a09..e6f1336989 100644
--- a/engines/kyra/scene_hof.cpp
+++ b/engines/kyra/scene_hof.cpp
@@ -670,13 +670,13 @@ void KyraEngine_HoF::initSceneScreen(int unk1) {
if (_noScriptEnter) {
memset(_screen->getPalette(0).getData(), 0, 384);
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
}
_screen->copyRegion(0, 0, 0, 0, 320, 144, 2, 0, Screen::CR_NO_P_CHECK);
if (_noScriptEnter) {
- _screen->setScreenPalette(_screen->getPalette(1).getData());
+ _screen->setScreenPalette(_screen->getPalette(1));
_screen->getPalette(0).copy(_screen->getPalette(1), 0, 128);
}
@@ -696,7 +696,7 @@ void KyraEngine_HoF::freeSceneShapePtrs() {
void KyraEngine_HoF::fadeScenePal(int srcIndex, int delayTime) {
_screen->getPalette(0).copy(_scenePal, srcIndex << 4, 16, 112);
- _screen->fadePalette(_screen->getPalette(0).getData(), delayTime, &_updateFunctor);
+ _screen->fadePalette(_screen->getPalette(0), delayTime, &_updateFunctor);
}
#pragma mark -
diff --git a/engines/kyra/scene_lok.cpp b/engines/kyra/scene_lok.cpp
index c09c9e1687..ce8fac3362 100644
--- a/engines/kyra/scene_lok.cpp
+++ b/engines/kyra/scene_lok.cpp
@@ -772,7 +772,7 @@ void KyraEngine_LoK::initSceneScreen(int brandonAlive) {
if (_unkScreenVar1 && !queryGameFlag(0xF0)) {
_screen->getPalette(2).clear();
if (_currentCharacter->sceneId != 117 || !queryGameFlag(0xB3))
- _screen->setScreenPalette(_screen->getPalette(2).getData());
+ _screen->setScreenPalette(_screen->getPalette(2));
}
if (_unkScreenVar2 == 1)
@@ -787,7 +787,7 @@ void KyraEngine_LoK::initSceneScreen(int brandonAlive) {
if (_currentCharacter->sceneId >= 229 && _currentCharacter->sceneId <= 245 && (_brandonStatusBit & 1))
_screen->copyPalette(0, 10);
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
}
} else {
if (_unkScreenVar1 && !queryGameFlag(0xA0)) {
@@ -797,7 +797,7 @@ void KyraEngine_LoK::initSceneScreen(int brandonAlive) {
col >>= 2;
_screen->getPalette(0)[684+i] = col;
}
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
}
if (_unkScreenVar2 == 1)
@@ -808,7 +808,7 @@ void KyraEngine_LoK::initSceneScreen(int brandonAlive) {
if (_unkScreenVar1 && _paletteChanged) {
if (!queryGameFlag(0xA0)) {
_screen->getPalette(0).copy(_screen->getPalette(1), 228, 20);
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
} else {
_screen->getPalette(0).clear();
}
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index cb628be48e..2be5ce88ab 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -1417,7 +1417,7 @@ void LoLEngine::prepareSpecialScene(int fieldType, int hasDialogue, int suspendG
initDialogueSequence(fieldType, 0);
if (fadeFlag) {
- _screen->fadePalette(_screen->getPalette(3).getData(), 10);
+ _screen->fadePalette(_screen->getPalette(3), 10);
_screen->_fadeFlag = 0;
}
@@ -1435,7 +1435,7 @@ void LoLEngine::prepareSpecialScene(int fieldType, int hasDialogue, int suspendG
if (fadeFlag) {
_screen->getPalette(3).copy(_screen->getPalette(0), 128);
_screen->loadSpecialColors(_screen->getPalette(3).getData());
- _screen->fadePalette(_screen->getPalette(3).getData(), 10);
+ _screen->fadePalette(_screen->getPalette(3), 10);
_screen->_fadeFlag = 0;
}
diff --git a/engines/kyra/scene_mr.cpp b/engines/kyra/scene_mr.cpp
index 890bb6515c..3f34d70867 100644
--- a/engines/kyra/scene_mr.cpp
+++ b/engines/kyra/scene_mr.cpp
@@ -609,14 +609,14 @@ void KyraEngine_MR::initSceneScreen(int unk1) {
if (_noScriptEnter) {
memset(_screen->getPalette(0).getData(), 0, 432);
if (!_wasPlayingVQA)
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
}
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
if (_noScriptEnter) {
if (!_wasPlayingVQA)
- _screen->setScreenPalette(_screen->getPalette(2).getData());
+ _screen->setScreenPalette(_screen->getPalette(2));
_screen->getPalette(0).copy(_screen->getPalette(2), 0, 144);
if (_wasPlayingVQA) {
_screen->fadeFromBlack(0x3C);
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index b82ec0d09a..8cf48c5ae4 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -124,8 +124,10 @@ bool Screen::init() {
memset(_palettes, 0, sizeof(_palettes));
- _screenPalette = new Palette(768);
+ _screenPalette = new Palette(256);
assert(_screenPalette);
+ _tempPalette = new Palette(_screenPalette->getNumColors());
+ assert(_tempPalette);
if (_vm->gameFlags().platform == Common::kPlatformAmiga) {
for (int i = 0; i < 7; ++i) {
@@ -134,12 +136,12 @@ bool Screen::init() {
}
} else {
for (int i = 0; i < 4; ++i) {
- _palettes[i] = new Palette(768);
+ _palettes[i] = new Palette(256);
assert(_palettes[i]);
}
}
- setScreenPalette(getPalette(0).getData());
+ setScreenPalette(getPalette(0));
_curDim = 0;
_charWidth = 0;
@@ -490,26 +492,25 @@ void Screen::setPagePixel(int pageNum, int x, int y, uint8 color) {
}
void Screen::fadeFromBlack(int delay, const UpdateFunctor *upFunc) {
- fadePalette(getPalette(0).getData(), delay, upFunc);
+ fadePalette(getPalette(0), delay, upFunc);
}
void Screen::fadeToBlack(int delay, const UpdateFunctor *upFunc) {
- uint8 blackPal[768];
- memset(blackPal, 0, 768);
- fadePalette(blackPal, delay, upFunc);
+ _tempPalette->clear();
+ fadePalette(*_tempPalette, delay, upFunc);
}
-void Screen::fadePalette(const uint8 *palData, int delay, const UpdateFunctor *upFunc) {
+void Screen::fadePalette(const Palette &pal, int delay, const UpdateFunctor *upFunc) {
updateScreen();
int diff = 0, delayInc = 0;
- getFadeParams(palData, delay, delayInc, diff);
+ getFadeParams(pal, delay, delayInc, diff);
int delayAcc = 0;
while (!_vm->shouldQuit()) {
delayAcc += delayInc;
- int refreshed = fadePalStep(palData, diff);
+ int refreshed = fadePalStep(pal, diff);
if (upFunc && upFunc->isValid())
(*upFunc)();
@@ -524,7 +525,7 @@ void Screen::fadePalette(const uint8 *palData, int delay, const UpdateFunctor *u
}
if (_vm->shouldQuit()) {
- setScreenPalette(palData);
+ setScreenPalette(pal);
if (upFunc && upFunc->isValid())
(*upFunc)();
else
@@ -532,12 +533,11 @@ void Screen::fadePalette(const uint8 *palData, int delay, const UpdateFunctor *u
}
}
-void Screen::getFadeParams(const uint8 *palette, int delay, int &delayInc, int &diff) {
+void Screen::getFadeParams(const Palette &pal, int delay, int &delayInc, int &diff) {
uint8 maxDiff = 0;
- const int colors = (_vm->gameFlags().platform == Common::kPlatformAmiga ? 32 : 256) * 3;
- for (int i = 0; i < colors; ++i) {
- diff = ABS(palette[i] - (*_screenPalette)[i]);
+ for (int i = 0; i < pal.getNumColors() * 3; ++i) {
+ diff = ABS(pal[i] - (*_screenPalette)[i]);
maxDiff = MAX<uint8>(maxDiff, diff);
}
@@ -553,17 +553,14 @@ void Screen::getFadeParams(const uint8 *palette, int delay, int &delayInc, int &
}
}
-int Screen::fadePalStep(const uint8 *palette, int diff) {
- const int colors = (_vm->gameFlags().platform == Common::kPlatformAmiga ? 32 : (_use16ColorMode ? 16 : 256)) * 3;
-
- uint8 fadePal[768];
- memcpy(fadePal, _screenPalette->getData(), colors);
+int Screen::fadePalStep(const Palette &pal, int diff) {
+ _tempPalette->copy(*_screenPalette);
bool needRefresh = false;
- for (int i = 0; i < colors; ++i) {
- int c1 = palette[i];
- int c2 = fadePal[i];
+ for (int i = 0; i < pal.getNumColors() * 3; ++i) {
+ int c1 = pal[i];
+ int c2 = (*_tempPalette)[i];
if (c1 != c2) {
needRefresh = true;
if (c1 > c2) {
@@ -578,12 +575,12 @@ int Screen::fadePalStep(const uint8 *palette, int diff) {
c2 = c1;
}
- fadePal[i] = (uint8)c2;
+ (*_tempPalette)[i] = (uint8)c2;
}
}
if (needRefresh)
- setScreenPalette(fadePal);
+ setScreenPalette(*_tempPalette);
return needRefresh ? 1 : 0;
}
@@ -592,7 +589,7 @@ void Screen::setPaletteIndex(uint8 index, uint8 red, uint8 green, uint8 blue) {
getPalette(0)[index * 3 + 0] = red;
getPalette(0)[index * 3 + 1] = green;
getPalette(0)[index * 3 + 2] = blue;
- setScreenPalette(getPalette(0).getData());
+ setScreenPalette(getPalette(0));
}
void Screen::getRealPalette(int num, uint8 *dst) {
@@ -613,35 +610,18 @@ void Screen::getRealPalette(int num, uint8 *dst) {
}
}
-void Screen::setScreenPalette(const uint8 *palData) {
- const int colors = (_vm->gameFlags().platform == Common::kPlatformAmiga ? 32 : 256);
-
+void Screen::setScreenPalette(const Palette &pal) {
uint8 screenPal[256 * 4];
- _screenPalette->copy(palData, 0, colors);
-
- if (_use16ColorMode && _vm->gameFlags().platform == Common::kPlatformPC98) {
- for (int l = 0; l < 1024; l += 64) {
- const uint8 *tp = palData;
- for (int i = 0; i < 16; ++i) {
- screenPal[l + 4 * i + 0] = palData[1];
- screenPal[l + 4 * i + 1] = palData[0];
- screenPal[l + 4 * i + 2] = palData[2];
- screenPal[l + 4 * i + 3] = 0;
- palData += 3;
- }
- palData = tp;
- }
- } else {
- for (int i = 0; i < colors; ++i) {
- screenPal[4 * i + 0] = (palData[0] << 2) | (palData[0] & 3);
- screenPal[4 * i + 1] = (palData[1] << 2) | (palData[1] & 3);
- screenPal[4 * i + 2] = (palData[2] << 2) | (palData[2] & 3);
- screenPal[4 * i + 3] = 0;
- palData += 3;
- }
+ _screenPalette->copy(pal);
+
+ for (int i = 0; i < pal.getNumColors(); ++i) {
+ screenPal[4 * i + 0] = (pal[i * 3 + 0] << 2) | (pal[i * 3 + 0] & 3);
+ screenPal[4 * i + 1] = (pal[i * 3 + 1] << 2) | (pal[i * 3 + 1] & 3);
+ screenPal[4 * i + 2] = (pal[i * 3 + 2] << 2) | (pal[i * 3 + 2] & 3);
+ screenPal[4 * i + 3] = 0;
}
- _system->setPalette(screenPal, 0, colors);
+ _system->setPalette(screenPal, 0, pal.getNumColors());
}
void Screen::copyToPage0(int y, int h, uint8 page, uint8 *seqBuf) {
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index dab50a54f5..706f54a9d2 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -223,13 +223,12 @@ public:
void fadeFromBlack(int delay=0x54, const UpdateFunctor *upFunc = 0);
void fadeToBlack(int delay=0x54, const UpdateFunctor *upFunc = 0);
- void fadePalette(const uint8 *palData, int delay, const UpdateFunctor *upFunc = 0);
- virtual void getFadeParams(const uint8 *palette, int delay, int &delayInc, int &diff);
- int fadePalStep(const uint8 *palette, int diff);
+ void fadePalette(const Palette &pal, int delay, const UpdateFunctor *upFunc = 0);
+ virtual void getFadeParams(const Palette &pal, int delay, int &delayInc, int &diff);
+ int fadePalStep(const Palette &pal, int diff);
void setPaletteIndex(uint8 index, uint8 red, uint8 green, uint8 blue);
- void setScreenPalette(const uint8 *palData);
- const uint8 *getScreenPalette() const { return _screenPalette->getData(); }
+ void setScreenPalette(const Palette &pal);
void getRealPalette(int num, uint8 *dst);
Palette &getPalette(int num);
@@ -362,6 +361,7 @@ protected:
Palette *_screenPalette;
Palette *_palettes[7];
+ Palette *_tempPalette;
Font _fonts[FID_NUM];
uint8 _textColorsMap[16];
diff --git a/engines/kyra/screen_lok.cpp b/engines/kyra/screen_lok.cpp
index a7cad28aa8..fbeb2a7a63 100644
--- a/engines/kyra/screen_lok.cpp
+++ b/engines/kyra/screen_lok.cpp
@@ -81,14 +81,14 @@ const ScreenDim *Screen_LoK::getScreenDim(int dim) {
void Screen_LoK::fadeSpecialPalette(int palIndex, int startIndex, int size, int fadeTime) {
assert(_vm->palTable1()[palIndex]);
- uint8 tempPal[768];
- memcpy(tempPal, getPalette(0).getData(), 768);
- memcpy(&tempPal[startIndex*3], _vm->palTable1()[palIndex], size*3);
+ Palette tempPal(getPalette(0).getNumColors());
+ tempPal.copy(getPalette(0));
+ tempPal.copy(_vm->palTable1()[palIndex], 0, size, startIndex);
fadePalette(tempPal, fadeTime*18);
getPalette(0).copy(tempPal, startIndex, size);
- setScreenPalette(getPalette(0).getData());
+ setScreenPalette(getPalette(0));
_system->updateScreen();
}
diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp
index 8e06c112ff..fc8740a9d3 100644
--- a/engines/kyra/screen_lol.cpp
+++ b/engines/kyra/screen_lol.cpp
@@ -282,14 +282,13 @@ void Screen_LoL::fadeClearSceneWindow(int delay) {
if (_fadeFlag == 1)
return;
- uint8 *tpal = new uint8[768];
+ Palette tpal(getPalette(0).getNumColors());
+ tpal.copy(getPalette(0));
- memcpy(tpal, getPalette(0).getData(), 768);
- memset(tpal, 0, 384);
- loadSpecialColors(tpal);
+ loadSpecialColors(tpal.getData());
fadePalette(tpal, delay);
+
fillRect(112, 0, 288, 120, 0);
- delete[] tpal;
_fadeFlag = 1;
}
@@ -839,7 +838,7 @@ void Screen_LoL::fadeToBlack(int delay, const UpdateFunctor *upFunc) {
void Screen_LoL::fadeToPalette1(int delay) {
loadSpecialColors(getPalette(1).getData());
- fadePalette(getPalette(1).getData(), delay);
+ fadePalette(getPalette(1), delay);
_fadeFlag = 0;
}
@@ -897,22 +896,22 @@ bool Screen_LoL::fadeColor(int dstColorIndex, int srcColorIndex, uint32 elapsedT
p++;
}
- uint8 tpal[768];
- memcpy(tpal, _screenPalette->getData(), 768);
- memcpy(tpal + dstColorIndex * 3, tmpPalEntry, 3);
- setScreenPalette(tpal);
+ _tempPalette->copy(*_screenPalette);
+ _tempPalette->copy(*_screenPalette);
+ _tempPalette->copy(tmpPalEntry, 0, 1, dstColorIndex);
+ setScreenPalette(*_tempPalette);
updateScreen();
return res;
}
bool Screen_LoL::fadePaletteStep(uint8 *pal1, uint8 *pal2, uint32 elapsedTime, uint32 targetTime) {
- uint8 tpal[768];
- uint8 *p1 = getPalette(1).getData();
+ Palette &p1 = getPalette(1);
bool res = false;
for (int i = 0; i < 768; i++) {
uint8 out = 0;
+
if (elapsedTime < targetTime) {
int32 d = ((pal2[i] & 0x3f) - (pal1[i] & 0x3f));
if (d)
@@ -925,10 +924,10 @@ bool Screen_LoL::fadePaletteStep(uint8 *pal1, uint8 *pal2, uint32 elapsedTime, u
res = false;
}
- tpal[i] = out;
+ (*_tempPalette)[i] = out;
}
- setScreenPalette(tpal);
+ setScreenPalette(*_tempPalette);
updateScreen();
return res;
diff --git a/engines/kyra/screen_v2.cpp b/engines/kyra/screen_v2.cpp
index 9f72725d2d..1446315be5 100644
--- a/engines/kyra/screen_v2.cpp
+++ b/engines/kyra/screen_v2.cpp
@@ -114,12 +114,11 @@ int Screen_v2::findLeastDifferentColor(const uint8 *paletteEntry, const uint8 *p
return r;
}
-void Screen_v2::getFadeParams(const uint8 *palette, int delay, int &delayInc, int &diff) {
+void Screen_v2::getFadeParams(const Palette &pal, int delay, int &delayInc, int &diff) {
int maxDiff = 0;
diff = 0;
- int len = _use16ColorMode ? 48 : 768;
- for (int i = 0; i < len; ++i) {
- diff = ABS(palette[i] - (*_screenPalette)[i]);
+ for (int i = 0; i < pal.getNumColors() * 3; ++i) {
+ diff = ABS(pal[i] - (*_screenPalette)[i]);
maxDiff = MAX(maxDiff, diff);
}
diff --git a/engines/kyra/screen_v2.h b/engines/kyra/screen_v2.h
index 8b94eb40d2..2906a9b5bf 100644
--- a/engines/kyra/screen_v2.h
+++ b/engines/kyra/screen_v2.h
@@ -44,7 +44,7 @@ public:
void applyOverlay(int x, int y, int w, int h, int pageNum, const uint8 *overlay);
int findLeastDifferentColor(const uint8 *paletteEntry, const uint8 *palette, uint16 numColors, bool skipSpecialColors = false);
- virtual void getFadeParams(const uint8 *palette, int delay, int &delayInc, int &diff);
+ virtual void getFadeParams(const Palette &pal, int delay, int &delayInc, int &diff);
// shape handling
uint8 *getPtrToShape(uint8 *shpFile, int shape);
diff --git a/engines/kyra/script_hof.cpp b/engines/kyra/script_hof.cpp
index b502483858..83c414e131 100644
--- a/engines/kyra/script_hof.cpp
+++ b/engines/kyra/script_hof.cpp
@@ -149,7 +149,7 @@ int KyraEngine_HoF::o2_meanWhileScene(EMCState *script) {
_screen->copyPalette(2, 0);
_screen->loadPalette(palfile, _screen->getPalette(2).getData());
_screen->fillRect(0, 0, 319, 199, 207);
- _screen->setScreenPalette(_screen->getPalette(2).getData());
+ _screen->setScreenPalette(_screen->getPalette(2));
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0);
if (!scumm_stricmp(cpsfile, "_MEANWIL.CPS") && _flags.lang == Common::JA_JPN) {
Screen::FontId o = _screen->setFont(Screen::FID_6_FNT);
@@ -567,7 +567,7 @@ int KyraEngine_HoF::o2_loadPalette384(EMCState *script) {
int KyraEngine_HoF::o2_setPalette384(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_setPalette384(%p) ()", (const void *)script);
_screen->getPalette(0).copy(_screen->getPalette(1), 0, 128);
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
return 0;
}
@@ -798,7 +798,7 @@ int KyraEngine_HoF::o2_showLetter(EMCState *script) {
}
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
- _screen->fadePalette(_screen->getPalette(0).getData(), 0x14);
+ _screen->fadePalette(_screen->getPalette(0), 0x14);
_screen->setMouseCursor(0, 0, getShapePtr(0));
setMousePos(280, 160);
@@ -820,7 +820,7 @@ int KyraEngine_HoF::o2_showLetter(EMCState *script) {
_screen->fadeToBlack(0x14);
restorePage0();
_screen->copyPalette(0, 2);
- _screen->fadePalette(_screen->getPalette(0).getData(), 0x14);
+ _screen->fadePalette(_screen->getPalette(0), 0x14);
setHandItem(_itemInHand);
_screen->showMouse();
@@ -1130,7 +1130,7 @@ int KyraEngine_HoF::o2_mushroomEffect(EMCState *script) {
for (int i = 1; i < 768; i += 3)
_screen->getPalette(0)[i] = 0;
snd_playSoundEffect(106);
- _screen->fadePalette(_screen->getPalette(0).getData(), 90, &_updateFunctor);
+ _screen->fadePalette(_screen->getPalette(0), 90, &_updateFunctor);
_screen->copyPalette(0, 2);
for (int i = 0; i < 768; i += 3) {
@@ -1140,10 +1140,10 @@ int KyraEngine_HoF::o2_mushroomEffect(EMCState *script) {
_screen->getPalette(0)[i + 2] = 63;
}
snd_playSoundEffect(106);
- _screen->fadePalette(_screen->getPalette(0).getData(), 90, &_updateFunctor);
+ _screen->fadePalette(_screen->getPalette(0), 90, &_updateFunctor);
_screen->copyPalette(0, 2);
- _screen->fadePalette(_screen->getPalette(0).getData(), 30, &_updateFunctor);
+ _screen->fadePalette(_screen->getPalette(0), 30, &_updateFunctor);
return 0;
}
@@ -1262,7 +1262,7 @@ int KyraEngine_HoF::o2_stopSceneAnimation(EMCState *script) {
int KyraEngine_HoF::o2_processPaletteIndex(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_processPaletteIndex(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5));
- uint8 *palette = _screen->getPalette(0).getData();
+ Palette &palette = _screen->getPalette(0);
const int index = stackPos(0);
const bool updatePalette = (stackPos(4) != 0);
@@ -1410,7 +1410,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->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
_screen->updateScreen();
_eventList.clear();
diff --git a/engines/kyra/script_lok.cpp b/engines/kyra/script_lok.cpp
index 19f8d87adc..b205f600e8 100644
--- a/engines/kyra/script_lok.cpp
+++ b/engines/kyra/script_lok.cpp
@@ -233,7 +233,7 @@ int KyraEngine_LoK::o1_fadeSpecialPalette(EMCState *script) {
if (stackPos(0) == 13) {
// TODO: Check this!
_screen->copyPalette(0, 12);
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
}
} else {
warning("KyraEngine_LoK::o1_fadeSpecialPalette not implemented");
@@ -1503,37 +1503,38 @@ int KyraEngine_LoK::o1_setNoDrawShapesFlag(EMCState *script) {
int KyraEngine_LoK::o1_fadeEntirePalette(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_fadeEntirePalette(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
int cmd = stackPos(0);
- uint8 *fadePal = 0;
+
+ int fadePal = 0;
if (_flags.platform == Common::kPlatformAmiga) {
if (cmd == 0) {
_screen->getPalette(2).clear();
- fadePal = _screen->getPalette(2).getData();
+ fadePal = 2;
_screen->copyPalette(4, 0);
} else if (cmd == 1) {
- fadePal = _screen->getPalette(0).getData();
+ fadePal = 0;
_screen->copyPalette(0, 4);
} else if (cmd == 2) {
- fadePal = _screen->getPalette(0).getData();
+ fadePal = 0;
_screen->getPalette(2).clear();
}
} else {
if (cmd == 0) {
+ fadePal = 2;
_screen->getPalette(2).clear();
- fadePal = _screen->getPalette(2).getData();
_screen->copyPalette(3, 0);
} else if (cmd == 1) {
- //fadePal = _screen->getPalette(3);
+ //fadePal = 3;
warning("unimplemented o1_fadeEntirePalette function");
return 0;
} else if (cmd == 2) {
_screen->getPalette(2).clear();
_screen->copyPalette(0, 1);
- fadePal = _screen->getPalette(0).getData();
+ fadePal = 0;
}
}
- _screen->fadePalette(fadePal, stackPos(1));
+ _screen->fadePalette(_screen->getPalette(fadePal), stackPos(1));
return 0;
}
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index c5711ee665..c97e452a88 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -602,7 +602,7 @@ int LoLEngine::olol_fadeToBlack(EMCState *script) {
int LoLEngine::olol_fadePalette(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_fadePalette(%p)", (const void *)script);
- _screen->fadePalette(_screen->getPalette(3).getData(), 10);
+ _screen->fadePalette(_screen->getPalette(3), 10);
_screen->_fadeFlag = 0;
return 1;
}
@@ -866,7 +866,7 @@ int LoLEngine::olol_fadeSequencePalette(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_fadeSequencePalette(%p)", (const void *)script);
_screen->getPalette(3).copy(_screen->getPalette(0), 128);
_screen->loadSpecialColors(_screen->getPalette(3).getData());
- _screen->fadePalette(_screen->getPalette(3).getData(), 10);
+ _screen->fadePalette(_screen->getPalette(3), 10);
_screen->_fadeFlag = 0;
return 1;
}
@@ -2003,7 +2003,7 @@ int LoLEngine::olol_drinkBezelCup(EMCState *script) {
int LoLEngine::olol_restoreFadePalette(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_restoreFadePalette(%p)", (const void *)script);
_screen->getPalette(0).copy(_screen->getPalette(1), 0, 128);
- _screen->fadePalette(_screen->getPalette(0).getData(), 10);
+ _screen->fadePalette(_screen->getPalette(0), 10);
_screen->_fadeFlag = 0;
return 1;
}
@@ -2101,27 +2101,29 @@ int LoLEngine::olol_increaseSkill(EMCState *script) {
int LoLEngine::olol_paletteFlash(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_paletteFlash(%p) (%d)", (const void *)script, stackPos(0));
- uint8 *s = _screen->getPalette(1).getData();
- uint8 *d = _screen->getPalette(3).getData();
+ Palette &p1 = _screen->getPalette(1);
+ Palette &p2 = _screen->getPalette(3);
+
uint8 ovl[256];
- generateFlashPalette(s, d, stackPos(0));
- _screen->loadSpecialColors(s);
- _screen->loadSpecialColors(d);
+ generateFlashPalette(p1.getData(), p2.getData(), stackPos(0));
+ _screen->loadSpecialColors(p1.getData());
+ _screen->loadSpecialColors(p2.getData());
if (_smoothScrollModeNormal) {
for (int i = 0; i < 256; i++)
ovl[i] = i;
ovl[1] = 6;
+
_screen->copyRegion(112, 0, 112, 0, 176, 120, 0, 2);
_screen->applyOverlay(112, 0, 176, 120, 0, ovl);
}
- _screen->setScreenPalette(d);
+ _screen->setScreenPalette(p2);
_screen->updateScreen();
delay(2 * _tickLength);
- _screen->setScreenPalette(s);
+ _screen->setScreenPalette(p1);
if (_smoothScrollModeNormal)
_screen->copyRegion(112, 0, 112, 0, 176, 120, 2, 0);
@@ -2139,6 +2141,8 @@ int LoLEngine::olol_restoreMagicShroud(EMCState *script) {
_screen->hideMouse();
+ // TODO: This function could need some major cleanup to work with our
+ // new palette code without needless conversions.
uint8 *fadeTab = new uint8[21504];
uint8 *tpal1 = fadeTab;
uint8 *tpal2 = tpal1 + 768;
@@ -2152,19 +2156,25 @@ int LoLEngine::olol_restoreMagicShroud(EMCState *script) {
_screen->loadPalette("LITEPAL3.COL", tpal1);
_screen->generateFadeTable(tpal2, tpal4, tpal1, 4);
+ Palette pal(768);
+
for (int i = 0; i < 21; i++) {
uint32 etime = _system->getMillis() + 20 * _tickLength;
mov->displayFrame(i, 0, 0, 0, 0, 0, 0);
_screen->updateScreen();
- _screen->setScreenPalette(tpal3);
+
+ pal.copy(tpal3, 0, 256);
+ _screen->setScreenPalette(pal);
tpal3 += 768;
+
if (i == 2 || i == 5 || i == 8 || i == 11 || i == 13 || i == 15 || i == 17 || i == 19)
snd_playSoundEffect(95, -1);
delayUntil(etime);
}
+ pal.copy(tpal3, 0, 256);
snd_playSoundEffect(91, -1);
- _screen->fadePalette(tpal3, 300);
+ _screen->fadePalette(pal, 300);
tpal3 += 768;
for (int i = 22; i < 38; i++) {
@@ -2173,7 +2183,9 @@ int LoLEngine::olol_restoreMagicShroud(EMCState *script) {
_screen->updateScreen();
if (i == 22 || i == 24 || i == 28 || i == 32) {
snd_playSoundEffect(131, -1);
- _screen->setScreenPalette(tpal3);
+
+ pal.copy(tpal3, 0, 256);
+ _screen->setScreenPalette(pal);
tpal3 += 768;
}
delayUntil(etime);
@@ -2289,7 +2301,7 @@ int LoLEngine::olol_getLanguage(EMCState *script) {
int LoLEngine::tlol_setupPaletteFade(const TIM *tim, const uint16 *param) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::t2_playSoundEffect(%p, %p) (%d)", (const void *)tim, (const void *)param, param[0]);
- _screen->getFadeParams(_screen->getPalette(0).getData(), param[0], _tim->_palDelayInc, _tim->_palDiff);
+ _screen->getFadeParams(_screen->getPalette(0), param[0], _tim->_palDelayInc, _tim->_palDiff);
_tim->_palDelayAcc = 0;
return 1;
}
@@ -2305,7 +2317,7 @@ int LoLEngine::tlol_setupPaletteFadeEx(const TIM *tim, const uint16 *param) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_setupPaletteFadeEx(%p, %p) (%d)", (const void *)tim, (const void *)param, param[0]);
_screen->copyPalette(0, 1);
- _screen->getFadeParams(_screen->getPalette(0).getData(), param[0], _tim->_palDelayInc, _tim->_palDiff);
+ _screen->getFadeParams(_screen->getPalette(0), param[0], _tim->_palDelayInc, _tim->_palDiff);
_tim->_palDelayAcc = 0;
return 1;
}
@@ -2390,7 +2402,7 @@ int LoLEngine::tlol_fadeClearWindow(const TIM *tim, const uint16 *param) {
case 1:
_screen->getPalette(3).copy(_screen->getPalette(0), 128);
_screen->loadSpecialColors(_screen->getPalette(3).getData());
- _screen->fadePalette(_screen->getPalette(3).getData(), 10);
+ _screen->fadePalette(_screen->getPalette(3), 10);
_screen->_fadeFlag = 0;
break;
@@ -2400,7 +2412,7 @@ int LoLEngine::tlol_fadeClearWindow(const TIM *tim, const uint16 *param) {
case 3:
_screen->loadSpecialColors(_screen->getPalette(3).getData());
- _screen->fadePalette(_screen->getPalette(3).getData(), 10);
+ _screen->fadePalette(_screen->getPalette(3), 10);
_screen->_fadeFlag = 0;
break;
@@ -2414,7 +2426,7 @@ int LoLEngine::tlol_fadeClearWindow(const TIM *tim, const uint16 *param) {
case 5:
_screen->loadSpecialColors(_screen->getPalette(3).getData());
- _screen->fadePalette(_screen->getPalette(1).getData(), 10);
+ _screen->fadePalette(_screen->getPalette(1), 10);
_screen->_fadeFlag = 0;
break;
@@ -2549,9 +2561,11 @@ int LoLEngine::tlol_unusedResourceFunc(const TIM *tim, const uint16 *param) {
int LoLEngine::tlol_fadeInPalette(const TIM *tim, const uint16 *param) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_fadeInPalette(%p, %p) (%d, %d)", (const void *)tim, (const void *)param, param[0], param[1]);
const char *bitmap = (const char *)(tim->text + READ_LE_UINT16(tim->text + (param[0]<<1)));
- uint8 palette[768];
- _screen->loadBitmap(bitmap, 3, 3, palette);
- _screen->fadePalette(palette, param[1]);
+
+ Palette pal(_screen->getPalette(0).getNumColors());
+ _screen->loadBitmap(bitmap, 3, 3, pal.getData());
+ _screen->fadePalette(pal, param[1]);
+
return 1;
}
diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp
index 1daab10dbd..abd09a51ac 100644
--- a/engines/kyra/script_tim.cpp
+++ b/engines/kyra/script_tim.cpp
@@ -439,9 +439,9 @@ void TIMInterpreter::setupTextPalette(uint index, int fadePalette) {
}
if (!fadePalette && !_palDiff) {
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
} else {
- _screen->getFadeParams(_screen->getPalette(0).getData(), fadePalette, _palDelayInc, _palDiff);
+ _screen->getFadeParams(_screen->getPalette(0), fadePalette, _palDelayInc, _palDiff);
_palDelayAcc = 0;
}
}
@@ -504,7 +504,7 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
}
if (wsaFlags & 2) {
- _screen->fadePalette(_screen->getPalette(1).getData(), 15, 0);
+ _screen->fadePalette(_screen->getPalette(1), 15, 0);
_screen->clearPage(_drawPage2);
if (_drawPage2)
_screen->checkedPageUpdate(8, 4);
@@ -526,10 +526,10 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
}
if (wsaFlags & 2)
- _screen->fadePalette(_screen->getPalette(0).getData(), 30, 0);
+ _screen->fadePalette(_screen->getPalette(0), 30, 0);
} else {
if (wsaFlags & 2) {
- _screen->fadePalette(_screen->getPalette(1).getData(), 15, 0);
+ _screen->fadePalette(_screen->getPalette(1), 15, 0);
_screen->clearPage(_drawPage2);
if (_drawPage2)
_screen->checkedPageUpdate(8, 4);
@@ -547,7 +547,7 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
}
if (wsaFlags & 2)
- _screen->fadePalette(_screen->getPalette(0).getData(), 30, 0);
+ _screen->fadePalette(_screen->getPalette(0), 30, 0);
}
return anim;
@@ -963,7 +963,7 @@ TIMInterpreter::Animation *TIMInterpreter_LoL::initAnimStruct(int index, const c
if (wsaFlags & 3) {
_screen->loadSpecialColors(_screen->getPalette(3).getData());
- _screen->fadePalette(_screen->getPalette(3).getData(), 10);
+ _screen->fadePalette(_screen->getPalette(3), 10);
_screen->_fadeFlag = 0;
}
diff --git a/engines/kyra/seqplayer.cpp b/engines/kyra/seqplayer.cpp
index 2d59f86e9f..bde0cae303 100644
--- a/engines/kyra/seqplayer.cpp
+++ b/engines/kyra/seqplayer.cpp
@@ -247,7 +247,7 @@ void SeqPlayer::s1_loadPalette() {
else if (colNum == 4)
_screen->copyPalette(0, 3);
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
} else {
uint32 fileSize;
uint8 *srcData;
diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp
index 03f92f188f..10df50eb2c 100644
--- a/engines/kyra/sequences_hof.cpp
+++ b/engines/kyra/sequences_hof.cpp
@@ -88,7 +88,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) {
if (cseq.flags & 2) {
_screen->loadBitmap(cseq.cpsFile, 2, 2, _screen->getPalette(0).getData());
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
} else {
_screen->setCurPage(2);
_screen->clearPage(2);
@@ -101,7 +101,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) {
if (cseq.flags & 1) {
_seqWsa->close();
_seqWsa->open(cseq.wsaFile, 0, _screen->getPalette(0).getData());
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
_seqWsa->displayFrame(0, 2, cseq.xPos, cseq.yPos, 0, 0, 0);
}
@@ -411,16 +411,16 @@ int KyraEngine_HoF::seq_introOverview(WSAMovie_v2 *wsaObj, int x, int y, int frm
case 200:
seq_waitForTextsTimeout();
- _screen->fadePalette(_screen->getPalette(2).getData(), 64);
+ _screen->fadePalette(_screen->getPalette(2), 64);
break;
case 201:
- _screen->setScreenPalette(_screen->getPalette(2).getData());
+ _screen->setScreenPalette(_screen->getPalette(2));
_screen->updateScreen();
_screen->applyOverlay(0, 0, 320, 200, 2, _screen->getPalette(3).getData());
_screen->copyPage(2, 12);
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0);
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
_screen->updateScreen();
seq_resetActiveWSA(0);
seq_resetActiveWSA(1);
@@ -1781,25 +1781,27 @@ int KyraEngine_HoF::seq_demoDig(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
#ifdef ENABLE_LOL
int KyraEngine_HoF::seq_lolDemoScene1(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
- uint8 *tmpPal = _screen->getPalette(2).getData();
+ Palette &tmpPal = _screen->getPalette(2);
if (!(_seqFrameCounter % 100)) {
if (_seqFrameCounter == 0) {
_sound->haltTrack();
_sound->playTrack(6);
}
- memcpy(tmpPal, _screen->getPalette(0).getData(), 0x300);
+ tmpPal.copy(_screen->getPalette(0));
+
for (int i = 3; i < 0x300; i++) {
tmpPal[i] = ((int)tmpPal[i] * 120) / 64;
if (tmpPal[i] > 0x3f)
tmpPal[i] = 0x3f;
}
+
seq_playTalkText(_rnd.getRandomBit());
_screen->setScreenPalette(tmpPal);
_screen->updateScreen();
delay(8);
} else {
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
_screen->updateScreen();
if (_seqFrameCounter == 40)
seq_playTalkText(3);
@@ -1924,15 +1926,17 @@ int KyraEngine_HoF::seq_lolDemoScene6(WSAMovie_v2 *wsaObj, int x, int y, int frm
}
if (_seqFrameCounter % 175) {
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
} else {
- uint8 *tmpPal = _screen->getPalette(2).getData();
- memcpy(tmpPal, _screen->getPalette(0).getData(), 0x300);
+ Palette &tmpPal = _screen->getPalette(2);
+ tmpPal.copy(_screen->getPalette(0));
+
for (int i = 3; i < 0x300; i++) {
tmpPal[i] = ((int)tmpPal[i] * 120) / 64;
if (tmpPal[i] > 0x3f)
tmpPal[i] = 0x3f;
}
+
seq_playTalkText(_rnd.getRandomBit());
_screen->setScreenPalette(tmpPal);
_screen->updateScreen();
@@ -2045,36 +2049,34 @@ char *KyraEngine_HoF::seq_preprocessString(const char *srcStr, int width) {
}
void KyraEngine_HoF::seq_sequenceCommand(int command) {
- uint8 pal[768];
-
for (int i = 0; i < 8; i++)
seq_resetActiveWSA(i);
switch (command) {
case 0:
- memset(pal, 0, 0x300);
- _screen->fadePalette(pal, 36);
+ _screen->fadeToBlack(36);
_screen->getPalette(0).clear();
_screen->getPalette(1).clear();
break;
case 1:
- memset(pal, 0x3F, 0x300);
seq_playTalkText(_rnd.getRandomBit());
- _screen->fadePalette(pal, 16);
- _screen->getPalette(0).copy(pal, 0, 256);
- _screen->getPalette(1).copy(pal, 0, 256);
+
+ memset(_screen->getPalette(0).getData(), 0x3F, 0x300);
+ _screen->fadePalette(_screen->getPalette(0), 16);
+
+ _screen->copyPalette(1, 0);
break;
case 3:
_screen->copyPage(2, 0);
- _screen->fadePalette(_screen->getPalette(0).getData(), 16);
+ _screen->fadePalette(_screen->getPalette(0), 16);
_screen->copyPalette(1, 0);
break;
case 4:
_screen->copyPage(2, 0);
- _screen->fadePalette(_screen->getPalette(0).getData(), 36);
+ _screen->fadePalette(_screen->getPalette(0), 36);
_screen->copyPalette(1, 0);
break;
@@ -2093,17 +2095,17 @@ void KyraEngine_HoF::seq_sequenceCommand(int command) {
break;
case 8:
- memset(pal, 0, 0x300);
- _screen->fadePalette(pal, 16);
- _screen->getPalette(0).copy(pal, 0, 256);
- _screen->getPalette(1).copy(pal, 0, 256);
+ _screen->fadeToBlack(16);
+ _screen->getPalette(0).clear();
+ _screen->getPalette(1).clear();
delay(120 * _tickLength);
break;
- case 9:
- for (int i = 0; i < 0x100; i++) {
- int pv = (_screen->getPalette(0)[3 * i] + _screen->getPalette(0)[3 * i + 1] + _screen->getPalette(0)[3 * i + 2]) / 3;
+ case 9: {
+ Palette &pal = _screen->getPalette(0);
+ for (int i = 0; i < 256; i++) {
+ int pv = (pal[3 * i] + pal[3 * i + 1] + pal[3 * i + 2]) / 3;
pal[3 * i] = pal[3 * i + 1] = pal[3 * i + 2] = pv & 0xff;
}
@@ -2112,9 +2114,8 @@ void KyraEngine_HoF::seq_sequenceCommand(int command) {
//pal[3 * i] = pal[3 * i + 1] = pal[3 * i + 2] = 0x3f;
_screen->fadePalette(pal, 64);
- _screen->getPalette(0).copy(pal, 0, 256);
- _screen->getPalette(1).copy(pal, 0, 256);
- break;
+ _screen->copyPalette(1, 0);
+ } break;
default:
break;
@@ -2435,7 +2436,7 @@ void KyraEngine_HoF::seq_printCreditsString(uint16 strIndex, int x, int y, const
_screen->getPalette(0)[0x2f7] = _screen->getPalette(0)[textcolor * 3];
_screen->getPalette(0)[0x2f8] = _screen->getPalette(0)[textcolor * 3 + 1];
_screen->getPalette(0)[0x2f9] = _screen->getPalette(0)[textcolor * 3 + 2];
- _screen->fadePalette(_screen->getPalette(0).getData(), 0x18);
+ _screen->fadePalette(_screen->getPalette(0), 0x18);
_seqTextColor[0] = textcolor;
_screen->setTextColorMap(colorMap);
@@ -2445,7 +2446,7 @@ void KyraEngine_HoF::seq_printCreditsString(uint16 strIndex, int x, int y, const
_screen->copyPage(2, 0);
_screen->updateScreen();
_screen->getPalette(0)[0x2f7] = _screen->getPalette(0)[0x2f8] = _screen->getPalette(0)[0x2f9] = 0;
- _screen->fadePalette(_screen->getPalette(0).getData(), 1);
+ _screen->fadePalette(_screen->getPalette(0), 1);
_screen->copyPage(2, 12);
seq_resetAllTextEntries();
@@ -2665,7 +2666,7 @@ void KyraEngine_HoF::seq_displayScrollText(uint8 *data, const ScreenDim *d, int
for (int col = 133; col > 112; col--)
_screen->getPalette(0).copy(_screen->getPalette(0), col - 1, 1, col);
_screen->getPalette(0).copy(_screen->getPalette(0), 133, 1, 112);
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
}
delayUntil(_seqSubFrameEndTimeInternal);
diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp
index a7686aa362..0fc39dc5c7 100644
--- a/engines/kyra/sequences_lok.cpp
+++ b/engines/kyra/sequences_lok.cpp
@@ -167,7 +167,7 @@ void KyraEngine_LoK::seq_introLogos() {
if (_flags.platform == Common::kPlatformAmiga) {
_screen->copyPalette(0, 1);
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
}
if ((_seq->playSequence(_seq_KyrandiaLogo, skipFlag()) && !seq_skipSequence()) || shouldQuit()) {
@@ -251,7 +251,7 @@ void KyraEngine_LoK::seq_introStory() {
_screen->loadBitmap("TEXT_ENG.CPS", 3, 3, _screen->getPalette(0).getData());
else
warning("no story graphics file found");
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
_screen->copyRegion(0, 0, 0, 0, 320, 200, 3, 0);
if (_flags.lang == Common::JA_JPN) {
@@ -569,12 +569,9 @@ void KyraEngine_LoK::seq_winterScroll1() {
_sprites->_anims[i].play = false;
_animator->sprites()[i].active = 0;
}
- uint8 tmpPal[768];
- memcpy(tmpPal, _screen->getPalette(0).getData(), 768);
- memcpy(&tmpPal[684], palTable2()[0], 60);
- _screen->fadePalette(tmpPal, 72);
_screen->getPalette(0).copy(palTable2()[0], 0, 20, 228);
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->fadePalette(_screen->getPalette(0), 72);
+ _screen->setScreenPalette(_screen->getPalette(0));
setGameFlag(0xB3);
} else {
delayWithTicks(120);
@@ -951,7 +948,7 @@ int KyraEngine_LoK::seq_playEnd() {
_screen->fadeSpecialPalette(32, 228, 20, 60);
delay(60 * _tickLength);
_screen->loadBitmap("GEMHEAL.CPS", 3, 3, _screen->getPalette(0).getData());
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _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);
@@ -1012,7 +1009,7 @@ void KyraEngine_LoK::seq_playEnding() {
drawSentenceCommand(_homeString[0], 179);
_screen->getPalette(2).clear();
- _screen->setScreenPalette(_screen->getPalette(2).getData());
+ _screen->setScreenPalette(_screen->getPalette(2));
_seqPlayerFlag = true;
_seq->playSequence(_seq_Reunion, false);
@@ -1124,9 +1121,9 @@ void KyraEngine_LoK::seq_playCredits() {
_screen->setCurPage(2);
_screen->getPalette(2).clear();
- _screen->setScreenPalette(_screen->getPalette(2).getData());
+ _screen->setScreenPalette(_screen->getPalette(2));
_screen->copyRegion(8, 32, 8, 32, 312, 128, 4, 0, Screen::CR_NO_P_CHECK);
- _screen->fadePalette(_screen->getPalette(0).getData(), 0x5A);
+ _screen->fadePalette(_screen->getPalette(0), 0x5A);
Common::Event event;
bool finished = false;
@@ -1683,7 +1680,7 @@ void KyraEngine_LoK::updateKyragemFading() {
_screen->getPalette(0)[palPos++] = kyraGemPalette[i + _kyragemFadingState.gOffset];
_screen->getPalette(0)[palPos++] = kyraGemPalette[i + _kyragemFadingState.bOffset];
}
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _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 b023b74cdb..0bc932f068 100644
--- a/engines/kyra/sequences_lol.cpp
+++ b/engines/kyra/sequences_lol.cpp
@@ -42,12 +42,12 @@ int LoLEngine::processPrologue() {
showIntro();
if (_flags.isDemo) {
- _screen->fadePalette(_screen->getPalette(1).getData(), 30, 0);
+ _screen->fadePalette(_screen->getPalette(1), 30, 0);
_screen->loadBitmap("FINAL.CPS", 2, 2, _screen->getPalette(0).getData());
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
- _screen->fadePalette(_screen->getPalette(0).getData(), 30, 0);
+ _screen->fadePalette(_screen->getPalette(0), 30, 0);
delayWithTicks(300);
- _screen->fadePalette(_screen->getPalette(1).getData(), 60, 0);
+ _screen->fadePalette(_screen->getPalette(1), 60, 0);
setupPrologueData(false);
return -1;
@@ -66,7 +66,7 @@ int LoLEngine::processPrologue() {
_screen->fprintString("SVM %s", 300 - width, 193, 0x67, 0x00, 0x04, gScummVMVersion);
_screen->setFont(Screen::FID_9_FNT);
- _screen->fadePalette(_screen->getPalette(0).getData(), 0x1E);
+ _screen->fadePalette(_screen->getPalette(0), 0x1E);
_screen->updateScreen();
_eventList.clear();
@@ -186,7 +186,7 @@ void LoLEngine::setupPrologueData(bool load) {
delete _chargenWSA; _chargenWSA = 0;
_screen->getPalette(0).clear();
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
if (shouldQuit())
return;
@@ -204,7 +204,7 @@ void LoLEngine::showIntro() {
showStarcraftLogo();
_screen->getPalette(0).clear();
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
_screen->clearPage(0);
_screen->clearPage(4);
@@ -234,8 +234,8 @@ void LoLEngine::showIntro() {
palNextFadeStep = _system->getMillis() + ((_tim->_palDelayAcc >> 8) * _tickLength);
_tim->_palDelayAcc &= 0xFF;
- if (!_screen->fadePalStep(_screen->getPalette(0).getData(), _tim->_palDiff)) {
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ if (!_screen->fadePalStep(_screen->getPalette(0), _tim->_palDiff)) {
+ _screen->setScreenPalette(_screen->getPalette(0));
_tim->_palDiff = 0;
}
}
@@ -259,7 +259,7 @@ void LoLEngine::showIntro() {
delete _tim;
_tim = 0;
- _screen->fadePalette(_screen->getPalette(1).getData(), 30, 0);
+ _screen->fadePalette(_screen->getPalette(1), 30, 0);
}
int LoLEngine::chooseCharacter() {
@@ -306,7 +306,7 @@ int LoLEngine::chooseCharacter() {
if (_flags.use16ColorMode)
_screen->loadPalette("LOL.NOL", _screen->getPalette(0).getData());
- _screen->fadePalette(_screen->getPalette(0).getData(), 30, 0);
+ _screen->fadePalette(_screen->getPalette(0), 30, 0);
bool kingIntro = true;
while (!shouldQuit()) {
@@ -728,7 +728,7 @@ void LoLEngine::setupEpilogueData(bool load) {
_sound->loadSoundFile("SOUND.DAT");
} else {
_screen->getPalette(0).clear();
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
if (shouldQuit())
return;
@@ -744,7 +744,7 @@ void LoLEngine::showOutro(int character, bool maxDifficulty) {
_tim = new TIMInterpreter(this, _screen, _system);
_screen->getPalette(0).clear();
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
_screen->clearPage(0);
_screen->clearPage(4);
@@ -773,8 +773,8 @@ void LoLEngine::showOutro(int character, bool maxDifficulty) {
palNextFadeStep = _system->getMillis() + ((_tim->_palDelayAcc >> 8) * _tickLength);
_tim->_palDelayAcc &= 0xFF;
- if (!_screen->fadePalStep(_screen->getPalette(0).getData(), _tim->_palDiff)) {
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ if (!_screen->fadePalStep(_screen->getPalette(0), _tim->_palDiff)) {
+ _screen->setScreenPalette(_screen->getPalette(0));
_tim->_palDiff = 0;
}
}
@@ -828,7 +828,7 @@ void LoLEngine::showOutro(int character, bool maxDifficulty) {
if (maxDifficulty)
_tim->displayText(0x8000, 0, 0xDC);
_screen->updateScreen();
- _screen->fadePalette(_screen->getPalette(0).getData(), 30, 0);
+ _screen->fadePalette(_screen->getPalette(0), 30, 0);
while (!checkInput(0) && !shouldQuit())
delay(_tickLength);
@@ -907,7 +907,7 @@ void LoLEngine::processCredits(char *t, int dimState, int page, int delayTime) {
assert(monsterPal);
_screen->getPalette(0).copy(monsterPal, 0, 40, 88);
- _screen->fadePalette(_screen->getPalette(0).getData(), 30);
+ _screen->fadePalette(_screen->getPalette(0), 30);
uint32 waitTimer = _system->getMillis();
@@ -1049,7 +1049,7 @@ void LoLEngine::processCredits(char *t, int dimState, int page, int delayTime) {
doorRedraw = false;
} else {
if (!monsterAnimFrame)
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, page, Screen::CR_NO_P_CHECK);
@@ -1130,7 +1130,7 @@ void LoLEngine::processCredits(char *t, int dimState, int page, int delayTime) {
loadOutroShapes(curShapeFile, shapes);
_screen->getPalette(0).copy(monsterPal, curShapeFile * 40, 40, 88);
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
needNewShape = false;
}
diff --git a/engines/kyra/text_lok.cpp b/engines/kyra/text_lok.cpp
index 4bb7f857d9..baae4547e5 100644
--- a/engines/kyra/text_lok.cpp
+++ b/engines/kyra/text_lok.cpp
@@ -333,7 +333,7 @@ void KyraEngine_LoK::drawSentenceCommand(const char *sentence, int color) {
_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->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
_startSentencePalIndex = 0;
}
@@ -371,7 +371,7 @@ void KyraEngine_LoK::updateTextFade() {
_screen->getPalette(0)[765] = _currSentenceColor[0];
_screen->getPalette(0)[766] = _currSentenceColor[1];
_screen->getPalette(0)[767] = _currSentenceColor[2];
- _screen->setScreenPalette(_screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0));
if (finished) {
_fadeText = false;
diff --git a/engines/kyra/vqa.cpp b/engines/kyra/vqa.cpp
index 0d5df03474..bfb27d0d16 100644
--- a/engines/kyra/vqa.cpp
+++ b/engines/kyra/vqa.cpp
@@ -520,9 +520,8 @@ void VQAMovie::displayFrame(uint frameNum) {
// The frame has been decoded
- if (_frameInfo[frameNum] & 0x80000000) {
- _vm->screen()->setScreenPalette(_vm->screen()->getPalette(0).getData());
- }
+ if (_frameInfo[frameNum] & 0x80000000)
+ _vm->screen()->setScreenPalette(_vm->screen()->getPalette(0));
int blockPitch = _header.width / _header.blockW;