diff options
author | Oystein Eftevaag | 2006-01-28 05:09:39 +0000 |
---|---|---|
committer | Oystein Eftevaag | 2006-01-28 05:09:39 +0000 |
commit | 3730bc19ebf236b339fc3d32ac6f13e017f64970 (patch) | |
tree | 83987be7909acacfecf9e4632a3df6e598f45596 | |
parent | 3c867006fac08e7476376574cbdb4f86ee4c8de4 (diff) | |
download | scummvm-rg350-3730bc19ebf236b339fc3d32ac6f13e017f64970.tar.gz scummvm-rg350-3730bc19ebf236b339fc3d32ac6f13e017f64970.tar.bz2 scummvm-rg350-3730bc19ebf236b339fc3d32ac6f13e017f64970.zip |
Fixes the kyra GUI palette issues, implements background fading when the GUI's up,
and a couple of very minor optimizations.
svn-id: r20263
-rw-r--r-- | kyra/gui.cpp | 37 | ||||
-rw-r--r-- | kyra/kyra.cpp | 2 | ||||
-rw-r--r-- | kyra/kyra.h | 2 | ||||
-rw-r--r-- | kyra/sprites.cpp | 10 |
4 files changed, 42 insertions, 9 deletions
diff --git a/kyra/gui.cpp b/kyra/gui.cpp index 10d66a42f2..668e33459d 100644 --- a/kyra/gui.cpp +++ b/kyra/gui.cpp @@ -403,6 +403,7 @@ int KyraEngine::buttonMenuCallback(Button *caller) { } _screen->savePageToDisk("SEENPAGE.TMP", 0); + gui_fadePalette(); calcCoords(_menu[0]); calcCoords(_menu[1]); @@ -425,6 +426,7 @@ int KyraEngine::buttonMenuCallback(Button *caller) { } if (_menuRestoreScreen) { + gui_restorePalette(); _screen->loadPageFromDisk("SEENPAGE.TMP", 0); _animator->_updateScreen = true; } @@ -715,6 +717,7 @@ int KyraEngine::gui_loadGameMenu(Button *button) { initMenu(_menu[0]); processAllMenuButtons(); } else { + gui_restorePalette(); loadGame(getSavegameFilename(_gameToLoad)); _displayMenu = false; _menuRestoreScreen = false; @@ -724,7 +727,13 @@ int KyraEngine::gui_loadGameMenu(Button *button) { void KyraEngine::gui_redrawTextfield() { _screen->fillRect(38, 91, 287, 102, 250); - _text->printText(_savegameName, 38, 91, 30, 0, 0); + _text->printText(_savegameName, 38, 92, 253, 0, 0); + + _screen->_charWidth = -2; + int width = _screen->getTextWidth(_savegameName); + _screen->fillRect(39 + width, 93, 45 + width, 100, 254); + _screen->_charWidth = 0; + _screen->updateScreen(); } @@ -830,8 +839,8 @@ int KyraEngine::gui_cancelSubMenu(Button *button) { int KyraEngine::gui_quitPlaying(Button *button) { debug(9, "KyraEngine::gui_quitPlaying()"); - processMenuButton(button); + if (gui_quitConfirm("Are you sure you want to quit playing?")) quitGame(); else { @@ -973,5 +982,29 @@ void KyraEngine::gui_redrawHighlight(Menu menu) { _text->printText(menu.item[i].itemString, textX, textY, menu.item[i].highlightColor, 0, 0); } +void KyraEngine::gui_fadePalette() { + static int16 menuPalIndexes[] = {248, 249, 250, 251, 252, 253, 254, -1}; + int index = 0; + + memcpy(_screen->getPalette(2), _screen->_currentPalette, 768); + + for (int i = 0; i < 768; i++) { + _screen->_currentPalette[i] /= 2; + } + + while( menuPalIndexes[index] != -1) { + memcpy(&_screen->_currentPalette[menuPalIndexes[index]*3], &_screen->getPalette(2)[menuPalIndexes[index]*3], 3); + index++; + } + + _screen->fadePalette(_screen->_currentPalette, 2); +} + +void KyraEngine::gui_restorePalette() { + memcpy(_screen->_currentPalette, _screen->getPalette(2), 768); + _screen->fadePalette(_screen->_currentPalette, 2); +} + + } // end of namespace Kyra diff --git a/kyra/kyra.cpp b/kyra/kyra.cpp index 2ed9509d69..6133e52a22 100644 --- a/kyra/kyra.cpp +++ b/kyra/kyra.cpp @@ -730,8 +730,6 @@ void KyraEngine::mainLoop() { processButtonList(_buttonList); updateMousePointer(); updateGameTimers(); - _sprites->updateSceneAnims(); - _animator->updateAllObjectShapes(); updateTextFade(); _handleInput = true; diff --git a/kyra/kyra.h b/kyra/kyra.h index cd1867351a..f981ae8c75 100644 --- a/kyra/kyra.h +++ b/kyra/kyra.h @@ -687,6 +687,8 @@ protected: void gui_processHighlights(Menu &menu); void gui_updateSavegameString(); void gui_redrawTextfield(); + void gui_fadePalette(); + void gui_restorePalette(); uint8 _game; bool _fastMode; diff --git a/kyra/sprites.cpp b/kyra/sprites.cpp index 63143404f6..9d91bb59e8 100644 --- a/kyra/sprites.cpp +++ b/kyra/sprites.cpp @@ -129,6 +129,9 @@ void Sprites::updateSceneAnims() { uint32 currTime = _system->getMillis(); uint8 *data; bool endLoop; + uint16 rndNr; + uint16 anim; + uint16 sound; for (int i = 0; i < MAX_NUM_ANIMS; i++) { if (_anims[i].script == 0 || !_anims[i].play || _anims[i].nextRun != 0 && _anims[i].nextRun > currTime) @@ -145,9 +148,6 @@ void Sprites::updateSceneAnims() { endLoop = false; while (READ_LE_UINT16(data) != 0xFF87 && !endLoop) { - uint16 rndNr; - uint16 anim; - uint16 sound; assert((data - _anims[i].script) < _anims[i].length); switch (READ_LE_UINT16(data)) { case 0xFF88: @@ -408,8 +408,8 @@ void Sprites::loadDAT(const char *filename, SceneExits &exits) { _engine->_northExitHeight = READ_LE_UINT16(_dat + 0x15); if (_engine->_northExitHeight & 1) _engine->_northExitHeight += 1; - // XXX - memcpy(_screen->_currentPalette + 745 - 0x3D, _dat + 0x17, 0x3D); + // XXX + memcpy(_screen->_currentPalette + 744 - 60, _dat + 0x17, 60); uint8 *data = _dat + 0x6B; uint16 length = READ_LE_UINT16(data); |