[Scummvm-cvs-logs] CVS: scummvm/bs2 build_display.cpp,1.17,1.18 debug.cpp,1.7,1.8 layers.cpp,1.4,1.5 resman.cpp,1.18,1.19

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Tue Sep 9 05:15:18 CEST 2003


Update of /cvsroot/scummvm/scummvm/bs2
In directory sc8-pr-cvs1:/tmp/cvs-serv26984

Modified Files:
	build_display.cpp debug.cpp layers.cpp resman.cpp 
Log Message:
Added a WaitForFade() function, to replace numerous while-loops scattered
througout the code.


Index: build_display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/build_display.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- build_display.cpp	8 Sep 2003 06:32:37 -0000	1.17
+++ build_display.cpp	9 Sep 2003 12:14:08 -0000	1.18
@@ -349,22 +349,7 @@
 	
 	if (GetFadeStatus() != RDFADE_BLACK) {
 		FadeDown((float) 0.75);
-
-		do {
-			//--------------------------------------------------
-			// Service windows
-			while (!gotTheFocus)
-				if (ServiceWindows() == RDERR_APPCLOSED)
-					break;
-
-			// if we pressed Ctrl-Q
-			if (ServiceWindows() == RDERR_APPCLOSED) {
-				Close_game();	//close engine systems down
-				CloseAppWindow();
-				exit(0);	//quit the game
-			}
- 			//--------------------------------------------------
-		} while (GetFadeStatus() == RDFADE_DOWN);
+		WaitForFade();
 	}
 
 	Set_mouse(0);
@@ -416,21 +401,7 @@
 
 	Free_mem(text_spr);
 
-	do {
-		//--------------------------------------------------
-		// Service windows
-		while (!gotTheFocus)
-			if (ServiceWindows() == RDERR_APPCLOSED)
-				break;
-
-		// if we pressed Ctrl-Q
-		if (ServiceWindows() == RDERR_APPCLOSED) {
-			Close_game();	//close engine systems down
-			CloseAppWindow();
-			exit(0);	//quit the game
-		}
- 		//--------------------------------------------------
-	} while (GetFadeStatus() == RDFADE_UP);
+	WaitForFade();
 
 	uint32 targetTime = SVM_timeGetTime() + (time * 1000);
 
@@ -473,22 +444,7 @@
 void RemoveMsg(void) {		// Chris 15May97
 	FadeDown((float) 0.75);
 
-	do {
-		//--------------------------------------------------
-		// Service windows
-		while (!gotTheFocus)
-			if (ServiceWindows() == RDERR_APPCLOSED)
-				break;
-
-		// if we pressed Ctrl-Q
-		if (ServiceWindows() == RDERR_APPCLOSED)
-		{
-			Close_game();	//close engine systems down
-			CloseAppWindow();
-			exit(0);	//quit the game
-		}
- 		//--------------------------------------------------
-	} while (GetFadeStatus() == RDFADE_DOWN);
+	WaitForFade();
 
 	EraseBackBuffer();		// for hardware rendering
 	EraseSoftwareScreenBuffer();	// for software rendering
@@ -1054,10 +1010,7 @@
 
 	// if the screen is still fading down then wait for black - could
 	// happen when everythings cached into a large memory model
-
-	do {
-		ServiceWindows();
-	} while (GetFadeStatus() == RDFADE_DOWN);
+	WaitForFade();
 
 	// open the screen file
 	screenFile = res_man.Res_open(this_screen.background_layer_id);
@@ -1111,9 +1064,7 @@
 }
 
 int32 FN_fade_up(int32 *params) {	//Chris 15May97
-	do {
-		ServiceWindows();
-	} while (GetFadeStatus() == RDFADE_DOWN);
+	WaitForFade();
 
 	if (GetFadeStatus() == RDFADE_BLACK)
 		FadeUp((float) 0.75);

Index: debug.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/debug.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- debug.cpp	21 Aug 2003 13:39:19 -0000	1.7
+++ debug.cpp	9 Sep 2003 12:14:08 -0000	1.8
@@ -102,13 +102,14 @@
 	vsprintf(buf, format, arg_ptr);
 	Zdebug("%s",buf);		// send output to 'debug.txt' as well, just for the record
 
-	while (GetFadeStatus())	// wait for fade to finish before calling RestoreDisplay()
-		ServiceWindows();
+	// wait for fade to finish before calling RestoreDisplay()
+	WaitForFade();
 
 	ReportFatalError((const uint8 *)buf);	// display message box
 	CloseAppWindow();
-	while (ServiceWindows() != RDERR_APPCLOSED);
-
+	// This looks like a bad idea, since our ServiceWindows() never
+	// returns RDERR_APPCLOSED.
+	// while (ServiceWindows() != RDERR_APPCLOSED);
 	exit(0);
 }
 

