[Scummvm-cvs-logs] SF.net SVN: scummvm: [26045] scummvm/trunk/engines/scumm

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Mar 10 01:34:21 CET 2007


Revision: 26045
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26045&view=rev
Author:   fingolfin
Date:     2007-03-09 16:34:20 -0800 (Fri, 09 Mar 2007)

Log Message:
-----------
SCUMM: got rid of the _bompActorPalettePtr member var (which was only used as a hidden param to drawBomp); turned drawBomp into a regular function (used to be a ScummEngine member method)

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/akos.cpp
    scummvm/trunk/engines/scumm/akos.h
    scummvm/trunk/engines/scumm/bomp.cpp
    scummvm/trunk/engines/scumm/bomp.h
    scummvm/trunk/engines/scumm/gfx.h
    scummvm/trunk/engines/scumm/object.cpp
    scummvm/trunk/engines/scumm/scumm.cpp
    scummvm/trunk/engines/scumm/scumm.h

Modified: scummvm/trunk/engines/scumm/akos.cpp
===================================================================
--- scummvm/trunk/engines/scumm/akos.cpp	2007-03-09 23:46:45 UTC (rev 26044)
+++ scummvm/trunk/engines/scumm/akos.cpp	2007-03-10 00:34:20 UTC (rev 26045)
@@ -317,7 +317,7 @@
 		if (color == 255) {
 			palette[0] = color;
 		} else {
-			_vm->_bompActorPalettePtr = palette;
+			useBompPalette = true;
 		}
 	}
 }
@@ -1025,14 +1025,7 @@
 
 	BompDrawData bdd;
 
-	bdd.srcwidth = _width;
-	bdd.srcheight = _height;
 	bdd.dst = _out;
-	bdd.dataptr = _srcptr;
-	bdd.scale_x = 255;
-	bdd.scale_y = 255;
-	bdd.shadowMode = _shadow_mode;
-
 	if (!_mirror) {
 		bdd.x = (_actorX - xmoveCur - _width) + 1;
 	} else {
@@ -1040,10 +1033,23 @@
 	}
 	bdd.y = _actorY + ymoveCur;
 
+	bdd.src = _srcptr;
+	bdd.srcwidth = _width;
+	bdd.srcheight = _height;
+
+	bdd.scale_x = 255;
+	bdd.scale_y = 255;
+
 	bdd.maskPtr = _vm->getMaskBuffer(0, 0, _zbuf);
-	_vm->drawBomp(bdd, !_mirror);
+	bdd.numStrips = _numStrips;
 
-	_vm->_bompActorPalettePtr = NULL;
+	bdd.shadowMode = _shadow_mode;
+	bdd.shadowPalette = _vm->_shadowPalette;
+
+	bdd.actorPalette = useBompPalette ? palette : 0;
+	bdd.mirror = !_mirror;
+
+	drawBomp(bdd);
 	
 	return 0;
 }

Modified: scummvm/trunk/engines/scumm/akos.h
===================================================================
--- scummvm/trunk/engines/scumm/akos.h	2007-03-09 23:46:45 UTC (rev 26044)
+++ scummvm/trunk/engines/scumm/akos.h	2007-03-10 00:34:20 UTC (rev 26045)
@@ -59,6 +59,7 @@
 
 	// actor palette
 	byte palette[256];
+	bool useBompPalette;
 
 	// pointer to various parts of the costume resource
 	const byte *akos;
@@ -84,6 +85,7 @@
 
 public:
 	AkosRenderer(ScummEngine *scumm) : BaseCostumeRenderer(scumm) {
+		useBompPalette = false;
 		akos = 0;
 		akhd = 0;
 		akpl = 0;

Modified: scummvm/trunk/engines/scumm/bomp.cpp
===================================================================
--- scummvm/trunk/engines/scumm/bomp.cpp	2007-03-09 23:46:45 UTC (rev 26044)
+++ scummvm/trunk/engines/scumm/bomp.cpp	2007-03-10 00:34:20 UTC (rev 26045)
@@ -197,7 +197,7 @@
 	}
 }
 
