From a6e1d6bd3dcdc1fae7832ffe26b4d774ec1fe6a3 Mon Sep 17 00:00:00 2001 From: Christopher Page Date: Sun, 13 Jul 2008 20:41:39 +0000 Subject: SKY works with the new GMM implementation, also updated gui/newgui.cpp and prevented pushEvent from pushing more than one EVENT_QUIT into the artificialEventQueue svn-id: r33041 --- backends/events/default/default-events.cpp | 8 +++++++- engines/sky/control.cpp | 11 ++++------- engines/sky/logic.cpp | 2 +- engines/sky/mouse.cpp | 1 - engines/sky/sky.cpp | 9 +++------ gui/newgui.cpp | 2 +- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp index 24750d038c..b91643c6fb 100644 --- a/backends/events/default/default-events.cpp +++ b/backends/events/default/default-events.cpp @@ -478,7 +478,13 @@ bool DefaultEventManager::pollEvent(Common::Event &event) { } void DefaultEventManager::pushEvent(Common::Event event) { - artificialEventQueue.push(event); + + // If already received an EVENT_QUIT, don't add another one + if (event.type == Common::EVENT_QUIT) { + if (!_shouldQuit) + artificialEventQueue.push(event); + } else + artificialEventQueue.push(event); } #endif // !defined(DISABLE_DEFAULT_EVENTMANAGER) diff --git a/engines/sky/control.cpp b/engines/sky/control.cpp index 5955c851f6..a6ab5429dd 100644 --- a/engines/sky/control.cpp +++ b/engines/sky/control.cpp @@ -492,7 +492,7 @@ void Control::doControlPanel(void) { _curButtonText = 0; uint16 clickRes = 0; - while (!quitPanel && !g_engine->_quit) { + while (!quitPanel && !g_engine->quit()) { _text->drawToScreen(WITH_MASK); _system->updateScreen(); _mouseClicked = false; @@ -524,7 +524,7 @@ void Control::doControlPanel(void) { } memset(_screenBuf, 0, GAME_SCREEN_WIDTH * FULL_SCREEN_HEIGHT); _system->copyRectToScreen(_screenBuf, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, FULL_SCREEN_HEIGHT); - if (!g_engine->_quit) + if (!g_engine->quit()) _system->updateScreen(); _skyScreen->forceRefresh(); _skyScreen->setPaletteEndian((uint8 *)_skyCompact->fetchCpt(SkyEngine::_systemVars.currentPalette)); @@ -603,7 +603,7 @@ uint16 Control::handleClick(ConResource *pButton) { case QUIT_TO_DOS: animClick(pButton); if (getYesNo(quitDos)) - g_engine->_quit = true; + g_engine->quitGame(); return 0; default: error("Control::handleClick: unknown routine: %X",pButton->_onClick); @@ -875,7 +875,7 @@ uint16 Control::saveRestorePanel(bool allowSave) { bool refreshNames = true; bool refreshAll = true; uint16 clickRes = 0; - while (!quitPanel && !g_engine->_quit) { + while (!quitPanel && !g_engine->quit()) { clickRes = 0; if (refreshNames || refreshAll) { if (refreshAll) { @@ -1546,9 +1546,6 @@ void Control::delay(unsigned int amount) { case Common::EVENT_WHEELDOWN: _mouseWheel = 1; break; - case Common::EVENT_QUIT: - g_engine->_quit = true; - break; default: break; } diff --git a/engines/sky/logic.cpp b/engines/sky/logic.cpp index 936efdacbe..6cd4ce505a 100644 --- a/engines/sky/logic.cpp +++ b/engines/sky/logic.cpp @@ -2489,7 +2489,7 @@ bool Logic::fnFadeUp(uint32 a, uint32 b, uint32 c) { } bool Logic::fnQuitToDos(uint32 a, uint32 b, uint32 c) { - g_engine->_quit = true; + g_engine->quitGame(); return false; } diff --git a/engines/sky/mouse.cpp b/engines/sky/mouse.cpp index 38a3b6a8e9..1fc9e47539 100644 --- a/engines/sky/mouse.cpp +++ b/engines/sky/mouse.cpp @@ -180,7 +180,6 @@ void Mouse::waitMouseNotPressed(int minDelay) { while (mousePressed || _system->getMillis() < now + minDelay) { if (eventMan->shouldQuit()) { - g_engine->_quit = true; minDelay = 0; mousePressed = false; } diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp index 072d0c914e..421f6a5f08 100644 --- a/engines/sky/sky.cpp +++ b/engines/sky/sky.cpp @@ -353,7 +353,7 @@ int SkyEngine::go() { introSkipped = !_skyIntro->doIntro(_floppyIntro); } - if (!_quit) { + if (!quit()) { _skyLogic->initScreen0(); if (introSkipped) _skyControl->restartGame(); @@ -363,7 +363,7 @@ int SkyEngine::go() { _lastSaveTime = _system->getMillis(); uint32 delayCount = _system->getMillis(); - while (!_quit) { + while (!quit()) { if (_debugger->isAttached()) _debugger->onFrame(); @@ -414,7 +414,7 @@ int SkyEngine::go() { _skyMusic->stopMusic(); ConfMan.flushToDisk(); delay(1500); - return _rtl; + return _eventMan->shouldRTL(); } int SkyEngine::init() { @@ -610,9 +610,6 @@ void SkyEngine::delay(int32 amount) { _skyMouse->mouseMoved(event.mouse.x, event.mouse.y); _skyMouse->buttonPressed(1); break; - case Common::EVENT_QUIT: - _quit = true; - break; default: break; } diff --git a/gui/newgui.cpp b/gui/newgui.cpp index 9f1ff51b14..b892fe076a 100644 --- a/gui/newgui.cpp +++ b/gui/newgui.cpp @@ -256,7 +256,7 @@ void NewGui::runLoop() { Common::Event event; while (eventMan->pollEvent(event)) { - if (activeDialog != getTopDialog() && event.type != Common::EVENT_QUIT && event.type != Common::EVENT_SCREEN_CHANGED) + if (activeDialog != getTopDialog() && event.type != Common::EVENT_SCREEN_CHANGED) continue; Common::Point mouse(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y); -- cgit v1.2.3