aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2009-01-30 16:04:39 +0000
committerMax Horn2009-01-30 16:04:39 +0000
commit716f88f57127e32916ce22f756b1a3f2d2eff9d6 (patch)
treee8d0463c041f44e52ef8a4bf1487fda8d4076577 /engines
parentf465abb75d81a248e3c553aa5706031b52c7189d (diff)
downloadscummvm-rg350-716f88f57127e32916ce22f756b1a3f2d2eff9d6.tar.gz
scummvm-rg350-716f88f57127e32916ce22f756b1a3f2d2eff9d6.tar.bz2
scummvm-rg350-716f88f57127e32916ce22f756b1a3f2d2eff9d6.zip
Avoid using g_engine if possible
svn-id: r36149
Diffstat (limited to 'engines')
-rw-r--r--engines/engine.cpp7
-rw-r--r--engines/engine.h4
-rw-r--r--engines/sky/control.cpp8
-rw-r--r--engines/sky/logic.cpp2
-rw-r--r--engines/sword1/control.cpp6
-rw-r--r--engines/sword1/credits.cpp12
-rw-r--r--engines/sword1/logic.cpp2
7 files changed, 21 insertions, 20 deletions
diff --git a/engines/engine.cpp b/engines/engine.cpp
index b0931d3c42..361d11c46a 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -328,11 +328,12 @@ void Engine::quitGame() {
Common::Event event;
event.type = Common::EVENT_QUIT;
- _eventMan->pushEvent(event);
+ g_system->getEventManager()->pushEvent(event);
}
-bool Engine::shouldQuit() const {
- return (_eventMan->shouldQuit() || _eventMan->shouldRTL());
+bool Engine::shouldQuit() {
+ Common::EventManager *eventMan = g_system->getEventManager();
+ return (eventMan->shouldQuit() || eventMan->shouldRTL());
}
/*
diff --git a/engines/engine.h b/engines/engine.h
index ac001de756..a67f5f6637 100644
--- a/engines/engine.h
+++ b/engines/engine.h
@@ -219,13 +219,13 @@ public:
* Request the engine to quit. Sends a EVENT_QUIT event to the Event
* Manager.
*/
- void quitGame();
+ static void quitGame();
/**
* Return whether the ENGINE should quit respectively should return to the
* launcher.
*/
- bool shouldQuit() const;
+ static bool shouldQuit();
/**
* Pause or resume the engine. This should stop/resume any audio playback
diff --git a/engines/sky/control.cpp b/engines/sky/control.cpp
index ed2902fe47..a1ac2460eb 100644
--- a/engines/sky/control.cpp
+++ b/engines/sky/control.cpp
@@ -496,7 +496,7 @@ void Control::doControlPanel(void) {
_curButtonText = 0;
uint16 clickRes = 0;
- while (!quitPanel && !g_engine->shouldQuit()) {
+ while (!quitPanel && !Engine::shouldQuit()) {
_text->drawToScreen(WITH_MASK);
_system->updateScreen();
_mouseClicked = false;
@@ -528,7 +528,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->shouldQuit())
+ if (!Engine::shouldQuit())
_system->updateScreen();
_skyScreen->forceRefresh();
_skyScreen->setPaletteEndian((uint8 *)_skyCompact->fetchCpt(SkyEngine::_systemVars.currentPalette));
@@ -607,7 +607,7 @@ uint16 Control::handleClick(ConResource *pButton) {
case QUIT_TO_DOS:
animClick(pButton);
if (getYesNo(quitDos))
- g_engine->quitGame();
+ Engine::quitGame();
return 0;
default:
error("Control::handleClick: unknown routine: %X",pButton->_onClick);
@@ -879,7 +879,7 @@ uint16 Control::saveRestorePanel(bool allowSave) {
bool refreshNames = true;
bool refreshAll = true;
uint16 clickRes = 0;
- while (!quitPanel && !g_engine->shouldQuit()) {
+ while (!quitPanel && !Engine::shouldQuit()) {
clickRes = 0;
if (refreshNames || refreshAll) {
if (refreshAll) {
diff --git a/engines/sky/logic.cpp b/engines/sky/logic.cpp
index fc8ecdca3a..7e2399d04f 100644
--- a/engines/sky/logic.cpp
+++ b/engines/sky/logic.cpp
@@ -2491,7 +2491,7 @@ bool Logic::fnFadeUp(uint32 a, uint32 b, uint32 c) {
}
bool Logic::fnQuitToDos(uint32 a, uint32 b, uint32 c) {
- g_engine->quitGame();
+ Engine::quitGame();
return false;
}
diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp
index 7022aa89c7..248f593aab 100644
--- a/engines/sword1/control.cpp
+++ b/engines/sword1/control.cpp
@@ -218,7 +218,7 @@ void Control::askForCd(void) {
notAccepted = false;
}
}
- } while (notAccepted && (!g_engine->shouldQuit()));
+ } while (notAccepted && (!Engine::shouldQuit()));
_resMan->resClose(fontId);
free(_screenBuf);
@@ -320,7 +320,7 @@ uint8 Control::runPanel(void) {
}
delay(1000 / 12);
newMode = getClicks(mode, &retVal);
- } while ((newMode != BUTTON_DONE) && (retVal == 0) && (!g_engine->shouldQuit()));
+ } while ((newMode != BUTTON_DONE) && (retVal == 0) && (!Engine::shouldQuit()));
if (SwordEngine::_systemVars.controlPanelMode == CP_NORMAL) {
uint8 volL, volR;
@@ -428,7 +428,7 @@ uint8 Control::handleButtonClick(uint8 id, uint8 mode, uint8 *retVal) {
_buttons[5]->setSelected(SwordEngine::_systemVars.showText);
} else if (id == BUTTON_QUIT) {
if (getConfirm(_lStrings[STR_QUIT]))
- g_engine->quitGame();
+ Engine::quitGame();
return mode;
}
break;
diff --git a/engines/sword1/credits.cpp b/engines/sword1/credits.cpp
index a3ce402711..986f751f8a 100644
--- a/engines/sword1/credits.cpp
+++ b/engines/sword1/credits.cpp
@@ -125,7 +125,7 @@ void CreditsPlayer::play(void) {
uint16 renderY = BUFSIZE_Y / 2;
uint16 clearY = 0xFFFF;
bool clearLine = false;
- while (((*textData != FNT_EOB) || (scrollY != renderY)) && !g_engine->shouldQuit()) {
+ while (((*textData != FNT_EOB) || (scrollY != renderY)) && !Engine::shouldQuit()) {
if ((int32)_mixer->getSoundElapsedTime(bgSound) - relDelay < (SCROLL_TIMING * 2)) { // sync to audio
if (scrollY < BUFSIZE_Y - CREDITS_Y)
_system->copyRectToScreen(screenBuf + scrollY * CREDITS_X, CREDITS_X, START_X, START_Y, CREDITS_X, CREDITS_Y);
@@ -175,7 +175,7 @@ void CreditsPlayer::play(void) {
uint8 *revoBuf = credFile.decompressFile(REVO_LOGO);
uint8 *revoPal = credFile.fetchFile(REVO_PAL, &_palLen);
_palLen /= 3;
- while ((_mixer->getSoundElapsedTime(bgSound) < LOGO_FADEUP_TIME) && !g_engine->shouldQuit()) {
+ while ((_mixer->getSoundElapsedTime(bgSound) < LOGO_FADEUP_TIME) && !Engine::shouldQuit()) {
delay(100);
}
memset(_palette, 0, 256 * 4);
@@ -184,13 +184,13 @@ void CreditsPlayer::play(void) {
_system->updateScreen();
fadePalette(revoPal, true, _palLen);
- while ((_mixer->getSoundElapsedTime(bgSound) < LOGO_FADEDOWN_TIME) && !g_engine->shouldQuit()) {
+ while ((_mixer->getSoundElapsedTime(bgSound) < LOGO_FADEDOWN_TIME) && !Engine::shouldQuit()) {
delay(100);
}
fadePalette(revoPal, false, _palLen);
delay(3000);
- if (g_engine->shouldQuit())
+ if (Engine::shouldQuit())
_mixer->stopAll();
free(revoBuf);
}
@@ -200,7 +200,7 @@ void CreditsPlayer::fadePalette(uint8 *srcPal, bool fadeup, uint16 len) {
int fadeStart = fadeup ? 0 : 12;
int relDelay = _system->getMillis();
- for (int fadeStep = fadeStart; (fadeStep >= 0) && (fadeStep <= 12) && !g_engine->shouldQuit(); fadeStep += fadeDir) {
+ for (int fadeStep = fadeStart; (fadeStep >= 0) && (fadeStep <= 12) && !Engine::shouldQuit(); fadeStep += fadeDir) {
for (uint16 cnt = 0; cnt < len * 3; cnt++)
_palette[(cnt / 3) * 4 + (cnt % 3)] = (srcPal[cnt] * fadeStep) / 12;
_system->setPalette(_palette, 0, 256);
@@ -293,7 +293,7 @@ void CreditsPlayer::delay(int msecs) {
if (msecs > 0)
_system->delayMillis(10);
- } while ((_system->getMillis() < start + msecs) && !g_engine->shouldQuit());
+ } while ((_system->getMillis() < start + msecs) && !Engine::shouldQuit());
}
ArcFile::ArcFile(void) {
diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp
index 8950986b09..2b24e4ba54 100644
--- a/engines/sword1/logic.cpp
+++ b/engines/sword1/logic.cpp
@@ -1637,7 +1637,7 @@ int Logic::fnQuitGame(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d,
if (SwordEngine::_systemVars.isDemo) {
GUI::MessageDialog dialog("This is the end of the Broken Sword 1 Demo", "OK", NULL);
dialog.runModal();
- g_engine->quitGame();
+ Engine::quitGame();
} else
error("fnQuitGame() called");
return fnQuit(cpt, id, 0, 0, 0, 0, 0, 0);