diff options
| author | Filippos Karapetis | 2009-09-24 06:53:03 +0000 | 
|---|---|---|
| committer | Filippos Karapetis | 2009-09-24 06:53:03 +0000 | 
| commit | a70351e5ea92d1095097ef6fe77911aa530d1043 (patch) | |
| tree | c1c0dcde93500ec6895069cca7b899036f760760 | |
| parent | f6cdfde2f7b697d82839f9106468e55cec149679 (diff) | |
| download | scummvm-rg350-a70351e5ea92d1095097ef6fe77911aa530d1043.tar.gz scummvm-rg350-a70351e5ea92d1095097ef6fe77911aa530d1043.tar.bz2 scummvm-rg350-a70351e5ea92d1095097ef6fe77911aa530d1043.zip | |
Changed some references from LureEngine to the global g_engine (e.g. calls to shouldQuit()), to minimize places where LureEngine is referenced
svn-id: r44290
| -rw-r--r-- | engines/lure/events.cpp | 8 | ||||
| -rw-r--r-- | engines/lure/fights.cpp | 6 | ||||
| -rw-r--r-- | engines/lure/game.cpp | 9 | ||||
| -rw-r--r-- | engines/lure/menu.cpp | 6 | ||||
| -rw-r--r-- | engines/lure/scripts.cpp | 5 | ||||
| -rw-r--r-- | engines/lure/surface.cpp | 14 | 
6 files changed, 19 insertions, 29 deletions
| diff --git a/engines/lure/events.cpp b/engines/lure/events.cpp index 5ca82a9be4..3c3a4af8fa 100644 --- a/engines/lure/events.cpp +++ b/engines/lure/events.cpp @@ -138,12 +138,11 @@ void Mouse::setPosition(int newX, int newY) {  void Mouse::waitForRelease() {  	Events &e = Events::getReference(); -	LureEngine &engine = LureEngine::getReference();  	do { -		while (e.pollEvent() && !engine.shouldQuit()) ; +		while (e.pollEvent() && !g_engine->shouldQuit()) ;  		g_system->delayMillis(20); -	} while (!engine.shouldQuit() && (lButton() || rButton() || mButton())); +	} while (!g_engine->shouldQuit() && (lButton() || rButton() || mButton()));  }  /*--------------------------------------------------------------------------*/ @@ -207,11 +206,10 @@ void Events::waitForPress() {  bool Events::interruptableDelay(uint32 milliseconds) {  	Events &events = Events::getReference(); -	LureEngine &engine = LureEngine::getReference();  	uint32 delayCtr = g_system->getMillis() + milliseconds;  	while (g_system->getMillis() < delayCtr) { -		if (engine.shouldQuit()) return true; +		if (g_engine->shouldQuit()) return true;  		if (events.pollEvent()) {  			if (((events.type() == Common::EVENT_KEYDOWN) && (events.event().kbd.ascii != 0)) || diff --git a/engines/lure/fights.cpp b/engines/lure/fights.cpp index 4a67c3df66..9f32036e5f 100644 --- a/engines/lure/fights.cpp +++ b/engines/lure/fights.cpp @@ -109,7 +109,6 @@ bool FightsManager::isFighting() {  }  void FightsManager::fightLoop() { -	LureEngine &engine = LureEngine::getReference();  	Resources &res = Resources::getReference();  	Game &game = Game::getReference();  	Room &room = Room::getReference(); @@ -117,7 +116,7 @@ void FightsManager::fightLoop() {  	uint32 timerVal = g_system->getMillis();  	// Loop for the duration of the battle -	while (!engine.shouldQuit() && (playerFight.fwhits != GENERAL_MAGIC_ID)) { +	while (!g_engine->shouldQuit() && (playerFight.fwhits != GENERAL_MAGIC_ID)) {  		checkEvents();  		if (g_system->getMillis() > timerVal + GAME_FRAME_DELAY) { @@ -185,7 +184,6 @@ const KeyMapping keyList[] = {  	{Common::KEYCODE_INVALID, 0}};  void FightsManager::checkEvents() { -	LureEngine &engine = LureEngine::getReference();  	Game &game = Game::getReference();  	Events &events = Events::getReference();  	Mouse &mouse = Mouse::getReference(); @@ -198,7 +196,7 @@ void FightsManager::checkEvents() {  		if (events.type() == Common::EVENT_KEYDOWN) {  			switch (events.event().kbd.keycode) {  			case Common::KEYCODE_ESCAPE: -				engine.quitGame(); +				g_engine->quitGame();  				return;  			case Common::KEYCODE_d: diff --git a/engines/lure/game.cpp b/engines/lure/game.cpp index 3dfc6a8478..660d41eede 100644 --- a/engines/lure/game.cpp +++ b/engines/lure/game.cpp @@ -151,7 +151,7 @@ void Game::execute() {  	bool initialRestart = true; -	while (!engine.shouldQuit()) { +	while (!g_engine->shouldQuit()) {  		if ((_state & GS_RESTART) != 0) {  			res.reset(); @@ -171,7 +171,7 @@ void Game::execute() {  		mouse.cursorOn();  		// Main game loop -		while (!engine.shouldQuit() && ((_state & GS_RESTART) == 0)) { +		while (!g_engine->shouldQuit() && ((_state & GS_RESTART) == 0)) {  			// If time for next frame, allow everything to update  			if (system.getMillis() > timerVal + GAME_FRAME_DELAY) {  				timerVal = system.getMillis(); @@ -898,7 +898,7 @@ void Game::doShowCredits() {  void Game::doQuit() {  	Sound.pause();  	if (getYN()) -		LureEngine::getReference().quitGame(); +		g_engine->quitGame();  	Sound.resume();  } @@ -983,7 +983,6 @@ bool Game::getYN() {  	Events &events = Events::getReference();  	Screen &screen = Screen::getReference();  	Resources &res = Resources::getReference(); -	LureEngine &engine = LureEngine::getReference();  	Common::Language l = LureEngine::getReference().getLanguage();  	Common::KeyCode y = Common::KEYCODE_y; @@ -1025,7 +1024,7 @@ bool Game::getYN() {  		}  		g_system->delayMillis(10); -	} while (!engine.shouldQuit() && !breakFlag); +	} while (!g_engine->shouldQuit() && !breakFlag);  	screen.update();  	if (!vKbdFlag) diff --git a/engines/lure/menu.cpp b/engines/lure/menu.cpp index 5027e6967e..863ca33f75 100644 --- a/engines/lure/menu.cpp +++ b/engines/lure/menu.cpp @@ -116,7 +116,6 @@ Menu &Menu::getReference() {  uint8 Menu::execute() {  	OSystem &system = *g_system; -	LureEngine &engine = LureEngine::getReference();  	Mouse &mouse = Mouse::getReference();  	Events &events = Events::getReference();  	Screen &screen = Screen::getReference(); @@ -131,7 +130,7 @@ uint8 Menu::execute() {  	while (mouse.lButton() || mouse.rButton()) {  		while (events.pollEvent()) { -			if (engine.shouldQuit()) return MENUITEM_NONE; +			if (g_engine->shouldQuit()) return MENUITEM_NONE;  			if (mouse.y() < MENUBAR_Y_SIZE) {  				MenuRecord *p = getMenuAt(mouse.x()); @@ -468,7 +467,6 @@ Action PopupMenu::Show(int numEntries, Action *actions) {  uint16 PopupMenu::Show(int numEntries, const char *actions[]) {  	if (numEntries == 0) return 0xffff; -	LureEngine &engine = LureEngine::getReference();  	Events &e = Events::getReference();  	Mouse &mouse = Mouse::getReference();  	OSystem &system = *g_system; @@ -547,7 +545,7 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) {  		}  		while (e.pollEvent()) { -			if (engine.shouldQuit()) { +			if (g_engine->shouldQuit()) {  				selectedIndex = 0xffff;  				goto bail_out; diff --git a/engines/lure/scripts.cpp b/engines/lure/scripts.cpp index 9e13a0d871..f78d9b348f 100644 --- a/engines/lure/scripts.cpp +++ b/engines/lure/scripts.cpp @@ -192,7 +192,6 @@ void Script::addSound(uint16 soundIndex, uint16 v2, uint16 v3) {  }  void Script::endgameSequence(uint16 v1, uint16 v2, uint16 v3) { -	LureEngine &engine = LureEngine::getReference();  	Screen &screen = Screen::getReference();  	Mouse &mouse = Mouse::getReference();  	Events &events = Events::getReference(); @@ -222,7 +221,7 @@ void Script::endgameSequence(uint16 v1, uint16 v2, uint16 v3) {  	anim->show();  	if (!events.interruptableDelay(30000)) {  		// No key yet pressed, so keep waiting -		while (Sound.musicInterface_CheckPlaying(6) && !engine.shouldQuit()) { +		while (Sound.musicInterface_CheckPlaying(6) && !g_engine->shouldQuit()) {  			if (events.interruptableDelay(20))  				break;  		} @@ -230,7 +229,7 @@ void Script::endgameSequence(uint16 v1, uint16 v2, uint16 v3) {  	delete anim;  	screen.paletteFadeOut(); -	engine.quitGame(); +	g_engine->quitGame();  }  // Setup the pig fight in the cave diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp index 84930661ad..e519c76995 100644 --- a/engines/lure/surface.cpp +++ b/engines/lure/surface.cpp @@ -506,7 +506,6 @@ Surface *Surface::getScreen(uint16 resourceId) {  bool Surface::getString(Common::String &line, int maxSize, bool isNumeric, bool varLength, int16 x, int16 y) {  	OSystem &system = *g_system; -	LureEngine &engine = LureEngine::getReference();  	Mouse &mouse = Mouse::getReference();  	Events &events = Events::getReference();  	Screen &screen = Screen::getReference(); @@ -534,7 +533,7 @@ bool Surface::getString(Common::String &line, int maxSize, bool isNumeric, bool  		// Loop until the input string changes  		refreshFlag = false;  		while (!refreshFlag && !abortFlag) { -			abortFlag = engine.shouldQuit(); +			abortFlag = g_engine->shouldQuit();  			if (abortFlag) break;  			while (events.pollEvent()) { @@ -976,7 +975,7 @@ bool SaveRestoreDialog::show(bool saveDialog) {  		// Provide highlighting of lines to select a save slot  		while (!abortFlag && !(mouse.lButton() && (selectedLine != -1))  				&& !mouse.rButton() && !mouse.mButton()) { -			abortFlag = engine.shouldQuit(); +			abortFlag = g_engine->shouldQuit();  			if (abortFlag) break;  			while (events.pollEvent()) { @@ -1179,7 +1178,7 @@ bool RestartRestoreDialog::show() {  		// Event loop for making selection  		bool buttonPressed = false; -		while (!engine.shouldQuit()) { +		while (!g_engine->shouldQuit()) {  			// Handle events  			while (events.pollEvent()) {  				if ((events.type() == Common::EVENT_LBUTTONDOWN) && (highlightedButton != -1)) { @@ -1231,7 +1230,7 @@ bool RestartRestoreDialog::show() {  	Sound.killSounds(); -	if (!restartFlag && !engine.shouldQuit()) { +	if (!restartFlag && !g_engine->shouldQuit()) {  		// Need to show Restore game dialog  		if (!SaveRestoreDialog::show(false))  			// User cancelled, so fall back on Restart @@ -1299,7 +1298,6 @@ CopyProtectionDialog::CopyProtectionDialog() {  bool CopyProtectionDialog::show() {  	Screen &screen = Screen::getReference();  	Events &events = Events::getReference(); -	LureEngine &engine = LureEngine::getReference();  	screen.setPaletteEmpty();  	Palette p(COPY_PROTECTION_RESOURCE_ID - 1); @@ -1350,7 +1348,7 @@ bool CopyProtectionDialog::show() {  		// Clear any prior try  		_charIndex = 0; -		while (!engine.shouldQuit()) { +		while (!g_engine->shouldQuit()) {  			while (events.pollEvent() && (_charIndex < 4)) {  				if (events.type() == Common::EVENT_KEYDOWN) {  					if ((events.event().kbd.keycode == Common::KEYCODE_BACKSPACE) && (_charIndex > 0)) { @@ -1384,7 +1382,7 @@ bool CopyProtectionDialog::show() {  				break;  		} -		if (engine.shouldQuit()) +		if (g_engine->shouldQuit())  			return false;  		// At this point, two page numbers have been entered - validate them | 
