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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Sep 19 00:06:46 CEST 2006


Revision: 23937
          http://svn.sourceforge.net/scummvm/?rev=23937&view=rev
Author:   fingolfin
Date:     2006-09-18 15:06:39 -0700 (Mon, 18 Sep 2006)

Log Message:
-----------
Moved some more code from class Gdi into new subclasses GdiV1 and GdiV2

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

Modified: scummvm/trunk/engines/scumm/gfx.cpp
===================================================================
--- scummvm/trunk/engines/scumm/gfx.cpp	2006-09-18 21:46:44 UTC (rev 23936)
+++ scummvm/trunk/engines/scumm/gfx.cpp	2006-09-18 22:06:39 UTC (rev 23937)
@@ -207,15 +207,24 @@
 	_vertStripNextInc = 0;
 	_zbufferDisabled = false;
 	_objectMode = false;
-	memset(&_C64, 0, sizeof(_C64));
-	_roomStrips = 0;
 }
 
+Gdi::~Gdi() {
+}
+
 GdiNES::GdiNES(ScummEngine *vm) : Gdi(vm) {
 	memset(&_NES, 0, sizeof(_NES));
 }
 
-Gdi::~Gdi() {
+GdiV1::GdiV1(ScummEngine *vm) : Gdi(vm) {
+	memset(&_C64, 0, sizeof(_C64));
+}
+
+GdiV2::GdiV2(ScummEngine *vm) : Gdi(vm) {
+	_roomStrips = 0;
+}
+
+GdiV2::~GdiV2() {
 	free(_roomStrips);
 }
 
@@ -240,20 +249,6 @@
 }
 
 void Gdi::roomChanged(byte *roomptr, uint32 IM00_offs, byte transparentColor) {
-	if (_vm->_game.version <= 1) {
-		for (int i = 0; i < 4; i++){
-			_C64.colors[i] = roomptr[6 + i];
-		}
-		decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 10), _C64.charMap, 2048);
-		decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 12), _C64.picMap, roomptr[4] * roomptr[5]);
-		decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 14), _C64.colorMap, roomptr[4] * roomptr[5]);
-		decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 16), _C64.maskMap, roomptr[4] * roomptr[5]);
-		decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 18) + 2, _C64.maskChar, READ_LE_UINT16(roomptr + READ_LE_UINT16(roomptr + 18)));
-		_objectMode = true;
-	} else if (_vm->_game.version == 2) {
-		_roomStrips = generateStripTable(roomptr + IM00_offs, _vm->_roomWidth, _vm->_roomHeight, _roomStrips);
-	}
-	
 	_transparentColor = transparentColor;
 }
 
@@ -262,6 +257,26 @@
 	_transparentColor = transparentColor;
 }
 
+void GdiV1::roomChanged(byte *roomptr, uint32 IM00_offs, byte transparentColor) {
+	for (int i = 0; i < 4; i++){
+		_C64.colors[i] = roomptr[6 + i];
+	}
+	decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 10), _C64.charMap, 2048);
+	decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 12), _C64.picMap, roomptr[4] * roomptr[5]);
+	decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 14), _C64.colorMap, roomptr[4] * roomptr[5]);
+	decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 16), _C64.maskMap, roomptr[4] * roomptr[5]);
+	decodeC64Gfx(roomptr + READ_LE_UINT16(roomptr + 18) + 2, _C64.maskChar, READ_LE_UINT16(roomptr + READ_LE_UINT16(roomptr + 18)));
+	_objectMode = true;
+
+	_transparentColor = transparentColor;
+}
+
+void GdiV2::roomChanged(byte *roomptr, uint32 IM00_offs, byte transparentColor) {
+	_roomStrips = generateStripTable(roomptr + IM00_offs, _vm->_roomWidth, _vm->_roomHeight, _roomStrips);
+
+	_transparentColor = transparentColor;
+}
+
 #pragma mark -
 #pragma mark --- Virtual Screens ---
 #pragma mark -
@@ -1259,7 +1274,38 @@
 #pragma mark -
 
 
