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
This commit is contained in:
Christopher Page 2008-07-09 02:27:05 +00:00
parent b8fe71e7a1
commit e808cdf7a0
41 changed files with 105 additions and 93 deletions

View file

@ -354,7 +354,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
bool result;
if (!artificialEventQueue.empty()) {
event.type = artificialEventQueue.pop();
event = artificialEventQueue.pop();
result = true;
} else
result = _boss->pollEvent(event);
@ -393,8 +393,11 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
#endif
// Global Main Menu
if (event.kbd.keycode == Common::KEYCODE_F11)
if (g_engine && !g_engine->isPaused())
pushEvent(Common::EVENT_MAINMENU);
if (g_engine && !g_engine->isPaused()) {
Common::Event menuEvent;
menuEvent.type = Common::EVENT_MAINMENU;
pushEvent(menuEvent);
}
break;
case Common::EVENT_KEYUP:
@ -472,8 +475,8 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
return result;
}
void DefaultEventManager::pushEvent(Common::EventType eventType) {
artificialEventQueue.push(eventType);
void DefaultEventManager::pushEvent(Common::Event event) {
artificialEventQueue.push(event);
}
#endif // !defined(DISABLE_DEFAULT_EVENTMANAGER)

View file

@ -108,7 +108,7 @@ public:
~DefaultEventManager();
virtual bool pollEvent(Common::Event &event);
virtual void pushEvent(Common::EventType eventType);
virtual void pushEvent(Common::Event event);
virtual void registerRandomSource(Common::RandomSource &rnd, const char *name);
virtual void processMillis(uint32 &millis);

View file

@ -149,7 +149,7 @@ public:
/**
* Pushes a "fake" event of the specified type into the event queue
*/
virtual void pushEvent(Common::EventType eventType) = 0;
virtual void pushEvent(Common::Event event) = 0;
/** Register random source so it can be serialized in game test purposes **/
virtual void registerRandomSource(Common::RandomSource &rnd, const char *name) = 0;
@ -200,7 +200,7 @@ public:
// replacing it by a generic getScreenChangeID method here
protected:
Common::Queue<Common::EventType> artificialEventQueue;
Common::Queue<Common::Event> artificialEventQueue;
};
} // End of namespace Common

View file

@ -209,6 +209,11 @@ public:
++i;
}
void pop_front() {
iterator i = begin();
i = erase(i);
}
List<t_T> &operator=(const List<t_T> &list) {
if (this != &list) {

View file

@ -26,7 +26,7 @@
#define COMMON_QUEUE_H
#include "common/scummsys.h"
#include "common/array.h"
#include "common/list.h"
namespace Common {
@ -36,10 +36,10 @@ namespace Common {
template<class T>
class Queue {
protected:
Array<T> _queue;
List<T> _queue;
public:
Queue<T>() {}
Queue<T>(const Array<T> &queueContent) : _queue(queueContent) {}
Queue<T>(const List<T> &queueContent) : _queue(queueContent) {}
bool empty() const {
return _queue.empty();
@ -51,23 +51,19 @@ public:
_queue.push_back(x);
}
T back() const {
const int s = size();
return _queue[s - 1];
return _queue.reverse_begin().operator*();
}
T front() const {
return _queue[0];
return _queue.begin().operator*();
}
T pop() {
T tmp = front();
_queue.remove_at(0);
_queue.pop_front();
return tmp;
}
int size() const {
return _queue.size();
}
T operator[](int i) {
return _queue[i];
}
};
} // End of namespace Common

View file

@ -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();

View file

@ -232,7 +232,7 @@ uint8 *AgiLoader_v3::loadVolRes(AgiDir *agid) {
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 */

View file

@ -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) {

View file

@ -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);

View file

@ -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:

View file

@ -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) {

View file

@ -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);

View file

@ -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:

View file

@ -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();

View file

@ -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);

View file

@ -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() {

View file

@ -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);

View file

@ -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();

View file

@ -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();

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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();

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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);

View file

@ -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);
}

View file

@ -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.

View file

@ -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;

View file

@ -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) {

View file

@ -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;

View file

@ -223,8 +223,6 @@ public:
SaveLoad *_saveLoad;
VideoPlayer *_vidPlayer;
void shutdown();
const char *getLangDesc(int16 language) const;
void validateLanguage();
void validateVideoMode(int16 videoMode);

View file

@ -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;

View file

@ -751,7 +751,7 @@ void Inter_Bargon::oBargon_intro2(OpGobParams &params) {
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 &params) {
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 &params) {
_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);

View file

@ -1226,7 +1226,7 @@ bool Inter_v1::o1_repeatUntil(OpFuncParams &params) {
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 &params) {
} 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;

View file

@ -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) :

View file

@ -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) {

View file

@ -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;

View file

@ -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));
}

View file

@ -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;
}

View file

@ -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
}