[Scummvm-cvs-logs] CVS: scummvm debug.cpp,1.35,1.36 debug.h,1.1,1.2

Max Horn fingolfin at users.sourceforge.net
Sun Jul 28 06:46:05 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv30472

Modified Files:
	debug.cpp debug.h 
Log Message:
allow to print (and draw!) only one specified box

Index: debug.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/debug.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- debug.cpp	27 Jul 2002 21:06:50 -0000	1.35
+++ debug.cpp	28 Jul 2002 13:45:51 -0000	1.36
@@ -67,7 +67,7 @@
 	case CMD_HELP:
 		printf("Debugger commands:\n"
 					 "(a)ctor [actornum] -> show actor information\n"
-					 "(b)oxes -> list and draw boxen\n"
+					 "(b)ox [boxnum] -> list and draw the specified (or all) boxes\n"
 					 "(c)ontinue -> exit the debugger and continue the program\n"
 					 "(h)elp -> display this help text\n"
 					 "(g)o [numframes] -> increase frame\n"
@@ -108,32 +108,10 @@
 		}
 		return true;
 	case CMD_DUMPBOX:
-		{
-			int num, i = 0;
-			BoxCoords box;
-			byte *boxm = _s->getBoxMatrixBaseAddr();
-			int flags;
-			num = _s->getNumBoxes();
-
-			printf("Walk matrix:\n");
-			for (i = 0; i < num; i++) {
-				while (*boxm != 0xFF) {
-					printf("[%d] ", *boxm);
-					boxm++;
-				}
-				boxm++;
-				printf("\n");
-			}
-
-			printf("\nWalk boxes:\n");
-			for (i = 0; i < num; i++) {
-				boxTest(i);
-				_s->getBoxCoordinates(i, &box);
-				flags = _s->getBoxFlags(i);
-				printf("%d: [%d x %d] [%d x %d] [%d x %d] [%d x %d], flags=0x%02x\n", i,
-							 box.ul.x, box.ul.y, box.ll.x, box.ll.y, box.ur.x, box.ur.y, box.lr.x, box.lr.y, flags);
-			}
-		}
+		if (!_parameters[0])
+			printBoxes();
+		else
+			printBox(atoi(_parameters));
 		return true;
 	case CMD_VAR:
 		if (!_parameters[0]) {
@@ -317,6 +295,45 @@
 }
 
 
+void ScummDebugger::printBoxes()
+{
+	int num, i = 0;
+	byte *boxm = _s->getBoxMatrixBaseAddr();
+	num = _s->getNumBoxes();
+
+	printf("Walk matrix:\n");
+	for (i = 0; i < num; i++) {
+		while (*boxm != 0xFF) {
+			printf("[%d] ", *boxm);
+			boxm++;
+		}
+		boxm++;
+		printf("\n");
+	}
+
+	printf("\nWalk boxes:\n");
+	for (i = 0; i < num; i++)
+		printBox(i);
+}
+
+void ScummDebugger::printBox(int box)
+{
+	BoxCoords coords;
+	int flags = _s->getBoxFlags(box);
+	int mask = _s->getMaskFromBox(box);
+
+	_s->getBoxCoordinates(box, &coords);
+	
+	// Draw the box
+	boxTest(box);
+
+	// Print out coords, flags, zbuffer mask
+	printf("%d: [%d x %d] [%d x %d] [%d x %d] [%d x %d], flags=0x%02x, mask=%d\n",
+				box,
+				 coords.ul.x, coords.ul.y, coords.ll.x, coords.ll.y,
+				 coords.ur.x, coords.ur.y, coords.lr.x, coords.lr.y,
+				 flags, mask);
+}
 
 
 /************ ENDER: Temporary debug code for boxen **************/

Index: debug.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/debug.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- debug.h	27 Jul 2002 21:06:50 -0000	1.1
+++ debug.h	28 Jul 2002 13:45:51 -0000	1.2
@@ -43,7 +43,9 @@
 
 	void printActors(int act);
 	void printScripts();
-	
+
+	void printBox(int box);
+	void printBoxes();
 	void boxTest(int box);
 };
 





More information about the Scummvm-git-logs mailing list