aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorJohannes Schickel2009-06-22 02:35:45 +0000
committerJohannes Schickel2009-06-22 02:35:45 +0000
commit882662977f2cdf574e5aab041ceaaf626386d0f2 (patch)
tree5c1bddf867152fe6d7c274416e8ddc2c4ea66e53 /engines/kyra
parent9da52cb28280e0164db7073b0d3ea5abb4d20934 (diff)
downloadscummvm-rg350-882662977f2cdf574e5aab041ceaaf626386d0f2.tar.gz
scummvm-rg350-882662977f2cdf574e5aab041ceaaf626386d0f2.tar.bz2
scummvm-rg350-882662977f2cdf574e5aab041ceaaf626386d0f2.zip
Changed Screen::getPalette to return a reference to a Palette object.
svn-id: r41741
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/gui_hof.cpp26
-rw-r--r--engines/kyra/gui_lok.cpp12
-rw-r--r--engines/kyra/gui_lol.cpp4
-rw-r--r--engines/kyra/gui_mr.cpp10
-rw-r--r--engines/kyra/kyra_hof.cpp38
-rw-r--r--engines/kyra/kyra_lok.cpp2
-rw-r--r--engines/kyra/kyra_mr.cpp24
-rw-r--r--engines/kyra/lol.cpp58
-rw-r--r--engines/kyra/scene_hof.cpp21
-rw-r--r--engines/kyra/scene_lok.cpp20
-rw-r--r--engines/kyra/scene_lol.cpp48
-rw-r--r--engines/kyra/scene_mr.cpp22
-rw-r--r--engines/kyra/screen.cpp22
-rw-r--r--engines/kyra/screen.h2
-rw-r--r--engines/kyra/screen_lok.cpp10
-rw-r--r--engines/kyra/screen_lol.cpp10
-rw-r--r--engines/kyra/script_hof.cpp46
-rw-r--r--engines/kyra/script_lok.cpp41
-rw-r--r--engines/kyra/script_lol.cpp54
-rw-r--r--engines/kyra/script_tim.cpp28
-rw-r--r--engines/kyra/seqplayer.cpp14
-rw-r--r--engines/kyra/sequences_hof.cpp120
-rw-r--r--engines/kyra/sequences_lok.cpp60
-rw-r--r--engines/kyra/sequences_lol.cpp85
-rw-r--r--engines/kyra/sprites.cpp10
-rw-r--r--engines/kyra/staticres.cpp4
-rw-r--r--engines/kyra/text_lok.cpp4
-rw-r--r--engines/kyra/vqa.cpp6
28 files changed, 395 insertions, 406 deletions
diff --git a/engines/kyra/gui_hof.cpp b/engines/kyra/gui_hof.cpp
index 6cfa68cc79..9a79eb46e3 100644
--- a/engines/kyra/gui_hof.cpp
+++ b/engines/kyra/gui_hof.cpp
@@ -281,7 +281,7 @@ void KyraEngine_HoF::scrollInventoryWheel() {
int frames = movie.opened() ? movie.frames() : 6;
memcpy(_screenBuffer, _screen->getCPagePtr(2), 64000);
uint8 overlay[0x100];
- _screen->generateOverlay(_screen->getPalette(0), overlay, 0, 50);
+ _screen->generateOverlay(_screen->getPalette(0).getData(), overlay, 0, 50);
_screen->hideMouse();
_screen->copyRegion(0x46, 0x90, 0x46, 0x79, 0x71, 0x17, 0, 2, Screen::CR_NO_P_CHECK);
_screen->showMouse();
@@ -365,9 +365,9 @@ int KyraEngine_HoF::bookButton(Button *button) {
_screen->showMouse();
}
- memcpy(_screen->getPalette(2), _screen->getPalette(0), 768);
+ _screen->getPalette(2).copy(_screen->getPalette(0));
_screen->fadeToBlack(7, &_updateFunctor);
- _res->loadFileToBuf("_BOOK.COL", _screen->getPalette(0), 768);
+ _res->loadFileToBuf("_BOOK.COL", _screen->getPalette(0).getData(), 768);
loadBookBkgd();
showBookPage();
_screen->copyRegion(0, 0, 0, 0, 0x140, 0xC8, 2, 0, Screen::CR_NO_P_CHECK);
@@ -375,7 +375,7 @@ int KyraEngine_HoF::bookButton(Button *button) {
int oldItemInHand = _itemInHand;
removeHandItem();
- _screen->fadePalette(_screen->getPalette(0), 7);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 7);
_screen->showMouse();
bookLoop();
@@ -393,8 +393,8 @@ int KyraEngine_HoF::bookButton(Button *button) {
}
setHandItem(_itemInHand);
- memcpy(_screen->getPalette(0), _screen->getPalette(2), 768);
- _screen->fadePalette(_screen->getPalette(0), 7, &_updateFunctor);
+ _screen->getPalette(0).copy(_screen->getPalette(2));
+ _screen->fadePalette(_screen->getPalette(0).getData(), 7, &_updateFunctor);
_screen->showMouse();
if (!queryGameFlag(4) && !queryGameFlag(0xB8)) {
@@ -800,26 +800,26 @@ void GUI_HoF::createScreenThumbnail(Graphics::Surface &dst) {
}
void GUI_HoF::setupPalette() {
- memcpy(_screen->getPalette(1), _screen->getPalette(0), 768);
+ _screen->getPalette(1).copy(_screen->getPalette(0));
- uint8 *palette = _screen->getPalette(0);
+ uint8 *palette = _screen->getPalette(0).getData();
for (int i = 0; i < 768; ++i)
palette[i] >>= 1;
static const uint8 guiPal[] = { 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFc, 0xFD, 0xFE };
for (uint i = 0; i < ARRAYSIZE(guiPal); ++i)
- memcpy(_screen->getPalette(0)+guiPal[i]*3, _screen->getPalette(1)+guiPal[i]*3, 3);
+ _screen->getPalette(0).copy(_screen->getPalette(1), guiPal[i], 1);
if (_isDeathMenu)
- _screen->fadePalette(_screen->getPalette(0), 0x64);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 0x64);
else
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
}
void GUI_HoF::restorePalette() {
- memcpy(_screen->getPalette(0), _screen->getPalette(1), 768);
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->getPalette(0).copy(_screen->getPalette(1));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
}
void GUI_HoF::resetState(int item) {
diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp
index 255a5dcd74..c1f439707b 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->getPalette(0), 768);
+ _screen->getPalette(2).copy(_screen->getPalette(0));
for (int i = 0; i < 768; i++)
_screen->getPalette(0)[i] >>= 1;
while (menuPalIndexes[index] != -1) {
- memcpy(&_screen->getPalette(0)[menuPalIndexes[index]*3], &_screen->getPalette(2)[menuPalIndexes[index]*3], 3);
- index++;
+ _screen->getPalette(0).copy(_screen->getPalette(2), menuPalIndexes[index], 1);
+ ++index;
}
- _screen->fadePalette(_screen->getPalette(0), 2);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 2);
}
void GUI_LoK::restorePalette() {
if (_vm->gameFlags().platform == Common::kPlatformAmiga)
return;
- memcpy(_screen->getPalette(0), _screen->getPalette(2), 768);
- _screen->fadePalette(_screen->getPalette(0), 2);
+ _screen->getPalette(0).copy(_screen->getPalette(2));
+ _screen->fadePalette(_screen->getPalette(0).getData(), 2);
}
#pragma mark -
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index 5e03f3d9bb..15dcbff761 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->getPalette(0), _brightness, _lampEffect);
+ setPaletteBrightness(_screen->getPalette(0).getData(), _brightness, _lampEffect);
return 1;
}
@@ -1842,7 +1842,7 @@ int LoLEngine::clickedLamp(Button *button) {
}
if (_brightness)
- setPaletteBrightness(_screen->getPalette(0), _brightness, _lampEffect);
+ setPaletteBrightness(_screen->getPalette(0).getData(), _brightness, _lampEffect);
return 1;
}
diff --git a/engines/kyra/gui_mr.cpp b/engines/kyra/gui_mr.cpp
index 515c51cb2c..f1c1078b74 100644
--- a/engines/kyra/gui_mr.cpp
+++ b/engines/kyra/gui_mr.cpp
@@ -674,13 +674,13 @@ void KyraEngine_MR::showAlbum() {
_screen->copyRegionToBuffer(0, 0, 0, 320, 200, _screenBuffer);
_screen->copyRegionToBuffer(4, 0, 0, 320, 200, _album.backUpPage);
- memcpy(_screen->getPalette(1), _screen->getPalette(0), 768);
+ _screen->getPalette(1).copy(_screen->getPalette(0));
_screen->fadeToBlack(9);
int itemInHand = _itemInHand;
removeHandItem();
- _res->loadFileToBuf("ALBUM.COL", _screen->getPalette(0), 768);
+ _res->loadFileToBuf("ALBUM.COL", _screen->getPalette(0).getData(), 768);
loadAlbumPage();
loadAlbumPageWSA();
@@ -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), 9);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 9);
processAlbum();
@@ -707,8 +707,8 @@ void KyraEngine_MR::showAlbum() {
_screen->copyBlockToPage(0, 0, 0, 320, 200, _screenBuffer);
_screen->copyBlockToPage(4, 0, 0, 320, 200, _album.backUpPage);
- memcpy(_screen->getPalette(0), _screen->getPalette(1), 768);
- _screen->fadePalette(_screen->getPalette(0), 9);
+ _screen->getPalette(0).copy(_screen->getPalette(1));
+ _screen->fadePalette(_screen->getPalette(0).getData(), 9);
delete[] _album.backUpRect;
_album.backUpRect = 0;
diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp
index 6fafbbc224..df007e87b4 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->getPalette(0), 0x300);
+ _res->loadFileToBuf("PALETTE.COL", _screen->getPalette(0).getData(), 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->getPalette(0) + palIndex, 3);
- memmove(_screen->getPalette(0) + 765, _screen->getPalette(0) + palIndex, 3);
- _screen->setScreenPalette(_screen->getPalette(0));
+ 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());
}
int x = _text->getCenterStringX(string, 0, 320);
@@ -978,8 +978,8 @@ void KyraEngine_HoF::fadeMessagePalette() {
}
if (updatePalette) {
- memcpy(_screen->getPalette(0) + 765, _messagePal, 3);
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->getPalette(0).copy(_messagePal, 0, 1, 255);
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
} else {
_fadeMessagePalette = false;
}
@@ -1139,18 +1139,18 @@ void KyraEngine_HoF::updateCharPal(int unk1) {
if (palEntry != _charPalEntry && unk1) {
const uint8 *src = &_scenePal[(palEntry << 4) * 3];
- uint8 *ptr = _screen->getPalette(0) + 336;
+ uint8 *ptr = _screen->getPalette(0).getData() + 336;
for (int i = 0; i < 48; ++i) {
*ptr -= (*ptr - *src) >> 1;
++ptr;
++src;
}
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
unkVar1 = true;
_charPalEntry = palEntry;
} else if (unkVar1 || !unk1) {
- memcpy(_screen->getPalette(0) + 336, &_scenePal[(palEntry << 4) * 3], 48);
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->getPalette(0).copy(_scenePal, palEntry << 4, 16, 112);
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
unkVar1 = false;
}
}
@@ -1656,24 +1656,24 @@ void KyraEngine_HoF::displayInvWsaLastFrame() {
#pragma mark -
void KyraEngine_HoF::setCauldronState(uint8 state, bool paletteFade) {
- memcpy(_screen->getPalette(2), _screen->getPalette(0), 768);
+ _screen->getPalette(2).copy(_screen->getPalette(0));
Common::SeekableReadStream *file = _res->createReadStream("_POTIONS.PAL");
if (!file)
error("Couldn't load cauldron palette");
file->seek(state*18, SEEK_SET);
- file->read(_screen->getPalette(2)+723, 18);
+ file->read(_screen->getPalette(2).getData() + 723, 18);
delete file;
file = 0;
if (paletteFade) {
snd_playSoundEffect((state == 0) ? 0x6B : 0x66);
- _screen->fadePalette(_screen->getPalette(2), 0x4B, &_updateFunctor);
+ _screen->fadePalette(_screen->getPalette(2).getData(), 0x4B, &_updateFunctor);
} else {
- _screen->setScreenPalette(_screen->getPalette(2));
+ _screen->setScreenPalette(_screen->getPalette(2).getData());
_screen->updateScreen();
}
- memcpy(_screen->getPalette(0)+723, _screen->getPalette(2)+723, 18);
+ _screen->getPalette(0).copy(_screen->getPalette(2), 241, 6);
_cauldronState = state;
_cauldronUseCount = 0;
//if (state == 5)
@@ -1833,13 +1833,13 @@ void KyraEngine_HoF::cauldronRndPaletteFade() {
if (!file)
error("Couldn't load cauldron palette");
file->seek(index*18, SEEK_SET);
- file->read(_screen->getPalette(0)+723, 18);
+ file->read(_screen->getPalette(0).getData()+723, 18);
snd_playSoundEffect(0x6A);
- _screen->fadePalette(_screen->getPalette(0), 0x1E, &_updateFunctor);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 0x1E, &_updateFunctor);
file->seek(0, SEEK_SET);
- file->read(_screen->getPalette(0)+723, 18);
+ file->read(_screen->getPalette(0).getData()+723, 18);
delete file;
- _screen->fadePalette(_screen->getPalette(0), 0x1E, &_updateFunctor);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 0x1E, &_updateFunctor);
}
void KyraEngine_HoF::resetCauldronStateTable(int idx) {
diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp
index 4d3b3e75c1..6d5c95a55c 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->getPalette(0));
+ _screen->loadPalette("PALETTE.COL", _screen->getPalette(0).getData());
// XXX
_animator->initAnimStateList();
diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp
index b9210c6093..d08f158aa8 100644
--- a/engines/kyra/kyra_mr.cpp
+++ b/engines/kyra/kyra_mr.cpp
@@ -230,8 +230,8 @@ Common::Error KyraEngine_MR::init() {
_screen->setAnimBlockPtr(3500);
_screen->setScreenDim(0);
- _res->loadFileToBuf("PALETTE.COL", _screen->getPalette(0), 768);
- _screen->setScreenPalette(_screen->getPalette(0));
+ _res->loadFileToBuf("PALETTE.COL", _screen->getPalette(0).getData(), 768);
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
return Common::kNoError;
}
@@ -267,7 +267,7 @@ Common::Error KyraEngine_MR::go() {
_screen->_curPage = 0;
_screen->clearPage(0);
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
// XXX
playMenuAudioFile();
@@ -328,8 +328,8 @@ Common::Error KyraEngine_MR::go() {
void KyraEngine_MR::initMainMenu() {
_menuAnim = new WSAMovie_v2(this);
- _menuAnim->open("REVENGE.WSA", 1, _screen->getPalette(0));
- memset(_screen->getPalette(0), 0, 3);
+ _menuAnim->open("REVENGE.WSA", 1, _screen->getPalette(0).getData());
+ memset(_screen->getPalette(0).getData(), 0, 3);
_menu = new MainMenu(this);
MainMenu::StaticData data = {
@@ -378,7 +378,7 @@ void KyraEngine_MR::playVQA(const char *name) {
}
_screen->hideMouse();
- memcpy(_screen->getPalette(1), _screen->getPalette(0), 768);
+ _screen->getPalette(1).copy(_screen->getPalette(0));
fadeOutMusic(60);
_screen->fadeToBlack(60);
_screen->clearPage(0);
@@ -395,7 +395,7 @@ void KyraEngine_MR::playVQA(const char *name) {
memset(pal, 1, sizeof(pal));
_screen->setScreenPalette(pal);
_screen->clearPage(0);
- memcpy(_screen->getPalette(0), _screen->getPalette(1), 768);
+ _screen->getPalette(0).copy(_screen->getPalette(1));
_wasPlayingVQA = true;
}
}
@@ -627,9 +627,9 @@ void KyraEngine_MR::startup() {
loadInterfaceShapes();
musicUpdate(0);
- _res->loadFileToBuf("PALETTE.COL", _screen->getPalette(0), 768);
+ _res->loadFileToBuf("PALETTE.COL", _screen->getPalette(0).getData(), 768);
_paletteOverlay = new uint8[256];
- _screen->generateOverlay(_screen->getPalette(0), _paletteOverlay, 0xF0, 0x19);
+ _screen->generateOverlay(_screen->getPalette(0).getData(), _paletteOverlay, 0xF0, 0x19);
loadInterface();
musicUpdate(0);
@@ -899,7 +899,7 @@ void KyraEngine_MR::updateCharAnimFrame(int character, int *table) {
void KyraEngine_MR::updateCharPal(int unk1) {
int layer = _screen->getLayer(_mainCharacter.x1, _mainCharacter.y1) - 1;
const uint8 *src = _costPalBuffer + _characterShapeFile * 72;
- uint8 *dst = _screen->getPalette(0) + 432;
+ uint8 *dst = _screen->getPalette(0).getData() + 432;
const int8 *sceneDatPal = &_sceneDatPalette[layer * 3];
if (layer != _lastCharPalLayer && unk1) {
@@ -919,7 +919,7 @@ void KyraEngine_MR::updateCharPal(int unk1) {
}
}
_charPalUpdate = true;
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
_lastCharPalLayer = layer;
} else if (_charPalUpdate || !unk1) {
memcpy(dst, src, 72);
@@ -936,7 +936,7 @@ void KyraEngine_MR::updateCharPal(int unk1) {
}
}
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
_charPalUpdate = false;
}
}
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 82c5e2c28c..052a805843 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -778,20 +778,20 @@ int LoLEngine::mainMenu() {
void LoLEngine::startup() {
_screen->clearPage(0);
- _screen->loadBitmap("PLAYFLD.CPS", 3, 3, _screen->getPalette(0));
+ _screen->loadBitmap("PLAYFLD.CPS", 3, 3, _screen->getPalette(0).getData());
uint8 *tmpPal = new uint8[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);
+ memcpy(tmpPal, _screen->getPalette(0).getData(), 0x300);
+ memset(_screen->getPalette(0).getData(), 0x3f, 0x180);
+ _screen->getPalette(0).copy(tmpPal, 1, 1);
+ memset(_screen->getPalette(0).getData() + 0x240, 0x3f, 12);
+ _screen->generateOverlay(_screen->getPalette(0).getData(), _screen->_paletteOverlay1, 1, 96);
+ _screen->generateOverlay(_screen->getPalette(0).getData(), _screen->_paletteOverlay2, 144, 65);
+ _screen->getPalette(0).copy(tmpPal, 0, 256);
delete[] tmpPal;
- memset(_screen->getPalette(1), 0, 0x300);
- memset(_screen->getPalette(2), 0, 0x300);
+ _screen->getPalette(1).clear();
+ _screen->getPalette(2).clear();
loadItemIconShapes();
_screen->setMouseCursor(0, 0, _itemIconShapes[0x85]);
@@ -1541,7 +1541,7 @@ void LoLEngine::restoreAfterSceneWindowDialogue(int redraw) {
if (_screen->_fadeFlag != 2)
_screen->fadeClearSceneWindow(10);
gui_drawPlayField();
- setPaletteBrightness(_screen->getPalette(0), _brightness, _lampEffect);
+ setPaletteBrightness(_screen->getPalette(0).getData(), _brightness, _lampEffect);
_screen->_fadeFlag = 0;
}
@@ -1676,8 +1676,8 @@ 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), brightness, modifier);
- _screen->fadePalette(_screen->getPalette(1), 5, 0);
+ generateBrightnessPalette(palette, _screen->getPalette(1).getData(), brightness, modifier);
+ _screen->fadePalette(_screen->getPalette(1).getData(), 5, 0);
_screen->_fadeFlag = 0;
}
@@ -2067,7 +2067,7 @@ int LoLEngine::processMagicHealSelectTarget() {
int LoLEngine::processMagicHeal(int charNum, int spellLevel) {
if (!_healOverlay) {
_healOverlay = new uint8[256];
- _screen->generateGrayOverlay(_screen->getPalette(1), _healOverlay, 52, 22, 20, 0, 256, true);
+ _screen->generateGrayOverlay(_screen->getPalette(1).getData(), _healOverlay, 52, 22, 20, 0, 256, true);
}
const uint8 *healShpFrames = 0;
@@ -2189,8 +2189,8 @@ int LoLEngine::processMagicIce(int charNum, int spellLevel) {
uint8 *swampCol = new uint8[768];
if (_currentLevel == 11 && !(_flagsTable[52] & 0x04)) {
- uint8 *sc = _screen->getPalette(0);
- uint8 *dc = _screen->getPalette(2);
+ uint8 *sc = _screen->getPalette(0).getData();
+ uint8 *dc = _screen->getPalette(2).getData();
for (int i = 1; i < 768; i++)
SWAP(sc[i], dc[i]);
_flagsTable[52] |= 0x04;
@@ -2200,7 +2200,7 @@ int LoLEngine::processMagicIce(int charNum, int spellLevel) {
uint8 *sc = _res->fileData("swampice.col", 0);
memcpy(swampCol, sc, 384);
- uint8 *s = _screen->getPalette(1);
+ uint8 *s = _screen->getPalette(1).getData();
for (int i = 384; i < 768; i++)
swampCol[i] = tpal[i] = s[i] & 0x3f;
@@ -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->getPalette(0), s, _brightness, _lampEffect);
+ generateBrightnessPalette(_screen->getPalette(0).getData(), 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->getPalette(0), swampCol, _brightness, _lampEffect);
+ generateBrightnessPalette(_screen->getPalette(0).getData(), swampCol, _brightness, _lampEffect);
playSpellAnimation(0, 0, 0, 2, 0, 0, 0, tpal, swampCol, 40, 0);
@@ -2617,7 +2617,7 @@ int LoLEngine::processMagicLightning(int charNum, int spellLevel) {
mov->close();
delete mov;
- _screen->setScreenPalette(_screen->getPalette(1));
+ _screen->setScreenPalette(_screen->getPalette(1).getData());
_screen->copyPage(12, 2);
_screen->copyPage(12, 0);
updateDrawPage2();
@@ -2736,7 +2736,7 @@ int LoLEngine::processMagicSwarm(int charNum, int damage) {
int LoLEngine::processMagicVaelansCube() {
uint8 *tmpPal1 = new uint8[768];
uint8 *tmpPal2 = new uint8[768];
- uint8 *sp1 = _screen->getPalette(1);
+ uint8 *sp1 = _screen->getPalette(1).getData();
memcpy(tmpPal1, sp1, 768);
memcpy(tmpPal2, sp1, 768);
@@ -2840,7 +2840,7 @@ void LoLEngine::callbackProcessMagicLightning(WSAMovie_v2 *mov, int x, int y) {
if (_lightningDiv == 2)
shakeScene(1, 2, 3, 0);
- uint8 *p1 = _screen->getPalette(1);
+ uint8 *p1 = _screen->getPalette(1).getData();
if (_lightningSfxFrame % _lightningDiv) {
_screen->setScreenPalette(p1);
@@ -3659,9 +3659,9 @@ void LoLEngine::restoreSwampPalette() {
if (_currentLevel != 11)
return;
- uint8 *s = _screen->getPalette(2);
- uint8 *d = _screen->getPalette(0);
- uint8 *d2 = _screen->getPalette(1);
+ uint8 *s = _screen->getPalette(2).getData();
+ uint8 *d = _screen->getPalette(0).getData();
+ uint8 *d2 = _screen->getPalette(1).getData();
for (int i = 1; i < 768; i++)
SWAP(s[i], d[i]);
@@ -3841,14 +3841,14 @@ void LoLEngine::displayAutomap() {
uint8 *tmpWll = new uint8[80];
memcpy(tmpWll, _wllBuffer4, 80);
- _screen->loadBitmap("parch.cps", 2, 2, _screen->getPalette(3));
+ _screen->loadBitmap("parch.cps", 2, 2, _screen->getPalette(3).getData());
_screen->loadBitmap("autobut.shp", 3, 5, 0);
const uint8 *shp = _screen->getCPagePtr(5);
for (int i = 0; i < 109; i++)
_automapShapes[i] = _screen->getPtrToShape(shp, i + 11);
- _screen->generateGrayOverlay(_screen->getPalette(3), _mapOverlay, 52, 0, 0, 0, 256, false);
+ _screen->generateGrayOverlay(_screen->getPalette(3).getData(), _mapOverlay, 52, 0, 0, 0, 256, false);
_screen->loadFont(Screen::FID_9_FNT, "FONT9PN.FNT");
_screen->loadFont(Screen::FID_6_FNT, "FONT6PN.FNT");
@@ -3871,7 +3871,7 @@ void LoLEngine::displayAutomap() {
_screen->copyPage(2, 0);
_screen->updateScreen();
- _screen->fadePalette(_screen->getPalette(3), 10);
+ _screen->fadePalette(_screen->getPalette(3).getData(), 10);
uint32 delayTimer = _system->getMillis() + 8 * _tickLength;
while (!exitAutomap && !shouldQuit()) {
@@ -4009,7 +4009,7 @@ void LoLEngine::loadMapLegendData(int level) {
void LoLEngine::drawMapPage(int pageNum) {
for (int i = 0; i < 2; i++) {
- _screen->loadBitmap("parch.cps", pageNum, pageNum, _screen->getPalette(3));
+ _screen->loadBitmap("parch.cps", pageNum, pageNum, _screen->getPalette(3).getData());
int cp = _screen->setCurPage(pageNum);
Screen::FontId of = _screen->setFont(Screen::FID_9_FNT);
diff --git a/engines/kyra/scene_hof.cpp b/engines/kyra/scene_hof.cpp
index fed7877c0b..8f8005c352 100644
--- a/engines/kyra/scene_hof.cpp
+++ b/engines/kyra/scene_hof.cpp
@@ -396,14 +396,14 @@ void KyraEngine_HoF::unloadScene() {
void KyraEngine_HoF::loadScenePal() {
uint16 sceneId = _mainCharacter.sceneId;
- memcpy(_screen->getPalette(1), _screen->getPalette(0), 768);
+ _screen->getPalette(1).copy(_screen->getPalette(0));
char filename[14];
strcpy(filename, _sceneList[sceneId].filename1);
strcat(filename, ".COL");
_screen->loadBitmap(filename, 3, 3, 0);
- memcpy(_screen->getPalette(1), _screen->getCPagePtr(3), 384);
- memset(_screen->getPalette(1), 0, 3);
+ _screen->getPalette(1).copy(_screen->getCPagePtr(3), 0, 128);
+ memset(_screen->getPalette(1).getData(), 0, 3);
memcpy(_scenePal, _screen->getCPagePtr(3)+336, 432);
}
@@ -669,15 +669,15 @@ void KyraEngine_HoF::initSceneScreen(int unk1) {
}
if (_noScriptEnter) {
- memset(_screen->getPalette(0), 0, 384);
- _screen->setScreenPalette(_screen->getPalette(0));
+ memset(_screen->getPalette(0).getData(), 0, 384);
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
}
_screen->copyRegion(0, 0, 0, 0, 320, 144, 2, 0, Screen::CR_NO_P_CHECK);
if (_noScriptEnter) {
- _screen->setScreenPalette(_screen->getPalette(1));
- memcpy(_screen->getPalette(0), _screen->getPalette(1), 384);
+ _screen->setScreenPalette(_screen->getPalette(1).getData());
+ _screen->getPalette(0).copy(_screen->getPalette(1), 0, 128);
}
updateCharPal(0);
@@ -695,11 +695,8 @@ void KyraEngine_HoF::freeSceneShapePtrs() {
}
void KyraEngine_HoF::fadeScenePal(int srcIndex, int delayTime) {
- uint8 *dst = _screen->getPalette(0) + 336;
- const uint8 *src = _scenePal + (srcIndex << 4)*3;
- memcpy(dst, src, 48);
-
- _screen->fadePalette(_screen->getPalette(0), delayTime, &_updateFunctor);
+ _screen->getPalette(0).copy(_scenePal, srcIndex << 4, 16, 112);
+ _screen->fadePalette(_screen->getPalette(0).getData(), delayTime, &_updateFunctor);
}
#pragma mark -
diff --git a/engines/kyra/scene_lok.cpp b/engines/kyra/scene_lok.cpp
index 345998e40e..c020fccee1 100644
--- a/engines/kyra/scene_lok.cpp
+++ b/engines/kyra/scene_lok.cpp
@@ -406,7 +406,7 @@ void KyraEngine_LoK::startSceneScript(int brandonAlive) {
_screen->clearPage(3);
_res->exists(fileNameBuffer, true);
// FIXME: check this hack for amiga version
- _screen->loadBitmap(fileNameBuffer, 3, 3, (_flags.platform == Common::kPlatformAmiga ? _screen->getPalette(0) : 0));
+ _screen->loadBitmap(fileNameBuffer, 3, 3, (_flags.platform == Common::kPlatformAmiga ? _screen->getPalette(0).getData() : 0));
_sprites->loadSceneShapes();
_exitListPtr = 0;
@@ -770,9 +770,9 @@ void KyraEngine_LoK::initSceneObjectList(int brandonAlive) {
void KyraEngine_LoK::initSceneScreen(int brandonAlive) {
if (_flags.platform == Common::kPlatformAmiga) {
if (_unkScreenVar1 && !queryGameFlag(0xF0)) {
- memset(_screen->getPalette(2), 0, 32*3);
+ _screen->getPalette(2).clear();
if (_currentCharacter->sceneId != 117 || !queryGameFlag(0xB3))
- _screen->setScreenPalette(_screen->getPalette(2));
+ _screen->setScreenPalette(_screen->getPalette(2).getData());
}
if (_unkScreenVar2 == 1)
@@ -782,12 +782,12 @@ void KyraEngine_LoK::initSceneScreen(int brandonAlive) {
if (_unkScreenVar1 && !queryGameFlag(0xA0)) {
if (_currentCharacter->sceneId == 45 && _paletteChanged)
- memcpy(_screen->getPalette(0) + 12*3, _screen->getPalette(4) + 12*3, 2);
+ _screen->getPalette(0).copy(_screen->getPalette(4), 12, 1);
if (_currentCharacter->sceneId >= 229 && _currentCharacter->sceneId <= 245 && (_brandonStatusBit & 1))
- memcpy(_screen->getPalette(0), _screen->getPalette(0) + 320*3, 64);
+ _screen->getPalette(0).copy(_screen->getPalette(10));
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
}
} 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));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
}
if (_unkScreenVar2 == 1)
@@ -807,10 +807,10 @@ void KyraEngine_LoK::initSceneScreen(int brandonAlive) {
if (_unkScreenVar1 && _paletteChanged) {
if (!queryGameFlag(0xA0)) {
- memcpy(_screen->getPalette(0) + 684, _screen->getPalette(1) + 684, 60);
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->getPalette(0).copy(_screen->getPalette(1), 228, 20);
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
} else {
- memset(_screen->getPalette(0), 0, 768);
+ _screen->getPalette(0).clear();
}
}
}
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index 28bd87ecc4..cb628be48e 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->getPalette(0), _screen->_grayOverlay, 32, 16, 0, 0, 128, true);
+ _screen->generateGrayOverlay(_screen->getPalette(0).getData(), _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->getPalette(0), _brightness, _lampEffect);
+ setPaletteBrightness(_screen->getPalette(0).getData(), _brightness, _lampEffect);
setMouseCursorToItemInHand();
snd_playTrack(_curMusicTheme);
@@ -379,11 +379,9 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight
v += 128;
if (_lastOverridePalFilePtr) {
- uint8 *tpal = _res->fileData(_lastOverridePalFilePtr, 0);
- memcpy(_screen->getPalette(0), tpal, 384);
- delete[] tpal;
+ _res->loadFileToBuf(_lastOverridePalFilePtr, _screen->getPalette(0).getData(), 384);
} else {
- memcpy(_screen->getPalette(0), v, 384);
+ _screen->getPalette(0).copy(v, 0, 128);
}
v += 384;
@@ -393,14 +391,12 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight
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->getPalette(0) + 384, 384);
- delete[] swampPal;
+ _res->loadFileToBuf("SWAMPICE.COL", _screen->getPalette(2).getData(), 384);
+ _screen->getPalette(2).copy(_screen->getPalette(0), 128);
if (_flagsTable[52] & 0x04) {
- uint8 *pal0 = _screen->getPalette(0);
- uint8 *pal2 = _screen->getPalette(2);
+ uint8 *pal0 = _screen->getPalette(0).getData();
+ uint8 *pal2 = _screen->getPalette(2).getData();
for (int i = 1; i < 768; i++)
SWAP(pal0[i], pal2[i]);
}
@@ -427,7 +423,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->getPalette(0), _screen->getLevelOverlay(i), _lastSpecialColor, weight);
+ _screen->generateLevelOverlay(_screen->getPalette(0).getData(), _screen->getLevelOverlay(i), _lastSpecialColor, weight);
for (int ii = 0; ii < 128; ii++) {
if (_screen->getLevelOverlay(i)[ii] == 255)
@@ -442,7 +438,7 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight
_screen->getLevelOverlay(7)[i] = i & 0xff;
_loadSuppFilesFlag = 0;
- generateBrightnessPalette(_screen->getPalette(0), _screen->getPalette(1), _brightness, _lampEffect);
+ generateBrightnessPalette(_screen->getPalette(0).getData(), _screen->getPalette(1).getData(), _brightness, _lampEffect);
char tname[13];
snprintf(tname, sizeof(tname), "LEVEL%.02d.TLC", _currentLevel);
@@ -548,14 +544,14 @@ void LoLEngine::updateLampStatus() {
if (!_brightness || !_lampOilStatus) {
newLampEffect = 8;
if (newLampEffect != _lampEffect && _screen->_fadeFlag == 0)
- setPaletteBrightness(_screen->getPalette(0), _brightness, newLampEffect);
+ setPaletteBrightness(_screen->getPalette(0).getData(), _brightness, newLampEffect);
} else {
tmpOilStatus = (_lampOilStatus < 100) ? _lampOilStatus : 100;
newLampEffect = (3 - ((tmpOilStatus - 1) / 25)) << 1;
if (_lampEffect == -1) {
if (_screen->_fadeFlag == 0)
- setPaletteBrightness(_screen->getPalette(0), _brightness, newLampEffect);
+ setPaletteBrightness(_screen->getPalette(0).getData(), _brightness, newLampEffect);
_lampStatusTimer = _system->getMillis() + (10 + _rnd.getRandomNumberRng(1, 30)) * _tickLength;
} else {
if ((_lampEffect & 0xfe) == (newLampEffect & 0xfe)) {
@@ -567,7 +563,7 @@ void LoLEngine::updateLampStatus() {
}
} else {
if (_screen->_fadeFlag == 0)
- setPaletteBrightness(_screen->getPalette(0), _lampEffect, newLampEffect);
+ setPaletteBrightness(_screen->getPalette(0).getData(), _lampEffect, newLampEffect);
}
}
}
@@ -1308,8 +1304,8 @@ void LoLEngine::processGasExplosion(int soundId) {
uint16 targetBlock = 0;
int dist = getSpellTargetBlock(_currentBlock, _currentDirection, 3, targetBlock);
- uint8 *p1 = _screen->getPalette(1);
- uint8 *p2 = _screen->getPalette(3);
+ uint8 *p1 = _screen->getPalette(1).getData();
+ uint8 *p2 = _screen->getPalette(3).getData();
if (dist) {
WSAMovie_v2 *mov = new WSAMovie_v2(this);
@@ -1331,11 +1327,11 @@ void LoLEngine::processGasExplosion(int soundId) {
p2[i * 3] = 0x3f;
uint32 ctime = _system->getMillis();
- while (_screen->fadePaletteStep(_screen->getPalette(0), p2, _system->getMillis() - ctime, 10))
+ while (_screen->fadePaletteStep(_screen->getPalette(0).getData(), p2, _system->getMillis() - ctime, 10))
updateInput();
ctime = _system->getMillis();
- while (_screen->fadePaletteStep(p2, _screen->getPalette(0), _system->getMillis() - ctime, 50))
+ while (_screen->fadePaletteStep(p2, _screen->getPalette(0).getData(), _system->getMillis() - ctime, 50))
updateInput();
}
@@ -1421,7 +1417,7 @@ void LoLEngine::prepareSpecialScene(int fieldType, int hasDialogue, int suspendG
initDialogueSequence(fieldType, 0);
if (fadeFlag) {
- _screen->fadePalette(_screen->getPalette(3), 10);
+ _screen->fadePalette(_screen->getPalette(3).getData(), 10);
_screen->_fadeFlag = 0;
}
@@ -1437,9 +1433,9 @@ void LoLEngine::prepareSpecialScene(int fieldType, int hasDialogue, int suspendG
gui_disableControls(controlMode);
if (fadeFlag) {
- memcpy(_screen->getPalette(3) + 384, _screen->getPalette(0) + 384, 384);
- _screen->loadSpecialColors(_screen->getPalette(3));
- _screen->fadePalette(_screen->getPalette(3), 10);
+ _screen->getPalette(3).copy(_screen->getPalette(0), 128);
+ _screen->loadSpecialColors(_screen->getPalette(3).getData());
+ _screen->fadePalette(_screen->getPalette(3).getData(), 10);
_screen->_fadeFlag = 0;
}
@@ -1495,7 +1491,7 @@ int LoLEngine::restoreAfterSpecialScene(int fadeFlag, int redrawPlayField, int r
if (redrawPlayField)
gui_drawPlayField();
- setPaletteBrightness(_screen->getPalette(0), _brightness, _lampEffect);
+ setPaletteBrightness(_screen->getPalette(0).getData(), _brightness, _lampEffect);
} else {
_currentControlMode = 0;
diff --git a/engines/kyra/scene_mr.cpp b/engines/kyra/scene_mr.cpp
index 07a7aa0d07..3b9d386c11 100644
--- a/engines/kyra/scene_mr.cpp
+++ b/engines/kyra/scene_mr.cpp
@@ -328,25 +328,23 @@ void KyraEngine_MR::freeSceneShapes() {
void KyraEngine_MR::loadScenePal() {
char filename[16];
- memcpy(_screen->getPalette(2), _screen->getPalette(0), 768);
+ _screen->getPalette(2).copy(_screen->getPalette(0));
strcpy(filename, _sceneList[_mainCharacter.sceneId].filename1);
strcat(filename, ".COL");
_screen->loadBitmap(filename, 3, 3, 0);
- memcpy(_screen->getPalette(2), _screen->getCPagePtr(3), 432);
- memset(_screen->getPalette(2), 0, 3);
+ _screen->getPalette(2).copy(_screen->getCPagePtr(3), 0, 144);
+ memset(_screen->getPalette(2).getData(), 0, 3);
for (int i = 144; i <= 167; ++i) {
- uint8 *palette = _screen->getPalette(2) + i * 3;
+ uint8 *palette = _screen->getPalette(2).getData() + i * 3;
palette[0] = palette[2] = 63;
palette[1] = 0;
}
- _screen->generateOverlay(_screen->getPalette(2), _paletteOverlay, 0xF0, 0x19);
+ _screen->generateOverlay(_screen->getPalette(2).getData(), _paletteOverlay, 0xF0, 0x19);
- uint8 *palette = _screen->getPalette(2) + 432;
- const uint8 *costPal = _costPalBuffer + _characterShapeFile * 72;
- memcpy(palette, costPal, 24*3);
+ _screen->getPalette(2).copy(_costPalBuffer, _characterShapeFile * 24, 24, 144);
}
void KyraEngine_MR::loadSceneMsc() {
@@ -609,17 +607,17 @@ void KyraEngine_MR::initSceneScreen(int unk1) {
}
if (_noScriptEnter) {
- memset(_screen->getPalette(0), 0, 432);
+ memset(_screen->getPalette(0).getData(), 0, 432);
if (!_wasPlayingVQA)
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
}
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
if (_noScriptEnter) {
if (!_wasPlayingVQA)
- _screen->setScreenPalette(_screen->getPalette(2));
- memcpy(_screen->getPalette(0), _screen->getPalette(2), 432);
+ _screen->setScreenPalette(_screen->getPalette(2).getData());
+ _screen->getPalette(0).copy(_screen->getPalette(2), 0, 144);
if (_wasPlayingVQA) {
_screen->fadeFromBlack(0x3C);
_wasPlayingVQA = false;
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index fc530d684b..7e88c56497 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -139,7 +139,7 @@ bool Screen::init() {
}
}
- setScreenPalette(getPalette(0));
+ setScreenPalette(getPalette(0).getData());
_curDim = 0;
_charWidth = 0;
@@ -490,7 +490,7 @@ void Screen::setPagePixel(int pageNum, int x, int y, uint8 color) {
}
void Screen::fadeFromBlack(int delay, const UpdateFunctor *upFunc) {
- fadePalette(getPalette(0), delay, upFunc);
+ fadePalette(getPalette(0).getData(), delay, upFunc);
}
void Screen::fadeToBlack(int delay, const UpdateFunctor *upFunc) {
@@ -592,12 +592,12 @@ 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));
+ setScreenPalette(getPalette(0).getData());
}
void Screen::getRealPalette(int num, uint8 *dst) {
const int colors = (_vm->gameFlags().platform == Common::kPlatformAmiga ? 32 : 256);
- const uint8 *palData = getPalette(num);
+ const uint8 *palData = getPalette(num).getData();
if (!palData) {
memset(dst, 0, colors * 3);
@@ -2661,9 +2661,9 @@ void Screen::setMouseCursor(int x, int y, const byte *shape) {
_system->updateScreen();
}
-uint8 *Screen::getPalette(int num) {
+Palette &Screen::getPalette(int num) {
assert(num >= 0 && num < (_vm->gameFlags().platform == Common::kPlatformAmiga ? 7 : 4));
- return _palettes[num]->getData();
+ return *_palettes[num];
}
byte Screen::getShapeFlag1(int x, int y) {
@@ -3288,9 +3288,9 @@ void Palette::copy(const Palette &source, int firstCol, int numCols, int dstStar
if (dstStart == -1)
dstStart = firstCol;
- assert(numCols >= 0 && numCols < _numColors);
- assert(firstCol >= 0 && firstCol < source.getNumColors());
- assert(dstStart >= 0 && dstStart + numCols < _numColors);
+ assert(numCols >= 0 && numCols <= _numColors);
+ assert(firstCol >= 0 && firstCol <= source.getNumColors());
+ assert(dstStart >= 0 && dstStart + numCols <= _numColors);
memcpy(_palData + dstStart * 3, source._palData + firstCol * 3, numCols * 3);
}
@@ -3302,9 +3302,9 @@ void Palette::copy(const uint8 *source, int firstCol, int numCols, int dstStart)
if (dstStart == -1)
dstStart = firstCol;
- assert(numCols >= 0 && numCols < _numColors);
+ assert(numCols >= 0 && numCols <= _numColors);
assert(firstCol >= 0);
- assert(dstStart >= 0 && dstStart + numCols < _numColors);
+ assert(dstStart >= 0 && dstStart + numCols <= _numColors);
memcpy(_palData + dstStart * 3, source + firstCol * 3, numCols * 3);
}
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index a7605037ca..32b9623d96 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -232,7 +232,7 @@ public:
const uint8 *getScreenPalette() const { return _screenPalette->getData(); }
void getRealPalette(int num, uint8 *dst);
- uint8 *getPalette(int num);
+ Palette &getPalette(int num);
// gui specific (processing on _curPage)
enum ShadeType {
diff --git a/engines/kyra/screen_lok.cpp b/engines/kyra/screen_lok.cpp
index 7796b5d27c..a7cad28aa8 100644
--- a/engines/kyra/screen_lok.cpp
+++ b/engines/kyra/screen_lok.cpp
@@ -80,13 +80,15 @@ const ScreenDim *Screen_LoK::getScreenDim(int dim) {
void Screen_LoK::fadeSpecialPalette(int palIndex, int startIndex, int size, int fadeTime) {
assert(_vm->palTable1()[palIndex]);
- assert(getPalette(0));
+
uint8 tempPal[768];
- memcpy(tempPal, getPalette(0), 768);
+ memcpy(tempPal, getPalette(0).getData(), 768);
memcpy(&tempPal[startIndex*3], _vm->palTable1()[palIndex], size*3);
+
fadePalette(tempPal, fadeTime*18);
- memcpy(&getPalette(0)[startIndex*3], &tempPal[startIndex*3], size*3);
- setScreenPalette(getPalette(0));
+
+ getPalette(0).copy(tempPal, startIndex, size);
+ setScreenPalette(getPalette(0).getData());
_system->updateScreen();
}
diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp
index 8ff1437a46..8e06c112ff 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, getPalette(0), 768);
+ memcpy(tpal, getPalette(0).getData(), 768);
memset(tpal, 0, 384);
loadSpecialColors(tpal);
fadePalette(tpal, delay);
@@ -838,8 +838,8 @@ void Screen_LoL::fadeToBlack(int delay, const UpdateFunctor *upFunc) {
}
void Screen_LoL::fadeToPalette1(int delay) {
- loadSpecialColors(getPalette(1));
- fadePalette(getPalette(1), delay);
+ loadSpecialColors(getPalette(1).getData());
+ fadePalette(getPalette(1).getData(), delay);
_fadeFlag = 0;
}
@@ -864,7 +864,7 @@ void Screen_LoL::copyColor(int dstColorIndex, int srcColorIndex) {
bool Screen_LoL::fadeColor(int dstColorIndex, int srcColorIndex, uint32 elapsedTime, uint32 targetTime) {
uint8 *dst = _screenPalette->getData() + 3 * dstColorIndex;
uint8 *src = _screenPalette->getData() + 3 * srcColorIndex;
- uint8 *p = getPalette(1) + 3 * dstColorIndex;
+ uint8 *p = getPalette(1).getData() + 3 * dstColorIndex;
bool res = false;
@@ -908,7 +908,7 @@ bool Screen_LoL::fadeColor(int dstColorIndex, int srcColorIndex, uint32 elapsedT
bool Screen_LoL::fadePaletteStep(uint8 *pal1, uint8 *pal2, uint32 elapsedTime, uint32 targetTime) {
uint8 tpal[768];
- uint8 *p1 = getPalette(1);
+ uint8 *p1 = getPalette(1).getData();
bool res = false;
for (int i = 0; i < 768; i++) {
diff --git a/engines/kyra/script_hof.cpp b/engines/kyra/script_hof.cpp
index bcdd5045a8..c2bf48da83 100644
--- a/engines/kyra/script_hof.cpp
+++ b/engines/kyra/script_hof.cpp
@@ -146,10 +146,10 @@ int KyraEngine_HoF::o2_meanWhileScene(EMCState *script) {
const char *palfile = stackPosString(1);
_screen->loadBitmap(cpsfile, 3, 3, 0);
- memcpy(_screen->getPalette(2), _screen->getPalette(0), 768);
- _screen->loadPalette(palfile, _screen->getPalette(2));
+ _screen->getPalette(2).copy(_screen->getPalette(0));
+ _screen->loadPalette(palfile, _screen->getPalette(2).getData());
_screen->fillRect(0, 0, 319, 199, 207);
- _screen->setScreenPalette(_screen->getPalette(2));
+ _screen->setScreenPalette(_screen->getPalette(2).getData());
_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);
@@ -559,15 +559,15 @@ int KyraEngine_HoF::o2_enableAnimObject(EMCState *script) {
int KyraEngine_HoF::o2_loadPalette384(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_loadPalette384(%p) ('%s')", (const void *)script, stackPosString(0));
- memcpy(_screen->getPalette(1), _screen->getPalette(0), 768);
- _res->loadFileToBuf(stackPosString(0), _screen->getPalette(1), 384);
+ _screen->getPalette(1).copy(_screen->getPalette(0));
+ _res->loadFileToBuf(stackPosString(0), _screen->getPalette(1).getData(), 384);
return 0;
}
int KyraEngine_HoF::o2_setPalette384(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_setPalette384(%p) ()", (const void *)script);
- memcpy(_screen->getPalette(0), _screen->getPalette(1), 384);
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->getPalette(0).copy(_screen->getPalette(1), 0, 128);
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
return 0;
}
@@ -774,13 +774,13 @@ int KyraEngine_HoF::o2_showLetter(EMCState *script) {
displayInvWsaLastFrame();
backUpPage0();
- memcpy(_screen->getPalette(2), _screen->getPalette(0), 768);
+ _screen->getPalette(2).copy(_screen->getPalette(0));
_screen->clearPage(3);
_screen->loadBitmap("_NOTE.CPS", 3, 3, 0);
sprintf(filename, "_NTEPAL%.1d.COL", letter+1);
- _res->loadFileToBuf(filename, _screen->getPalette(0), 768);
+ _res->loadFileToBuf(filename, _screen->getPalette(0).getData(), 768);
_screen->fadeToBlack(0x14);
@@ -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), 0x14);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 0x14);
_screen->setMouseCursor(0, 0, getShapePtr(0));
setMousePos(280, 160);
@@ -819,8 +819,8 @@ int KyraEngine_HoF::o2_showLetter(EMCState *script) {
_screen->hideMouse();
_screen->fadeToBlack(0x14);
restorePage0();
- memcpy(_screen->getPalette(0), _screen->getPalette(2), 768);
- _screen->fadePalette(_screen->getPalette(0), 0x14);
+ _screen->getPalette(0).copy(_screen->getPalette(2));
+ _screen->fadePalette(_screen->getPalette(0).getData(), 0x14);
setHandItem(_itemInHand);
_screen->showMouse();
@@ -1125,13 +1125,13 @@ 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->getPalette(0), 768);
+ _screen->getPalette(2).copy(_screen->getPalette(0));
for (int i = 1; i < 768; i += 3)
_screen->getPalette(0)[i] = 0;
snd_playSoundEffect(106);
- _screen->fadePalette(_screen->getPalette(0), 90, &_updateFunctor);
- memcpy(_screen->getPalette(0), _screen->getPalette(2), 768);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 90, &_updateFunctor);
+ _screen->getPalette(0).copy(_screen->getPalette(2));
for (int i = 0; i < 768; i += 3) {
_screen->getPalette(0)[i] = _screen->getPalette(0)[i + 1] = 0;
@@ -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), 90, &_updateFunctor);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 90, &_updateFunctor);
- memcpy(_screen->getPalette(0), _screen->getPalette(2), 768);
- _screen->fadePalette(_screen->getPalette(0), 30, &_updateFunctor);
+ _screen->getPalette(0).copy(_screen->getPalette(2));
+ _screen->fadePalette(_screen->getPalette(0).getData(), 30, &_updateFunctor);
return 0;
}
@@ -1262,19 +1262,23 @@ 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);
+ uint8 *palette = _screen->getPalette(0).getData();
+
const int index = stackPos(0);
const bool updatePalette = (stackPos(4) != 0);
const int delayTime = stackPos(5);
+
palette[index*3+0] = (stackPos(1) * 0x3F) / 100;
palette[index*3+1] = (stackPos(2) * 0x3F) / 100;
palette[index*3+2] = (stackPos(3) * 0x3F) / 100;
+
if (updatePalette) {
if (delayTime > 0)
_screen->fadePalette(palette, delayTime, &_updateFunctor);
else
_screen->setScreenPalette(palette);
}
+
return 0;
}
@@ -1396,7 +1400,7 @@ int KyraEngine_HoF::o2_demoFinale(EMCState *script) {
assert(strings);
_screen->clearPage(0);
- _screen->loadPalette("THANKS.COL", _screen->getPalette(0));
+ _screen->loadPalette("THANKS.COL", _screen->getPalette(0).getData());
_screen->loadBitmap("THANKS.CPS", 3, 3, 0);
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0);
@@ -1406,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));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
_screen->updateScreen();
_eventList.clear();
diff --git a/engines/kyra/script_lok.cpp b/engines/kyra/script_lok.cpp
index 0d18e03f29..263875a58e 100644
--- a/engines/kyra/script_lok.cpp
+++ b/engines/kyra/script_lok.cpp
@@ -231,8 +231,9 @@ int KyraEngine_LoK::o1_fadeSpecialPalette(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_fadeSpecialPalette(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
if (_currentCharacter->sceneId != 45) {
if (stackPos(0) == 13) {
- memcpy(_screen->getPalette(0), _screen->getPalette(0) + 384*3, 32*3);
- _screen->setScreenPalette(_screen->getPalette(0));
+ // TODO: Check this!
+ _screen->getPalette(0).copy(_screen->getPalette(12));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
}
} else {
warning("KyraEngine_LoK::o1_fadeSpecialPalette not implemented");
@@ -578,7 +579,7 @@ int KyraEngine_LoK::o1_restoreAllObjectBackgrounds(EMCState *script) {
int KyraEngine_LoK::o1_setCustomPaletteRange(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_setCustomPaletteRange(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
- memcpy(_screen->getPalette(1) + stackPos(1)*3, _specialPalettes[stackPos(0)], stackPos(2)*3);
+ _screen->getPalette(1).copy(_specialPalettes[stackPos(0)], 0, stackPos(2), stackPos(1));
return 0;
}
@@ -1243,8 +1244,9 @@ int KyraEngine_LoK::o1_setFireberryGlowPalette(EMCState *script) {
palIndex = 14;
}
}
- const uint8 *palette = _specialPalettes[palIndex];
- memcpy(_screen->getPalette(1) + 684, palette, 44);
+
+ // TODO: Original used "44" here, which would be 14.666... colors. That looks strange, we should verify this one again.
+ _screen->getPalette(1).copy(_specialPalettes[palIndex], 0, 15, 228);
return 0;
}
@@ -1505,32 +1507,29 @@ int KyraEngine_LoK::o1_fadeEntirePalette(EMCState *script) {
if (_flags.platform == Common::kPlatformAmiga) {
if (cmd == 0) {
- fadePal = _screen->getPalette(2);
- memset(fadePal, 0, 32*3);
- memcpy(_screen->getPalette(4), _screen->getPalette(0), 32*3);
+ _screen->getPalette(2).clear();
+ fadePal = _screen->getPalette(2).getData();
+ _screen->getPalette(4).copy(_screen->getPalette(0));
} else if (cmd == 1) {
- fadePal = _screen->getPalette(0);
- memcpy(_screen->getPalette(0), _screen->getPalette(4), 32*3);
+ fadePal = _screen->getPalette(0).getData();
+ _screen->getPalette(0).copy(_screen->getPalette(4));
} else if (cmd == 2) {
- fadePal = _screen->getPalette(0);
- memset(_screen->getPalette(2), 0, 32*3);
+ fadePal = _screen->getPalette(0).getData();
+ _screen->getPalette(2).clear();
}
} else {
if (cmd == 0) {
- fadePal = _screen->getPalette(2);
- uint8 *screenPal = _screen->getPalette(0);
- uint8 *backUpPal = _screen->getPalette(3);
-
- memcpy(backUpPal, screenPal, sizeof(uint8)*768);
- memset(fadePal, 0, sizeof(uint8)*768);
+ _screen->getPalette(2).clear();
+ fadePal = _screen->getPalette(2).getData();
+ _screen->getPalette(3).copy(_screen->getPalette(0));
} else if (cmd == 1) {
//fadePal = _screen->getPalette(3);
warning("unimplemented o1_fadeEntirePalette function");
return 0;
} else if (cmd == 2) {
- memset(_screen->getPalette(2), 0, 768);
- memcpy(_screen->getPalette(0), _screen->getPalette(1), 768);
- fadePal = _screen->getPalette(0);
+ _screen->getPalette(2).clear();
+ _screen->getPalette(0).copy(_screen->getPalette(1));
+ fadePal = _screen->getPalette(0).getData();
}
}
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index b2cf152270..a8e1d1c57a 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -602,14 +602,14 @@ 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), 10);
+ _screen->fadePalette(_screen->getPalette(3).getData(), 10);
_screen->_fadeFlag = 0;
return 1;
}
int LoLEngine::olol_loadBitmap(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_clearDialogueField(%p) (%s, %d)", (const void *)script, stackPosString(0), stackPos(1));
- _screen->loadBitmap(stackPosString(0), 3, 3, _screen->getPalette(3));
+ _screen->loadBitmap(stackPosString(0), 3, 3, _screen->getPalette(3).getData());
if (stackPos(1) != 2)
_screen->copyPage(3, stackPos(1));
return 1;
@@ -864,9 +864,9 @@ 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->getPalette(0) + 0x180, 0x180);
- _screen->loadSpecialColors(_screen->getPalette(3));
- _screen->fadePalette(_screen->getPalette(3), 10);
+ _screen->getPalette(3).copy(_screen->getPalette(0), 128);
+ _screen->loadSpecialColors(_screen->getPalette(3).getData());
+ _screen->fadePalette(_screen->getPalette(3).getData(), 10);
_screen->_fadeFlag = 0;
return 1;
}
@@ -876,7 +876,7 @@ int LoLEngine::olol_redrawPlayfield(EMCState *script) {
if (_screen->_fadeFlag != 2)
_screen->fadeClearSceneWindow(10);
gui_drawPlayField();
- setPaletteBrightness(_screen->getPalette(0), _brightness, _lampEffect);
+ setPaletteBrightness(_screen->getPalette(0).getData(), _brightness, _lampEffect);
_screen->_fadeFlag = 0;
return 1;
}
@@ -1408,7 +1408,7 @@ int LoLEngine::olol_playEndSequence(EMCState *script){
_eventList.clear();
_screen->hideMouse();
- memset(_screen->getPalette(1), 0, 768);
+ _screen->getPalette(1).clear();
showOutro(c, (_monsterDifficulty == 2));
quitGame();
@@ -1428,7 +1428,7 @@ int LoLEngine::olol_setPaletteBrightness(EMCState *script) {
uint16 old = _brightness;
_brightness = stackPos(0);
if (stackPos(1) == 1)
- setPaletteBrightness(_screen->getPalette(0), stackPos(0), _lampEffect);
+ setPaletteBrightness(_screen->getPalette(0).getData(), 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->getPalette(0), _screen->getPalette(1), 384);
- _screen->fadePalette(_screen->getPalette(0), 10);
+ _screen->getPalette(0).copy(_screen->getPalette(1), 0, 128);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 10);
_screen->_fadeFlag = 0;
return 1;
}
@@ -2101,8 +2101,8 @@ 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);
- uint8 *d = _screen->getPalette(3);
+ uint8 *s = _screen->getPalette(1).getData();
+ uint8 *d = _screen->getPalette(3).getData();
uint8 ovl[256];
generateFlashPalette(s, d, stackPos(0));
_screen->loadSpecialColors(s);
@@ -2289,7 +2289,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), param[0], _tim->_palDelayInc, _tim->_palDiff);
+ _screen->getFadeParams(_screen->getPalette(0).getData(), param[0], _tim->_palDelayInc, _tim->_palDiff);
_tim->_palDelayAcc = 0;
return 1;
}
@@ -2297,15 +2297,15 @@ int LoLEngine::tlol_setupPaletteFade(const TIM *tim, const uint16 *param) {
int LoLEngine::tlol_loadPalette(const TIM *tim, const uint16 *param) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_loadPalette(%p, %p) (%d)", (const void *)tim, (const void *)param, param[0]);
const char *palFile = (const char *)(tim->text + READ_LE_UINT16(tim->text + (param[0]<<1)));
- _screen->loadPalette(palFile, _screen->getPalette(0));
+ _screen->loadPalette(palFile, _screen->getPalette(0).getData());
return 1;
}
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]);
- memcpy(_screen->getPalette(0), _screen->getPalette(1), 768);
+ _screen->getPalette(0).copy(_screen->getPalette(1));
- _screen->getFadeParams(_screen->getPalette(0), param[0], _tim->_palDelayInc, _tim->_palDiff);
+ _screen->getFadeParams(_screen->getPalette(0).getData(), param[0], _tim->_palDelayInc, _tim->_palDiff);
_tim->_palDelayAcc = 0;
return 1;
}
@@ -2381,7 +2381,6 @@ int LoLEngine::tlol_setPartyPosition(const TIM *tim, const uint16 *param) {
int LoLEngine::tlol_fadeClearWindow(const TIM *tim, const uint16 *param) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_fadeClearWindow(%p, %p) (%d)", (const void *)tim, (const void *)param, param[0]);
- uint8 *tmp = 0;
switch (param[0]) {
case 0:
@@ -2389,10 +2388,9 @@ int LoLEngine::tlol_fadeClearWindow(const TIM *tim, const uint16 *param) {
break;
case 1:
- tmp = _screen->getPalette(3);
- memcpy(tmp + 0x180, _screen->getPalette(0) + 0x180, 0x180);
- _screen->loadSpecialColors(tmp);
- _screen->fadePalette(tmp, 10);
+ _screen->getPalette(3).copy(_screen->getPalette(0), 128);
+ _screen->loadSpecialColors(_screen->getPalette(3).getData());
+ _screen->fadePalette(_screen->getPalette(3).getData(), 10);
_screen->_fadeFlag = 0;
break;
@@ -2401,9 +2399,8 @@ int LoLEngine::tlol_fadeClearWindow(const TIM *tim, const uint16 *param) {
break;
case 3:
- tmp = _screen->getPalette(3);
- _screen->loadSpecialColors(tmp);
- _screen->fadePalette(tmp, 10);
+ _screen->loadSpecialColors(_screen->getPalette(3).getData());
+ _screen->fadePalette(_screen->getPalette(3).getData(), 10);
_screen->_fadeFlag = 0;
break;
@@ -2411,14 +2408,13 @@ int LoLEngine::tlol_fadeClearWindow(const TIM *tim, const uint16 *param) {
if (_screen->_fadeFlag != 2)
_screen->fadeClearSceneWindow(10);
gui_drawPlayField();
- setPaletteBrightness(_screen->getPalette(0), _brightness, _lampEffect);
+ setPaletteBrightness(_screen->getPalette(0).getData(), _brightness, _lampEffect);
_screen->_fadeFlag = 0;
break;
case 5:
- tmp = _screen->getPalette(3);
- _screen->loadSpecialColors(tmp);
- _screen->fadePalette(_screen->getPalette(1), 10);
+ _screen->loadSpecialColors(_screen->getPalette(3).getData());
+ _screen->fadePalette(_screen->getPalette(1).getData(), 10);
_screen->_fadeFlag = 0;
break;
@@ -2517,7 +2513,7 @@ int LoLEngine::tlol_fadeInScene(const TIM *tim, const uint16 *param) {
strcpy(filename, sceneFile);
strcat(filename, ".CPS");
- _screen->loadBitmap(filename, 7, 5, _screen->getPalette(0));
+ _screen->loadBitmap(filename, 7, 5, _screen->getPalette(0).getData());
filename[0] = 0;
diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp
index 1d3e1e0d32..1daab10dbd 100644
--- a/engines/kyra/script_tim.cpp
+++ b/engines/kyra/script_tim.cpp
@@ -427,7 +427,7 @@ void TIMInterpreter::setupTextPalette(uint index, int fadePalette) {
};
for (int i = 0; i < 15; ++i) {
- uint8 *palette = _screen->getPalette(0) + (240 + i) * 3;
+ uint8 *palette = _screen->getPalette(0).getData() + (240 + i) * 3;
uint8 c1 = (((15 - i) << 2) * palTable[index*3+0]) / 100;
uint8 c2 = (((15 - i) << 2) * palTable[index*3+1]) / 100;
@@ -439,9 +439,9 @@ void TIMInterpreter::setupTextPalette(uint index, int fadePalette) {
}
if (!fadePalette && !_palDiff) {
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
} else {
- _screen->getFadeParams(_screen->getPalette(0), fadePalette, _palDelayInc, _palDiff);
+ _screen->getFadeParams(_screen->getPalette(0).getData(), fadePalette, _palDelayInc, _palDiff);
_palDelayAcc = 0;
}
}
@@ -478,7 +478,7 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
anim->wsa = new WSAMovie_v2(_vm);
assert(anim->wsa);
- anim->wsa->open(file, wsaOpenFlags, (index == 1) ? _screen->getPalette(0) : 0);
+ anim->wsa->open(file, wsaOpenFlags, (index == 1) ? _screen->getPalette(0).getData() : 0);
}
if (anim->wsa && anim->wsa->opened()) {
@@ -504,7 +504,7 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
}
if (wsaFlags & 2) {
- _screen->fadePalette(_screen->getPalette(1), 15, 0);
+ _screen->fadePalette(_screen->getPalette(1).getData(), 15, 0);
_screen->clearPage(_drawPage2);
if (_drawPage2)
_screen->checkedPageUpdate(8, 4);
@@ -515,7 +515,7 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
snprintf(file, 32, "%s.CPS", filename);
if (_vm->resource()->exists(file)) {
- _screen->loadBitmap(file, 3, 3, _screen->getPalette(0));
+ _screen->loadBitmap(file, 3, 3, _screen->getPalette(0).getData());
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, _drawPage2, Screen::CR_NO_P_CHECK);
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), 30, 0);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 30, 0);
} else {
if (wsaFlags & 2) {
- _screen->fadePalette(_screen->getPalette(1), 15, 0);
+ _screen->fadePalette(_screen->getPalette(1).getData(), 15, 0);
_screen->clearPage(_drawPage2);
if (_drawPage2)
_screen->checkedPageUpdate(8, 4);
@@ -539,7 +539,7 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char
snprintf(file, 32, "%s.CPS", filename);
if (_vm->resource()->exists(file)) {
- _screen->loadBitmap(file, 3, 3, _screen->getPalette(0));
+ _screen->loadBitmap(file, 3, 3, _screen->getPalette(0).getData());
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, _drawPage2, Screen::CR_NO_P_CHECK);
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), 30, 0);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 30, 0);
}
return anim;
@@ -947,13 +947,13 @@ TIMInterpreter::Animation *TIMInterpreter_LoL::initAnimStruct(int index, const c
if (_vm->resource()->exists(file)) {
anim->wsa = new WSAMovie_v2(_vm);
assert(anim->wsa);
- anim->wsa->open(file, wsaOpenFlags, _screen->getPalette(3));
+ anim->wsa->open(file, wsaOpenFlags, _screen->getPalette(3).getData());
}
if (wsaFlags & 1) {
if (_screen->_fadeFlag != 1)
_screen->fadeClearSceneWindow(10);
- memcpy(_screen->getPalette(3) + 384, _screen->getPalette(0) + 384, 384);
+ _screen->getPalette(3).copy(_screen->getPalette(0), 128, 128);
} else if (wsaFlags & 2) {
_screen->fadeToBlack(10);
}
@@ -962,8 +962,8 @@ TIMInterpreter::Animation *TIMInterpreter_LoL::initAnimStruct(int index, const c
anim->wsa->displayFrame(0, 0, x, y, 0, 0, 0);
if (wsaFlags & 3) {
- _screen->loadSpecialColors(_screen->getPalette(3));
- _screen->fadePalette(_screen->getPalette(3), 10);
+ _screen->loadSpecialColors(_screen->getPalette(3).getData());
+ _screen->fadePalette(_screen->getPalette(3).getData(), 10);
_screen->_fadeFlag = 0;
}
diff --git a/engines/kyra/seqplayer.cpp b/engines/kyra/seqplayer.cpp
index 214acb6240..c31cb9a35a 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->getPalette(0));
+ _screen->loadBitmap("WRITING.CPS", 3, 3, _screen->getPalette(0).getData());
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->getPalette(0), _screen->getPalette(0) + 576, 3*32);
+ _screen->getPalette(0).copy(_screen->getPalette(6));
else if (colNum == 3)
- memcpy(_screen->getPalette(0), _screen->getPalette(0) + 672, 3*32);
+ _screen->getPalette(0).copy(_screen->getPalette(7));
else if (colNum == 4)
- memcpy(_screen->getPalette(0), _screen->getPalette(0) + 288, 3*32);
+ _screen->getPalette(0).copy(_screen->getPalette(3));
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
} else {
uint32 fileSize;
uint8 *srcData;
srcData = _res->fileData(_vm->seqCOLTable()[colNum], &fileSize);
- memcpy(_screen->getPalette(0), srcData, fileSize);
+ memcpy(_screen->getPalette(0).getData(), srcData, fileSize);
delete[] srcData;
}
}
void SeqPlayer::s1_loadBitmap() {
uint8 cpsNum = *_seqData++;
- _screen->loadBitmap(_vm->seqCPSTable()[cpsNum], 3, 3, _screen->getPalette(0));
+ _screen->loadBitmap(_vm->seqCPSTable()[cpsNum], 3, 3, _screen->getPalette(0).getData());
}
void SeqPlayer::s1_fadeToBlack() {
diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp
index 2b5f3df89a..5562ead43a 100644
--- a/engines/kyra/sequences_hof.cpp
+++ b/engines/kyra/sequences_hof.cpp
@@ -62,7 +62,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) {
int oldPage = _screen->setCurPage(2);
for (int i = 0; i < 4; ++i)
- memset(_screen->getPalette(i), 0, 0x300);
+ _screen->getPalette(i).clear();
_screen->clearPage(10);
_screen->clearPage(12);
@@ -77,7 +77,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) {
for (int seqNum = startSeq; seqNum <= endSeq && !((skipFlag() && allowSkip) || shouldQuit() || (_abortIntroFlag && allowSkip) || _menuChoice); seqNum++) {
_screen->clearPage(0);
_screen->clearPage(8);
- memcpy(_screen->getPalette(1), _screen->getPalette(0), 0x300);
+ _screen->getPalette(1).copy(_screen->getPalette(0));
_seqFrameCounter = 0;
_seqStartTime = _system->getMillis();
@@ -87,12 +87,12 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) {
SeqProc cb = _callbackS[seqNum];
if (cseq.flags & 2) {
- _screen->loadBitmap(cseq.cpsFile, 2, 2, _screen->getPalette(0));
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->loadBitmap(cseq.cpsFile, 2, 2, _screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
} else {
_screen->setCurPage(2);
_screen->clearPage(2);
- _screen->loadPalette("goldfont.col", _screen->getPalette(0));
+ _screen->loadPalette("goldfont.col", _screen->getPalette(0).getData());
}
if (cb && !(_flags.isDemo && !_flags.isTalkie))
@@ -100,8 +100,8 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) {
if (cseq.flags & 1) {
_seqWsa->close();
- _seqWsa->open(cseq.wsaFile, 0, _screen->getPalette(0));
- _screen->setScreenPalette(_screen->getPalette(0));
+ _seqWsa->open(cseq.wsaFile, 0, _screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
_seqWsa->displayFrame(0, 2, cseq.xPos, cseq.yPos, 0, 0, 0);
}
@@ -361,7 +361,7 @@ int KyraEngine_HoF::seq_introTitle(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
}
int KyraEngine_HoF::seq_introOverview(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
- uint8 *tmpPal = &(_screen->getPalette(3)[0x101]);
+ uint8 *tmpPal = _screen->getPalette(3).getData() + 0x101;
memset(tmpPal, 0, 256);
_seqSubFrameEndTimeInternal = 0;
uint32 now = 0;
@@ -372,9 +372,9 @@ int KyraEngine_HoF::seq_introOverview(WSAMovie_v2 *wsaObj, int x, int y, int frm
_sound->playTrack(4);
_seqSubFrameEndTimeInternal = _system->getMillis() + 60 * _tickLength;
- _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff;
+ _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0).getData() + 3, 255) & 0xff;
memset(_seqTextColorMap, _seqTextColor[1], 16);
- _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff;
+ _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0).getData() + 3, 255) & 0xff;
_screen->setTextColorMap(_seqTextColorMap);
@@ -384,7 +384,7 @@ int KyraEngine_HoF::seq_introOverview(WSAMovie_v2 *wsaObj, int x, int y, int frm
break;
case 1:
- _screen->generateGrayOverlay(_screen->getPalette(0), _screen->getPalette(3), 0x40, 0, 0, 0, 0x100, true);
+ _screen->generateGrayOverlay(_screen->getPalette(0).getData(), _screen->getPalette(3).getData(), 0x40, 0, 0, 0, 0x100, true);
for (int i = 0; i < 256; i++)
tmpPal[_screen->getPalette(3)[i]] = 1;
@@ -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), 64);
+ _screen->fadePalette(_screen->getPalette(2).getData(), 64);
break;
case 201:
- _screen->setScreenPalette(_screen->getPalette(2));
+ _screen->setScreenPalette(_screen->getPalette(2).getData());
_screen->updateScreen();
- _screen->applyOverlay(0, 0, 320, 200, 2, _screen->getPalette(3));
+ _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));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
_screen->updateScreen();
seq_resetActiveWSA(0);
seq_resetActiveWSA(1);
@@ -465,10 +465,10 @@ int KyraEngine_HoF::seq_introLibrary(WSAMovie_v2 *wsaObj, int x, int y, int frm)
_seqSubframePlaying = true;
_sound->playTrack(5);
- _screen->generateGrayOverlay(_screen->getPalette(0), _screen->getPalette(3), 0x24, 0, 0, 0, 0x100, false);
- _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff;
+ _screen->generateGrayOverlay(_screen->getPalette(0).getData(), _screen->getPalette(3).getData(), 0x24, 0, 0, 0, 0x100, false);
+ _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0).getData() + 3, 255) & 0xff;
memset(_seqTextColorMap, _seqTextColor[1], 16);
- _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff;
+ _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0).getData() + 3, 255) & 0xff;
_screen->setTextColorMap(_seqTextColorMap);
break;
@@ -482,7 +482,7 @@ int KyraEngine_HoF::seq_introLibrary(WSAMovie_v2 *wsaObj, int x, int y, int frm)
seq_waitForTextsTimeout();
_screen->copyPage(12, 2);
- _screen->applyOverlay(0, 0, 320, 200, 2, _screen->getPalette(3));
+ _screen->applyOverlay(0, 0, 320, 200, 2, _screen->getPalette(3).getData());
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0);
_screen->updateScreen();
_screen->copyPage(2, 12);
@@ -503,7 +503,7 @@ int KyraEngine_HoF::seq_introLibrary(WSAMovie_v2 *wsaObj, int x, int y, int frm)
case 340:
seq_resetActiveWSA(0);
- _screen->applyOverlay(0, 0, 320, 200, 2, _screen->getPalette(3));
+ _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->updateScreen();
@@ -539,10 +539,10 @@ int KyraEngine_HoF::seq_introHand(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
_seqSubframePlaying = true;
_sound->playTrack(6);
- _screen->generateGrayOverlay(_screen->getPalette(0), _screen->getPalette(3), 0x24, 0, 0, 0, 0x100, false);
- _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff;
+ _screen->generateGrayOverlay(_screen->getPalette(0).getData(), _screen->getPalette(3).getData(), 0x24, 0, 0, 0, 0x100, false);
+ _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0).getData() + 3, 255) & 0xff;
memset(_seqTextColorMap, _seqTextColor[1], 16);
- _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff;
+ _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0).getData() + 3, 255) & 0xff;
_screen->setTextColorMap(_seqTextColorMap);
break;
@@ -556,7 +556,7 @@ int KyraEngine_HoF::seq_introHand(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
case 201:
seq_waitForTextsTimeout();
- _screen->applyOverlay(0, 0, 320, 200, 2, _screen->getPalette(3));
+ _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->updateScreen();
@@ -631,9 +631,9 @@ int KyraEngine_HoF::seq_introPoint(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
_seqTextColor[1] = 0xf7;
memset(_seqTextColorMap, _seqTextColor[1], 16);
- _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff;
+ _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0).getData() + 3, 255) & 0xff;
_screen->setTextColorMap(_seqTextColorMap);
- _screen->generateGrayOverlay(_screen->getPalette(0), _screen->getPalette(3), 0x24, 0, 0, 0, 0x100, false);
+ _screen->generateGrayOverlay(_screen->getPalette(0).getData(), _screen->getPalette(3).getData(), 0x24, 0, 0, 0, 0x100, false);
break;
case 1:
@@ -661,7 +661,7 @@ int KyraEngine_HoF::seq_introZanfaun(WSAMovie_v2 *wsaObj, int x, int y, int frm)
_seqTextColor[1] = 0xfd;
memset(_seqTextColorMap, _seqTextColor[1], 16);
- _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 255) & 0xff;
+ _seqTextColorMap[1] = _seqTextColor[0] = _screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0).getData() + 3, 255) & 0xff;
_screen->setTextColorMap(_seqTextColorMap);
break;
@@ -831,7 +831,7 @@ int KyraEngine_HoF::seq_finaleFunters(WSAMovie_v2 *wsaObj, int x, int y, int frm
case 0:
_sound->playTrack(3);
- _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff;
+ _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0).getData() + 3, 255) & 0xff;
memset(_seqTextColorMap, _seqTextColor[1], 16);
_seqTextColor[0] = _seqTextColorMap[1] = 0xff;
_screen->setTextColorMap(_seqTextColorMap);
@@ -924,7 +924,7 @@ int KyraEngine_HoF::seq_finaleFerb(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
break;
case 0:
- _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff;
+ _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0).getData() + 3, 255) & 0xff;
memset(_seqTextColorMap, _seqTextColor[1], 16);
_seqTextColor[0] = _seqTextColorMap[1] = 255;
_screen->setTextColorMap(_seqTextColorMap);
@@ -1006,7 +1006,7 @@ int KyraEngine_HoF::seq_finaleFish(WSAMovie_v2 *wsaObj, int x, int y, int frm) {
break;
case 0:
- _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff;
+ _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0).getData() + 3, 255) & 0xff;
memset(_seqTextColorMap, _seqTextColor[1], 16);
_seqTextColor[0] = _seqTextColorMap[1] = 0xff;
_screen->setTextColorMap(_seqTextColorMap);
@@ -1096,7 +1096,7 @@ int KyraEngine_HoF::seq_finaleFheep(WSAMovie_v2 *wsaObj, int x, int y, int frm)
break;
case 0:
- _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff;
+ _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0).getData() + 3, 255) & 0xff;
memset(_seqTextColorMap, _seqTextColor[1], 16);
_seqTextColor[0] = _seqTextColorMap[1] = 0xff;
_screen->setTextColorMap(_seqTextColorMap);
@@ -1172,9 +1172,9 @@ int KyraEngine_HoF::seq_finaleFarmer(WSAMovie_v2 *wsaObj, int x, int y, int frm)
break;
case 0:
- _seqTextColor[1] = 1 + (_screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 254) & 0xff);
+ _seqTextColor[1] = 1 + (_screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0).getData() + 3, 254) & 0xff);
memset(_seqTextColorMap, _seqTextColor[1], 16);
- _seqTextColorMap[1] = _seqTextColor[0] = 1 + (_screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0) + 3, 254) & 0xff);
+ _seqTextColorMap[1] = _seqTextColor[0] = 1 + (_screen->findLeastDifferentColor(_seqTextColorPresets + 3, _screen->getPalette(0).getData() + 3, 254) & 0xff);
_screen->setTextColorMap(_seqTextColorMap);
seq_playTalkText(_flags.isTalkie ? 30 : 26);
break;
@@ -1339,7 +1339,7 @@ int KyraEngine_HoF::seq_finaleFirates(WSAMovie_v2 *wsaObj, int x, int y, int frm
break;
case 0:
- _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff;
+ _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0).getData() + 3, 255) & 0xff;
memset(_seqTextColorMap, _seqTextColor[1], 16);
_seqTextColor[0] = _seqTextColorMap[1] = 0xff;
_screen->setTextColorMap(_seqTextColorMap);
@@ -1426,7 +1426,7 @@ int KyraEngine_HoF::seq_finaleFrash(WSAMovie_v2 *wsaObj, int x, int y, int frm)
case 0:
if (_seqFrameCounter == 1) {
_sound->playTrack(4);
- _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0) + 3, 255) & 0xff;
+ _seqTextColor[1] = _screen->findLeastDifferentColor(_seqTextColorPresets, _screen->getPalette(0).getData() + 3, 255) & 0xff;
memset(_seqTextColorMap, _seqTextColor[1], 16);
_seqTextColor[0] = _seqTextColorMap[1] = 0xff;
_screen->setTextColorMap(_seqTextColorMap);
@@ -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->getPalette(0));
+ _screen->loadBitmap("finale.cps", 3, 3, _screen->getPalette(0).getData());
_screen->setFont(Screen::FID_GOLDFONT_FNT);
int talkieCreditsSize, talkieCreditsSpecialSize;
@@ -1781,14 +1781,14 @@ 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);
+ uint8 *tmpPal = _screen->getPalette(2).getData();
if (!(_seqFrameCounter % 100)) {
if (_seqFrameCounter == 0) {
_sound->haltTrack();
_sound->playTrack(6);
}
- memcpy(tmpPal, _screen->getPalette(0), 0x300);
+ memcpy(tmpPal, _screen->getPalette(0).getData(), 0x300);
for (int i = 3; i < 0x300; i++) {
tmpPal[i] = ((int)tmpPal[i] * 120) / 64;
if (tmpPal[i] > 0x3f)
@@ -1799,7 +1799,7 @@ int KyraEngine_HoF::seq_lolDemoScene1(WSAMovie_v2 *wsaObj, int x, int y, int frm
_screen->updateScreen();
delay(8);
} else {
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
_screen->updateScreen();
if (_seqFrameCounter == 40)
seq_playTalkText(3);
@@ -1924,10 +1924,10 @@ int KyraEngine_HoF::seq_lolDemoScene6(WSAMovie_v2 *wsaObj, int x, int y, int frm
}
if (_seqFrameCounter % 175) {
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
} else {
- uint8 *tmpPal = _screen->getPalette(2);
- memcpy(tmpPal, _screen->getPalette(0), 0x300);
+ uint8 *tmpPal = _screen->getPalette(2).getData();
+ memcpy(tmpPal, _screen->getPalette(0).getData(), 0x300);
for (int i = 3; i < 0x300; i++) {
tmpPal[i] = ((int)tmpPal[i] * 120) / 64;
if (tmpPal[i] > 0x3f)
@@ -2054,28 +2054,28 @@ void KyraEngine_HoF::seq_sequenceCommand(int command) {
case 0:
memset(pal, 0, 0x300);
_screen->fadePalette(pal, 36);
- memcpy(_screen->getPalette(0), pal, 0x300);
- memcpy(_screen->getPalette(1), pal, 0x300);
+ _screen->getPalette(0).clear();
+ _screen->getPalette(1).clear();
break;
case 1:
memset(pal, 0x3F, 0x300);
seq_playTalkText(_rnd.getRandomBit());
_screen->fadePalette(pal, 16);
- memcpy(_screen->getPalette(0), pal, 0x300);
- memcpy(_screen->getPalette(1), pal, 0x300);
+ _screen->getPalette(0).copy(pal, 0, 256);
+ _screen->getPalette(1).copy(pal, 0, 256);
break;
case 3:
_screen->copyPage(2, 0);
- _screen->fadePalette(_screen->getPalette(0), 16);
- memcpy(_screen->getPalette(1), _screen->getPalette(0), 0x300);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 16);
+ _screen->getPalette(1).copy(_screen->getPalette(0));
break;
case 4:
_screen->copyPage(2, 0);
- _screen->fadePalette(_screen->getPalette(0), 36);
- memcpy(_screen->getPalette(1), _screen->getPalette(0), 0x300);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 36);
+ _screen->getPalette(1).copy(_screen->getPalette(0));
break;
case 5:
@@ -2095,8 +2095,8 @@ void KyraEngine_HoF::seq_sequenceCommand(int command) {
case 8:
memset(pal, 0, 0x300);
_screen->fadePalette(pal, 16);
- memcpy(_screen->getPalette(0), pal, 0x300);
- memcpy(_screen->getPalette(1), pal, 0x300);
+ _screen->getPalette(0).copy(pal, 0, 256);
+ _screen->getPalette(1).copy(pal, 0, 256);
delay(120 * _tickLength);
break;
@@ -2112,8 +2112,8 @@ void KyraEngine_HoF::seq_sequenceCommand(int command) {
//pal[3 * i] = pal[3 * i + 1] = pal[3 * i + 2] = 0x3f;
_screen->fadePalette(pal, 64);
- memcpy(_screen->getPalette(0), pal, 0x300);
- memcpy(_screen->getPalette(1), pal, 0x300);
+ _screen->getPalette(0).copy(pal, 0, 256);
+ _screen->getPalette(1).copy(pal, 0, 256);
break;
default:
@@ -2435,7 +2435,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), 0x18);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 0x18);
_seqTextColor[0] = textcolor;
_screen->setTextColorMap(colorMap);
@@ -2445,7 +2445,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), 1);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 1);
_screen->copyPage(2, 12);
seq_resetAllTextEntries();
@@ -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->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));
+ _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());
}
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->getPalette(0));
+ int endframe = ci->open("ci.wsa", 0, _screen->getPalette(0).getData());
_res->unloadPakFile("INTROGEN.PAK");
if (!ci->opened()) {
delete ci;
diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp
index 10591e0912..ba496dcfb0 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->getPalette(0));
+ _screen->loadBitmap("START.CPS", 7, 7, _screen->getPalette(0).getData());
_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->getPalette(0));
+ _screen->loadBitmap("BOTTOM.CPS", 5, 5, _screen->getPalette(0).getData());
_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->getPalette(0));
+ _screen->loadBitmap("FINAL.CPS", 7, 7, _screen->getPalette(0).getData());
_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->getPalette(0));
+ _screen->loadBitmap("LOGO.CPS", 3, 3, _screen->getPalette(0).getData());
_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->getPalette(0));
+ _screen->loadPalette("INTRO.PAL", _screen->getPalette(0).getData());
_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->getPalette(0));
+ _screen->loadBitmap("BOTTOM.CPS", 5, 5, _screen->getPalette(0).getData());
_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->getPalette(0), _screen->getPalette(0) + 3*32, 3*32);
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->getPalette(0).copy(_screen->getPalette(1));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
}
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->getPalette(0), _screen->getPalette(0) + 3*64, 3*32);
+ _screen->getPalette(0).copy(_screen->getPalette(2));
_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->getPalette(0));
+ _screen->loadBitmap("TEXT.CPS", 3, 3, _screen->getPalette(0).getData());
else if (_flags.lang == Common::EN_ANY || _flags.lang == Common::JA_JPN)
- _screen->loadBitmap("TEXT_ENG.CPS", 3, 3, _screen->getPalette(0));
+ _screen->loadBitmap("TEXT_ENG.CPS", 3, 3, _screen->getPalette(0).getData());
else if (_flags.lang == Common::DE_DEU)
- _screen->loadBitmap("TEXT_GER.CPS", 3, 3, _screen->getPalette(0));
+ _screen->loadBitmap("TEXT_GER.CPS", 3, 3, _screen->getPalette(0).getData());
else if (_flags.lang == Common::FR_FRA)
- _screen->loadBitmap("TEXT_FRE.CPS", 3, 3, _screen->getPalette(0));
+ _screen->loadBitmap("TEXT_FRE.CPS", 3, 3, _screen->getPalette(0).getData());
else if (_flags.lang == Common::ES_ESP)
- _screen->loadBitmap("TEXT_SPA.CPS", 3, 3, _screen->getPalette(0));
+ _screen->loadBitmap("TEXT_SPA.CPS", 3, 3, _screen->getPalette(0).getData());
else if (_flags.lang == Common::IT_ITA && !_flags.isTalkie)
- _screen->loadBitmap("TEXT_ITA.CPS", 3, 3, _screen->getPalette(0));
+ _screen->loadBitmap("TEXT_ITA.CPS", 3, 3, _screen->getPalette(0).getData());
else if (_flags.lang == Common::IT_ITA && _flags.isTalkie)
- _screen->loadBitmap("TEXT_ENG.CPS", 3, 3, _screen->getPalette(0));
+ _screen->loadBitmap("TEXT_ENG.CPS", 3, 3, _screen->getPalette(0).getData());
else
warning("no story graphics file found");
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
_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->getPalette(0), 768);
+ memcpy(tmpPal, _screen->getPalette(0).getData(), 768);
memcpy(&tmpPal[684], palTable2()[0], 60);
_screen->fadePalette(tmpPal, 72);
- memcpy(&_screen->getPalette(0)[684], palTable2()[0], 60);
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->getPalette(0).copy(palTable2()[0], 0, 20, 228);
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
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->getPalette(0));
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->loadBitmap("GEMHEAL.CPS", 3, 3, _screen->getPalette(0).getData());
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
_screen->shuffleScreen(8, 8, 304, 128, 2, 0, 1, 0);
uint32 nextTime = _system->getMillis() + 120 * _tickLength;
_finalA = new WSAMovie_v1(this);
@@ -1004,15 +1004,15 @@ void KyraEngine_LoK::seq_playEnding() {
_screen->hideMouse();
_screen->_curPage = 0;
_screen->fadeToBlack();
- _screen->loadBitmap("REUNION.CPS", 3, 3, _screen->getPalette(0));
+ _screen->loadBitmap("REUNION.CPS", 3, 3, _screen->getPalette(0).getData());
_screen->copyRegion(8, 8, 8, 8, 304, 128, 2, 0);
_screen->_curPage = 0;
// XXX
assert(_homeString);
drawSentenceCommand(_homeString[0], 179);
- memset(_screen->getPalette(2), 0, sizeof(uint8)*768);
- _screen->setScreenPalette(_screen->getPalette(2));
+ _screen->getPalette(2).clear();
+ _screen->setScreenPalette(_screen->getPalette(2).getData());
_seqPlayerFlag = true;
_seq->playSequence(_seq_Reunion, false);
@@ -1045,7 +1045,7 @@ void KyraEngine_LoK::seq_playCredits() {
} else
_screen->setFont(Screen::FID_8_FNT);
- _screen->loadBitmap("CHALET.CPS", 4, 4, _screen->getPalette(0));
+ _screen->loadBitmap("CHALET.CPS", 4, 4, _screen->getPalette(0).getData());
_screen->setCurPage(0);
_screen->clearCurPage();
@@ -1123,10 +1123,10 @@ void KyraEngine_LoK::seq_playCredits() {
_screen->setCurPage(2);
- memset(_screen->getPalette(2), 0, sizeof(uint8)*768);
- _screen->setScreenPalette(_screen->getPalette(2));
+ _screen->getPalette(2).clear();
+ _screen->setScreenPalette(_screen->getPalette(2).getData());
_screen->copyRegion(8, 32, 8, 32, 312, 128, 4, 0, Screen::CR_NO_P_CHECK);
- _screen->fadePalette(_screen->getPalette(0), 0x5A);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 0x5A);
Common::Event event;
bool finished = false;
@@ -1683,7 +1683,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));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
_animator->_updateScreen = true;
switch (_kyragemFadingState.nextOperation) {
case 0:
diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp
index c288113496..b023b74cdb 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), 30, 0);
- _screen->loadBitmap("FINAL.CPS", 2, 2, _screen->getPalette(0));
+ _screen->fadePalette(_screen->getPalette(1).getData(), 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), 30, 0);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 30, 0);
delayWithTicks(300);
- _screen->fadePalette(_screen->getPalette(1), 60, 0);
+ _screen->fadePalette(_screen->getPalette(1).getData(), 60, 0);
setupPrologueData(false);
return -1;
@@ -57,7 +57,7 @@ int LoLEngine::processPrologue() {
int processSelection = -1;
while (!shouldQuit() && processSelection == -1) {
- _screen->loadBitmap("TITLE.CPS", 2, 2, _screen->getPalette(0));
+ _screen->loadBitmap("TITLE.CPS", 2, 2, _screen->getPalette(0).getData());
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
_screen->setFont(Screen::FID_6_FNT);
@@ -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), 0x1E);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 0x1E);
_screen->updateScreen();
_eventList.clear();
@@ -74,9 +74,10 @@ int LoLEngine::processPrologue() {
if (selection != 3) {
_screen->hideMouse();
+
// Unlike the original, we add a nice fade to black
- memset(_screen->getPalette(0), 0, 768);
- _screen->fadePalette(_screen->getPalette(0), 0x54);
+ _screen->getPalette(0).clear();
+ _screen->fadeToBlack(0x54);
}
switch (selection) {
@@ -168,7 +169,7 @@ void LoLEngine::setupPrologueData(bool load) {
_selectionAnimFrames[1] = _selectionAnimFrames[3] = 1;
memset(_selectionAnimTimers, 0, sizeof(_selectionAnimTimers));
- memset(_screen->getPalette(1), 0, 768);
+ _screen->getPalette(1).clear();
_sound->setSoundList(&_soundData[kMusicIntro]);
@@ -184,9 +185,8 @@ void LoLEngine::setupPrologueData(bool load) {
} else {
delete _chargenWSA; _chargenWSA = 0;
- uint8 *pal = _screen->getPalette(0);
- memset(pal, 0, 768);
- _screen->setScreenPalette(pal);
+ _screen->getPalette(0).clear();
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
if (shouldQuit())
return;
@@ -203,9 +203,8 @@ void LoLEngine::showIntro() {
if (_flags.platform == Common::kPlatformPC98)
showStarcraftLogo();
- uint8 *pal = _screen->getPalette(0);
- memset(pal, 0, 768);
- _screen->setScreenPalette(pal);
+ _screen->getPalette(0).clear();
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
_screen->clearPage(0);
_screen->clearPage(4);
@@ -235,8 +234,8 @@ void LoLEngine::showIntro() {
palNextFadeStep = _system->getMillis() + ((_tim->_palDelayAcc >> 8) * _tickLength);
_tim->_palDelayAcc &= 0xFF;
- if (!_screen->fadePalStep(_screen->getPalette(0), _tim->_palDiff)) {
- _screen->setScreenPalette(_screen->getPalette(0));
+ if (!_screen->fadePalStep(_screen->getPalette(0).getData(), _tim->_palDiff)) {
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
_tim->_palDiff = 0;
}
}
@@ -260,7 +259,7 @@ void LoLEngine::showIntro() {
delete _tim;
_tim = 0;
- _screen->fadePalette(_screen->getPalette(1), 30, 0);
+ _screen->fadePalette(_screen->getPalette(1).getData(), 30, 0);
}
int LoLEngine::chooseCharacter() {
@@ -277,8 +276,8 @@ int LoLEngine::chooseCharacter() {
while (!_screen->isMouseVisible())
_screen->showMouse();
- _screen->loadBitmap("CHAR.CPS", 2, 2, _screen->getPalette(0));
- _screen->loadBitmap("BACKGRND.CPS", 4, 4, _screen->getPalette(0));
+ _screen->loadBitmap("CHAR.CPS", 2, 2, _screen->getPalette(0).getData());
+ _screen->loadBitmap("BACKGRND.CPS", 4, 4, _screen->getPalette(0).getData());
if (!_chargenWSA->open("CHARGEN.WSA", 1, 0))
error("Couldn't load CHARGEN.WSA");
@@ -305,9 +304,9 @@ int LoLEngine::chooseCharacter() {
_screen->_curPage = 0;
if (_flags.use16ColorMode)
- _screen->loadPalette("LOL.NOL", _screen->getPalette(0));
+ _screen->loadPalette("LOL.NOL", _screen->getPalette(0).getData());
- _screen->fadePalette(_screen->getPalette(0), 30, 0);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 30, 0);
bool kingIntro = true;
while (!shouldQuit()) {
@@ -650,7 +649,7 @@ void LoLEngine::showStarcraftLogo() {
_screen->clearPage(0);
_screen->clearPage(2);
- int endframe = ci->open("ci01.wsa", 0, _screen->getPalette(0));
+ int endframe = ci->open("ci01.wsa", 0, _screen->getPalette(0).getData());
if (!ci->opened()) {
delete ci;
return;
@@ -728,9 +727,8 @@ void LoLEngine::setupEpilogueData(bool load) {
if (_flags.platform == Common::kPlatformPC98)
_sound->loadSoundFile("SOUND.DAT");
} else {
- uint8 *pal = _screen->getPalette(0);
- memset(pal, 0, 768);
- _screen->setScreenPalette(pal);
+ _screen->getPalette(0).clear();
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
if (shouldQuit())
return;
@@ -745,9 +743,8 @@ void LoLEngine::showOutro(int character, bool maxDifficulty) {
TIMInterpreter *timBackUp = _tim;
_tim = new TIMInterpreter(this, _screen, _system);
- uint8 *pal = _screen->getPalette(0);
- memset(pal, 0, 768);
- _screen->setScreenPalette(pal);
+ _screen->getPalette(0).clear();
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
_screen->clearPage(0);
_screen->clearPage(4);
@@ -776,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), _tim->_palDiff)) {
- _screen->setScreenPalette(_screen->getPalette(0));
+ if (!_screen->fadePalStep(_screen->getPalette(0).getData(), _tim->_palDiff)) {
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
_tim->_palDiff = 0;
}
}
@@ -806,24 +803,24 @@ void LoLEngine::showOutro(int character, bool maxDifficulty) {
switch (character) {
case 0:
- _screen->loadBitmap("KIERAN.CPS", 3, 3, _screen->getPalette(0));
+ _screen->loadBitmap("KIERAN.CPS", 3, 3, _screen->getPalette(0).getData());
break;
case 1:
- _screen->loadBitmap("AK'SHEL.CPS", 3, 3, _screen->getPalette(0));
+ _screen->loadBitmap("AK'SHEL.CPS", 3, 3, _screen->getPalette(0).getData());
break;
case 2:
- _screen->loadBitmap("MICHAEL.CPS", 3, 3, _screen->getPalette(0));
+ _screen->loadBitmap("MICHAEL.CPS", 3, 3, _screen->getPalette(0).getData());
break;
case 3:
- _screen->loadBitmap("CONRAD.CPS", 3, 3, _screen->getPalette(0));
+ _screen->loadBitmap("CONRAD.CPS", 3, 3, _screen->getPalette(0).getData());
break;
default:
_screen->clearPage(3);
- memset(_screen->getPalette(0), 0, 768);
+ memset(_screen->getPalette(0).getData(), 0, 768);
break;
}
@@ -831,7 +828,7 @@ void LoLEngine::showOutro(int character, bool maxDifficulty) {
if (maxDifficulty)
_tim->displayText(0x8000, 0, 0xDC);
_screen->updateScreen();
- _screen->fadePalette(_screen->getPalette(0), 30, 0);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 30, 0);
while (!checkInput(0) && !shouldQuit())
delay(_tickLength);
@@ -859,8 +856,8 @@ void LoLEngine::showCredits() {
_screen->setTextColorMap(colorMap);
_screen->_charWidth = 0;
- _screen->loadBitmap("ROOM.CPS", 2, 2, _screen->getPalette(0));
- memset(_screen->getPalette(0) + 764, 0, 3);
+ _screen->loadBitmap("ROOM.CPS", 2, 2, _screen->getPalette(0).getData());
+ memset(_screen->getPalette(0).getData() + 764, 0, 3);
_screen->fadeToBlack(30);
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
@@ -909,8 +906,8 @@ void LoLEngine::processCredits(char *t, int dimState, int page, int delayTime) {
uint8 *monsterPal = _res->fileData("MONSTERS.PAL", 0);
assert(monsterPal);
- memcpy(_screen->getPalette(0) + 88 * 3, monsterPal + 0 * 3, 40 * 3);
- _screen->fadePalette(_screen->getPalette(0), 30);
+ _screen->getPalette(0).copy(monsterPal, 0, 40, 88);
+ _screen->fadePalette(_screen->getPalette(0).getData(), 30);
uint32 waitTimer = _system->getMillis();
@@ -1052,7 +1049,7 @@ void LoLEngine::processCredits(char *t, int dimState, int page, int delayTime) {
doorRedraw = false;
} else {
if (!monsterAnimFrame)
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, page, Screen::CR_NO_P_CHECK);
@@ -1132,8 +1129,8 @@ void LoLEngine::processCredits(char *t, int dimState, int page, int delayTime) {
curShapeFile = curShapeFile % 28;
loadOutroShapes(curShapeFile, shapes);
- memcpy(_screen->getPalette(0) + 88 * 3, monsterPal + curShapeFile * 40 * 3, 40 * 3);
- _screen->setScreenPalette(_screen->getPalette(0));
+ _screen->getPalette(0).copy(monsterPal, curShapeFile * 40, 40, 88);
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
needNewShape = false;
}
diff --git a/engines/kyra/sprites.cpp b/engines/kyra/sprites.cpp
index 1c9260caaf..707c107b2c 100644
--- a/engines/kyra/sprites.cpp
+++ b/engines/kyra/sprites.cpp
@@ -420,16 +420,16 @@ void Sprites::loadDat(const char *filename, SceneExits &exits) {
if (_vm->gameFlags().platform == Common::kPlatformAmiga) {
if (_vm->queryGameFlag(0xA0))
- memcpy(_screen->getPalette(3), _screen->getPalette(4), 32*3);
+ _screen->getPalette(3).copy(_screen->getPalette(4));
else
- memcpy(_screen->getPalette(3), _screen->getPalette(0), 32*3);
+ _screen->getPalette(3).copy(_screen->getPalette(0));
} else {
if (_vm->queryGameFlag(0xA0))
- memcpy(_screen->getPalette(1), _screen->getPalette(3), 768);
+ _screen->getPalette(1).copy(_screen->getPalette(3));
else
- memcpy(_screen->getPalette(1), _screen->getPalette(0), 768);
+ _screen->getPalette(1).copy(_screen->getPalette(0));
- _screen->loadPalette(_dat + 0x17, _screen->getPalette(1) + 684, 60);
+ _screen->loadPalette(_dat + 0x17, _screen->getPalette(1).getData() + 684, 60);
}
uint8 *data = _dat + 0x6B;
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index 5a4f008a1a..38ade654e5 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -1584,7 +1584,7 @@ void KyraEngine_LoK::loadMainScreen(int page) {
_screen->clearPage(page);
if (_flags.lang == Common::EN_ANY && !_flags.isTalkie && (_flags.platform == Common::kPlatformPC || _flags.platform == Common::kPlatformAmiga))
- _screen->loadBitmap("MAIN15.CPS", page, page, _screen->getPalette(0));
+ _screen->loadBitmap("MAIN15.CPS", page, page, _screen->getPalette(0).getData());
else if (_flags.lang == Common::EN_ANY || _flags.lang == Common::JA_JPN || (_flags.isTalkie && _flags.lang == Common::IT_ITA))
_screen->loadBitmap("MAIN_ENG.CPS", page, page, 0);
else if (_flags.lang == Common::FR_FRA)
@@ -1599,7 +1599,7 @@ void KyraEngine_LoK::loadMainScreen(int page) {
warning("no main graphics file found");
if (_flags.platform == Common::kPlatformAmiga)
- memcpy(_screen->getPalette(1), _screen->getPalette(0), 32*3);
+ _screen->getPalette(1).copy(_screen->getPalette(0));
_screen->copyRegion(0, 0, 0, 0, 320, 200, page, 0);
}
diff --git a/engines/kyra/text_lok.cpp b/engines/kyra/text_lok.cpp
index baae4547e5..4bb7f857d9 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));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
_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));
+ _screen->setScreenPalette(_screen->getPalette(0).getData());
if (finished) {
_fadeText = false;
diff --git a/engines/kyra/vqa.cpp b/engines/kyra/vqa.cpp
index 5e0b22a715..0d5df03474 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()->getPalette(0), size);
+ _file->read(_vm->screen()->getPalette(0).getData(), size);
break;
case MKID_BE('CPLZ'): // Palette
inbuf = (byte *)allocBuffer(0, size);
_file->read(inbuf, size);
- Screen::decodeFrame4(inbuf, _vm->screen()->getPalette(0), 768);
+ Screen::decodeFrame4(inbuf, _vm->screen()->getPalette(0).getData(), 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()->getPalette(0));
+ _vm->screen()->setScreenPalette(_vm->screen()->getPalette(0).getData());
}
int blockPitch = _header.width / _header.blockW;