[Scummvm-cvs-logs] CVS: scummvm/kyra screen.cpp,1.18,1.19

Johannes Schickel lordhoto at users.sourceforge.net
Sat Oct 29 12:08:52 CEST 2005


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

Modified Files:
	screen.cpp 
Log Message:
Oops, fixed a segfault with CD version.


Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/screen.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- screen.cpp	29 Oct 2005 18:37:40 -0000	1.18
+++ screen.cpp	29 Oct 2005 19:07:43 -0000	1.19
@@ -568,7 +568,6 @@
 	// XXX
 }
 
-// TODO: implement the other callbacks and implement all of this function
 void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int sd, int flags, ...) {
 	debug(9, "Screen::drawShape(%d, %d, %d, %d, %d, ...)", pageNum, x, y, sd, flags);
 	assert(shapeData);
@@ -1303,7 +1302,11 @@
 	}
 	
 	int16 shapeSize2 = shapeSize;
-	shapeSize += 10;
+	if (_vm->features() & GF_TALKIE) {
+		shapeSize += 12;
+	} else {
+		shapeSize += 10;
+	}
 	if (flags & 1)
 		shapeSize += 16;
 	
@@ -1311,11 +1314,7 @@
 	int tableIndex = 0;
 	
 	uint8 *newShape = NULL;
-	if (_vm->features() & GF_TALKIE) {
-		newShape = (uint8*)malloc(shapeSize+16);
-	} else {
-		newShape = (uint8*)malloc(shapeSize+18);
-	}
+	newShape = (uint8*)malloc(shapeSize+16);
 	assert(newShape);
 	
 	byte *dst = newShape;
@@ -1387,15 +1386,17 @@
 	if (!(flags & 2)) {
 		if (shapeSize > _animBlockSize) {
 			dst = newShape;
-			if (_vm->features() & GF_TALKIE)
+			if (_vm->features() & GF_TALKIE) {
 				dst += 2;
+			}
 			flags = READ_LE_UINT16(dst);
 			flags |= 2;
 			WRITE_LE_UINT16(dst, flags);
 		} else {
 			src = newShape;
-			if (_vm->features() & GF_TALKIE)
+			if (_vm->features() & GF_TALKIE) {
 				src += 2;
+			}
 			if (flags & 1) {
 				src += 16;
 			}
@@ -1421,12 +1422,14 @@
 		}
 	}
 	
-	WRITE_LE_UINT16((newShape + 6), shapeSize);
+	dst = newShape;
+	if (_vm->features() & GF_TALKIE) {
+		dst += 2;
+	}
+	WRITE_LE_UINT16((dst + 6), shapeSize);
 	
 	if (flags & 1) {
 		dst = newShape + 10;
-		if (_vm->features() & GF_TALKIE)
-			dst += 2;
 		src = &table[0x100];
 		memcpy(dst, src, sizeof(uint8)*16);
 	}
@@ -1623,6 +1626,8 @@
 	}
 	
 	int shapeSize = READ_LE_UINT16(shape + 8) + 10;
+	if (_vm->features() & GF_TALKIE)
+		shapeSize += 2;
 	if (READ_LE_UINT16(shape) & 1)
 		shapeSize += 16;
 	
@@ -1660,8 +1665,13 @@
 	}
 	
 	_mouseXOffset = x; _mouseYOffset = y;
-	_mouseHeight = _mouseShape[5];
-	_mouseWidth = (READ_LE_UINT16(_mouseShape + 3) >> 3) + 2;
+	if (_vm->features() & GF_TALKIE) {
+		_mouseHeight = _mouseShape[7];
+		_mouseWidth = (READ_LE_UINT16(_mouseShape + 5) >> 3) + 2;
+	} else {
+		_mouseHeight = _mouseShape[5];
+		_mouseWidth = (READ_LE_UINT16(_mouseShape + 3) >> 3) + 2;
+	}
 	
 	copyMouseToScreen();
 	





More information about the Scummvm-git-logs mailing list