-void ScummEngine::drawBomp(const BompDrawData &bd, bool mirror) {
+void drawBomp(const BompDrawData &bd) {
 	const byte *src;
 	byte *dst;
 	byte *mask = 0;
@@ -231,14 +231,14 @@
 		clip.bottom = bd.dst.h - bd.y;
 	}
 
-	src = bd.dataptr;
+	src = bd.src;
 	dst = (byte *)bd.dst.pixels + bd.y * bd.dst.pitch + (bd.x + clip.left);
 
 	const byte maskbit = revBitMask((bd.x + clip.left) & 7);
 
 	// Mask against any additionally imposed mask
 	if (bd.maskPtr) {
-		mask = bd.maskPtr + (bd.y * _gdi->_numStrips) + ((bd.x + clip.left) / 8);
+		mask = bd.maskPtr + (bd.y * bd.numStrips) + ((bd.x + clip.left) / 8);
 	}
 
 	// Setup vertical scaling
@@ -276,7 +276,7 @@
 	// Loop over all lines
 	while (pos_y < clip.bottom) {
 		// Decode a single (bomp encoded) line, reversed if we are in mirror mode
-		if (mirror)
+		if (bd.mirror)
 			bompDecodeLineReverse(line_buffer, src + 2, bd.srcwidth);
 		else
 			bompDecodeLine(line_buffer, src + 2, bd.srcwidth);
@@ -313,17 +313,17 @@
 				bompApplyMask(line_ptr, mask, maskbit, width, 255);
 
 			// Apply custom color map, if available
-			if (_bompActorPalettePtr)
-				bompApplyActorPalette(_bompActorPalettePtr, line_ptr, width);
+			if (bd.actorPalette)
+				bompApplyActorPalette(bd.actorPalette, line_ptr, width);
 
 			// Finally, draw the decoded, scaled, masked and recolored line onto
 			// the target surface, using the specified shadow mode
-			bompApplyShadow(bd.shadowMode, _shadowPalette, line_ptr, dst, width, 255);
+			bompApplyShadow(bd.shadowMode, bd.shadowPalette, line_ptr, dst, width, 255);
 		}
 
 		// Advance to the next line
 		pos_y++;
-		mask += _gdi->_numStrips;
+		mask += bd.numStrips;
 		dst += bd.dst.pitch;
 	}
 }

Modified: scummvm/trunk/engines/scumm/bomp.h
===================================================================
--- scummvm/trunk/engines/scumm/bomp.h	2007-03-09 23:46:45 UTC (rev 26044)
+++ scummvm/trunk/engines/scumm/bomp.h	2007-03-10 00:34:20 UTC (rev 26045)
@@ -24,6 +24,7 @@
 #define SCUMM_BOMP_H
 
 #include "common/scummsys.h"
+#include "graphics/surface.h"
 
 namespace Scumm {
 
@@ -34,6 +35,30 @@
 void bompDecodeLine(byte *dst, const byte *src, int size);
 void bompDecodeLineReverse(byte *dst, const byte *src, int size);
 
+
+/** Bomp graphics data */
+struct BompDrawData {
+	Graphics::Surface dst;
+	int x, y;
+
+	const byte *src;
+	int srcwidth, srcheight;
+
+	byte scale_x, scale_y;
+
+	byte *maskPtr;
+	int numStrips;
+
+	uint16 shadowMode;
+	byte *shadowPalette;
+
+	byte *actorPalette;
+
+	bool mirror;
+};
+
+void drawBomp(const BompDrawData &bd);
+
 } // End of namespace Scumm
 
 #endif

Modified: scummvm/trunk/engines/scumm/gfx.h
===================================================================
--- scummvm/trunk/engines/scumm/gfx.h	2007-03-09 23:46:45 UTC (rev 26044)
+++ scummvm/trunk/engines/scumm/gfx.h	2007-03-10 00:34:20 UTC (rev 26045)
@@ -170,21 +170,6 @@
 	byte end;
 };
 