Index: layers.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/layers.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- layers.cpp	30 Jul 2003 19:25:29 -0000	1.4
+++ layers.cpp	9 Sep 2003 12:14:08 -0000	1.5
@@ -92,11 +92,8 @@
 
 	//-------------------------------------------------------
 	// if the screen is still fading down then wait for black
-	do
-	{
-		ServiceWindows();
-	}
-	while(GetFadeStatus()==RDFADE_DOWN);
+	WaitForFade();
+
 	//-------------------------------------------------------
 
 	if (this_screen.mask_flag)	// if last screen was using a shading mask (see below) (James 08apr97)

Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/resman.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- resman.cpp	2 Sep 2003 09:55:11 -0000	1.18
+++ resman.cpp	9 Sep 2003 12:14:08 -0000	1.19
@@ -955,38 +955,11 @@
 	char buf[1024];
 	sprintf(buf, "%sClusters\\%s", cdPath, resource_files[newCluster]);
 
-	uint8 fadeStat;
-
-	do {
-		fadeStat = GetFadeStatus();
-
-		//--------------------------------------------------
-		// Service windows
-
-		// if we pressed Ctrl-Q
-		if (ServiceWindows() == RDERR_APPCLOSED) {
-			Close_game();	//close engine systems down
-			CloseAppWindow();
-			exit(0);	//quit the game
-		}
- 		//--------------------------------------------------
-	} while (fadeStat == RDFADE_UP || fadeStat == RDFADE_DOWN);
+	WaitForFade();
 
 	if (GetFadeStatus() != RDFADE_BLACK) {
 		FadeDown((float) 0.75);
-
-		do {
-			//--------------------------------------------------
-			// Service windows
-
-			// if we pressed Ctrl-Q
-			if (ServiceWindows() == RDERR_APPCLOSED) {
-				Close_game();	//close engine systems down
-				CloseAppWindow();
-				exit(0);	//quit the game
-			}
- 			//--------------------------------------------------
-		} while (GetFadeStatus() != RDFADE_BLACK);
+		WaitForFade();
 	}
 
 	EraseBackBuffer();
@@ -1083,18 +1056,7 @@
 	CopyScreenBuffer();
 	FadeUp((float) 0.75);
 
-	do {
-		//--------------------------------------------------
-		// Service windows
-
-		// if we pressed Ctrl-Q
-		if (ServiceWindows() == RDERR_APPCLOSED) {
-			Close_game();	//close engine systems down
-			CloseAppWindow();
-			exit(0);	//quit the game
-		}
- 		//--------------------------------------------------
-	} while (GetFadeStatus() == RDFADE_UP);
+	WaitForFade();
 
 	fseek(inFile, 0, SEEK_END);
 	uint32 size = ftell(inFile);
@@ -1167,22 +1129,9 @@
 	EraseSoftwareScreenBuffer();	// for software rendering
 
 	FadeDown((float) 0.75);
-
-	do {
-		//--------------------------------------------------
-		// Service windows
-
-		// if we pressed Ctrl-Q
-		if (ServiceWindows() == RDERR_APPCLOSED) {
-			Close_game();	//close engine systems down
-			CloseAppWindow();
-			exit(0);	//quit the game
-		}
- 		//--------------------------------------------------
-	} while (GetFadeStatus() == RDFADE_DOWN);
-
+	WaitForFade();
 	CopyScreenBuffer();
-	FadeUp((float)0.75);
+	FadeUp((float) 0.75);
 
 	// Git rid of read-only status.
 	SVM_SetFileAttributes(resource_files[newCluster], FILE_ATTRIBUTE_NORMAL);





More information about the Scummvm-git-logs mailing list