diff options
author | lukaslw | 2014-03-08 16:24:17 +0100 |
---|---|---|
committer | lukaslw | 2014-03-08 16:24:17 +0100 |
commit | 41285953605c0bc7a42988eff3b6f6de1038cda2 (patch) | |
tree | caa8a38879699c0da81a554b3719641c6009861d | |
parent | 579c343d1361801c936eedae50d956018a7d83f4 (diff) | |
download | scummvm-rg350-41285953605c0bc7a42988eff3b6f6de1038cda2.tar.gz scummvm-rg350-41285953605c0bc7a42988eff3b6f6de1038cda2.tar.bz2 scummvm-rg350-41285953605c0bc7a42988eff3b6f6de1038cda2.zip |
DRACI: Fading out improvements.
-rw-r--r-- | engines/draci/game.cpp | 32 | ||||
-rw-r--r-- | engines/draci/game.h | 1 |
2 files changed, 19 insertions, 14 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 98777a7eca..3a335f249a 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -72,6 +72,7 @@ Game::Game(DraciEngine *vm) : _vm(vm), _walkingState(vm) { _fadePhases = 0; _fadePhase = 0; _fadeTick = 0; + _isFadeOut = 1; _mouseChangeTick = 0; _enableQuickHero = 0; _wantQuickHero = 0; @@ -216,6 +217,7 @@ void Game::start() { // init scripts. This flag was turned on to skip the rest of // those programs. Don't call loop(), because the // location may have changed. + fadePalette(true); continue; } @@ -478,6 +480,7 @@ void Game::handleDialogueLoop() { } void Game::fadePalette(bool fading_out) { + _isFadeOut = fading_out; const byte *startPal = NULL; const byte *endPal = _currentRoom._palette >= 0 ? _vm->_paletteArchive->getFile(_currentRoom._palette)->_data @@ -551,6 +554,19 @@ void Game::advanceAnimationsAndTestLoopExit() { _vm->_anims->drawScene(_vm->_screen->getSurface()); _vm->_screen->copyToScreen(); _vm->_system->delayMillis(kTimeUnit); + if(_isFadeOut) { + fadePalette(false); + // Set cursor state + // Need to do this after we set the palette since the cursors use it + if (_currentRoom._mouseOn) { + debugC(6, kDraciLogicDebugLevel, "Mouse: ON"); + _vm->_mouse->cursorOn(); + _vm->_mouse->setCursorType(kNormalCursor); + } else { + debugC(6, kDraciLogicDebugLevel, "Mouse: OFF"); + _vm->_mouse->cursorOff(); + } + } // If the hero has arrived at his destination, after even the last // phase was correctly animated, run the callback. @@ -598,6 +614,8 @@ void Game::loop(LoopSubstatus substatus, bool shouldExit) { break; } + advanceAnimationsAndTestLoopExit(); + if (_vm->_mouse->isCursorOn()) { // Find animation under cursor and the game object // corresponding to it @@ -629,8 +647,6 @@ void Game::loop(LoopSubstatus substatus, bool shouldExit) { } } - advanceAnimationsAndTestLoopExit(); - } while (!shouldExitLoop()); setLoopSubstatus(kOuterLoop); @@ -1435,7 +1451,6 @@ void Game::enterNewRoom() { _vm->_screen->setPalette(NULL, 0, kNumColors); _vm->_anims->drawScene(_vm->_screen->getSurface()); _vm->_screen->copyToScreen(); - fadePalette(false); // Run the program for the gate the dragon came through debugC(6, kDraciLogicDebugLevel, "Running program for gate %d", _newGate); @@ -1448,17 +1463,6 @@ void Game::enterNewRoom() { // Don't immediately switch to the map or inventory even if the mouse // position tell us to. _mouseChangeTick = kMouseDoNotSwitch; - - // Set cursor state - // Need to do this after we set the palette since the cursors use it - if (_currentRoom._mouseOn) { - debugC(6, kDraciLogicDebugLevel, "Mouse: ON"); - _vm->_mouse->cursorOn(); - _vm->_mouse->setCursorType(kNormalCursor); - } else { - debugC(6, kDraciLogicDebugLevel, "Mouse: OFF"); - _vm->_mouse->cursorOff(); - } } void Game::positionAnimAsHero(Animation *anim) { diff --git a/engines/draci/game.h b/engines/draci/game.h index d3ae36e816..638c979d61 100644 --- a/engines/draci/game.h +++ b/engines/draci/game.h @@ -413,6 +413,7 @@ private: int _fadePhases; int _fadePhase; uint _fadeTick; + bool _isFadeOut; int _mouseChangeTick; bool _enableQuickHero; |