[Scummvm-cvs-logs] CVS: scummvm/sword1 animation.cpp,1.10.2.3,1.10.2.4 animation.h,1.5,1.5.2.1 screen.cpp,1.37.2.1,1.37.2.2

Travis Howell kirben at users.sourceforge.net
Sun Feb 29 20:23:07 CET 2004


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

Modified Files:
      Tag: branch-0-6-0
	animation.cpp animation.h screen.cpp 
Log Message:

Add patch from roever to fix Broken Sword 1/2 cutscene crashes under Windows.


Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/animation.cpp,v
retrieving revision 1.10.2.3
retrieving revision 1.10.2.4
diff -u -d -r1.10.2.3 -r1.10.2.4
--- animation.cpp	22 Feb 2004 18:09:44 -0000	1.10.2.3
+++ animation.cpp	1 Mar 2004 04:03:31 -0000	1.10.2.4
@@ -180,16 +180,16 @@
 		pos = 0;
 	}
 
-	if (cr >= BITDEPTH)
+	if (cr > BITDEPTH)
 		return;
 
 	for (ii = 0; ii < lines; ii++) {
 		r = (-16 * 256 + (int) (256 * 1.596) * ((cr << SHIFT) - 128)) / 256;
-		for (cb = 0; cb < BITDEPTH; cb++) {
+		for (cb = 0; cb <= BITDEPTH; cb++) {
 			g = (-16 * 256 - (int) (0.813 * 256) * ((cr << SHIFT) - 128) - (int) (0.391 * 256) * ((cb << SHIFT) - 128)) / 256;
 			b = (-16 * 256 + (int) (2.018 * 256) * ((cb << SHIFT) - 128)) / 256;
 
-			for (y = 0; y < BITDEPTH; y++) {
+			for (y = 0; y <= BITDEPTH; y++) {
 				int idx, bst = 0;
 				int dis = 2 * SQR(r - palettes[p].pal[0]) + 4 * SQR(g - palettes[p].pal[1]) + SQR(b - palettes[p].pal[2]);
 
@@ -206,10 +206,10 @@
 				g += (1 << SHIFT);
 				b += (1 << SHIFT);
 			}
-			r -= 256;
+			r -= (BITDEPTH+1)*(1 << SHIFT);
 		}
 		cr++;
-		if (cr >= BITDEPTH)
+		if (cr > BITDEPTH)
 			return;
 	}
 }
@@ -237,14 +237,14 @@
 	if (lookup)
 		return;
 
-	lookup = (NewGuiColor *)calloc(BITDEPTH * BITDEPTH * 256, sizeof(NewGuiColor));
+	lookup = (NewGuiColor *)calloc((BITDEPTH+1) * (BITDEPTH+1) * 256, sizeof(NewGuiColor));
 
 	int y, cb, cr;
 	int r, g, b;
 	int pos = 0;
 
-	for (cr = 0; cr < BITDEPTH; cr++) {
-		for (cb = 0; cb < BITDEPTH; cb++) {
+	for (cr = 0; cr <= BITDEPTH; cr++) {
+		for (cb = 0; cb <= BITDEPTH; cb++) {
 			for (y = 0; y < 256; y++) {
 				r = ((y-16) * 256 + (int) (256 * 1.596) * ((cr << SHIFT) - 128)) / 256;
 				g = ((y-16) * 256 - (int) (0.813 * 256) * ((cr << SHIFT) - 128) - (int) (0.391 * 256) * ((cb << SHIFT) - 128)) / 256;
@@ -275,7 +275,7 @@
 
 	for (y = 0; y < height; y += 2) {
 		for (x = 0; x < width; x += 2) {
-			int i = ((((dat[2][cpos] + ROUNDADD) >> SHIFT) * BITDEPTH) + ((dat[1][cpos] + ROUNDADD)>>SHIFT)) * 256;
+			int i = ((((dat[2][cpos] + ROUNDADD) >> SHIFT) * (BITDEPTH+1)) + ((dat[1][cpos] + ROUNDADD)>>SHIFT)) * 256;
 			cpos++;
 
 			ptr[linepos               ] = lut[i + dat[0][        ypos  ]];

Index: animation.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/animation.h,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -d -r1.5 -r1.5.2.1
--- animation.h	12 Feb 2004 17:16:38 -0000	1.5
+++ animation.h	1 Mar 2004 04:03:31 -0000	1.5.2.1
@@ -96,7 +96,7 @@
 	int palnum;
 	int maxPalnum;
 
-	byte lookup[2][BITDEPTH * BITDEPTH * BITDEPTH];
+	byte lookup[2][(BITDEPTH+1) * (BITDEPTH+1) * (BITDEPTH+1)];
 	byte *lut;
 	byte *lut2;
 	int lutcalcnum;

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/screen.cpp,v
retrieving revision 1.37.2.1
retrieving revision 1.37.2.2
diff -u -d -r1.37.2.1 -r1.37.2.2
--- screen.cpp	22 Feb 2004 16:01:51 -0000	1.37.2.1
+++ screen.cpp	1 Mar 2004 04:03:31 -0000	1.37.2.2
@@ -943,7 +943,7 @@
 
 	for (y = 0; y < height; y += 2) {
 		for (x = 0; x < width; x += 2) {
-			int i = ((((dat[2][cpos] + ROUNDADD) >> SHIFT) * BITDEPTH) + ((dat[1][cpos] + ROUNDADD)>>SHIFT)) * BITDEPTH;
+			int i = ((((dat[2][cpos] + ROUNDADD) >> SHIFT) * (BITDEPTH+1)) + ((dat[1][cpos] + ROUNDADD)>>SHIFT)) * (BITDEPTH+1);
 			cpos++;
 
 			buf[linepos          ] = lut[i + ((dat[0][        ypos  ] + ROUNDADD) >> SHIFT)];





More information about the Scummvm-git-logs mailing list