[Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.70,1.71 akos.h,1.20,1.21 gfx.cpp,2.128,2.129 scumm.h,1.225,1.226

Max Horn fingolfin at users.sourceforge.net
Fri May 30 11:47:04 CEST 2003


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

Modified Files:
	akos.cpp akos.h gfx.cpp scumm.h 
Log Message:
cleanup

Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- akos.cpp	30 May 2003 15:39:04 -0000	1.70
+++ akos.cpp	30 May 2003 17:52:15 -0000	1.71
@@ -820,25 +820,6 @@
 	akos16.dataptr = src + 4;
 }
 
-void AkosRenderer::akos16PutOnScreen(byte *dst, const byte *src, byte transparency, int32 count) {
-	if (count <= 0)
-		return;
-
-	switch(_shadow_mode) {
-	case 0:
-		_vm->bompApplyShadow0(src, dst, count, transparency);
-		break;
-	case 1:
-		_vm->bompApplyShadow1(src, dst, count, transparency);
-		break;
-	case 3:
-		_vm->bompApplyShadow3(src, dst, count, transparency);
-		break;
-	default:
-		error("Unknown shadowMode %d", _shadow_mode);
-	}
-}
-
 #define AKOS16_FILL_BITS()                                        \
         if (akos16.numbits <= 8) {                                \
           akos16.bits |= (*akos16.dataptr++) << akos16.numbits;   \
@@ -934,16 +915,16 @@
 		akos16SkipData(numskip_before);
 	}
 
-	while (t_height != 0) {
+	assert(t_height > 0);
+	assert(t_width > 0);
+	while (t_height--) {
 		akos16DecodeLine(tmp_buf, t_width, dir);
-		akos16PutOnScreen(dest, akos16.buffer, transparency, t_width);
+		_vm->bompApplyShadow(_shadow_mode, akos16.buffer, dest, t_width, transparency);
 
 		if (numskip_after != 0)	{
 			akos16SkipData(numskip_after);
 		}
 		dest += pitch;
-
-		t_height--;
 	}
 }
 
@@ -964,18 +945,18 @@
 
 	maskpitch = _numStrips;
 
-	while (t_height != 0) {
+	assert(t_height > 0);
+	assert(t_width > 0);
+	while (t_height--) {
 		akos16DecodeLine(tmp_buf, t_width, dir);
 		akos16ApplyMask(akos16.buffer, maskptr, (byte)bitpos_start, t_width, transparency);
-		akos16PutOnScreen(dest, akos16.buffer, transparency, t_width);
+		_vm->bompApplyShadow(_shadow_mode, akos16.buffer, dest, t_width, transparency);
 
 		if (numskip_after != 0)	{
 			akos16SkipData(numskip_after);
 		}
 		dest += pitch;
 		maskptr += maskpitch;
-
-		t_height--;
 	}
 }
 

Index: akos.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- akos.h	29 May 2003 11:07:54 -0000	1.20
+++ akos.h	30 May 2003 17:52:16 -0000	1.21
@@ -74,14 +74,13 @@
 protected:
 	byte drawLimb(const CostumeData &cost, int limb);
 
-	byte codec1(int _xmoveCur, int _ymoveCur);
+	byte codec1(int xmoveCur, int ymoveCur);
 	void codec1_genericDecode();
 
-	byte codec5(int _xmoveCur, int _ymoveCur);
+	byte codec5(int xmoveCur, int ymoveCur);
 
-	byte codec16(int _xmoveCur, int _ymoveCur);
+	byte codec16(int xmoveCur, int ymoveCur);
 	void akos16SetupBitReader(const byte *src);
