aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorJohannes Schickel2009-06-22 02:36:16 +0000
committerJohannes Schickel2009-06-22 02:36:16 +0000
commit4bb392b593c492299dd916784548dc56bc0b25cb (patch)
treeb37fd6fe6bac21244f0e52b8816fe0beaee7eeba /engines/kyra
parent882662977f2cdf574e5aab041ceaaf626386d0f2 (diff)
downloadscummvm-rg350-4bb392b593c492299dd916784548dc56bc0b25cb.tar.gz
scummvm-rg350-4bb392b593c492299dd916784548dc56bc0b25cb.tar.bz2
scummvm-rg350-4bb392b593c492299dd916784548dc56bc0b25cb.zip
Add wrapper functionality for copying full palettes.
svn-id: r41742
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/gui_hof.cpp8
-rw-r--r--engines/kyra/gui_lok.cpp4
-rw-r--r--engines/kyra/gui_mr.cpp4
-rw-r--r--engines/kyra/kyra_hof.cpp2
-rw-r--r--engines/kyra/kyra_mr.cpp4
-rw-r--r--engines/kyra/scene_hof.cpp2
-rw-r--r--engines/kyra/scene_lok.cpp2
-rw-r--r--engines/kyra/scene_mr.cpp2
-rw-r--r--engines/kyra/screen.cpp4
-rw-r--r--engines/kyra/screen.h1
-rw-r--r--engines/kyra/script_hof.cpp14
-rw-r--r--engines/kyra/script_lok.cpp10
-rw-r--r--engines/kyra/script_lol.cpp2
-rw-r--r--engines/kyra/seqplayer.cpp6
-rw-r--r--engines/kyra/sequences_hof.cpp6
-rw-r--r--engines/kyra/sequences_lok.cpp4
-rw-r--r--engines/kyra/sprites.cpp8
-rw-r--r--engines/kyra/staticres.cpp2
18 files changed, 45 insertions, 40 deletions
diff --git a/engines/kyra/gui_hof.cpp b/engines/kyra/gui_hof.cpp
index 9a79eb46e3..254d58741d 100644
--- a/engines/kyra/gui_hof.cpp
+++ b/engines/kyra/gui_hof.cpp
@@ -365,7 +365,7 @@ int KyraEngine_HoF::bookButton(Button *button) {
_screen->showMouse();
}
- _screen->getPalette(2).copy(_screen->getPalette(0));
+ _screen->copyPalette(2, 0);
_screen->fadeToBlack(7, &_updateFunctor);
_res->loadFileToBuf("_BOOK.COL", _screen->getPalette(0).getData(), 768);
loadBookBkgd();
@@ -393,7 +393,7 @@ int KyraEngine_HoF::bookButton(Button *button) {
}
setHandItem(_itemInHand);
- _screen->getPalette(0).copy(_screen->getPalette(2));
+ _screen->copyPalette(0, 2);
_screen->fadePalette(_screen->getPalette(0).getData(), 7, &_updateFunctor);
_screen->showMouse();
@@ -800,7 +800,7 @@ void GUI_HoF::createScreenThumbnail(Graphics::Surface &dst) {
}
void GUI_HoF::setupPalette() {
- _screen->getPalette(1).copy(_screen->getPalette(0));
+ _screen->copyPalette(1, 0);
uint8 *palette = _screen->getPalette(0).getData();
for (int i = 0; i < 768; ++i)
@@ -818,7 +818,7 @@ void GUI_HoF::setupPalette() {
}
void GUI_HoF::restorePalette() {
- _screen->getPalette(0).copy(_screen->getPalette(1));
+ _screen->copyPalette(0, 1);
_screen->setScreenPalette(_screen->getPalette(0).getData());
}
diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp
index c1f439707b..a73707e8ee 100644
--- a/engines/kyra/gui_lok.cpp
+++ b/engines/kyra/gui_lok.cpp
@@ -1024,7 +1024,7 @@ void GUI_LoK::fadePalette() {
static const int16 menuPalIndexes[] = {248, 249, 250, 251, 252, 253, 254, -1};
int index = 0;
- _screen->getPalette(2).copy(_screen->getPalette(0));
+ _screen->copyPalette(2, 0);
for (int i = 0; i < 768; i++)
_screen->getPalette(0)[i] >>= 1;
@@ -1041,7 +1041,7 @@ void GUI_LoK::restorePalette() {
if (_vm->gameFlags().platform == Common::kPlatformAmiga)
return;
- _screen->getPalette(0).copy(_screen->getPalette(2));
+ _screen->copyPalette(0, 2);
_screen->fadePalette(_screen->getPalette(0).getData(), 2);
}
diff --git a/engines/kyra/gui_mr.cpp b/engines/kyra/gui_mr.cpp
index f1c1078b74..340d30d663 100644
--- a/engines/kyra/gui_mr.cpp
+++ b/engines/kyra/gui_mr.cpp
@@ -674,7 +674,7 @@ void KyraEngine_MR::showAlbum() {
_screen->copyRegionToBuffer(0, 0, 0, 320, 200, _screenBuffer);
_screen->copyRegionToBuffer(4, 0, 0, 320, 200, _album.backUpPage);
- _screen->getPalette(1).copy(_screen->getPalette(0));
+ _screen->copyPalette(1, 0);
_screen->fadeToBlack(9);
int itemInHand = _itemInHand;
@@ -707,7 +707,7 @@ void KyraEngine_MR::showAlbum() {
_screen->copyBlockToPage(0, 0, 0, 320, 200, _screenBuffer);
_screen->copyBlockToPage(4, 0, 0, 320, 200, _album.backUpPage);
- _screen->getPalette(0).copy(_screen->getPalette(1));
+ _screen->copyPalette(0, 1);
_screen->fadePalette(_screen->getPalette(0).getData(), 9);
delete[] _album.backUpRect;
diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp
index df007e87b4..28a42fabd9 100644
--- a/engines/kyra/kyra_hof.cpp
+++ b/engines/kyra/kyra_hof.cpp
@@ -1656,7 +1656,7 @@ void KyraEngine_HoF::displayInvWsaLastFrame() {
#pragma mark -
void KyraEngine_HoF::setCauldronState(uint8 state, bool paletteFade) {
- _screen->getPalette(2).copy(_screen->getPalette(0));
+ _screen->copyPalette(2, 0);
Common::SeekableReadStream *file = _res->createReadStream("_POTIONS.PAL");
if (!file)
error("Couldn't load cauldron palette");
diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp
index d08f158aa8..b50a42cb8a 100644
--- a/engines/kyra/kyra_mr.cpp
+++ b/engines/kyra/kyra_mr.cpp
@@ -378,7 +378,7 @@ void KyraEngine_MR::playVQA(const char *name) {
}
_screen->hideMouse();
- _screen->getPalette(1).copy(_screen->getPalette(0));
+ _screen->copyPalette(1, 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);
- _screen->getPalette(0).copy(_screen->getPalette(1));
+ _screen->copyPalette(0, 1);
_wasPlayingVQA = true;
}
}
diff --git a/engines/kyra/scene_hof.cpp b/engines/kyra/scene_hof.cpp
index 8f8005c352..0300bf3a09 100644
--- a/engines/kyra/scene_hof.cpp
+++ b/engines/kyra/scene_hof.cpp
@@ -396,7 +396,7 @@ void KyraEngine_HoF::unloadScene() {
void KyraEngine_HoF::loadScenePal() {
uint16 sceneId = _mainCharacter.sceneId;
- _screen->getPalette(1).copy(_screen->getPalette(0));
+ _screen->copyPalette(1, 0);
char filename[14];
strcpy(filename, _sceneList[sceneId].filename1);
diff --git a/engines/kyra/scene_lok.cpp b/engines/kyra/scene_lok.cpp
index c020fccee1..c09c9e1687 100644
--- a/engines/kyra/scene_lok.cpp
+++ b/engines/kyra/scene_lok.cpp
@@ -785,7 +785,7 @@ void KyraEngine_LoK::initSceneScreen(int brandonAlive) {
_screen->getPalette(0).copy(_screen->getPalette(4), 12, 1);
if (_currentCharacter->sceneId >= 229 && _currentCharacter->sceneId <= 245 && (_brandonStatusBit & 1))
- _screen->getPalette(0).copy(_screen->getPalette(10));
+ _screen->copyPalette(0, 10);
_screen->setScreenPalette(_screen->getPalette(0).getData());
}
diff --git a/engines/kyra/scene_mr.cpp b/engines/kyra/scene_mr.cpp
index 3b9d386c11..890bb6515c 100644
--- a/engines/kyra/scene_mr.cpp
+++ b/engines/kyra/scene_mr.cpp
@@ -328,7 +328,7 @@ void KyraEngine_MR::freeSceneShapes() {
void KyraEngine_MR::loadScenePal() {
char filename[16];
- _screen->getPalette(2).copy(_screen->getPalette(0));
+ _screen->copyPalette(2, 0);
strcpy(filename, _sceneList[_mainCharacter.sceneId].filename1);
strcat(filename, ".COL");
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index 7e88c56497..b82ec0d09a 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -2666,6 +2666,10 @@ Palette &Screen::getPalette(int num) {
return *_palettes[num];
}
+void Screen::copyPalette(const int dst, const int src) {
+ getPalette(dst).copy(getPalette(src));
+}
+
byte Screen::getShapeFlag1(int x, int y) {
uint8 color = _shapePages[0][y * SCREEN_W + x];
color &= 0x80;
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index 32b9623d96..dab50a54f5 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -233,6 +233,7 @@ public:
void getRealPalette(int num, uint8 *dst);
Palette &getPalette(int num);
+ void copyPalette(const int dst, const int src);
// gui specific (processing on _curPage)
enum ShadeType {
diff --git a/engines/kyra/script_hof.cpp b/engines/kyra/script_hof.cpp
index c2bf48da83..b502483858 100644
--- a/engines/kyra/script_hof.cpp
+++ b/engines/kyra/script_hof.cpp
@@ -146,7 +146,7 @@ int KyraEngine_HoF::o2_meanWhileScene(EMCState *script) {
const char *palfile = stackPosString(1);
_screen->loadBitmap(cpsfile, 3, 3, 0);
- _screen->getPalette(2).copy(_screen->getPalette(0));
+ _screen->copyPalette(2, 0);
_screen->loadPalette(palfile, _screen->getPalette(2).getData());
_screen->fillRect(0, 0, 319, 199, 207);
_screen->setScreenPalette(_screen->getPalette(2).getData());
@@ -559,7 +559,7 @@ 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));
- _screen->getPalette(1).copy(_screen->getPalette(0));
+ _screen->copyPalette(1, 0);
_res->loadFileToBuf(stackPosString(0), _screen->getPalette(1).getData(), 384);
return 0;
}
@@ -774,7 +774,7 @@ int KyraEngine_HoF::o2_showLetter(EMCState *script) {
displayInvWsaLastFrame();
backUpPage0();
- _screen->getPalette(2).copy(_screen->getPalette(0));
+ _screen->copyPalette(2, 0);
_screen->clearPage(3);
_screen->loadBitmap("_NOTE.CPS", 3, 3, 0);
@@ -819,7 +819,7 @@ int KyraEngine_HoF::o2_showLetter(EMCState *script) {
_screen->hideMouse();
_screen->fadeToBlack(0x14);
restorePage0();
- _screen->getPalette(0).copy(_screen->getPalette(2));
+ _screen->copyPalette(0, 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);
- _screen->getPalette(2).copy(_screen->getPalette(0));
+ _screen->copyPalette(2, 0);
for (int i = 1; i < 768; i += 3)
_screen->getPalette(0)[i] = 0;
snd_playSoundEffect(106);
_screen->fadePalette(_screen->getPalette(0).getData(), 90, &_updateFunctor);
- _screen->getPalette(0).copy(_screen->getPalette(2));
+ _screen->copyPalette(0, 2);
for (int i = 0; i < 768; i += 3) {
_screen->getPalette(0)[i] = _screen->getPalette(0)[i + 1] = 0;
@@ -1142,7 +1142,7 @@ int KyraEngine_HoF::o2_mushroomEffect(EMCState *script) {
snd_playSoundEffect(106);
_screen->fadePalette(_screen->getPalette(0).getData(), 90, &_updateFunctor);
- _screen->getPalette(0).copy(_screen->getPalette(2));
+ _screen->copyPalette(0, 2);
_screen->fadePalette(_screen->getPalette(0).getData(), 30, &_updateFunctor);
return 0;
diff --git a/engines/kyra/script_lok.cpp b/engines/kyra/script_lok.cpp
index 263875a58e..19f8d87adc 100644
--- a/engines/kyra/script_lok.cpp
+++ b/engines/kyra/script_lok.cpp
@@ -232,7 +232,7 @@ int KyraEngine_LoK::o1_fadeSpecialPalette(EMCState *script) {
if (_currentCharacter->sceneId != 45) {
if (stackPos(0) == 13) {
// TODO: Check this!
- _screen->getPalette(0).copy(_screen->getPalette(12));
+ _screen->copyPalette(0, 12);
_screen->setScreenPalette(_screen->getPalette(0).getData());
}
} else {
@@ -1509,10 +1509,10 @@ int KyraEngine_LoK::o1_fadeEntirePalette(EMCState *script) {
if (cmd == 0) {
_screen->getPalette(2).clear();
fadePal = _screen->getPalette(2).getData();
- _screen->getPalette(4).copy(_screen->getPalette(0));
+ _screen->copyPalette(4, 0);
} else if (cmd == 1) {
fadePal = _screen->getPalette(0).getData();
- _screen->getPalette(0).copy(_screen->getPalette(4));
+ _screen->copyPalette(0, 4);
} else if (cmd == 2) {
fadePal = _screen->getPalette(0).getData();
_screen->getPalette(2).clear();
@@ -1521,14 +1521,14 @@ int KyraEngine_LoK::o1_fadeEntirePalette(EMCState *script) {
if (cmd == 0) {
_screen->getPalette(2).clear();
fadePal = _screen->getPalette(2).getData();
- _screen->getPalette(3).copy(_screen->getPalette(0));
+ _screen->copyPalette(3, 0);
} else if (cmd == 1) {
//fadePal = _screen->getPalette(3);
warning("unimplemented o1_fadeEntirePalette function");
return 0;
} else if (cmd == 2) {
_screen->getPalette(2).clear();
- _screen->getPalette(0).copy(_screen->getPalette(1));
+ _screen->copyPalette(0, 1);
fadePal = _screen->getPalette(0).getData();
}
}
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index a8e1d1c57a..c5711ee665 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -2303,7 +2303,7 @@ int LoLEngine::tlol_loadPalette(const TIM *tim, const uint16 *param) {
int LoLEngine::tlol_setupPaletteFadeEx(const TIM *tim, const uint16 *param) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_setupPaletteFadeEx(%p, %p) (%d)", (const void *)tim, (const void *)param, param[0]);
- _screen->getPalette(0).copy(_screen->getPalette(1));
+ _screen->copyPalette(0, 1);
_screen->getFadeParams(_screen->getPalette(0).getData(), param[0], _tim->_palDelayInc, _tim->_palDiff);
_tim->_palDelayAcc = 0;
diff --git a/engines/kyra/seqplayer.cpp b/engines/kyra/seqplayer.cpp
index c31cb9a35a..2d59f86e9f 100644
--- a/engines/kyra/seqplayer.cpp
+++ b/engines/kyra/seqplayer.cpp
@@ -241,11 +241,11 @@ void SeqPlayer::s1_loadPalette() {
if (_vm->gameFlags().platform == Common::kPlatformAmiga) {
if (!colNum)
- _screen->getPalette(0).copy(_screen->getPalette(6));
+ _screen->copyPalette(0, 6);
else if (colNum == 3)
- _screen->getPalette(0).copy(_screen->getPalette(7));
+ _screen->copyPalette(0, 7);
else if (colNum == 4)
- _screen->getPalette(0).copy(_screen->getPalette(3));
+ _screen->copyPalette(0, 3);
_screen->setScreenPalette(_screen->getPalette(0).getData());
} else {
diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp
index 5562ead43a..03f92f188f 100644
--- a/engines/kyra/sequences_hof.cpp
+++ b/engines/kyra/sequences_hof.cpp
@@ -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);
- _screen->getPalette(1).copy(_screen->getPalette(0));
+ _screen->copyPalette(1, 0);
_seqFrameCounter = 0;
_seqStartTime = _system->getMillis();
@@ -2069,13 +2069,13 @@ void KyraEngine_HoF::seq_sequenceCommand(int command) {
case 3:
_screen->copyPage(2, 0);
_screen->fadePalette(_screen->getPalette(0).getData(), 16);
- _screen->getPalette(1).copy(_screen->getPalette(0));
+ _screen->copyPalette(1, 0);
break;
case 4:
_screen->copyPage(2, 0);
_screen->fadePalette(_screen->getPalette(0).getData(), 36);
- _screen->getPalette(1).copy(_screen->getPalette(0));
+ _screen->copyPalette(1, 0);
break;
case 5:
diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp
index ba496dcfb0..a7686aa362 100644
--- a/engines/kyra/sequences_lok.cpp
+++ b/engines/kyra/sequences_lok.cpp
@@ -166,7 +166,7 @@ void KyraEngine_LoK::seq_introLogos() {
delay(60 * _tickLength);
if (_flags.platform == Common::kPlatformAmiga) {
- _screen->getPalette(0).copy(_screen->getPalette(1));
+ _screen->copyPalette(0, 1);
_screen->setScreenPalette(_screen->getPalette(0).getData());
}
@@ -181,7 +181,7 @@ void KyraEngine_LoK::seq_introLogos() {
return;
if (_flags.platform == Common::kPlatformAmiga) {
- _screen->getPalette(0).copy(_screen->getPalette(2));
+ _screen->copyPalette(0, 2);
_screen->fadeToBlack();
_screen->copyRegion(0, 0, 0, 0, 320, 200, 4, 0);
_screen->fadeFromBlack();
diff --git a/engines/kyra/sprites.cpp b/engines/kyra/sprites.cpp
index 707c107b2c..4772ad95bb 100644
--- a/engines/kyra/sprites.cpp
+++ b/engines/kyra/sprites.cpp
@@ -420,14 +420,14 @@ void Sprites::loadDat(const char *filename, SceneExits &exits) {
if (_vm->gameFlags().platform == Common::kPlatformAmiga) {
if (_vm->queryGameFlag(0xA0))
- _screen->getPalette(3).copy(_screen->getPalette(4));
+ _screen->copyPalette(3, 4);
else
- _screen->getPalette(3).copy(_screen->getPalette(0));
+ _screen->copyPalette(3, 0);
} else {
if (_vm->queryGameFlag(0xA0))
- _screen->getPalette(1).copy(_screen->getPalette(3));
+ _screen->copyPalette(1, 3);
else
- _screen->getPalette(1).copy(_screen->getPalette(0));
+ _screen->copyPalette(1, 0);
_screen->loadPalette(_dat + 0x17, _screen->getPalette(1).getData() + 684, 60);
}
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index 38ade654e5..3974bb7252 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -1599,7 +1599,7 @@ void KyraEngine_LoK::loadMainScreen(int page) {
warning("no main graphics file found");
if (_flags.platform == Common::kPlatformAmiga)
- _screen->getPalette(1).copy(_screen->getPalette(0));
+ _screen->copyPalette(1, 0);
_screen->copyRegion(0, 0, 0, 0, 320, 200, page, 0);
}