[Scummvm-cvs-logs] CVS: scummvm/scumm boxes.cpp,1.30,1.31

Max Horn fingolfin at users.sourceforge.net
Mon May 19 13:37:10 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv4603

Modified Files:
	boxes.cpp 
Log Message:
cleanup

Index: boxes.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/boxes.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- boxes.cpp	19 May 2003 19:52:08 -0000	1.30
+++ boxes.cpp	19 May 2003 20:36:39 -0000	1.31
@@ -577,23 +577,27 @@
 	boxm = getBoxMatrixBaseAddr();
 
 	if (_features & GF_AFTER_V2) {
+		// The v2 box matrix is a real matrix with numOfBoxes rows and columns.
+		// The first numOfBoxes bytes contain indices to the start of the corresponding
+		// row (although that seems unnecessary to me - the value is easily computable.
 		boxm += numOfBoxes + boxm[from];
 		return boxm[to];
 	}
 
-	i = 0;
-	while (i != from) {
+	// Skip up to the matrix data for box 'from'
+	for (i = 0; i < from; i++) {
 		while (*boxm != 0xFF)
 			boxm += 3;
-		i++;
 		boxm++;
 	}
 
+	// Now search for the entry for box 'to'
 	while (boxm[0] != 0xFF) {
 		if (boxm[0] <= to && to <= boxm[1])
 			dest = boxm[2];
 		boxm += 3;
 	}
+
 	return dest;
 }
 





More information about the Scummvm-git-logs mailing list