[Scummvm-cvs-logs] SF.net SVN: scummvm:[36149] scummvm/trunk/engines

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Jan 30 17:04:39 CET 2009


Revision: 36149
          http://scummvm.svn.sourceforge.net/scummvm/?rev=36149&view=rev
Author:   fingolfin
Date:     2009-01-30 16:04:39 +0000 (Fri, 30 Jan 2009)

Log Message:
-----------
Avoid using g_engine if possible

Modified Paths:
--------------
    scummvm/trunk/engines/engine.cpp
    scummvm/trunk/engines/engine.h
    scummvm/trunk/engines/sky/control.cpp
    scummvm/trunk/engines/sky/logic.cpp
    scummvm/trunk/engines/sword1/control.cpp
    scummvm/trunk/engines/sword1/credits.cpp
    scummvm/trunk/engines/sword1/logic.cpp

Modified: scummvm/trunk/engines/engine.cpp
===================================================================
--- scummvm/trunk/engines/engine.cpp	2009-01-30 15:43:45 UTC (rev 36148)
+++ scummvm/trunk/engines/engine.cpp	2009-01-30 16:04:39 UTC (rev 36149)
@@ -328,11 +328,12 @@
 	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());
 }
 
 /*

Modified: scummvm/trunk/engines/engine.h
===================================================================
--- scummvm/trunk/engines/engine.h	2009-01-30 15:43:45 UTC (rev 36148)
+++ scummvm/trunk/engines/engine.h	2009-01-30 16:04:39 UTC (rev 36149)
@@ -219,13 +219,13 @@
 	 * 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

Modified: scummvm/trunk/engines/sky/control.cpp
===================================================================
--- scummvm/trunk/engines/sky/control.cpp	2009-01-30 15:43:45 UTC (rev 36148)
+++ scummvm/trunk/engines/sky/control.cpp	2009-01-30 16:04:39 UTC (rev 36149)
@@ -496,7 +496,7 @@
 	_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 @@
 	}
 	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 @@
 	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 @@
 	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) {

Modified: scummvm/trunk/engines/sky/logic.cpp
===================================================================
--- scummvm/trunk/engines/sky/logic.cpp	2009-01-30 15:43:45 UTC (rev 36148)
+++ scummvm/trunk/engines/sky/logic.cpp	2009-01-30 16:04:39 UTC (rev 36149)
@@ -2491,7 +2491,7 @@
 }
 
 bool Logic::fnQuitToDos(uint32 a, uint32 b, uint32 c) {
-	g_engine->quitGame();
+	Engine::quitGame();
 	return false;
 }
 

Modified: scummvm/trunk/engines/sword1/control.cpp
===================================================================
--- scummvm/trunk/engines/sword1/control.cpp	2009-01-30 15:43:45 UTC (rev 36148)
+++ scummvm/trunk/engines/sword1/control.cpp	2009-01-30 16:04:39 UTC (rev 36149)
@@ -218,7 +218,7 @@
 				notAccepted = false;
 			}
 		}
-	} while (notAccepted && (!g_engine->shouldQuit()));
+	} while (notAccepted && (!Engine::shouldQuit()));
 
 	_resMan->resClose(fontId);
 	free(_screenBuf);
@@ -320,7 +320,7 @@
 		}
 		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 @@
 			_buttons[5]->setSelected(SwordEngine::_systemVars.showText);
 		} else if (id == BUTTON_QUIT) {
 			if (getConfirm(_lStrings[STR_QUIT]))
-				g_engine->quitGame();
+				Engine::quitGame();
 			return mode;
 		}
 		break;

Modified: scummvm/trunk/engines/sword1/credits.cpp
===================================================================
--- scummvm/trunk/engines/sword1/credits.cpp	2009-01-30 15:43:45 UTC (rev 36148)
+++ scummvm/trunk/engines/sword1/credits.cpp	2009-01-30 16:04:39 UTC (rev 36149)
@@ -125,7 +125,7 @@
 	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 @@
 	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 @@
 	_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 @@
 	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 @@
 		if (msecs > 0)
 			_system->delayMillis(10);
 
-	} while ((_system->getMillis() < start + msecs) && !g_engine->shouldQuit());
+	} while ((_system->getMillis() < start + msecs) && !Engine::shouldQuit());
 }
 
 ArcFile::ArcFile(void) {

Modified: scummvm/trunk/engines/sword1/logic.cpp
===================================================================
--- scummvm/trunk/engines/sword1/logic.cpp	2009-01-30 15:43:45 UTC (rev 36148)
+++ scummvm/trunk/engines/sword1/logic.cpp	2009-01-30 16:04:39 UTC (rev 36149)
@@ -1637,7 +1637,7 @@
 	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);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list