diff --git a/engines/sword1/menu.cpp b/engines/sword1/menu.cpp index 2d2604bc0d3e..4b3bfb1fe268 100644 --- a/engines/sword1/menu.cpp +++ b/engines/sword1/menu.cpp @@ -389,14 +389,39 @@ void Menu::setToTargetState() { // Note that we are only doing this for the top menu: // I haven't seen any instance of a bottom menu (dialog) // being able to immediately open after a palette fade. - if (_objectBarStatus == MENU_CLOSING) + if (_objectBarStatus == MENU_CLOSING) { _objectBarStatus = MENU_CLOSED; + _fadeObject = 0; + for (int i = 0; i < 16; i++) { + if (_objects[i]) + _objects[i]->draw(_fadeEffectTop, _fadeObject); + else + _screen->showFrame(i * 40, 0, 0xffffffff, 0, _fadeEffectTop, _fadeObject); + } + } if (_objectBarStatus == MENU_OPENING) { _objectBarStatus = MENU_OPEN; _fadeObject = 8; showMenu(MENU_TOP); } + + if (_subjectBarStatus == MENU_CLOSING) { + _subjectBarStatus = MENU_CLOSED; + _fadeSubject = 0; + for (int i = 0; i < 16; i++) { + if (_subjects[i]) + _subjects[i]->draw(_fadeEffectBottom, _fadeSubject); + else + _screen->showFrame(i * 40, 440, 0xffffffff, 0, _fadeEffectBottom, _fadeSubject); + } + } + + if (_subjectBarStatus == MENU_OPENING) { + _subjectBarStatus = MENU_OPEN; + _fadeSubject = 8; + showMenu(MENU_TOP); + } } int Menu::logicChooser(Object *compact) { diff --git a/engines/sword1/mouse.cpp b/engines/sword1/mouse.cpp index 9354f3abbce2..656159008737 100644 --- a/engines/sword1/mouse.cpp +++ b/engines/sword1/mouse.cpp @@ -141,7 +141,7 @@ void Mouse::engine(uint16 x, uint16 y, uint16 eventFlags) { //- int32 touchedId = 0; uint16 clicked = 0; - if (y > 40) { + if ((y > 40 && _inTopMenu) || !_inTopMenu) { for (uint16 priority = 0; (priority < 10) && (!touchedId); priority++) { for (uint16 cnt = 0; (cnt < _numObjs) && (!touchedId); cnt++) { if ((_objList[cnt].compact->o_priority == priority) && diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp index bcbb3cf9cf98..1f9ef16d10fd 100644 --- a/engines/sword1/sword1.cpp +++ b/engines/sword1/sword1.cpp @@ -1230,7 +1230,7 @@ static void vblCallback(void *refCon) { if ((vm->_vblCount == 3) || (vm->_vblCount == 7)) { vm->updateBottomMenu(); } - } else { + } else if (vm->fadeDirectionIsUp()) { // This is an optimization for all the locks introduced // with the fade palette changes: we disable the menu // updates whenever the palette is fading, and we bring @@ -1254,6 +1254,10 @@ bool SwordEngine::screenIsFading() { return _screen->stillFading() != 0; } +bool SwordEngine::fadeDirectionIsUp() { + return _screen->stillFading() == 1; +} + void SwordEngine::installTimerRoutines() { debug(2, "SwordEngine::installTimerRoutines(): Installing timers..."); _ticker = 0; diff --git a/engines/sword1/sword1.h b/engines/sword1/sword1.h index e270baca8356..448d098732b7 100644 --- a/engines/sword1/sword1.h +++ b/engines/sword1/sword1.h @@ -124,6 +124,7 @@ class SwordEngine : public Engine { void startFadePaletteUp(int speed); void waitForFade(); bool screenIsFading(); + bool fadeDirectionIsUp(); void setMenuToTargetState(); void showDebugInfo();