-void Gdi::drawBitmapV2Helper(const byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height, int stripnr, int numstrip) {
+void Gdi::prepareDrawBitmap(const byte *ptr, VirtScreen *vs,
+					const int x, const int y, const int width, const int height,
+	                int stripnr, int numstrip) {
+}
+
+void GdiV1::prepareDrawBitmap(const byte *ptr, VirtScreen *vs,
+					const int x, const int y, const int width, const int height,
+	                int stripnr, int numstrip) {
+	if (_objectMode) {
+		decodeC64Gfx(ptr, _C64.objectMap, (width / 8) * (height / 8) * 3);
+	}
+}
+
+void GdiNES::prepareDrawBitmap(const byte *ptr, VirtScreen *vs,
+					const int x, const int y, const int width, const int height,
+	                int stripnr, int numstrip) {
+	if (_objectMode) {
+		decodeNESObject(ptr, x, y, width, height);
+	}
+}
+
+
+void GdiV2::prepareDrawBitmap(const byte *ptr, VirtScreen *vs,
+					const int x, const int y, const int width, const int height,
+	                int stripnr, int numstrip) {
+	//
+	// Since V3, all graphics data was encoded in strips, which is very efficient
+	// for redrawing only parts of the screen. However, V2 is different: here
+	// the whole graphics are encoded as one big chunk. That makes it rather
+	// dificult to draw only parts of a room/object. We handle the V2 graphics
+	// differently from all other (newer) graphic formats for this reason.
+	//
 	StripTable *table = (_objectMode ? 0 : _roomStrips);
 	const int left = (stripnr * 8);
 	const int right = left + (numstrip * 8);
@@ -1436,19 +1482,6 @@
 	return numzbuf;
 }
 
-void Gdi::prepareDrawBitmap(const byte *ptr, int x, int y, const int width, const int height) {
-	if (_objectMode && _vm->_game.version <= 1) {
-		decodeC64Gfx(ptr, _C64.objectMap, (width / 8) * (height / 8) * 3);
-	}
-}
-
-void GdiNES::prepareDrawBitmap(const byte *ptr, int x, int y, const int width, const int height) {
-	if (_objectMode) {
-		decodeNESObject(ptr, x, y, width, height);
-	}
-}
-
-
 /**
  * Draw a bitmap onto a virtual screen. This is main drawing method for room backgrounds
  * and objects, used throughout all SCUMM versions.
@@ -1457,12 +1490,10 @@
 					int stripnr, int numstrip, byte flag) {
 	assert(ptr);
 	assert(height > 0);
+
 	byte *dstPtr;
 	const byte *smap_ptr;
-
 	const byte *zplane_list[9];
-
-	int bottom;
 	int numzbuf;
 	int sx;
 	bool transpStrip = false;
@@ -1470,21 +1501,17 @@
 	// Check whether lights are turned on or not
 	const bool lightsOn = _vm->isLightOn();
 
-	_objectMode = (flag & dbObjectMode) == dbObjectMode;
-
-	prepareDrawBitmap(ptr, x, y, width, height);
-
 	CHECK_HEAP;
 	if (_vm->_game.features & GF_SMALL_HEADER) {
 		smap_ptr = ptr;
 	} else if (_vm->_game.version == 8) {
 		// Skip to the BSTR->WRAP->OFFS chunk
 		smap_ptr = ptr + 24;
-	} else
+	} else {
 		smap_ptr = _vm->findResource(MKID_BE('SMAP'), ptr);
+		assert(smap_ptr);
+	}
 
-	assert(smap_ptr);
-
 	numzbuf = getZPlanes(ptr, zplane_list, false);
 	
 	const byte *tmsk_ptr = NULL;
@@ -1492,22 +1519,14 @@
 		tmsk_ptr = _vm->findResource(MKID_BE('TMSK'), ptr);
 	}
 
-	bottom = y + height;
-	if (bottom > vs->h) {
-		warning("Gdi::drawBitmap, strip drawn to %d below window bottom %d", bottom, vs->h);
+	if (y + height > vs->h) {
+		warning("Gdi::drawBitmap, strip drawn to %d below window bottom %d", y + height, vs->h);
 	}
 
 	_vertStripNextInc = height * vs->pitch - 1;
 
-	//
-	// Since V3, all graphics data was encoded in strips, which is very efficient
-	// for redrawing only parts of the screen. However, V2 is different: here
-	// the whole graphics are encoded as one big chunk. That makes it rather
-	// dificult to draw only parts of a room/object. We handle the V2 graphics
-	// differently from all other (newer) graphic formats for this reason.
-	//
-	if (_vm->_game.version == 2)
-		drawBitmapV2Helper(ptr, vs, x, y, width, height, stripnr, numstrip);
+	_objectMode = (flag & dbObjectMode) == dbObjectMode;
+	prepareDrawBitmap(ptr, vs, x, y, width, height, stripnr, numstrip);
 
 	sx = x - vs->xstart / 8;
 	if (sx < 0) {
@@ -1517,9 +1536,6 @@
 		sx = 0;
 	}
 
-	//if (_vm->_NESStartStrip > 0)
-	//	stripnr -= _vm->_NESStartStrip;
-
 	// Compute the number of strips we have to iterate over.
 	// TODO/FIXME: The computation of its initial value looks very fishy.
 	// It was added as a kind of hack to fix some corner cases, but it compares
@@ -1536,8 +1552,8 @@
 		if (y < vs->tdirty[sx])
 			vs->tdirty[sx] = y;
 
-		if (bottom > vs->bdirty[sx])
-			vs->bdirty[sx] = bottom;
+		if (y + height > vs->bdirty[sx])
+			vs->bdirty[sx] = y + height;
 
 		// In the case of a double buffered virtual screen, we draw to
 		// the backbuffer, otherwise to the primary surface memory.
@@ -1592,41 +1608,53 @@
 
 bool Gdi::drawStrip(byte *dstPtr, VirtScreen *vs, int x, int y, const int width, const int height,
 					int stripnr, const byte *smap_ptr) {
-	bool transpStrip = false;
-
-	if (_vm->_game.version <= 1) {
-		if (_objectMode)
-			drawStripC64Object(dstPtr, vs->pitch, stripnr, width, height);
-		else
-			drawStripC64Background(dstPtr, vs->pitch, stripnr, height);
-	} else if (_vm->_game.version == 2) {
-		// Do nothing here for V2 games - drawing was already handled.
+	// Do some input verification and make sure the strip/strip offset
+	// are actually valid. Normally, this should never be a problem,
+	// but if e.g. a savegame gets corrupted, we can easily get into
+	// trouble here. See also bug #795214.
+	int offset = -1, smapLen;
+	if (_vm->_game.features & GF_16COLOR) {
+		smapLen = READ_LE_UINT16(smap_ptr);
+		if (stripnr * 2 + 2 < smapLen)
+			offset = READ_LE_UINT16(smap_ptr + stripnr * 2 + 2);
+	} else if (_vm->_game.features & GF_SMALL_HEADER) {
+		smapLen = READ_LE_UINT32(smap_ptr);
+		if (stripnr * 4 + 4 < smapLen)
+			offset = READ_LE_UINT32(smap_ptr + stripnr * 4 + 4);
 	} else {
-		// Do some input verification and make sure the strip/strip offset
-		// are actually valid. Normally, this should never be a problem,
-		// but if e.g. a savegame gets corrupted, we can easily get into
-		// trouble here. See also bug #795214.
-		int offset = -1, smapLen;
-		if (_vm->_game.features & GF_16COLOR) {
-			smapLen = READ_LE_UINT16(smap_ptr);
-			if (stripnr * 2 + 2 < smapLen)
-				offset = READ_LE_UINT16(smap_ptr + stripnr * 2 + 2);
-		} else if (_vm->_game.features & GF_SMALL_HEADER) {
-			smapLen = READ_LE_UINT32(smap_ptr);
-			if (stripnr * 4 + 4 < smapLen)
-				offset = READ_LE_UINT32(smap_ptr + stripnr * 4 + 4);
-		} else {
-			smapLen = READ_BE_UINT32(smap_ptr);
-			if (stripnr * 4 + 8 < smapLen)
-				offset = READ_LE_UINT32(smap_ptr + stripnr * 4 + 8);
-		}
-		assertRange(0, offset, smapLen-1, "screen strip");
-		transpStrip = decompressBitmap(dstPtr, vs->pitch, smap_ptr + offset, height);
+		smapLen = READ_BE_UINT32(smap_ptr);
+		if (stripnr * 4 + 8 < smapLen)
+			offset = READ_LE_UINT32(smap_ptr + stripnr * 4 + 8);
 	}
+	assertRange(0, offset, smapLen-1, "screen strip");
 
-	return transpStrip;
+	return decompressBitmap(dstPtr, vs->pitch, smap_ptr + offset, height);
 }
 
+bool GdiNES::drawStrip(byte *dstPtr, VirtScreen *vs, int x, int y, const int width, const int height,
+					int stripnr, const byte *smap_ptr) {
+	byte *mask_ptr = getMaskBuffer(x, y, 1);
+	drawStripNES(dstPtr, mask_ptr, vs->pitch, stripnr, y, height);
+
+	return false;
+}
+
+bool GdiV1::drawStrip(byte *dstPtr, VirtScreen *vs, int x, int y, const int width, const int height,
+					int stripnr, const byte *smap_ptr) {
+	if (_objectMode)
+		drawStripC64Object(dstPtr, vs->pitch, stripnr, width, height);
+	else
+		drawStripC64Background(dstPtr, vs->pitch, stripnr, height);
+
+	return false;
+}
+
+bool GdiV2::drawStrip(byte *dstPtr, VirtScreen *vs, int x, int y, const int width, const int height,
+					int stripnr, const byte *smap_ptr) {
+	// Do nothing here for V2 games - drawing was already handled.
+	return false;
+}
+
 void Gdi::decodeMask(int x, int y, const int width, const int height,
 	                int stripnr, int numzbuf, const byte *zplane_list[9],
 	                bool transpStrip, byte flag, const byte *tmsk_ptr) {
@@ -1634,12 +1662,7 @@
 	byte *mask_ptr;
 	const byte *z_plane_ptr;
 
-	if (_vm->_game.version <= 1) {
-		mask_ptr = getMaskBuffer(x, y, 1);
-		drawStripC64Mask(mask_ptr, stripnr, width, height);
-	} else if (_vm->_game.version == 2) {
-		// Do nothing here for V2 games - zplane was already handled.
-	} else if (flag & dbDrawMaskOnAll) {
+	if (flag & dbDrawMaskOnAll) {
 		// Sam & Max uses dbDrawMaskOnAll for things like the inventory
 		// box and the speech icons. While these objects only have one
 		// mask, it should be applied to all the Z-planes in the room,
@@ -1708,21 +1731,26 @@
 	}
 }
 
-bool GdiNES::drawStrip(byte *dstPtr, VirtScreen *vs, int x, int y, const int width, const int height,
-					int stripnr, const byte *smap_ptr) {
+void GdiNES::decodeMask(int x, int y, const int width, const int height,
+	                int stripnr, int numzbuf, const byte *zplane_list[9],
+	                bool transpStrip, byte flag, const byte *tmsk_ptr) {
 	byte *mask_ptr = getMaskBuffer(x, y, 1);
-	drawStripNES(dstPtr, mask_ptr, vs->pitch, stripnr, y, height);
-
-	return false;
+	drawStripNESMask(mask_ptr, stripnr, y, height);
 }
 
-void GdiNES::decodeMask(int x, int y, const int width, const int height,
+void GdiV1::decodeMask(int x, int y, const int width, const int height,
 	                int stripnr, int numzbuf, const byte *zplane_list[9],
 	                bool transpStrip, byte flag, const byte *tmsk_ptr) {
 	byte *mask_ptr = getMaskBuffer(x, y, 1);
-	drawStripNESMask(mask_ptr, stripnr, y, height);
+	drawStripC64Mask(mask_ptr, stripnr, width, height);
 }
 
+void GdiV2::decodeMask(int x, int y, const int width, const int height,
+	                int stripnr, int numzbuf, const byte *zplane_list[9],
+	                bool transpStrip, byte flag, const byte *tmsk_ptr) {
+	// Do nothing here for V2 games - zplane was already handled.
+}
+
 #ifndef DISABLE_HE
 /**
  * Draw a bitmap onto a virtual screen. This is main drawing method for room backgrounds
@@ -2412,7 +2440,7 @@
 	}
 }
 
-void Gdi::drawStripC64Background(byte *dst, int dstPitch, int stripnr, int height) {
+void GdiV1::drawStripC64Background(byte *dst, int dstPitch, int stripnr, int height) {
 	int charIdx;
 	height /= 8;
 	for (int y = 0; y < height; y++) {
@@ -2435,7 +2463,7 @@
 	}
 }
 
-void Gdi::drawStripC64Object(byte *dst, int dstPitch, int stripnr, int width, int height) {
+void GdiV1::drawStripC64Object(byte *dst, int dstPitch, int stripnr, int width, int height) {
 	int charIdx;
 	height /= 8;
 	width /= 8;
@@ -2453,7 +2481,7 @@
 	}
 }
 
-void Gdi::drawStripC64Mask(byte *dst, int stripnr, int width, int height) const {
+void GdiV1::drawStripC64Mask(byte *dst, int stripnr, int width, int height) const {
 	int maskIdx;
 	height /= 8;
 	width /= 8;
@@ -2472,7 +2500,7 @@
 	}
 }
 
-void Gdi::decodeC64Gfx(const byte *src, byte *dst, int size) const {
+void GdiV1::decodeC64Gfx(const byte *src, byte *dst, int size) const {
 	int x, z;
 	byte color, run, common[4];
 
@@ -2512,7 +2540,7 @@
  * @param table		the strip table to fill
  * @return filled strip table
  */
-StripTable *Gdi::generateStripTable(const byte *src, int width, int height, StripTable *table) const {
+StripTable *GdiV2::generateStripTable(const byte *src, int width, int height, StripTable *table) const {
 
 	// If no strip table was given to use, allocate a new one
 	if (table == 0)

Modified: scummvm/trunk/engines/scumm/gfx.h
===================================================================
--- scummvm/trunk/engines/scumm/gfx.h	2006-09-18 21:46:44 UTC (rev 23936)
+++ scummvm/trunk/engines/scumm/gfx.h	2006-09-18 22:06:39 UTC (rev 23937)
@@ -193,12 +193,6 @@
 protected:
 	ScummEngine *_vm;
 
-public:
-	int _numZBuffer;
-	int _imgBufOffs[8];
-	int32 _numStrips;
-
-protected:
 	byte _paletteMod;
 	byte *_roomPalette;
 	byte _transparentColor;
@@ -210,22 +204,16 @@
 	/** Flag which is true when an object is being rendered, false otherwise. */
 	bool _objectMode;
 
-	/** Render settings which are specific to the C64 graphic decoders. */
-	struct {
-		byte colors[4];
-		byte charMap[2048], objectMap[2048], picMap[4096], colorMap[4096];
-		byte maskMap[4096], maskChar[4096];
-	} _C64;
+public:
+	int _numZBuffer;
+	int _imgBufOffs[8];
+	int32 _numStrips;
 
-	/** For V2 games, we cache offsets into the room graphics, to speed up things. */
-	StripTable *_roomStrips;
-
+protected:
 	/* Bitmap decompressors */
 	bool decompressBitmap(byte *dst, int dstPitch, const byte *src, int numLinesToProcess);
 
 	void drawStripEGA(byte *dst, int dstPitch, const byte *src, int height) const;
-	void drawStripC64Object(byte *dst, int dstPitch, int stripnr, int width, int height);
-	void drawStripC64Background(byte *dst, int dstPitch, int stripnr, int height);
 
 	void drawStripComplex(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const;
 	void drawStripBasicH(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const;
@@ -241,20 +229,13 @@
 	void drawStripHE(byte *dst, int dstPitch, const byte *src, int width, int height, const bool transpCheck) const;
 
 	/* Mask decompressors */
-	void drawStripC64Mask(byte *dst, int stripnr, int width, int height) const;
 	void decompressTMSK(byte *dst, const byte *tmsk, const byte *src, int height) const;
 	void decompressMaskImgOr(byte *dst, const byte *src, int height) const;
 	void decompressMaskImg(byte *dst, const byte *src, int height) const;
 
 	/* Misc */
-	void decodeC64Gfx(const byte *src, byte *dst, int size) const;
-
 	int getZPlanes(const byte *smap_ptr, const byte *zplane_list[9], bool bmapImage) const;
 
-	StripTable *generateStripTable(const byte *src, int width, int height, StripTable *table) const;
-	void drawBitmapV2Helper(const byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height,
-	                int stripnr, int numstrip);
-
 	virtual bool drawStrip(byte *dstPtr, VirtScreen *vs,
 					int x, int y, const int width, const int height,
 					int stripnr, const byte *smap_ptr);
@@ -263,7 +244,9 @@
 	                int stripnr, int numzbuf, const byte *zplane_list[9],
 	                bool transpStrip, byte flag, const byte *tmsk_ptr);
 
-	virtual void prepareDrawBitmap(const byte *ptr, int x, int y, const int width, const int height);
+	virtual void prepareDrawBitmap(const byte *ptr, VirtScreen *vs,
+					const int x, const int y, const int width, const int height,
+	                int stripnr, int numstrip);
 
 public:
 	Gdi(ScummEngine *vm);
@@ -295,8 +278,6 @@
 
 class GdiNES : public Gdi {
 protected:
-	//ScummEngine *_vm;
-
 	struct {
 		byte nametable[16][64], nametableObj[16][64];
 		byte attributes[64], attributesObj[64];
@@ -305,6 +286,7 @@
 		bool hasmask;
 	} _NES;
 
+protected:
 	void decodeNESGfx(const byte *room);
 	void decodeNESObject(const byte *ptr, int xpos, int ypos, int width, int height);
 
@@ -319,7 +301,9 @@
 	                int stripnr, int numzbuf, const byte *zplane_list[9],
 	                bool transpStrip, byte flag, const byte *tmsk_ptr);
 
-	virtual void prepareDrawBitmap(const byte *ptr, int x, int y, const int width, const int height);
+	virtual void prepareDrawBitmap(const byte *ptr, VirtScreen *vs,
+					const int x, const int y, const int width, const int height,
+	                int stripnr, int numstrip);
 
 public:
 	GdiNES(ScummEngine *vm);
@@ -327,7 +311,67 @@
 	virtual void roomChanged(byte *roomptr, uint32 IM00_offs, byte transparentColor);
 };
 
+class GdiV1 : public Gdi {
+protected:
+	/** Render settings which are specific to the C64 graphic decoders. */
+	struct {
+		byte colors[4];
+		byte charMap[2048], objectMap[2048], picMap[4096], colorMap[4096];
+		byte maskMap[4096], maskChar[4096];
+	} _C64;
 
+protected:
+	void decodeC64Gfx(const byte *src, byte *dst, int size) const;
+
+	void drawStripC64Object(byte *dst, int dstPitch, int stripnr, int width, int height);
+	void drawStripC64Background(byte *dst, int dstPitch, int stripnr, int height);
+	void drawStripC64Mask(byte *dst, int stripnr, int width, int height) const;
+
+	virtual bool drawStrip(byte *dstPtr, VirtScreen *vs,
+					int x, int y, const int width, const int height,
+					int stripnr, const byte *smap_ptr);
+
+	virtual void decodeMask(int x, int y, const int width, const int height,
+	                int stripnr, int numzbuf, const byte *zplane_list[9],
+	                bool transpStrip, byte flag, const byte *tmsk_ptr);
+
+	virtual void prepareDrawBitmap(const byte *ptr, VirtScreen *vs,
+					const int x, const int y, const int width, const int height,
+	                int stripnr, int numstrip);
+
+public:
+	GdiV1(ScummEngine *vm);
+
+	virtual void roomChanged(byte *roomptr, uint32 IM00_offs, byte transparentColor);
+};
+
+class GdiV2 : public Gdi {
+protected:
+	/** For V2 games, we cache offsets into the room graphics, to speed up things. */
+	StripTable *_roomStrips;
+
+protected:
+	StripTable *generateStripTable(const byte *src, int width, int height, StripTable *table) const;
+
+	virtual bool drawStrip(byte *dstPtr, VirtScreen *vs,
+					int x, int y, const int width, const int height,
+					int stripnr, const byte *smap_ptr);
+
+	virtual void decodeMask(int x, int y, const int width, const int height,
+	                int stripnr, int numzbuf, const byte *zplane_list[9],
+	                bool transpStrip, byte flag, const byte *tmsk_ptr);
+
+	virtual void prepareDrawBitmap(const byte *ptr, VirtScreen *vs,
+					const int x, const int y, const int width, const int height,
+	                int stripnr, int numstrip);
+
+public:
+	GdiV2(ScummEngine *vm);
+	~GdiV2();
+
+	virtual void roomChanged(byte *roomptr, uint32 IM00_offs, byte transparentColor);
+};
+
 } // End of namespace Scumm
 
 #endif

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2006-09-18 21:46:44 UTC (rev 23936)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2006-09-18 22:06:39 UTC (rev 23937)
@@ -89,6 +89,10 @@
 
 	if (_game.platform == Common::kPlatformNES) {
 		_gdi = new GdiNES(this);
+	} else if (_game.version <= 1) {
+		_gdi = new GdiV1(this);
+	} else if (_game.version == 2) {
+		_gdi = new GdiV2(this);
 	} else {
 		_gdi = new Gdi(this);
 	}


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