[Scummvm-cvs-logs] SF.net SVN: scummvm:[35735] scummvm/trunk/engines/agi/preagi_mickey.cpp

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Mon Jan 5 02:40:11 CET 2009


Revision: 35735
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35735&view=rev
Author:   mthreepwood
Date:     2009-01-05 01:40:08 +0000 (Mon, 05 Jan 2009)

Log Message:
-----------
fix quitting in Mickey's Space Adventure as well as other minor cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/agi/preagi_mickey.cpp

Modified: scummvm/trunk/engines/agi/preagi_mickey.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_mickey.cpp	2009-01-05 00:51:54 UTC (rev 35734)
+++ scummvm/trunk/engines/agi/preagi_mickey.cpp	2009-01-05 01:40:08 UTC (rev 35735)
@@ -102,7 +102,7 @@
 bool Mickey::chooseY_N(int ofsPrompt, bool fErrorMsg) {
 	printExeStr(ofsPrompt);
 
-	for (;;) {
+	while (!_vm->shouldQuit()) {
 		switch (_vm->getSelection(kSelYesNo)) {
 		case 0: return false;
 		case 1: return true;
@@ -115,13 +115,15 @@
 			break;
 		}
 	}
+	
+	return false;
 }
 
 int Mickey::choose1to9(int ofsPrompt) {
 	int answer = 0;
 	printExeStr(ofsPrompt);
 
-	for (;;) {
+	while (!_vm->shouldQuit()) {
 		answer = _vm->getSelection(kSelNumber);
 		if (answer == 10) {
 			printExeStr(IDO_MSA_PRESS_1_TO_9);
@@ -131,6 +133,7 @@
 		} else return answer;
 	}
 
+	return 0;
 }
 
 void Mickey::printStr(char *buffer) {
@@ -343,7 +346,7 @@
 
 	drawMenu(menu, *sel0, *sel1);
 
-	for(;;) {
+	while (!_vm->shouldQuit()) {
 		while (_vm->_system->getEventManager()->pollEvent(event)) {
 			switch(event.type) {
 			case Common::EVENT_RTL:
@@ -495,6 +498,8 @@
 		animate();
 		drawMenu(menu, *sel0, *sel1);
 	}
+	
+	return false;
 }
 
 void Mickey::getMenuSel(char *buffer, int *sel0, int *sel1) {
@@ -508,8 +513,8 @@
 	// Show the mouse cursor for the menu
 	CursorMan.showMouse(true);
 
-	for (;;) {
-		for (;;) {
+	while (!_vm->shouldQuit()) {
+		while (!_vm->shouldQuit()) {
 			if (getMenuSelRow(menu, sel0, sel1, 0)) {
 				if (_clickToMove)
 					break;
@@ -519,6 +524,7 @@
 				}
 			}
 		}
+		
 		if (_clickToMove || getMenuSelRow(menu, sel0, sel1, 2)) {
 			break;
 		}
@@ -1208,6 +1214,10 @@
 }
 
 void Mickey::gameOver() {
+	// We shouldn't run the game over segment if we're quitting.
+	if (_vm->shouldQuit())
+		return;
+
 	drawPic(IDI_MSA_PIC_EARTH_SHIP_LEAVING);
 	printExeMsg(IDO_MSA_GAME_OVER[3]);
 	playSound(IDI_MSA_SND_GAME_OVER);
@@ -1222,7 +1232,6 @@
 	}
 
 	waitAnyKey();
-	_vm->quitGame();
 }
 
 void Mickey::flipSwitch() {
@@ -1338,6 +1347,11 @@
 
 	// show copyright and play theme
 	printExeMsg(IDO_MSA_COPYRIGHT);
+	
+	// Quit if necessary
+	if (_vm->shouldQuit())
+		return;
+	
 	playSound(IDI_MSA_SND_THEME);
 
 	// load game
@@ -1350,6 +1364,10 @@
 			return;
 		}
 	}
+	
+	// Quit if necessary
+	if (_vm->shouldQuit())
+		return;
 
 	// play spaceship landing scene
 	_game.iPlanet = IDI_MSA_PLANET_EARTH;
@@ -1357,11 +1375,15 @@
 
 	drawRoom();
 	printRoomDesc();
+	
+	// Quit if necessary
+	if (_vm->shouldQuit())
+		return;
 
 	playSound(IDI_MSA_SND_SHIP_LAND);
 
 	// Flash screen 3 times
-	for (int i = 1; i <= 3; i++) {
+	for (byte i = 0; i < 3; i++) {
 		playSound(IDI_MSA_SND_PRESS_BLUE);
 
 		//Set screen to white
@@ -2058,7 +2080,7 @@
 	if (!anim)
 		_vm->_gfx->doUpdate();
 
-	for (;;) {
+	while (!_vm->shouldQuit()) {
 		while (_vm->_system->getEventManager()->pollEvent(event)) {
 			switch(event.type) {
 			case Common::EVENT_RTL:
@@ -2071,6 +2093,7 @@
 				break;
 			}
 		}
+		
 		if (anim) {
 			animate();
 			_vm->_gfx->doUpdate();
@@ -2177,7 +2200,7 @@
 			done = false;
 		}
 
-		while (!done) {
+		while (!done && !_vm->shouldQuit()) {
 			// Check air supply
 			if (_game.fSuit) {
 				_game.nAir -= 1;
@@ -2186,9 +2209,8 @@
 						playSound(IDI_MSA_SND_XL30);
 						printExeMsg(IDO_MSA_XL30_SPEAKING);
 						printExeMsg(IDO_MSA_AIR_SUPPLY[i]);
-						if (i == 3) {
-							exit(0);
-						}
+						if (i == 3)
+							return;
 					}
 				}
 			} else {


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