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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Thu Sep 24 19:07:27 CEST 2009


Revision: 44311
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44311&view=rev
Author:   thebluegr
Date:     2009-09-24 17:07:27 +0000 (Thu, 24 Sep 2009)

Log Message:
-----------
Reverted my commit #44290 - apparently, it was a bad idea, as g_engine is a hack

Modified Paths:
--------------
    scummvm/trunk/engines/lure/events.cpp
    scummvm/trunk/engines/lure/fights.cpp
    scummvm/trunk/engines/lure/game.cpp
    scummvm/trunk/engines/lure/menu.cpp
    scummvm/trunk/engines/lure/scripts.cpp
    scummvm/trunk/engines/lure/surface.cpp

Modified: scummvm/trunk/engines/lure/events.cpp
===================================================================
--- scummvm/trunk/engines/lure/events.cpp	2009-09-24 16:30:10 UTC (rev 44310)
+++ scummvm/trunk/engines/lure/events.cpp	2009-09-24 17:07:27 UTC (rev 44311)
@@ -138,11 +138,12 @@
 
 void Mouse::waitForRelease() {
 	Events &e = Events::getReference();
+	LureEngine &engine = LureEngine::getReference();
 
 	do {
-		while (e.pollEvent() && !g_engine->shouldQuit()) ;
+		while (e.pollEvent() && !engine.shouldQuit()) ;
 		g_system->delayMillis(20);
-	} while (!g_engine->shouldQuit() && (lButton() || rButton() || mButton()));
+	} while (!engine.shouldQuit() && (lButton() || rButton() || mButton()));
 }
 
 /*--------------------------------------------------------------------------*/
@@ -206,10 +207,11 @@
 
 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 (g_engine->shouldQuit()) return true;
