[Scummvm-cvs-logs] CVS: residual bitmap.cpp,1.21,1.22 debug.h,1.4,1.5 engine.cpp,1.24,1.25 main.cpp,1.23,1.24 model.cpp,1.14,1.15 scene.cpp,1.22,1.23

Daniel Schepler dschepler at users.sourceforge.net
Wed Mar 24 04:32:02 CET 2004


Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12117

Modified Files:
	bitmap.cpp debug.h engine.cpp main.cpp model.cpp scene.cpp 
Log Message:
Add zbuffer and screenblocks options in .residualrc.

Also, make ZBUFFER_GLOBAL and SCREENBLOCKS_GLOBAL into bool variables.


Index: bitmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/bitmap.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- bitmap.cpp	23 Mar 2004 10:38:02 -0000	1.21
+++ bitmap.cpp	24 Mar 2004 12:20:46 -0000	1.22
@@ -204,7 +204,7 @@
 		glEnable(GL_DEPTH_TEST);
 	} else if (format_ == 5) {	// ZBuffer image
 		// Only draw the manual zbuffer when we are not using screenblocks, and when enabled
-		if ((ZBUFFER_GLOBAL == 0) || (SCREENBLOCKS_GLOBAL == 1))
+		if ((! ZBUFFER_GLOBAL) || SCREENBLOCKS_GLOBAL)
 			return;
 
 		g_driver->drawDepthBitmap(x_, y_, width_, height_, data_[curr_image_ - 1]);

Index: debug.h
===================================================================
RCS file: /cvsroot/scummvm/residual/debug.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- debug.h	24 Feb 2004 21:09:53 -0000	1.4
+++ debug.h	24 Mar 2004 12:20:46 -0000	1.5
@@ -20,7 +20,7 @@
 #ifndef DEBUG_H
 #define DEBUG_H
 // Hacky toggles for experimental / debug code (defined/set in main.cpp)
-extern int ZBUFFER_GLOBAL, SCREENBLOCKS_GLOBAL;
+extern bool ZBUFFER_GLOBAL, SCREENBLOCKS_GLOBAL;
 
 void warning(const char *fmt, ...);
 void error(const char *fmt, ...);

Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/engine.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- engine.cpp	22 Mar 2004 11:23:37 -0000	1.24
+++ engine.cpp	24 Mar 2004 12:20:46 -0000	1.25
@@ -96,7 +96,7 @@
 			}
 			g_driver->flipBuffer();
 		} else if (_mode == ENGINE_MODE_NORMAL) {
-			if (SCREENBLOCKS_GLOBAL == 1)
+			if (SCREENBLOCKS_GLOBAL)
 				screenBlocksReset();
 
 			// Update actor costumes
@@ -109,7 +109,7 @@
 
 			g_driver->clearScreen();
 
-			if (SCREENBLOCKS_GLOBAL == 1)
+			if (SCREENBLOCKS_GLOBAL)
 				screenBlocksBlitDirtyBlocks();
 
 			if (currScene_ != NULL) {

Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/main.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- main.cpp	22 Mar 2004 11:23:37 -0000	1.23
+++ main.cpp	24 Mar 2004 12:20:46 -0000	1.24
@@ -35,7 +35,7 @@
 #endif
 
 // Hacky global toggles for experimental/debug code
-int ZBUFFER_GLOBAL, SCREENBLOCKS_GLOBAL;
+bool ZBUFFER_GLOBAL, SCREENBLOCKS_GLOBAL;
 
 static void saveRegistry() {
 	Registry::instance()->save();
@@ -50,23 +50,50 @@
 extern SoundMixer *g_mixer;
 extern Timer *g_timer;
 
+static bool parseBoolStr(const char *val) {
+	if (val == NULL || val[0] == 0)
+		return false;
+	switch (val[0]) {
+	case 'y': case 'Y':	// yes
+	case 't': case 'T':	// true
+	case '1':
+		return true;
+	case 'n': case 'N':	// no
+	case 'f': case 'F':	// false
+	case '0':
+		return false;
+	case 'o':
+		switch (val[1]) {
+		case 'n': case 'N': // on
+			return true;
+		case 'f': case 'F': // off
+			return false;
+		}
+	}
+	error("Unrecognized boolean value %s\n", val);
+}
+
 int main(int argc, char *argv[]) {
 	int i;
 
 	// Parse command line
-	ZBUFFER_GLOBAL = 0;
-	SCREENBLOCKS_GLOBAL = 0;
+	ZBUFFER_GLOBAL = parseBoolStr(Registry::instance()->get("zbuffer"));
+	SCREENBLOCKS_GLOBAL = parseBoolStr(Registry::instance()->get("screenblocks"));
 	for (i=1;i<argc;i++) {
 		if (strcmp(argv[i], "-zbuffer") == 0)
-			ZBUFFER_GLOBAL = 1;
-		else if (strcmp(argv[i], "-screenblocks") ==0)
-			SCREENBLOCKS_GLOBAL = 1;
+			ZBUFFER_GLOBAL = true;
+		else if (strcmp(argv[i], "-nozbuffer") == 0)
+			ZBUFFER_GLOBAL = false;
+		else if (strcmp(argv[i], "-screenblocks") == 0)
+			SCREENBLOCKS_GLOBAL = true;
+		else if (strcmp(argv[i], "-noscreenblocks") == 0)
+			SCREENBLOCKS_GLOBAL = false;
 		else {
 			printf("Residual CVS Version\n");
 			printf("--------------------\n");
 			printf("Recognised options:\n");
-			printf("\t-zbuffer\t\tEnable ZBuffers (Very slow on older cards)\n");
-			printf("\t-screenblocks\t\tEnable Screenblocks (Experimental zbuffer speedup on older cards - BROKEN!!\n");
+			printf("\t-[no]zbuffer\t\tEnable/disable ZBuffers (Very slow on older cards)\n");
+			printf("\t-[no]screenblocks\t\tEnable/disable Screenblocks (Experimental zbuffer speedup on older cards - BROKEN!!\n");
 			exit(-1);
 		}
 	}

Index: model.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/model.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- model.cpp	21 Mar 2004 15:16:56 -0000	1.14
+++ model.cpp	24 Mar 2004 12:20:46 -0000	1.15
@@ -690,7 +690,7 @@
 				bestDepth = winZ;
 		}
 
-		if (SCREENBLOCKS_GLOBAL == 1)
+		if (SCREENBLOCKS_GLOBAL)
 			screenBlocksAddRectangle( (int)top, (int)right, (int)left, (int)bottom, (int)bestDepth );
 	}
 	/*

Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/scene.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- scene.cpp	23 Mar 2004 11:22:22 -0000	1.22
+++ scene.cpp	24 Mar 2004 12:20:46 -0000	1.23
@@ -155,7 +155,7 @@
 void Scene::setSetup(int num) {
 	currSetup_ = setups_ + num;
 
-	if (SCREENBLOCKS_GLOBAL == 0)
+	if (! SCREENBLOCKS_GLOBAL)
 		return;
 	if(currSetup_->bkgnd_zbm_)
 		screenBlocksInit( currSetup_->bkgnd_zbm_->getData() );





More information about the Scummvm-git-logs mailing list