diff options
author | Johannes Schickel | 2006-06-03 15:13:18 +0000 |
---|---|---|
committer | Johannes Schickel | 2006-06-03 15:13:18 +0000 |
commit | 369e79bfba0fabc743b25a476737147f994c8d4e (patch) | |
tree | 099b23bbbe821612d9e5c341543b8fe2100b7b66 /engines | |
parent | db709f57f694336fbf6bf7d21f61b5f8c35f099b (diff) | |
download | scummvm-rg350-369e79bfba0fabc743b25a476737147f994c8d4e.tar.gz scummvm-rg350-369e79bfba0fabc743b25a476737147f994c8d4e.tar.bz2 scummvm-rg350-369e79bfba0fabc743b25a476737147f994c8d4e.zip |
Implements cmd_fadeEntirePalette, should fix some missing palette fades.
svn-id: r22888
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/scene.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/screen.cpp | 6 | ||||
-rw-r--r-- | engines/kyra/script_v1.cpp | 23 | ||||
-rw-r--r-- | engines/kyra/sprites.cpp | 2 |
4 files changed, 27 insertions, 6 deletions
diff --git a/engines/kyra/scene.cpp b/engines/kyra/scene.cpp index a66de78789..972f4e00be 100644 --- a/engines/kyra/scene.cpp +++ b/engines/kyra/scene.cpp @@ -460,8 +460,6 @@ void KyraEngine::startSceneScript(int brandonAlive) { _screen->loadBitmap(fileNameBuffer, 3, 3, 0); _sprites->loadSceneShapes(); _exitListPtr = 0; - - _screen->setScreenPalette(_screen->_currentPalette); _scaleMode = 1; for (int i = 0; i < 145; ++i) { diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 66edbf6967..34003bb44d 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -49,7 +49,7 @@ Screen::~Screen() { free(_screenPalette); free(_decodeShapeBuffer); free(_animBlockPtr); - for (int i = 0; i < 3; ++i) { + for (int i = 0; i < ARRAYSIZE(_palettes); ++i) { free(_palettes[i]); } delete [] _bitBlitRects; @@ -92,7 +92,7 @@ bool Screen::init() { if (_screenPalette) { memset(_screenPalette, 0, 768); } - for (int i = 0; i < 3; ++i) { + for (int i = 0; i < ARRAYSIZE(_palettes); ++i) { _palettes[i] = (uint8 *)malloc(768); if (_palettes[i]) { memset(_palettes[i], 0, 768); @@ -1928,7 +1928,7 @@ void Screen::copyScreenToRect(int x, int y, int w, int h, uint8 *ptr) { uint8 *Screen::getPalette(int num) { debugC(9, kDebugLevelScreen, "Screen::getPalette(%d)", num); - assert(num >= 0 && num < 4); + assert(num >= 0 && num < ARRAYSIZE(_palettes)+1); if (num == 0) { return _screenPalette; } diff --git a/engines/kyra/script_v1.cpp b/engines/kyra/script_v1.cpp index 72d02df7e7..ce2be68a91 100644 --- a/engines/kyra/script_v1.cpp +++ b/engines/kyra/script_v1.cpp @@ -1504,7 +1504,28 @@ int KyraEngine::cmd_setNoDrawShapesFlag(ScriptState *script) { } int KyraEngine::cmd_fadeEntirePalette(ScriptState *script) { - warning("STUB: cmd_fadeEntirePalette"); + debugC(3, kDebugLevelScriptFuncs, "cmd_fadeEntirePalette(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); + int cmd = stackPos(0); + uint8 *fadePal = 0; + 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); + } else if (cmd == 1) { + //fadePal = _screen->getPalette(3); + warning("unimplemented cmd_fadeEntirePalette function"); + return 0; + } else if (cmd == 2) { + // HACK + uint8 *clearPal = _screen->getPalette(0); + fadePal = _screen->getPalette(1); + memset(clearPal, 0, sizeof(uint8)*768); + } + + _screen->fadePalette(fadePal, stackPos(1)); return 0; } diff --git a/engines/kyra/sprites.cpp b/engines/kyra/sprites.cpp index 8e3b000367..c16f891735 100644 --- a/engines/kyra/sprites.cpp +++ b/engines/kyra/sprites.cpp @@ -412,6 +412,8 @@ void Sprites::loadDAT(const char *filename, SceneExits &exits) { _engine->_northExitHeight += 1; // XXX memcpy(_screen->_currentPalette + 744 - 60, _dat + 0x17, 60); + _engine->_paletteChanged = 1; + memcpy(_screen->getPalette(1), _screen->_currentPalette, sizeof(uint8)*768); uint8 *data = _dat + 0x6B; uint16 length = READ_LE_UINT16(data); |