[Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.68,1.69 gfx.cpp,2.126,2.127 gfx.h,1.34,1.35 object.cpp,1.109,1.110 scumm.h,1.223,1.224 scummvm.cpp,2.190,2.191

Max Horn fingolfin at users.sourceforge.net
Fri May 30 08:07:14 CEST 2003


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

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

Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- akos.cpp	30 May 2003 02:01:44 -0000	1.68
+++ akos.cpp	30 May 2003 15:06:26 -0000	1.69
@@ -781,8 +781,10 @@
 	bdd.scale_y = 255;
 	bdd.shadowMode = _shadow_mode;
 
-	_vm->_bompScallingXPtr = NULL;
-	_vm->_bompScallingYPtr = NULL;
+	bdd.scalingXPtr = NULL;
+	bdd.scalingYPtr = NULL;
+	bdd.scaleRight = 0;
+	bdd.scaleBottom = 0;
 
 	int decode_mode;
 
@@ -797,10 +799,10 @@
 	bdd.y = _actorY + ymoveCur;
 
 	if (_zbuf != 0) {
-		_vm->_bompMaskPtr = _vm->getResourceAddress(rtBuffer, 9) + _vm->gdi._imgBufOffs[_zbuf];
-		_vm->drawBomp(&bdd, decode_mode, 1);
+		bdd.maskPtr = _vm->getResourceAddress(rtBuffer, 9) + _vm->gdi._imgBufOffs[_zbuf];
+		_vm->drawBomp(bdd, decode_mode, 1);
 	} else {
-		_vm->drawBomp(&bdd, decode_mode, 0);
+		_vm->drawBomp(bdd, decode_mode, 0);
 	}
 
 	_vm->_bompActorPalettePtr = NULL;

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.126
retrieving revision 2.127
diff -u -d -r2.126 -r2.127
--- gfx.cpp	30 May 2003 02:01:45 -0000	2.126
+++ gfx.cpp	30 May 2003 15:06:27 -0000	2.127
@@ -3245,9 +3245,7 @@
 	if (size <= 0)
 		return size;
 
-	for (int32 l = 0; l < size; l++) {
-		*(line_buffer++) = *(src++);
-	}
+	memcpy(line_buffer, src, size);
 	return size;
 }
 
@@ -3376,11 +3374,11 @@
 	}
 }
 
-void Scumm::bompScaleFuncX(byte *line_buffer, byte *scalling_x_ptr, byte skip, int32 size) {
+void Scumm::bompScaleFuncX(byte *line_buffer, byte *scaling_x_ptr, byte skip, int32 size) {
 	byte * line_ptr1 = line_buffer;
 	byte * line_ptr2 = line_buffer;
 
-	byte tmp = *(scalling_x_ptr++);
+	byte tmp = *(scaling_x_ptr++);
 
 	while (size--) {
 		if ((skip & tmp) == 0) {
@@ -3390,7 +3388,7 @@
 		skip >>= 1;
 		if (skip == 0) {
 			skip = 128;
-			tmp = *(scalling_x_ptr++);
+			tmp = *(scaling_x_ptr++);
 		}
 	}
 }
@@ -3427,7 +3425,7 @@
 	} while (--h);
 }
 
