From e808cdf7a08d641389ecc81063b3b1016c7bc8cf Mon Sep 17 00:00:00 2001 From: Christopher Page Date: Wed, 9 Jul 2008 02:27:05 +0000 Subject: Reimplemented pushEvent() and artificialEventQueue to work with Events instead of EventTypes. Reimplemented Queue as a List instead of Array. Updated AGOS, AGI, CINE, GOB, and KYRA to work with the current implementation of the GMM svn-id: r32971 --- engines/agi/cycle.cpp | 6 +++--- engines/agi/loader_v3.cpp | 4 ++-- engines/agi/op_cmd.cpp | 8 ++++---- engines/agi/op_test.cpp | 2 +- engines/agi/preagi_common.cpp | 2 +- engines/agi/preagi_mickey.cpp | 4 ++-- engines/agi/preagi_troll.cpp | 4 ++-- engines/agi/preagi_winnie.cpp | 6 +++--- engines/agi/saveload.cpp | 4 ++-- engines/agos/agos.cpp | 6 +++--- engines/agos/event.cpp | 4 ++-- engines/agos/gfx.cpp | 2 +- engines/agos/input.cpp | 4 ++-- engines/agos/script.cpp | 8 ++++---- engines/agos/script_e1.cpp | 4 ++-- engines/agos/script_s1.cpp | 4 ++-- engines/cine/anim.cpp | 2 +- engines/cine/main_loop.cpp | 7 ++----- engines/cine/prc.cpp | 2 +- engines/cine/various.cpp | 2 +- engines/dialogs.cpp | 14 ++++++++++---- engines/engine.cpp | 7 +++++++ engines/engine.h | 2 +- engines/gob/game_v1.cpp | 4 ++-- engines/gob/game_v2.cpp | 10 +++++----- engines/gob/gob.cpp | 4 ---- engines/gob/gob.h | 2 -- engines/gob/inter.cpp | 4 ++-- engines/gob/inter_bargon.cpp | 6 +++--- engines/gob/inter_v1.cpp | 4 ++-- engines/gob/inter_v2.cpp | 2 +- engines/gob/mult.cpp | 2 +- engines/gob/palanim.cpp | 2 +- engines/gob/util.cpp | 2 +- engines/gob/videoplayer.cpp | 2 +- engines/kyra/kyra_v1.cpp | 6 +++++- 36 files changed, 83 insertions(+), 75 deletions(-) (limited to 'engines') diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp index e12efb6a2e..361f9479bc 100644 --- a/engines/agi/cycle.cpp +++ b/engines/agi/cycle.cpp @@ -117,7 +117,7 @@ void AgiEngine::interpretCycle() { oldSound = getflag(fSoundOn); _game.exitAllLogics = false; - while (runLogic(0) == 0 && !_eventMan->shouldQuit()) { + while (runLogic(0) == 0 && !quit()) { _game.vars[vWordNotFound] = 0; _game.vars[vBorderTouchObj] = 0; _game.vars[vBorderCode] = 0; @@ -354,10 +354,10 @@ int AgiEngine::playGame() { _game.vars[vKey] = 0; } - if (_eventMan->shouldQuit() == 0xff) + if (quit() == 0xff) ec = errRestartGame; - } while (_eventMan->shouldQuit() == 0); + } while (quit() == 0); _sound->stopSound(); diff --git a/engines/agi/loader_v3.cpp b/engines/agi/loader_v3.cpp index 8c8c8da7fa..1432d35799 100644 --- a/engines/agi/loader_v3.cpp +++ b/engines/agi/loader_v3.cpp @@ -231,8 +231,8 @@ uint8 *AgiLoader_v3::loadVolRes(AgiDir *agid) { debugC(3, kDebugLevelResources, "offset = %d", agid->offset); debugC(3, kDebugLevelResources, "x = %x %x", x[0], x[1]); error("ACK! BAD RESOURCE"); - - g_system->getEventManager()->pushEvent(Common::EVENT_QUIT); + + _vm->quitGame(); } agid->len = READ_LE_UINT16((uint8 *) x + 3); /* uncompressed size */ diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp index 0cd633b078..16d2a240dc 100644 --- a/engines/agi/op_cmd.cpp +++ b/engines/agi/op_cmd.cpp @@ -1215,11 +1215,11 @@ cmd(quit) { g_sound->stopSound(); if (p0) { - g_system->getEventManager()->pushEvent(Common::EVENT_QUIT); + g_agi->quitGame(); } else { if (g_agi->selectionBox (" Quit the game, or continue? \n\n\n", buttons) == 0) { - g_system->getEventManager()->pushEvent(Common::EVENT_QUIT); + g_agi->quitGame(); } } } @@ -1233,7 +1233,7 @@ cmd(restart_game) { g_agi->selectionBox(" Restart game, or continue? \n\n\n", buttons); if (sel == 0) { - g_system->getEventManager()->pushEvent(Common::EVENT_QUIT); + g_agi->quitGame(); g_agi->setflag(fRestartGame, true); g_agi->_menu->enableAll(); } @@ -1741,7 +1741,7 @@ int AgiEngine::runLogic(int n) { curLogic->cIP = curLogic->sIP; timerHack = 0; - while (ip < _game.logics[n].size && !_eventMan->shouldQuit()) { + while (ip < _game.logics[n].size && !quit()) { if (_debug.enabled) { if (_debug.steps > 0) { if (_debug.logic0 || n) { diff --git a/engines/agi/op_test.cpp b/engines/agi/op_test.cpp index 32fc2d89db..e1c2060df7 100644 --- a/engines/agi/op_test.cpp +++ b/engines/agi/op_test.cpp @@ -233,7 +233,7 @@ int AgiEngine::testIfCode(int lognum) { uint8 p[16] = { 0 }; bool end_test = false; - while (retval && !_eventMan->shouldQuit() && !end_test) { + while (retval && !quit() && !end_test) { if (_debug.enabled && (_debug.logic0 || lognum)) debugConsole(lognum, lTEST_MODE, NULL); diff --git a/engines/agi/preagi_common.cpp b/engines/agi/preagi_common.cpp index 70490b66e7..df933996ca 100644 --- a/engines/agi/preagi_common.cpp +++ b/engines/agi/preagi_common.cpp @@ -122,7 +122,7 @@ void PreAgiEngine::printStrXOR(char *szMsg) { int PreAgiEngine::getSelection(SelectionTypes type) { Common::Event event; - while (!_eventMan->shouldQuit()) { + while (!quit()) { while (_eventMan->pollEvent(event)) { switch(event.type) { case Common::EVENT_QUIT: diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp index 07f96a31bd..fea78ed654 100644 --- a/engines/agi/preagi_mickey.cpp +++ b/engines/agi/preagi_mickey.cpp @@ -343,7 +343,7 @@ bool Mickey::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) { drawMenu(menu, *sel0, *sel1); - while (!_vm->_system->getEventManager()->shouldQuit()) { + while (!_vm->quit()) { while (_vm->_system->getEventManager()->pollEvent(event)) { switch(event.type) { case Common::EVENT_QUIT: @@ -2151,7 +2151,7 @@ void Mickey::run() { intro(); // Game loop - while (!_vm->_system->getEventManager()->shouldQuit()) { + while (!_vm->quit()) { drawRoom(); if (_game.fIntro) { diff --git a/engines/agi/preagi_troll.cpp b/engines/agi/preagi_troll.cpp index f811cf421f..07bd1068dc 100644 --- a/engines/agi/preagi_troll.cpp +++ b/engines/agi/preagi_troll.cpp @@ -58,7 +58,7 @@ bool Troll::getMenuSel(const char *szMenu, int *iSel, int nSel) { drawMenu(szMenu, *iSel); - while (!_vm->_system->getEventManager()->shouldQuit()) { + while (!_vm->quit()) { while (_vm->_system->getEventManager()->pollEvent(event)) { switch(event.type) { case Common::EVENT_QUIT: @@ -268,7 +268,7 @@ void Troll::tutorial() { int iSel = 0; //char szTreasure[16] = {0}; - while (!_vm->_system->getEventManager()->shouldQuit()) { + while (!_vm->quit()) { _vm->clearScreen(0xFF); _vm->printStr(IDS_TRO_TUTORIAL_0); diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index 827aad3ffe..ac8c8939a4 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -241,7 +241,7 @@ int Winnie::parser(int pc, int index, uint8 *buffer) { // extract header from buffer parseRoomHeader(&hdr, buffer, sizeof(WTP_ROOM_HDR)); - while (!_vm->_system->getEventManager()->shouldQuit()) { + while (!_vm->quit()) { pc = startpc; // check if block is to be run @@ -797,7 +797,7 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) { // Show the mouse cursor for the menu CursorMan.showMouse(true); - while (!_vm->_system->getEventManager()->shouldQuit()) { + while (!_vm->quit()) { while (_vm->_system->getEventManager()->pollEvent(event)) { switch(event.type) { case Common::EVENT_QUIT: @@ -1013,7 +1013,7 @@ phase2: if (parser(hdr.ofsDesc[iBlock] - _roomOffset, iBlock, roomdata) == IDI_WTP_PAR_BACK) goto phase1; } - while (!_vm->_system->getEventManager()->shouldQuit()) { + while (!_vm->quit()) { for (iBlock = 0; iBlock < IDI_WTP_MAX_BLOCK; iBlock++) { switch(parser(hdr.ofsBlock[iBlock] - _roomOffset, iBlock, roomdata)) { case IDI_WTP_PAR_GOTO: diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index 26d903d52a..4ea80479dc 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -92,7 +92,7 @@ int AgiEngine::saveGame(const char *fileName, const char *description) { out->writeSint16BE((int16)_game.lognum); out->writeSint16BE((int16)_game.playerControl); - out->writeSint16BE((int16)_eventMan->shouldQuit()); + out->writeSint16BE((int16)quit()); out->writeSint16BE((int16)_game.statusLine); out->writeSint16BE((int16)_game.clockEnabled); out->writeSint16BE((int16)_game.exitAllLogics); @@ -283,7 +283,7 @@ int AgiEngine::loadGame(const char *fileName, bool checkId) { _game.playerControl = in->readSint16BE(); if (in->readSint16BE()) - _eventMan->pushEvent(Common::EVENT_QUIT); + quitGame(); _game.statusLine = in->readSint16BE(); _game.clockEnabled = in->readSint16BE(); _game.exitAllLogics = in->readSint16BE(); diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 86121f89a6..a6e559726a 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -947,7 +947,7 @@ void AGOSEngine::pauseEngineIntern(bool pauseIt) { void AGOSEngine::pause() { pauseEngine(true); - while (_pause && !_eventMan->shouldQuit()) { + while (_pause && !quit()) { delay(1); if (_keyPressed.keycode == Common::KEYCODE_p) pauseEngine(false); @@ -984,7 +984,7 @@ int AGOSEngine::go() { (getFeatures() & GF_DEMO)) { int i; - while (!_eventMan->shouldQuit()) { + while (!quit()) { for (i = 0; i < 4; i++) { setWindowImage(3, 9902 + i); debug(0, "Displaying image %d", 9902 + i); @@ -1013,7 +1013,7 @@ int AGOSEngine::go() { runSubroutine101(); permitInput(); - while (!_eventMan->shouldQuit()) { + while (!quit()) { waitForInput(); handleVerbClicked(_verbHitArea); delay(100); diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp index 4a362d420a..5082db84be 100644 --- a/engines/agos/event.cpp +++ b/engines/agos/event.cpp @@ -142,7 +142,7 @@ bool AGOSEngine::kickoffTimeEvents() { cur_time = getTime() - _gameStoppedClock; - while ((te = _firstTimeStruct) != NULL && te->time <= cur_time && !_eventMan->shouldQuit()) { + while ((te = _firstTimeStruct) != NULL && te->time <= cur_time && !quit()) { result = true; _pendingDeleteTimeEvent = te; invokeTimeEvent(te); @@ -543,7 +543,7 @@ void AGOSEngine::delay(uint amount) { _system->delayMillis(this_delay); cur = _system->getMillis(); - } while (cur < start + amount && !_eventMan->shouldQuit()); + } while (cur < start + amount && !quit()); } void AGOSEngine::timer_callback() { diff --git a/engines/agos/gfx.cpp b/engines/agos/gfx.cpp index e39b7c9ea4..bc8457aef9 100644 --- a/engines/agos/gfx.cpp +++ b/engines/agos/gfx.cpp @@ -1264,7 +1264,7 @@ void AGOSEngine::setWindowImageEx(uint16 mode, uint16 vga_res) { if (getGameType() == GType_WW && (mode == 6 || mode == 8 || mode == 9)) { setWindowImage(mode, vga_res); } else { - while (_copyScnFlag && !_eventMan->shouldQuit()) + while (_copyScnFlag && !quit()) delay(1); setWindowImage(mode, vga_res); diff --git a/engines/agos/input.cpp b/engines/agos/input.cpp index b3acfe188b..e9d64589b8 100644 --- a/engines/agos/input.cpp +++ b/engines/agos/input.cpp @@ -190,12 +190,12 @@ void AGOSEngine::waitForInput() { resetVerbs(); } - while (!_eventMan->shouldQuit()) { + while (!quit()) { _lastHitArea = NULL; _lastHitArea3 = NULL; _dragAccept = 1; - while (!_eventMan->shouldQuit()) { + while (!quit()) { if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) && _keyPressed.keycode == Common::KEYCODE_F10) displayBoxStars(); diff --git a/engines/agos/script.cpp b/engines/agos/script.cpp index da47d61891..69a1944605 100644 --- a/engines/agos/script.cpp +++ b/engines/agos/script.cpp @@ -411,7 +411,7 @@ void AGOSEngine::o_msg() { void AGOSEngine::o_end() { // 68: exit interpreter - _eventMan->pushEvent(Common::EVENT_QUIT); + quitGame(); } void AGOSEngine::o_done() { @@ -966,7 +966,7 @@ void AGOSEngine::writeVariable(uint16 variable, uint16 contents) { int AGOSEngine::runScript() { bool flag; - if (_eventMan->shouldQuit()) + if (quit()) return 1; do { @@ -1011,7 +1011,7 @@ int AGOSEngine::runScript() { error("Invalid opcode '%d' encountered", _opcode); executeOpcode(_opcode); - } while (getScriptCondition() != flag && !getScriptReturn() && !_eventMan->shouldQuit()); + } while (getScriptCondition() != flag && !getScriptReturn() && !quit()); return getScriptReturn(); } @@ -1067,7 +1067,7 @@ void AGOSEngine::waitForSync(uint a) { _exitCutscene = false; _rightButtonDown = false; - while (_vgaWaitFor != 0 && !_eventMan->shouldQuit()) { + while (_vgaWaitFor != 0 && !quit()) { if (_rightButtonDown) { if (_vgaWaitFor == 200 && (getGameType() == GType_FF || !getBitFlag(14))) { skipSpeech(); diff --git a/engines/agos/script_e1.cpp b/engines/agos/script_e1.cpp index e394779ab8..97019800b1 100644 --- a/engines/agos/script_e1.cpp +++ b/engines/agos/script_e1.cpp @@ -565,7 +565,7 @@ void AGOSEngine_Elvira1::oe1_look() { lobjFunc(l, "You can see "); /* Show objects */ } if (r && (r->flags & 4) && levelOf(i) < 10000) { - _eventMan->pushEvent(Common::EVENT_QUIT); + quitGame(); } } @@ -944,7 +944,7 @@ restart: windowPutChar(window, *message2); if (confirmYesOrNo(120, 62) == 0x7FFF) { - _eventMan->pushEvent(Common::EVENT_QUIT); + quitGame(); } else { goto restart; } diff --git a/engines/agos/script_s1.cpp b/engines/agos/script_s1.cpp index e8577d21bc..5a26550847 100644 --- a/engines/agos/script_s1.cpp +++ b/engines/agos/script_s1.cpp @@ -345,14 +345,14 @@ void AGOSEngine_Simon1::os1_pauseGame() { if (isSmartphone()) { if (_keyPressed.keycode) { if (_keyPressed.keycode == Common::KEYCODE_RETURN) - _eventMan->pushEvent(Common::EVENT_QUIT); + quitGame(); else break; } } #endif if (_keyPressed.keycode == keyYes) - _eventMan->pushEvent(Common::EVENT_QUIT); + quitGame(); else if (_keyPressed.keycode == keyNo) break; } diff --git a/engines/cine/anim.cpp b/engines/cine/anim.cpp index b06dbd4576..555b4ceec3 100644 --- a/engines/cine/anim.cpp +++ b/engines/cine/anim.cpp @@ -732,7 +732,7 @@ void loadResource(const char *resourceName) { loadSeq(resourceName, -1); return; } else if (strstr(resourceName, "ECHEC")) { // Echec (French) means failure - g_system->getEventManager()->pushEvent(Common::EVENT_QUIT); + g_cine->quitGame(); return; } diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp index b42134eb0b..026a3181a8 100644 --- a/engines/cine/main_loop.cpp +++ b/engines/cine/main_loop.cpp @@ -61,9 +61,6 @@ static void processEvent(Common::Event &event) { break; case Common::EVENT_MOUSEMOVE: break; - case Common::EVENT_QUIT: - g_system->getEventManager()->pushEvent(Common::EVENT_QUIT); - break; case Common::EVENT_KEYDOWN: switch (event.kbd.keycode) { case Common::KEYCODE_RETURN: @@ -292,7 +289,7 @@ void CineEngine::mainLoop(int bootScriptIdx) { if ("quit"[menuCommandLen] == (char)di) { ++menuCommandLen; if (menuCommandLen == 4) { - g_system->getEventManager()->pushEvent(Common::EVENT_QUIT); + quitGame(); } } else { menuCommandLen = 0; @@ -301,7 +298,7 @@ void CineEngine::mainLoop(int bootScriptIdx) { manageEvents(); - } while (!_eventMan->shouldQuit() && _danKeysPressed != 7); + } while (!quit() && _danKeysPressed != 7); hideMouse(); g_sound->stopMusic(); diff --git a/engines/cine/prc.cpp b/engines/cine/prc.cpp index 4df82478cd..a6ec085878 100644 --- a/engines/cine/prc.cpp +++ b/engines/cine/prc.cpp @@ -54,7 +54,7 @@ void loadPrc(const char *pPrcName) { // This is copy protection. Used to hang the machine if (!scumm_stricmp(pPrcName, "L201.ANI")) { - g_system->getEventManager()->pushEvent(Common::EVENT_QUIT); + g_cine->quitGame(); return; } diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index 23891cb667..1c0108f6e1 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -756,7 +756,7 @@ void CineEngine::makeSystemMenu(void) { { getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY); if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) { - g_system->getEventManager()->pushEvent(Common::EVENT_QUIT); + quitGame(); } break; } diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp index a1af87c5b8..adcb7b54ee 100644 --- a/engines/dialogs.cpp +++ b/engines/dialogs.cpp @@ -107,13 +107,19 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat case kAboutCmd: _aboutDialog->runModal(); break; - case kRTLCmd: - g_system->getEventManager()->pushEvent(Common::EVENT_RTL); + case kRTLCmd: { + Common::Event eventRTL; + eventRTL.type = Common::EVENT_RTL; + g_system->getEventManager()->pushEvent(eventRTL); close(); + } break; - case kQuitCmd: - g_system->getEventManager()->pushEvent(Common::EVENT_QUIT); + case kQuitCmd: { + Common::Event eventQ; + eventQ.type = Common::EVENT_QUIT; + g_system->getEventManager()->pushEvent(eventQ); close(); + } break; default: GlobalDialog::handleCommand(sender, cmd, data); diff --git a/engines/engine.cpp b/engines/engine.cpp index 3a13c275ba..ffc044a508 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -246,3 +246,10 @@ void Engine::syncSoundSettings() { _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, soundVolumeSFX); _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, soundVolumeSpeech); } + +void Engine::quitGame() { + Common::Event event; + + event.type = Common::EVENT_QUIT; + _eventMan->pushEvent(event); +} diff --git a/engines/engine.h b/engines/engine.h index d84ef2bbf8..0968642a08 100644 --- a/engines/engine.h +++ b/engines/engine.h @@ -120,7 +120,7 @@ public: /** * Quit the engine, sends a Quit event to the Event Manager */ - void quitGame() { _eventMan->pushEvent(Common::EVENT_QUIT); }; + void quitGame(); /** * Return whether the engine is currently paused or not. diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index 4bfcd0fcad..90c96d6eb7 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -64,7 +64,7 @@ void Game_v1::playTot(int16 skipPlay) { strcpy(savedTotName, _curTotFile); if (skipPlay <= 0) { - while (!g_system->getEventManager()->shouldQuit()) { + while (!_vm->quit()) { for (int i = 0; i < 4; i++) { _vm->_draw->_fontToSprite[i].sprite = -1; _vm->_draw->_fontToSprite[i].base = -1; @@ -998,7 +998,7 @@ void Game_v1::collisionsBlock(void) { WRITE_VAR(16, 0); _activeCollResId = 0; } - while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !g_system->getEventManager()->shouldQuit()); + while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !_vm->quit()); if (((uint16) _activeCollResId & ~0x8000) == collResId) { collStackPos = 0; diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index cf7beec031..d99b9e82fc 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -71,7 +71,7 @@ void Game_v2::playTot(int16 skipPlay) { strcpy(savedTotName, _curTotFile); if (skipPlay <= 0) { - while (!g_system->getEventManager()->shouldQuit()) { + while (!_vm->quit()) { if (_vm->_inter->_variables) _vm->_draw->animateCursor(4); @@ -439,7 +439,7 @@ int16 Game_v2::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, timeKey = _vm->_util->getTimeKey(); while (1) { - if (_vm->_inter->_terminate || g_system->getEventManager()->shouldQuit()) { + if (_vm->_inter->_terminate || _vm->quit()) { if (handleMouse) _vm->_draw->blitCursor(); return 0; @@ -1044,7 +1044,7 @@ void Game_v2::collisionsBlock(void) { WRITE_VAR(16, 0); _activeCollResId = 0; } - while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !g_system->getEventManager()->shouldQuit()); + while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !_vm->quit()); if ((_activeCollResId & 0xFFF) == collResId) { collStackPos = 0; @@ -1466,7 +1466,7 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, key = checkCollisions(handleMouse, -300, collResId, collIndex); if ((key != 0) || (*collResId != 0) || - _vm->_inter->_terminate || g_system->getEventManager()->shouldQuit()) + _vm->_inter->_terminate || _vm->quit()) break; if (*pTotTime > 0) { @@ -1480,7 +1480,7 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, } if ((key == 0) || (*collResId != 0) || - _vm->_inter->_terminate || g_system->getEventManager()->shouldQuit()) + _vm->_inter->_terminate || _vm->quit()) return 0; switch (key) { diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 61d173346e..f38371d685 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -114,10 +114,6 @@ int GobEngine::go() { return _eventMan->shouldRTL(); } -void GobEngine::shutdown() { - g_system->getEventManager()->pushEvent(Common::EVENT_QUIT); -} - const char *GobEngine::getLangDesc(int16 language) const { if ((language < 0) || (language > 8)) language = 2; diff --git a/engines/gob/gob.h b/engines/gob/gob.h index d55d2b874a..842a1dc59f 100644 --- a/engines/gob/gob.h +++ b/engines/gob/gob.h @@ -223,8 +223,6 @@ public: SaveLoad *_saveLoad; VideoPlayer *_vidPlayer; - void shutdown(); - const char *getLangDesc(int16 language) const; void validateLanguage(); void validateVideoMode(int16 videoMode); diff --git a/engines/gob/inter.cpp b/engines/gob/inter.cpp index 0c226193f9..04643b7b75 100644 --- a/engines/gob/inter.cpp +++ b/engines/gob/inter.cpp @@ -250,7 +250,7 @@ void Inter::funcBlock(int16 retFlag) { if (executeFuncOpcode(cmd2, cmd, params)) return; - if (g_system->getEventManager()->shouldQuit()) + if (_vm->quit()) break; if (_break) { @@ -270,7 +270,7 @@ void Inter::funcBlock(int16 retFlag) { void Inter::callSub(int16 retFlag) { byte block; - while (!g_system->getEventManager()->shouldQuit() && _vm->_global->_inter_execPtr && + while (!_vm->quit() && _vm->_global->_inter_execPtr && (_vm->_global->_inter_execPtr != _vm->_game->_totFileData)) { block = *_vm->_global->_inter_execPtr; diff --git a/engines/gob/inter_bargon.cpp b/engines/gob/inter_bargon.cpp index b0378f1bdb..25d75589df 100644 --- a/engines/gob/inter_bargon.cpp +++ b/engines/gob/inter_bargon.cpp @@ -751,7 +751,7 @@ void Inter_Bargon::oBargon_intro2(OpGobParams ¶ms) { for (i = 320; i >= 0; i--) { _vm->_util->setScrollOffset(i, 0); if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == 0x11B) || - g_system->getEventManager()->shouldQuit()) { + _vm->quit()) { _vm->_palAnim->fade(0, -2, 0); _vm->_video->clearSurf(_vm->_draw->_frontSurface); memset((char *) _vm->_draw->_vgaPalette, 0, 768); @@ -761,7 +761,7 @@ void Inter_Bargon::oBargon_intro2(OpGobParams ¶ms) { break; } } - if (!g_system->getEventManager()->shouldQuit()) + if (!_vm->quit()) _vm->_util->setScrollOffset(0, 0); surface = 0; if (VAR(57) == ((uint32) -1)) @@ -800,7 +800,7 @@ void Inter_Bargon::oBargon_intro3(OpGobParams ¶ms) { _vm->_util->longDelay(_vm->_util->getRandom(200)); } if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == 0x11B) || - g_system->getEventManager()->shouldQuit()) { + _vm->quit()) { _vm->_sound->blasterStop(10); _vm->_palAnim->fade(0, -2, 0); _vm->_video->clearSurf(_vm->_draw->_frontSurface); diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp index 8553354f87..df85f94d58 100644 --- a/engines/gob/inter_v1.cpp +++ b/engines/gob/inter_v1.cpp @@ -1226,7 +1226,7 @@ bool Inter_v1::o1_repeatUntil(OpFuncParams ¶ms) { funcBlock(1); _vm->_global->_inter_execPtr = blockPtr + size + 1; flag = evalBoolResult(); - } while (!flag && !_break && !_terminate && !g_system->getEventManager()->shouldQuit()); + } while (!flag && !_break && !_terminate && !_vm->quit()); _nestLevel[0]--; @@ -1261,7 +1261,7 @@ bool Inter_v1::o1_whileDo(OpFuncParams ¶ms) { } else _vm->_global->_inter_execPtr += size; - if (_break || _terminate || g_system->getEventManager()->shouldQuit()) { + if (_break || _terminate || _vm->quit()) { _vm->_global->_inter_execPtr = blockPtr; _vm->_global->_inter_execPtr += size; break; diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index 2d39fc0a65..16d253ea90 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -1485,7 +1485,7 @@ void Inter_v2::o2_scroll() { curX = startX; curY = startY; - while (!g_system->getEventManager()->shouldQuit() && ((curX != endX) || (curY != endY))) { + while (!_vm->quit() && ((curX != endX) || (curY != endY))) { curX = stepX > 0 ? MIN(curX + stepX, (int) endX) : MAX(curX + stepX, (int) endX); curY = stepY > 0 ? MIN(curY + stepY, (int) endY) : diff --git a/engines/gob/mult.cpp b/engines/gob/mult.cpp index 2916e246a0..d11600cc08 100644 --- a/engines/gob/mult.cpp +++ b/engines/gob/mult.cpp @@ -198,7 +198,7 @@ void Mult::playMult(int16 startFrame, int16 endFrame, char checkEscape, _frame++; _vm->_util->waitEndFrame(); - } while (!stop && !stopNoClear && !g_system->getEventManager()->shouldQuit()); + } while (!stop && !stopNoClear && !_vm->quit()); if (!stopNoClear) { if (_animDataAllocated) { diff --git a/engines/gob/palanim.cpp b/engines/gob/palanim.cpp index 25c5fb43b7..4bcf89a892 100644 --- a/engines/gob/palanim.cpp +++ b/engines/gob/palanim.cpp @@ -133,7 +133,7 @@ void PalAnim::fade(Video::PalDesc *palDesc, int16 fadeV, int16 allColors) { bool stop; int16 i; - if (g_system->getEventManager()->shouldQuit()) + if (_vm->quit()) return; _fadeValue = (fadeV < 0) ? -fadeV : 2; diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index c38f2e9a77..e5ba535b5c 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -72,7 +72,7 @@ void Util::longDelay(uint16 msecs) { _vm->_video->waitRetrace(); processInput(); delay(15); - } while (!g_system->getEventManager()->shouldQuit() && + } while (!_vm->quit() && ((g_system->getMillis() * _vm->_global->_speedFactor) < time)); } diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index 84524b3210..5e6319fcb8 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -570,7 +570,7 @@ bool VideoPlayer::doPlay(int16 frame, int16 breakKey, _vm->_util->processInput(); - if (g_system->getEventManager()->shouldQuit()) { + if (_vm->quit()) { _primaryVideo->getVideo()->disableSound(); return true; } diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index c7b39aa257..2f63e2831b 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -24,6 +24,7 @@ */ #include "common/config-manager.h" +#include "common/events.h" #include "sound/mididrv.h" #include "sound/mixer.h" @@ -218,7 +219,10 @@ KyraEngine_v1::~KyraEngine_v1() { void KyraEngine_v1::quitGame() { debugC(9, kDebugLevelMain, "KyraEngine_v1::quitGame()"); - _eventMan->pushEvent(Common::EVENT_QUIT); + Common::Event event; + + event.type = Common::EVENT_QUIT; + _eventMan->pushEvent(event); // Nothing to do here } -- cgit v1.2.3