[Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.69,1.70 gfx.cpp,2.127,2.128 scumm.h,1.224,1.225

Max Horn fingolfin at users.sourceforge.net
Fri May 30 08:43:05 CEST 2003


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

Modified Files:
	akos.cpp gfx.cpp scumm.h 
Log Message:
code unification

Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- akos.cpp	30 May 2003 15:06:26 -0000	1.69
+++ akos.cpp	30 May 2003 15:39:04 -0000	1.70
@@ -820,48 +820,22 @@
 	akos16.dataptr = src + 4;
 }
 
-void AkosRenderer::akos16PutOnScreen(byte *dest, const byte *src, byte transparency, int32 count) {
-	byte tmp_data;
-
-	if (count == 0)
+void AkosRenderer::akos16PutOnScreen(byte *dst, const byte *src, byte transparency, int32 count) {
+	if (count <= 0)
 		return;
 
 	switch(_shadow_mode) {
 	case 0:
-		do {
-			tmp_data = *(src++);
-			if (tmp_data != transparency) {
-				*(dest) = tmp_data;
-			}
-			dest++;
-		} while (--count != 0);
+		_vm->bompApplyShadow0(src, dst, count, transparency);
 		break;
-
 	case 1:
-		do {
-			tmp_data = *(src++);
-			if (tmp_data != transparency) {
-				if (tmp_data == 13) {
-					tmp_data = _shadow_table[*(dest)];
-				}
-				*(dest) = tmp_data;
-			}
-			dest++;
-		} while (--count != 0);
+		_vm->bompApplyShadow1(src, dst, count, transparency);
 		break;
-
 	case 3:
-		do {
-			tmp_data = *(src++);
-			if (tmp_data != transparency) {
-				if (tmp_data < 8) {
-					tmp_data = _shadow_table[*(dest) + (tmp_data << 8)];
-				}
-				*(dest) = tmp_data;
-			}
-			dest++;
-		} while (--count != 0);
+		_vm->bompApplyShadow3(src, dst, count, transparency);
 		break;
+	default:
+		error("Unknown shadowMode %d", _shadow_mode);
 	}
 }
 
@@ -925,15 +899,13 @@
 }
 
 void AkosRenderer::akos16ApplyMask(byte *dest, byte *maskptr, byte bits, int32 count, byte fillwith) {
-	byte tmp;
-	byte tmp_data = *(maskptr++);
 	byte bitpos = 1 << (7 - bits);
 
-	if (count == 0)
+	if (count <= 0)
 		return;
 
-	for(;;) {
-		tmp = tmp_data;
+	while(1) {
+		byte tmp = *(maskptr++);
 		do {
 			if (tmp & bitpos) {
 				*(dest) = fillwith;
@@ -945,7 +917,6 @@
 		} while ((bitpos>>=1) != 0);
 
 		bitpos = 0x80;
-		tmp_data = *(maskptr++);
 	}
 }
 
@@ -991,7 +962,7 @@
 		akos16SkipData(numskip_before);
 	}
 
-	maskpitch = _numStrips ;
+	maskpitch = _numStrips;
 
 	while (t_height != 0) {
 		akos16DecodeLine(tmp_buf, t_width, dir);
@@ -1100,13 +1071,12 @@
 
 	if (_zbuf == 0) {
 		akos16Decompress(dest, pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency);
-		return 0;
+	} else {
+		byte *ptr = _vm->_screenStartStrip + _vm->getResourceAddress(rtBuffer, 9) + _vm->gdi._imgBufOffs[_zbuf];
+		ptr += _numStrips * clip_top + (clip_left / 8);
+		akos16DecompressMask(dest, pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency, ptr, clip_left / 8);
 	}
-
-	byte *ptr = _vm->_screenStartStrip + _vm->getResourceAddress(rtBuffer, 9) + _vm->gdi._imgBufOffs[_zbuf];
-	ptr += _numStrips * clip_top + (clip_left / 8);
-	akos16DecompressMask(dest, pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency, ptr, clip_left / 8);
-
+	
 	return 0;
 }
 

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.127
retrieving revision 2.128
diff -u -d -r2.127 -r2.128
--- gfx.cpp	30 May 2003 15:06:27 -0000	2.127
+++ gfx.cpp	30 May 2003 15:39:06 -0000	2.128
@@ -3320,43 +3320,37 @@
 	}
 }
 
-void Scumm::bompApplyShadow0(byte *line_buffer, byte *dst, int32 size) {
-	while(1) {
-		if (size-- == 0)
-			return;
-		byte tmp = *(line_buffer++);
-		if (tmp != 255) {
-			*(dst) = tmp;
+void Scumm::bompApplyShadow0(const byte *line_buffer, byte *dst, int32 size, byte transparency) {
+	while(size-- > 0) {
+		byte tmp = *line_buffer++;
+		if (tmp != transparency) {
+			*dst = tmp;
 		}
 		dst++;
 	}
 }
 
-void Scumm::bompApplyShadow1(byte *line_buffer, byte *dst, int32 size) {
-	while(1) {
-		if (size-- == 0)
-			return;
-		byte tmp = *(line_buffer++);
-		if (tmp != 255) {
+void Scumm::bompApplyShadow1(const byte *line_buffer, byte *dst, int32 size, byte transparency) {
+	while(size-- > 0) {
+		byte tmp = *line_buffer++;
+		if (tmp != transparency) {
 			if (tmp == 13) {
 				tmp = _shadowPalette[*(dst)];
 			}
-			*(dst) = tmp;
+			*dst = tmp;
 		}
 		dst++;
 	}
 }
 
-void Scumm::bompApplyShadow3(byte *line_buffer, byte *dst, int32 size) {
-	while(1) {
-		if (size-- == 0)
-			return;
-		byte tmp = *(line_buffer++);
-		if (tmp != 255) {
+void Scumm::bompApplyShadow3(const byte *line_buffer, byte *dst, int32 size, byte transparency) {
+	while(size-- > 0) {
+		byte tmp = *line_buffer++;
+		if (tmp != transparency) {
 			if (tmp < 8) {
-				tmp = _shadowPalette[*(dst) + (tmp << 8)];
+				tmp = _shadowPalette[*dst + (tmp << 8)];
 			}
-			*(dst) = tmp;
+			*dst = tmp;
 		}
 		dst++;
 	}

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.224
retrieving revision 1.225
diff -u -d -r1.224 -r1.225
--- scumm.h	30 May 2003 15:06:28 -0000	1.224
+++ scumm.h	30 May 2003 15:39:06 -0000	1.225
@@ -909,9 +909,11 @@
 	int32 bompDecodeLineMode1(const byte *src, byte *line_buffer, int32 size);
 	int32 bompDecodeLineMode3(const byte *src, byte *line_buffer, int32 size);
 	void bompApplyMask(byte *line_buffer, byte *mask_out, byte bits, int32 size);
-	void bompApplyShadow0(byte *line_buffer, byte *dst, int32 size);
-	void bompApplyShadow1(byte *line_buffer, byte *dst, int32 size);
-	void bompApplyShadow3(byte *line_buffer, byte *dst, int32 size);
+public:
+	void bompApplyShadow0(const byte *line_buffer, byte *dst, int32 size, byte transparency = 255);
+	void bompApplyShadow1(const byte *line_buffer, byte *dst, int32 size, byte transparency = 255);
+	void bompApplyShadow3(const byte *line_buffer, byte *dst, int32 size, byte transparency = 255);
+protected:
 	void bompApplyActorPalette(byte *line_buffer, int32 size);
 
 	bool _shakeEnabled;





More information about the Scummvm-git-logs mailing list