-	void akos16PutOnScreen(byte *dest, const byte *src, byte transparency, int32 count);
 	void akos16SkipData(int32 numskip);
 	void akos16DecodeLine(byte *buf, int32 numbytes, int32 dir);
 	void akos16ApplyMask(byte *dest, byte *maskptr, byte bits, int32 count, byte fillwith);

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.128
retrieving revision 2.129
diff -u -d -r2.128 -r2.129
--- gfx.cpp	30 May 2003 15:39:06 -0000	2.128
+++ gfx.cpp	30 May 2003 17:52:16 -0000	2.129
@@ -3173,6 +3173,12 @@
 	_cursor.height = height;
 	_cursor.animate = 0;
 
+	// Skip the header
+	if (_features & GF_AFTER_V8) {
+		im += 16;
+	} else {
+		im += 18;
+	}
 	decompressBomp(_grabbedCursor, im, width, height);
 
 	updateCursor();
@@ -3254,24 +3260,25 @@
 	if (size <= 0)
 		return t_size;
 	
-	int32 len = size;
+	int len, num;
+	byte code, color;
+
+	len = size;
 	src += 2;
 	while (len) {
-		byte code = *src++;
-		int32 num = (code >> 1) + 1;
+		code = *src++;
+		num = (code >> 1) + 1;
 		if (num > len)
 			num = len;
 		len -= num;
 		if (code & 1) {
-			byte color = *src++;
-			do
-				*line_buffer++ = color;
-			while (--num);
+			color = *src++;
+			memset(line_buffer, color, num);
 		} else {
-			do
-				*line_buffer++ = *src++;
-			while (--num);
+			memcpy(line_buffer, src, num);
+			src += num;
 		}
+		line_buffer += num;
 	}
 	return t_size;
 }
@@ -3282,23 +3289,24 @@
 	if (size <= 0)
 		return t_size;
 	
-	int32 len = size;
+	int len, num;
+	byte code, color;
+
+	len = size;
 	src += 2;
 	while (len) {
-		byte code = *src++;
-		int32 num = (code >> 1) + 1;
+		code = *src++;
+		num = (code >> 1) + 1;
 		if (num > len)
 			num = len;
 		len -= num;
+		line_buffer -= num;
 		if (code & 1) {
-			byte color = *src++;
-			do
-				*--line_buffer = color;
-			while (--num);
+			color = *src++;
+			memset(line_buffer, color, num);
 		} else {
-			do
-				*--line_buffer = *src++;
-			while (--num);
+			memcpy(line_buffer, src, num);
+			src += num;
 		}
 	}
 	return t_size;
@@ -3320,7 +3328,23 @@
 	}
 }
 
