[Scummvm-cvs-logs] CVS: scummvm/scumm boxes.cpp,1.19,1.20 boxes.h,1.3,1.4 scummvm.cpp,2.131,2.132

Max Horn fingolfin at users.sourceforge.net
Fri May 9 14:47:03 CEST 2003


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

Modified Files:
	boxes.cpp boxes.h scummvm.cpp 
Log Message:
implemented v2 walkboxes (at least the debugger output looks right now, though I might have overlooked something)

Index: boxes.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/boxes.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- boxes.cpp	9 May 2003 03:02:49 -0000	1.19
+++ boxes.cpp	9 May 2003 21:46:34 -0000	1.20
@@ -34,6 +34,17 @@
 struct Box {				/* Internal walkbox file format */
 	union {
 		struct {
+			byte uy;
+			byte ly;
+			byte ulx;
+			byte urx;
+			byte llx;
+			byte lrx;
+			byte mask;
+			byte flags;
+		} GCC_PACK v2;
+
+		struct {
 			int16 ulx, uly;
 			int16 urx, ury;
 			int16 lrx, lry;
@@ -85,6 +96,8 @@
 
 	if (_features & GF_AFTER_V8)
 		return (byte) FROM_LE_32(ptr->v8.mask);
+	else if (_features & GF_AFTER_V2)
+		return ptr->v2.mask;
 	else
 		return ptr->old.mask;
 }
@@ -97,12 +110,14 @@
 		assert(box >= 0 && box < 65);
 		_extraBoxFlags[box] = val;
 	} else {
-		Box *b = getBoxBaseAddr(box);
-		assert(b);
+		Box *ptr = getBoxBaseAddr(box);
+		assert(ptr);
 		if (_features & GF_AFTER_V8)
-			b->v8.flags = TO_LE_32(val);
+			ptr->v8.flags = TO_LE_32(val);
+		else if (_features & GF_AFTER_V2)
+			ptr->v2.flags = val;
 		else
-			b->old.flags = val;
+			ptr->old.flags = val;
 	}
 }
 
@@ -112,16 +127,20 @@
 		return 0;
 	if (_features & GF_AFTER_V8)
 		return (byte) FROM_LE_32(ptr->v8.flags);
+	else if (_features & GF_AFTER_V2)
+		return ptr->v2.flags;
 	else
 		return ptr->old.flags;
 }
 
 void Scumm::setBoxScale(int box, int scale) {
-	Box *b = getBoxBaseAddr(box);
+	Box *ptr = getBoxBaseAddr(box);
 	if (_features & GF_AFTER_V8)
-		b->v8.scale = TO_LE_32(scale);
+		ptr->v8.scale = TO_LE_32(scale);
+	else if (_features & GF_AFTER_V2)
+		error("This should not ever be called!");
 	else
-		b->old.scale = TO_LE_16(scale);
+		ptr->old.scale = TO_LE_16(scale);
 }
 
 void Scumm::setBoxScaleSlot(int box, int slot) {
@@ -162,6 +181,9 @@
 			}
 		} else
 			return FROM_LE_32(ptr->v8.scale);
+	} else if (_features & GF_AFTER_V2) {
+		// FIXME - nothing ?!?
+		return 255;
 	} else {
 		uint16 scale = READ_LE_UINT16(&ptr->old.scale);
 
@@ -216,14 +238,15 @@
 	if ((_gameId != GID_MONKEY_EGA) && !(_features & GF_AFTER_V2))
 		checkRange(ptr[0] - 1, 0, box, "Illegal box %d");
 
-	if (_features & GF_SMALL_HEADER) {
-		if (_features & GF_AFTER_V3) // GF_OLD256 or GF_AFTER_V3 ?
-			return (Box *)(ptr + box * (SIZEOF_BOX - 2) + 1);
-		else
-			return (Box *)(ptr + box * SIZEOF_BOX + 1);
-	} else if (_features & GF_AFTER_V8) {
-		return (Box *)(ptr + box * 52 + 4);
-	} else
+	if (_features & GF_AFTER_V2)
+		return (Box *)(ptr + box * SIZEOF_BOX_V2 + 1);
+	else if (_features & GF_AFTER_V3)
+		return (Box *)(ptr + box * SIZEOF_BOX_V3 + 1);
+	else if (_features & GF_SMALL_HEADER)
+		return (Box *)(ptr + box * SIZEOF_BOX + 1);
+	else if (_features & GF_AFTER_V8)
+		return (Box *)(ptr + box * SIZEOF_BOX_V8 + 4);
+	else
 		return (Box *)(ptr + box * SIZEOF_BOX + 2);
 }
 
@@ -326,6 +349,16 @@
 			SWAP(box->ll.x, box->lr.x);
 			SWAP(box->ll.y, box->lr.y);
 		}
+	} else if (_features & GF_AFTER_V2) {
+		box->ul.x = bp->v2.ulx;
+		box->ul.y = bp->v2.uy;
+		box->ur.x = bp->v2.urx;
+		box->ur.y = bp->v2.uy;
+	
+		box->ll.x = bp->v2.llx;
+		box->ll.y = bp->v2.ly;
+		box->lr.x = bp->v2.lrx;
+		box->lr.y = bp->v2.ly;
 	} else {
 		box->ul.x = (int16)READ_LE_UINT16(&bp->old.ulx);
 		box->ul.y = (int16)READ_LE_UINT16(&bp->old.uly);

Index: boxes.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/boxes.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- boxes.h	6 Mar 2003 21:45:53 -0000	1.3
+++ boxes.h	9 May 2003 21:46:34 -0000	1.4
@@ -23,7 +23,10 @@
 #ifndef BOXES_H
 #define BOXES_H
 
+#define SIZEOF_BOX_V2 8
+#define SIZEOF_BOX_V3 18
 #define SIZEOF_BOX 20
+#define SIZEOF_BOX_V8 52
 
 typedef enum {
 	kBoxXFlip		= 0x08,

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.131
retrieving revision 2.132
diff -u -d -r2.131 -r2.132
--- scummvm.cpp	8 May 2003 22:44:46 -0000	2.131
+++ scummvm.cpp	9 May 2003 21:46:34 -0000	2.132
@@ -1332,8 +1332,10 @@
 		if (ptr) {
 			byte numOfBoxes = *ptr;
 			int size;
-			if (_features & GF_AFTER_V3)
-				size = numOfBoxes * (SIZEOF_BOX - 2) + 1;
+			if (_features & GF_AFTER_V2)
+				size = numOfBoxes * SIZEOF_BOX_V2 + 1;
+			else if (_features & GF_AFTER_V3)
+				size = numOfBoxes * SIZEOF_BOX_V3 + 1;
 			else
 				size = numOfBoxes * SIZEOF_BOX + 1;
 





More information about the Scummvm-git-logs mailing list