-/** Bomp graphics data, used as parameter to ScummEngine::drawBomp. */
-struct BompDrawData {
-	Graphics::Surface dst;
-
-	int x, y;
-	byte scale_x, scale_y;
-	const byte *dataptr;
-	int srcwidth, srcheight;
-	uint16 shadowMode;
-
-	byte *maskPtr;
-
-	BompDrawData() { memset(this, 0, sizeof(*this)); }
-};
-
 struct StripTable;
 
 #define CHARSET_MASK_TRANSPARENCY	253

Modified: scummvm/trunk/engines/scumm/object.cpp
===================================================================
--- scummvm/trunk/engines/scumm/object.cpp	2007-03-09 23:46:45 UTC (rev 26044)
+++ scummvm/trunk/engines/scumm/object.cpp	2007-03-10 00:34:20 UTC (rev 26045)
@@ -1650,7 +1650,18 @@
 	if (!bomp)
 		error("object %d is not a blast object", eo->number);
 
+	bdd.dst = *vs;
+	bdd.dst.pixels = vs->getPixels(0, 0);
+	bdd.x = eo->rect.left;
+	bdd.y = eo->rect.top;
+
+	// Skip the bomp header
 	if (_game.version == 8) {
+		bdd.src = bomp + 8;
+	} else {
+		bdd.src = bomp + 10;
+	}
+	if (_game.version == 8) {
 		bdd.srcwidth = READ_LE_UINT32(bomp);
 		bdd.srcheight = READ_LE_UINT32(bomp+4);
 	} else {
@@ -1658,27 +1669,24 @@
 		bdd.srcheight = READ_LE_UINT16(bomp+4);
 	}
 
-	bdd.dst = *vs;
-	bdd.dst.pixels = vs->getPixels(0, 0);
-	// Skip the bomp header
-	if (_game.version == 8) {
-		bdd.dataptr = bomp + 8;
-	} else {
-		bdd.dataptr = bomp + 10;
-	}
-	bdd.x = eo->rect.left;
-	bdd.y = eo->rect.top;
 	bdd.scale_x = (byte)eo->scaleX;
 	bdd.scale_y = (byte)eo->scaleY;
+
 	bdd.maskPtr = NULL;
+	bdd.numStrips = _gdi->_numStrips;
 
 	if ((bdd.scale_x != 255) || (bdd.scale_y != 255)) {
 		bdd.shadowMode = 0;
 	} else {
 		bdd.shadowMode = eo->mode;
 	}
-	drawBomp(bdd, false);
+	bdd.shadowPalette = _shadowPalette;
 
+	bdd.actorPalette = 0;
+	bdd.mirror = false;
+
+	drawBomp(bdd);
+
 	markRectAsDirty(vs->number, bdd.x, bdd.x + bdd.srcwidth, bdd.y, bdd.y + bdd.srcheight);
 }
 

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2007-03-09 23:46:45 UTC (rev 26044)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2007-03-10 00:34:20 UTC (rev 26045)
@@ -250,7 +250,6 @@
 
 	_doEffect = false;
 	_currentLights = 0;
-	_bompActorPalettePtr = NULL;
 	_shakeEnabled = false;
 	_shakeFrame = 0;
 	_screenStartStrip = 0;

Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h	2007-03-09 23:46:45 UTC (rev 26044)
+++ scummvm/trunk/engines/scumm/scumm.h	2007-03-10 00:34:20 UTC (rev 26045)
@@ -1040,11 +1040,6 @@
 	void dissolveEffect(int width, int height);
 	void scrollEffect(int dir);
 
-	// bomp
-public:
-	byte *_bompActorPalettePtr;
-	void drawBomp(const BompDrawData &bd, bool mirror);
-
 protected:
 	bool _shakeEnabled;
 	uint _shakeFrame;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list