-void Scumm::bompApplyShadow0(const byte *line_buffer, byte *dst, int32 size, byte transparency) {
+void Scumm::bompApplyShadow(int shadowMode, const byte *line_buffer, byte *dst, int32 size, byte transparency) const {
+	assert(size > 0);
+	switch(shadowMode) {
+	case 0:
+		bompApplyShadow0(line_buffer, dst, size, transparency);
+		break;
+	case 1:
+		bompApplyShadow1(line_buffer, dst, size, transparency);
+		break;
+	case 3:
+		bompApplyShadow3(line_buffer, dst, size, transparency);
+		break;
+	default:
+		error("Unknown shadow mode %d", shadowMode);
+	}
+}
+void Scumm::bompApplyShadow0(const byte *line_buffer, byte *dst, int32 size, byte transparency) const {
 	while(size-- > 0) {
 		byte tmp = *line_buffer++;
 		if (tmp != transparency) {
@@ -3330,7 +3354,7 @@
 	}
 }
 
-void Scumm::bompApplyShadow1(const byte *line_buffer, byte *dst, int32 size, byte transparency) {
+void Scumm::bompApplyShadow1(const byte *line_buffer, byte *dst, int32 size, byte transparency) const {
 	while(size-- > 0) {
 		byte tmp = *line_buffer++;
 		if (tmp != transparency) {
@@ -3343,7 +3367,7 @@
 	}
 }
 
-void Scumm::bompApplyShadow3(const byte *line_buffer, byte *dst, int32 size, byte transparency) {
+void Scumm::bompApplyShadow3(const byte *line_buffer, byte *dst, int32 size, byte transparency) const {
 	while(size-- > 0) {
 		byte tmp = *line_buffer++;
 		if (tmp != transparency) {
@@ -3356,7 +3380,7 @@
 	}
 }
 
-void Scumm::bompApplyActorPalette(byte *line_buffer, int32 size) {
+void Scumm::bompApplyActorPalette(byte *line_buffer, int32 size) const {
 	if (_bompActorPalettePtr != 0) {
 		*(_bompActorPalettePtr + 255) = 255;
 		while(1) {
@@ -3391,13 +3415,6 @@
 	int len, num;
 	byte code, color;
 
-	// Skip the header
-	if (_features & GF_AFTER_V8) {
-		src += 16;
-	} else {
-		src += 18;
-	}
-
 	do {
 		len = w;
 		src += 2;
@@ -3532,20 +3549,7 @@
 	
 			bompApplyMask(line_ptr, charset_mask, bits, clip_right);
 			bompApplyActorPalette(line_ptr, clip_right);
-	
-			switch(bd.shadowMode) {
-			case 0:
-				bompApplyShadow0(line_ptr, dst, clip_right);
-				break;
-			case 1:
-				bompApplyShadow1(line_ptr, dst, clip_right);
-				break;
-			case 3:
-				bompApplyShadow3(line_ptr, dst, clip_right);
-				break;
-			default:
-				error("Unknown bomp shadowMode %d", bd.shadowMode);
-			}
+			bompApplyShadow(bd.shadowMode, line_ptr, dst, clip_right, 255);
 		}
 
 		mask_out += mask_pitch;

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.225
retrieving revision 1.226
diff -u -d -r1.225 -r1.226
--- scumm.h	30 May 2003 15:39:06 -0000	1.225
+++ scumm.h	30 May 2003 17:52:17 -0000	1.226
@@ -902,19 +902,20 @@
 
 	void drawBomp(const BompDrawData &bd, int decode_mode, int mask);
 protected:
-	void decompressBomp(byte *dst, const byte *src, int w, int h);
-	int32 setupBompScale(byte *scaling, int32 size, byte scale);
-	void bompScaleFuncX(byte *line_buffer, byte *scaling_x_ptr, byte skip, int32 size);
-	int32 bompDecodeLineMode0(const byte *src, byte *line_buffer, int32 size);
-	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);
+	static void decompressBomp(byte *dst, const byte *src, int w, int h);
+	static int32 setupBompScale(byte *scaling, int32 size, byte scale);
+	static void bompScaleFuncX(byte *line_buffer, byte *scaling_x_ptr, byte skip, int32 size);
+	static int32 bompDecodeLineMode0(const byte *src, byte *line_buffer, int32 size);
+	static int32 bompDecodeLineMode1(const byte *src, byte *line_buffer, int32 size);
+	static int32 bompDecodeLineMode3(const byte *src, byte *line_buffer, int32 size);
+	static void bompApplyMask(byte *line_buffer, byte *mask_out, byte bits, 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);
+	void bompApplyShadow(int shadowMode, const byte *line_buffer, byte *dst, int32 size, byte transparency) const;
 protected:
-	void bompApplyActorPalette(byte *line_buffer, int32 size);
+	void bompApplyShadow0(const byte *line_buffer, byte *dst, int32 size, byte transparency) const;
+	void bompApplyShadow1(const byte *line_buffer, byte *dst, int32 size, byte transparency) const;
+	void bompApplyShadow3(const byte *line_buffer, byte *dst, int32 size, byte transparency) const;
+	void bompApplyActorPalette(byte *line_buffer, int32 size) const;
 
 	bool _shakeEnabled;
 	uint _shakeFrame;





More information about the Scummvm-git-logs mailing list