+		if (engine.shouldQuit()) return true;
 
 		if (events.pollEvent()) {
 			if (((events.type() == Common::EVENT_KEYDOWN) && (events.event().kbd.ascii != 0)) ||

Modified: scummvm/trunk/engines/lure/fights.cpp
===================================================================
--- scummvm/trunk/engines/lure/fights.cpp	2009-09-24 16:30:10 UTC (rev 44310)
+++ scummvm/trunk/engines/lure/fights.cpp	2009-09-24 17:07:27 UTC (rev 44311)
@@ -109,6 +109,7 @@
 }
 
 void FightsManager::fightLoop() {
+	LureEngine &engine = LureEngine::getReference();
 	Resources &res = Resources::getReference();
 	Game &game = Game::getReference();
 	Room &room = Room::getReference();
@@ -116,7 +117,7 @@
 	uint32 timerVal = g_system->getMillis();
 
 	// Loop for the duration of the battle
-	while (!g_engine->shouldQuit() && (playerFight.fwhits != GENERAL_MAGIC_ID)) {
+	while (!engine.shouldQuit() && (playerFight.fwhits != GENERAL_MAGIC_ID)) {
 		checkEvents();
 
 		if (g_system->getMillis() > timerVal + GAME_FRAME_DELAY) {
@@ -184,6 +185,7 @@
 	{Common::KEYCODE_INVALID, 0}};
 
 void FightsManager::checkEvents() {
+	LureEngine &engine = LureEngine::getReference();
 	Game &game = Game::getReference();
 	Events &events = Events::getReference();
 	Mouse &mouse = Mouse::getReference();
@@ -196,7 +198,7 @@
 		if (events.type() == Common::EVENT_KEYDOWN) {
 			switch (events.event().kbd.keycode) {
 			case Common::KEYCODE_ESCAPE:
-				g_engine->quitGame();
+				engine.quitGame();
 				return;
 
 			case Common::KEYCODE_d:

Modified: scummvm/trunk/engines/lure/game.cpp
===================================================================
--- scummvm/trunk/engines/lure/game.cpp	2009-09-24 16:30:10 UTC (rev 44310)
+++ scummvm/trunk/engines/lure/game.cpp	2009-09-24 17:07:27 UTC (rev 44311)
@@ -151,7 +151,7 @@
 
 	bool initialRestart = true;
 
-	while (!g_engine->shouldQuit()) {
+	while (!engine.shouldQuit()) {
 
 		if ((_state & GS_RESTART) != 0) {
 			res.reset();
@@ -171,7 +171,7 @@
 		mouse.cursorOn();
 
 		// Main game loop
-		while (!g_engine->shouldQuit() && ((_state & GS_RESTART) == 0)) {
+		while (!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::doQuit() {
 	Sound.pause();
 	if (getYN())
-		g_engine->quitGame();
+		LureEngine::getReference().quitGame();
 	Sound.resume();
 }
 
@@ -983,6 +983,7 @@
 	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;
@@ -1024,7 +1025,7 @@
 		}
 
 		g_system->delayMillis(10);
-	} while (!g_engine->shouldQuit() && !breakFlag);
+	} while (!engine.shouldQuit() && !breakFlag);
 
 	screen.update();
 	if (!vKbdFlag)

Modified: scummvm/trunk/engines/lure/menu.cpp
===================================================================
--- scummvm/trunk/engines/lure/menu.cpp	2009-09-24 16:30:10 UTC (rev 44310)
+++ scummvm/trunk/engines/lure/menu.cpp	2009-09-24 17:07:27 UTC (rev 44311)
@@ -116,6 +116,7 @@
 
 uint8 Menu::execute() {
 	OSystem &system = *g_system;
+	LureEngine &engine = LureEngine::getReference();
 	Mouse &mouse = Mouse::getReference();
 	Events &events = Events::getReference();
 	Screen &screen = Screen::getReference();
@@ -130,7 +131,7 @@
 
 	while (mouse.lButton() || mouse.rButton()) {
 		while (events.pollEvent()) {
-			if (g_engine->shouldQuit()) return MENUITEM_NONE;
+			if (engine.shouldQuit()) return MENUITEM_NONE;
 
 			if (mouse.y() < MENUBAR_Y_SIZE) {
 				MenuRecord *p = getMenuAt(mouse.x());
@@ -467,6 +468,7 @@
 
 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;
@@ -545,7 +547,7 @@
 		}
 
 		while (e.pollEvent()) {
-			if (g_engine->shouldQuit()) {
+			if (engine.shouldQuit()) {
 				selectedIndex = 0xffff;
 				goto bail_out;
 

Modified: scummvm/trunk/engines/lure/scripts.cpp
===================================================================
--- scummvm/trunk/engines/lure/scripts.cpp	2009-09-24 16:30:10 UTC (rev 44310)
+++ scummvm/trunk/engines/lure/scripts.cpp	2009-09-24 17:07:27 UTC (rev 44311)
@@ -192,6 +192,7 @@
 }
 
 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();
@@ -221,7 +222,7 @@
 	anim->show();
 	if (!events.interruptableDelay(30000)) {
 		// No key yet pressed, so keep waiting
-		while (Sound.musicInterface_CheckPlaying(6) && !g_engine->shouldQuit()) {
+		while (Sound.musicInterface_CheckPlaying(6) && !engine.shouldQuit()) {
 			if (events.interruptableDelay(20))
 				break;
 		}
@@ -229,7 +230,7 @@
 	delete anim;
 
 	screen.paletteFadeOut();
-	g_engine->quitGame();
+	engine.quitGame();
 }
 
 // Setup the pig fight in the cave

Modified: scummvm/trunk/engines/lure/surface.cpp
===================================================================
--- scummvm/trunk/engines/lure/surface.cpp	2009-09-24 16:30:10 UTC (rev 44310)
+++ scummvm/trunk/engines/lure/surface.cpp	2009-09-24 17:07:27 UTC (rev 44311)
@@ -506,6 +506,7 @@
 
 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();
@@ -533,7 +534,7 @@
 		// Loop until the input string changes
 		refreshFlag = false;
 		while (!refreshFlag && !abortFlag) {
-			abortFlag = g_engine->shouldQuit();
+			abortFlag = engine.shouldQuit();
 			if (abortFlag) break;
 
 			while (events.pollEvent()) {
@@ -975,7 +976,7 @@
 		// Provide highlighting of lines to select a save slot
 		while (!abortFlag && !(mouse.lButton() && (selectedLine != -1))
 				&& !mouse.rButton() && !mouse.mButton()) {
-			abortFlag = g_engine->shouldQuit();
+			abortFlag = engine.shouldQuit();
 			if (abortFlag) break;
 
 			while (events.pollEvent()) {
@@ -1178,7 +1179,7 @@
 		// Event loop for making selection
 		bool buttonPressed = false;
 
-		while (!g_engine->shouldQuit()) {
+		while (!engine.shouldQuit()) {
 			// Handle events
 			while (events.pollEvent()) {
 				if ((events.type() == Common::EVENT_LBUTTONDOWN) && (highlightedButton != -1)) {
@@ -1230,7 +1231,7 @@
 
 	Sound.killSounds();
 
-	if (!restartFlag && !g_engine->shouldQuit()) {
+	if (!restartFlag && !engine.shouldQuit()) {
 		// Need to show Restore game dialog
 		if (!SaveRestoreDialog::show(false))
 			// User cancelled, so fall back on Restart
@@ -1298,6 +1299,7 @@
 bool CopyProtectionDialog::show() {
 	Screen &screen = Screen::getReference();
 	Events &events = Events::getReference();
+	LureEngine &engine = LureEngine::getReference();
 
 	screen.setPaletteEmpty();
 	Palette p(COPY_PROTECTION_RESOURCE_ID - 1);
@@ -1348,7 +1350,7 @@
 		// Clear any prior try
 		_charIndex = 0;
 
-		while (!g_engine->shouldQuit()) {
+		while (!engine.shouldQuit()) {
 			while (events.pollEvent() && (_charIndex < 4)) {
 				if (events.type() == Common::EVENT_KEYDOWN) {
 					if ((events.event().kbd.keycode == Common::KEYCODE_BACKSPACE) && (_charIndex > 0)) {
@@ -1382,7 +1384,7 @@
 				break;
 		}
 
-		if (g_engine->shouldQuit())
+		if (engine.shouldQuit())
 			return false;
 
 		// At this point, two page numbers have been entered - validate them


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