-void Scumm::drawBomp(BompDrawData *bd, int decode_mode, int mask) {
+void Scumm::drawBomp(const BompDrawData &bd, int decode_mode, int mask) {
 	byte skip_y = 128;
 	byte skip_y_new = 0;
 	byte bits;
@@ -3435,55 +3433,56 @@
 	byte *charset_mask;
 	byte tmp;
 	int32 clip_left, clip_right, clip_top, clip_bottom, tmp_x, tmp_y, mask_offset, mask_pitch;
+	byte *scalingYPtr = bd.scalingYPtr;
 
-	if (bd->x < 0) {
-		clip_left = -bd->x;
+	if (bd.x < 0) {
+		clip_left = -bd.x;
 	} else {
 		clip_left = 0;
 	}
 
-	if (bd->y < 0) {
-		clip_top = -bd->y;
+	if (bd.y < 0) {
+		clip_top = -bd.y;
 	} else {
 		clip_top = 0;
 	}
 
-	clip_right = bd->srcwidth - clip_left;
-	tmp_x = bd->x + bd->srcwidth;
-	if (tmp_x > bd->outwidth) {
-		clip_right -= tmp_x - bd->outwidth;
+	clip_right = bd.srcwidth - clip_left;
+	tmp_x = bd.x + bd.srcwidth;
+	if (tmp_x > bd.outwidth) {
+		clip_right -= tmp_x - bd.outwidth;
 	}
 
-	clip_bottom = bd->srcheight;
-	tmp_y = bd->y + bd->srcheight;
-	if (tmp_y > bd->outheight) {
-		clip_bottom -= tmp_y - bd->outheight;
+	clip_bottom = bd.srcheight;
+	tmp_y = bd.y + bd.srcheight;
+	if (tmp_y > bd.outheight) {
+		clip_bottom -= tmp_y - bd.outheight;
 	}
 
-	const byte *src = bd->dataptr;
-	byte *dst = bd->out + bd->y * bd->outwidth + bd->x + clip_left;
+	const byte *src = bd.dataptr;
+	byte *dst = bd.out + bd.y * bd.outwidth + bd.x + clip_left;
 
 	mask_pitch = _screenWidth / 8;
-	mask_offset = _screenStartStrip + (bd->y * mask_pitch) + ((bd->x + clip_left) >> 3);
+	mask_offset = _screenStartStrip + (bd.y * mask_pitch) + ((bd.x + clip_left) >> 3);
 
 	charset_mask = getResourceAddress(rtBuffer, 9) + mask_offset;
-	bits = 128 >> ((bd->x + clip_left) & 7);
+	bits = 128 >> ((bd.x + clip_left) & 7);
 
 	if (mask == 1) {
-		mask_out = _bompMaskPtr + mask_offset;
+		mask_out = bd.maskPtr + mask_offset;
 	}
 
 	if (mask == 3) {
-		if (_bompScallingYPtr != NULL) {
-			skip_y_new = *(_bompScallingYPtr++);
+		if (scalingYPtr != NULL) {
+			skip_y_new = *(scalingYPtr++);
 		}
 
-		if ((clip_right + clip_left) > _bompScaleRight) {
-			clip_right = _bompScaleRight - clip_left;
+		if ((clip_right + clip_left) > bd.scaleRight) {
+			clip_right = bd.scaleRight - clip_left;
 		}
 
-		if (clip_bottom > _bompScaleBottom) {
-			clip_bottom = _bompScaleBottom;
+		if (clip_bottom > bd.scaleBottom) {
+			clip_bottom = bd.scaleBottom;
 		}
 	}
 
@@ -3499,33 +3498,33 @@
 	while(1) {
 		switch(decode_mode) {
 		case 0:
-			src += bompDecodeLineMode0(src, line_buffer, bd->srcwidth);
+			src += bompDecodeLineMode0(src, line_buffer, bd.srcwidth);
 			break;
 		case 1:
-			src += bompDecodeLineMode1(src, line_buffer, bd->srcwidth);
+			src += bompDecodeLineMode1(src, line_buffer, bd.srcwidth);
 			break;
 		case 3:
-			src += bompDecodeLineMode3(src, line_buffer, bd->srcwidth);
+			src += bompDecodeLineMode3(src, line_buffer, bd.srcwidth);
 			break;
 		default:
 			error("Unknown bomp decode_mode %d", decode_mode);
 		}
 
 		if (mask == 3) {
-			if (bd->scale_y != 255) {
+			if (bd.scale_y != 255) {
 				tmp = skip_y_new & skip_y;
 				skip_y >>= 1;
 				if (skip_y == 0) {
 					skip_y = 128;
-					skip_y_new = *(_bompScallingYPtr++);
+					skip_y_new = *(scalingYPtr++);
 				}
 
 				if (tmp != 0) 
 					continue;
 			}
 
-			if (bd->scale_x != 255) {
-				bompScaleFuncX(line_buffer, _bompScallingXPtr, 128, bd->srcwidth);
+			if (bd.scale_x != 255) {
+				bompScaleFuncX(line_buffer, bd.scalingXPtr, 128, bd.srcwidth);
 			}
 		}
 
@@ -3540,7 +3539,7 @@
 			bompApplyMask(line_ptr, charset_mask, bits, clip_right);
 			bompApplyActorPalette(line_ptr, clip_right);
 	
-			switch(bd->shadowMode) {
+			switch(bd.shadowMode) {
 			case 0:
 				bompApplyShadow0(line_ptr, dst, clip_right);
 				break;
@@ -3551,14 +3550,14 @@
 				bompApplyShadow3(line_ptr, dst, clip_right);
 				break;
 			default:
-				error("Unknown bomp shadowMode %d", bd->shadowMode);
+				error("Unknown bomp shadowMode %d", bd.shadowMode);
 			}
 		}
 
 		mask_out += mask_pitch;
 		charset_mask += mask_pitch;
 		pos_y++;
-		dst += bd->outwidth;
+		dst += bd.outwidth;
 		if (pos_y >= clip_bottom)
 			break;
 	}

Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- gfx.h	29 May 2003 12:55:27 -0000	1.34
+++ gfx.h	30 May 2003 15:06:28 -0000	1.35
@@ -55,12 +55,6 @@
 	byte *backBuf;
 };
 
-struct MouseCursor {	/* Mouse cursor */
-	int8 hotspot_x, hotspot_y;
-	byte colors[4];
-	byte data[32];
-};
-
 struct ColorCycle {		/* Palette cycles */
 	uint16 delay;
 	uint16 counter;
@@ -78,27 +72,6 @@
 	uint16 mode;
 };
 
-#if !defined(__GNUC__)
-	#pragma START_PACK_STRUCTS
-#endif
-
-struct BompHeader {			/* Bomp header */
-	union {
-		struct {
-			uint16 unk;
-			uint16 width, height;
-		} GCC_PACK old;
-
-		struct {
-			uint32 width, height;
-		} GCC_PACK v8;
-	} GCC_PACK;
-} GCC_PACK;
-
-#if !defined(__GNUC__)
-	#pragma END_PACK_STRUCTS
-#endif
-
 struct BompDrawData {		/* Bomp graphics data */
 	byte *out;
 	int outwidth, outheight;
@@ -107,6 +80,12 @@
 	const byte *dataptr;
 	int srcwidth, srcheight;
 	uint16 shadowMode;
+
+	int32 scaleRight, scaleBottom;
+	byte *scalingXPtr, *scalingYPtr;
+	byte *maskPtr;
+	
+	BompDrawData() { memset(this, 0, sizeof(*this)); }
 };
 
 class Gdi {

Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- object.cpp	30 May 2003 00:40:58 -0000	1.109
+++ object.cpp	30 May 2003 15:06:28 -0000	1.110
@@ -27,6 +27,28 @@
 #include "resource.h"
 #include "usage_bits.h"
 
+#if !defined(__GNUC__)
+	#pragma START_PACK_STRUCTS
+#endif
+
+struct BompHeader {			/* Bomp header */
+	union {
+		struct {
+			uint16 unk;
+			uint16 width, height;
+		} GCC_PACK old;
+
+		struct {
+			uint32 width, height;
+		} GCC_PACK v8;
+	} GCC_PACK;
+} GCC_PACK;
+
+#if !defined(__GNUC__)
+	#pragma END_PACK_STRUCTS
+#endif
+
+
 bool Scumm::getClass(int obj, int cls)
 {
 	checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getClass");
@@ -1518,25 +1540,20 @@
 	bdd.scale_x = (byte)eo->scaleX;
 	bdd.scale_y = (byte)eo->scaleY;
 
-	byte bomp_scalling_x[64], bomp_scalling_y[64];
 
 	if ((bdd.scale_x != 255) || (bdd.scale_y != 255)) {
-		_bompScallingXPtr = bomp_scalling_x;
-		_bompScallingYPtr = bomp_scalling_y;
-		_bompScaleRight = setupBompScale(_bompScallingXPtr, bdd.srcwidth, bdd.scale_x);
-		_bompScaleBottom = setupBompScale(_bompScallingYPtr, bdd.srcheight, bdd.scale_y);
+		byte bomp_scaling_x[64], bomp_scaling_y[64];
+		bdd.scalingXPtr = bomp_scaling_x;
+		bdd.scalingYPtr = bomp_scaling_y;
+		bdd.scaleRight = setupBompScale(bomp_scaling_x, bdd.srcwidth, bdd.scale_x);
+		bdd.scaleBottom = setupBompScale(bomp_scaling_y, bdd.srcheight, bdd.scale_y);
 		bdd.shadowMode = 0;
-		drawBomp(&bdd, 1, 3);
-	}	else {
+		drawBomp(bdd, 1, 3);
+	} else {
 		bdd.shadowMode = eo->mode;
-		drawBomp(&bdd, 1, 0);
+		drawBomp(bdd, 1, 0);
 	}
 
-	_bompScallingXPtr = NULL;
-	_bompScallingYPtr = NULL;
-	_bompScaleRight = 0;
-	_bompScaleBottom = 0;
-
 	updateDirtyRect(vs->number, bdd.x, bdd.x + bdd.srcwidth, bdd.y, bdd.y + bdd.srcheight, 0);
 }
 
@@ -1627,12 +1644,12 @@
 	4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0,
 };
 
-int32 Scumm::setupBompScale(byte * scalling, int32 size, byte scale) {
+int32 Scumm::setupBompScale(byte * scaling, int32 size, byte scale) {
 	uint32 tmp = (256 - (size >> 1));
 	int32 count = (size + 7) >> 3;
 	assert(tmp < sizeof(_bompScaleTable));
 	byte * tmp_ptr = _bompScaleTable + tmp;
-	byte * tmp_scalling = scalling;
+	byte * tmp_scaling = scaling;
 	byte a = 0;
 
 	while((count--) != 0) {
@@ -1680,16 +1697,16 @@
 		}
 		tmp_ptr += 4;
 
-		*(tmp_scalling++) = a;
+		*(tmp_scaling++) = a;
 	}
 	if ((size & 7) != 0) {
-		*(tmp_scalling - 1) |= revBitMask[size & 7];
+		*(tmp_scaling - 1) |= revBitMask[size & 7];
 	}
 
 	count = (size + 7) >> 3;
 	byte ret_value = 0;
 	while(count--) {
-		tmp = *scalling++;
+		tmp = *scaling++;
 		assert(tmp < sizeof(_bompBitsTable));
 		ret_value += _bompBitsTable[tmp];
 	}

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.223
retrieving revision 1.224
diff -u -d -r1.223 -r1.224
--- scumm.h	30 May 2003 14:29:06 -0000	1.223
+++ scumm.h	30 May 2003 15:06:28 -0000	1.224
@@ -897,18 +897,14 @@
 	void blit(byte *dst, const byte *src, int w, int h);
 
 	// bomp
-protected:
-	int32 _bompScaleRight, _bompScaleBottom;
 public:
-	byte *_bompScallingXPtr, *_bompScallingYPtr;
-	byte *_bompMaskPtr;
 	byte *_bompActorPalettePtr;
 
-	void drawBomp(BompDrawData *bd, int decode_mode, int mask);
+	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 *scalling, int32 size, byte scale);
-	void bompScaleFuncX(byte *line_buffer, byte *scalling_x_ptr, byte skip, int32 size);
+	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);

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.190
retrieving revision 2.191
diff -u -d -r2.190 -r2.191
--- scummvm.cpp	30 May 2003 14:29:07 -0000	2.190
+++ scummvm.cpp	30 May 2003 15:06:29 -0000	2.191
@@ -334,11 +334,6 @@
 	_switchRoomEffect = 0;
 	_doEffect = false;
 	memset(&_flashlight,0,sizeof(_flashlight));
-	_bompScaleRight = 0;
-	_bompScaleBottom = 0;
-	_bompScallingXPtr = NULL;
-	_bompScallingYPtr = NULL;
-	_bompMaskPtr = NULL;
 	_bompActorPalettePtr = NULL;
 	_shakeEnabled= false;
 	_shakeFrame = 0;





More information about the Scummvm-git-logs mailing list