[Scummvm-cvs-logs] CVS: residual README,1.8,1.9 TODO,1.15,1.16 bitmap.cpp,1.9,1.10 debug.h,1.1,1.2 engine.cpp,1.12,1.13 main.cpp,1.11,1.12 model.cpp,1.8,1.9 scene.cpp,1.14,1.15

James Brown ender at users.sourceforge.net
Sun Sep 21 02:55:02 CEST 2003


Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1:/tmp/cvs-serv27678

Modified Files:
	README TODO bitmap.cpp debug.h engine.cpp main.cpp model.cpp 
	scene.cpp 
Log Message:
'unbreak' Residual - disable Zbuffer and (broken) screenblocks code by default. Add hacky commandline options for these.


Index: README
===================================================================
RCS file: /cvsroot/scummvm/residual/README,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- README	24 Aug 2003 14:12:22 -0000	1.8
+++ README	21 Sep 2003 09:51:59 -0000	1.9
@@ -1,5 +1,5 @@
 Residual: A LucasArts 3D game interpreter            Version 0.01-CVS
-(C) 2003- The ScummVM-Residual team                  Last Updated: 24st Aug 2003
+(C) 2003- The ScummVM-Residual team                  Last Updated: 21st Sept 2003
 --------------------------------------------------------------------------------
 
 What is Residual?
@@ -26,6 +26,7 @@
      Create a ~/.residualrc file, containing the following lines:
        DataDir=[path to all the .lab files]
        good_times=TRUE
+
 Win32:
      Copy 'residual.exe' into the directory containing your .lab files, and
 create a file in this directory called 'residual.ini'. This file should contain
@@ -33,15 +34,18 @@
        DataDir=.
        good_times=TRUE
 
-It runs really slow!
---------------------
+Residual understands two options: '-zbuffer' which enables masking, and '-screenblocks'
+which is a (currently broken) attempt to speed up masking on older cards.
+
+It runs really slow when using -zbuffer!
+----------------------------------------
 A large portion of older cards (Such as 3dfx cards, Radeon 7500 and earlier,
 Matrox G4xx series cards, etc) do not have a fast glDrawPixels implementation.
 Unix users can achieve a usable speed by using Mesa 5.0 or newer, but people
 unable to upgrade or Windows users are stuck.
 
-We are working on this problem, however it is a tricky one and no easy
-solution has yet been found.
+We do have a possible solution (-screenblocks), however it is experimental
+untested, and currently will thrash memory and potentially crash.
 
 What is the state of Residual?
 -------------------------------

Index: TODO
===================================================================
RCS file: /cvsroot/scummvm/residual/TODO,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- TODO	6 Sep 2003 15:04:58 -0000	1.15
+++ TODO	21 Sep 2003 09:51:59 -0000	1.16
@@ -6,8 +6,8 @@
 
 Residual TODO list (in rough order of priority):
 ------------------------------------------------ 
- * Bounds check the ZBuffer/Screen stuff, so it stops trashing memory and making
-   Residual unusable/unstable.
+ * Bounds check the Screenblocks dirty rectangle stuff, so it stops trashing
+   memory and making Residual unusable/unstable.
  * Implement 2D primitives 
  * Remove hash_map usage (not implemented on Visual Studio & other compilers)
  * Remove as much other STL stuff as possible (see above)

Index: bitmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/bitmap.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- bitmap.cpp	30 Aug 2003 19:04:06 -0000	1.9
+++ bitmap.cpp	21 Sep 2003 09:51:59 -0000	1.10
@@ -120,8 +120,7 @@
 }
 
 void Bitmap::draw() const {
-
-  if (format_ == 1) {
+  if (format_ == 1) {		// Normal image
     if (curr_image_ != 0) {
       warning("Animation not handled yet in GL texture path !\n");
     }
@@ -152,8 +151,11 @@
     glDisable(GL_TEXTURE_2D);
     glDepthMask(GL_TRUE);
     glEnable(GL_DEPTH_TEST);
-  } else if (format_ == 5) {
-#if 0
+  } 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))
+	return;
+
     if (curr_image_ != 0) {
       warning("Animation not handled yet in GL texture path !\n");
     }
@@ -171,7 +173,6 @@
     }
     glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
     glDepthFunc(GL_LESS);
-#endif
   }
 }
 

Index: debug.h
===================================================================
RCS file: /cvsroot/scummvm/residual/debug.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- debug.h	15 Aug 2003 19:41:26 -0000	1.1
+++ debug.h	21 Sep 2003 09:51:59 -0000	1.2
@@ -17,6 +17,8 @@
 
 #ifndef DEBUG_H
 #define DEBUG_H
+// Hacky toggles for experimental / debug code (defined/set in main.cpp)
+extern int 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.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- engine.cpp	31 Aug 2003 13:20:28 -0000	1.12
+++ engine.cpp	21 Sep 2003 09:51:59 -0000	1.13
@@ -84,7 +84,7 @@
 
     // Run asynchronous tasks
     lua_runtasks();
-
+    if (SCREENBLOCKS_GLOBAL == 1)
 	screenBlocksReset();
 
     // Draw the screen
@@ -118,8 +118,8 @@
     }
     glDisable(GL_TEXTURE_2D);
 
-	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
+    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+    if (SCREENBLOCKS_GLOBAL == 1)
 	screenBlocksBlitDirtyBlocks();
 
     Bitmap::prepareGL();

Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/main.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- main.cpp	29 Aug 2003 12:10:53 -0000	1.11
+++ main.cpp	21 Sep 2003 09:51:59 -0000	1.12
@@ -30,6 +30,9 @@
 #include <unistd.h>
 #endif
 
+// Hacky global toggles for experimental/debug code
+int ZBUFFER_GLOBAL, SCREENBLOCKS_GLOBAL;
+
 static void saveRegistry() {
   Registry::instance()->save();
 }
@@ -40,8 +43,28 @@
 }
 #endif
 
-int main(int /* argc */, char ** /* argv */) {
+int main(int argc, char *argv[]) {
   char 	GLDriver[1024];
+  int i;
+
+  // Parse command line
+  ZBUFFER_GLOBAL = 0;
+  SCREENBLOCKS_GLOBAL = 0;
+  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;
+	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");
+		exit(-1);
+	}
+  }
+
   if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
     return 1;
   SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);

Index: model.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/model.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- model.cpp	1 Sep 2003 17:07:31 -0000	1.8
+++ model.cpp	21 Sep 2003 09:51:59 -0000	1.9
@@ -709,7 +709,8 @@
 
 	  }
 
-	 screenBlocksAddRectangle( top, right, left, bottom, bestDepth );
+	 if (SCREENBLOCKS_GLOBAL == 1)
+		 screenBlocksAddRectangle( top, right, left, bottom, bestDepth );
   }
 
  /* glDisable(GL_DEPTH_TEST);

Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/scene.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- scene.cpp	30 Aug 2003 17:58:33 -0000	1.14
+++ scene.cpp	21 Sep 2003 09:51:59 -0000	1.15
@@ -169,6 +169,9 @@
 void Scene::setSetup(int num)
 {
 	currSetup_ = setups_ + num;
+
+	if (SCREENBLOCKS_GLOBAL == 0)
+		return;
 	if(currSetup_->bkgnd_zbm_)
 		screenBlocksInit( currSetup_->bkgnd_zbm_->getData() );
 	else





More information about the Scummvm-git-logs mailing list