[Scummvm-cvs-logs] SF.net SVN: scummvm:[41195] scummvm/branches/gsoc2009-16bit/engines/scumm

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Fri Jun 5 12:13:19 CEST 2009


Revision: 41195
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41195&view=rev
Author:   Kirben
Date:     2009-06-05 10:13:19 +0000 (Fri, 05 Jun 2009)

Log Message:
-----------
Cleanup.

Modified Paths:
--------------
    scummvm/branches/gsoc2009-16bit/engines/scumm/gfx.cpp
    scummvm/branches/gsoc2009-16bit/engines/scumm/gfx.h
    scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.cpp

Modified: scummvm/branches/gsoc2009-16bit/engines/scumm/gfx.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/scumm/gfx.cpp	2009-06-05 08:09:37 UTC (rev 41194)
+++ scummvm/branches/gsoc2009-16bit/engines/scumm/gfx.cpp	2009-06-05 10:13:19 UTC (rev 41195)
@@ -231,6 +231,9 @@
 	free(_roomStrips);
 }
 
+Gdi16Bit::Gdi16Bit(ScummEngine *vm) : Gdi(vm) {
+}
+
 void Gdi::init() {
 	_numStrips = _vm->_screenWidth / 8;
 
@@ -2803,12 +2806,8 @@
 
 	int x = width;
 	while (1) {
-		if (!transpCheck || color != _transparentColor) {
-			if (_vm->_game.features & GF_16BIT_COLOR)
-				WRITE_UINT16(dst, READ_LE_UINT16(_vm->_hePalettes + 2048 + color * 2));
-			else
-				*dst = _roomPalette[color];
-		}
+		if (!transpCheck || color != _transparentColor)
+			writeRoomColor(dst, color);
 		dst += _vm->_bitDepth;
 		--x;
 		if (x == 0) {
@@ -2896,12 +2895,8 @@
 		int x = 8;
 		do {
 			FILL_BITS;
-			if (!transpCheck || color != _transparentColor) {
-				if (_vm->_game.features & GF_16BIT_COLOR)
-					WRITE_UINT16(dst, READ_LE_UINT16(_vm->_hePalettes + 2048 + color * 2));
-				else
-					*dst = _roomPalette[color] + _paletteMod;
-			}
+			if (!transpCheck || color != _transparentColor)
+				writeRoomColor(dst, color);
 			dst += _vm->_bitDepth;
 
 		againPos:
@@ -2927,12 +2922,8 @@
 							if (!--height)
 								return;
 						}
-						if (!transpCheck || color != _transparentColor) {
-							if (_vm->_game.features & GF_16BIT_COLOR)
-								WRITE_UINT16(dst, READ_LE_UINT16(_vm->_hePalettes + 2048 + color * 2));
-							else
-								*dst = _roomPalette[color] + _paletteMod;
-						}
+						if (!transpCheck || color != _transparentColor)
+							writeRoomColor(dst, color);
 						dst += _vm->_bitDepth;
 					} while (--reps);
 					bits >>= 8;
@@ -2956,12 +2947,8 @@
 		int x = 8;
 		do {
 			FILL_BITS;
-			if (!transpCheck || color != _transparentColor) {
-				if (_vm->_game.features & GF_16BIT_COLOR)
-					WRITE_UINT16(dst, READ_LE_UINT16(_vm->_hePalettes + 2048 + color * 2));
-				else
-					*dst = _roomPalette[color] + _paletteMod;
-			}
+			if (!transpCheck || color != _transparentColor)
+				writeRoomColor(dst, color);
 			dst += _vm->_bitDepth;
 			if (!READ_BIT) {
 			} else if (!READ_BIT) {
@@ -2993,12 +2980,8 @@
 		int h = height;
 		do {
 			FILL_BITS;
-			if (!transpCheck || color != _transparentColor) {
-				if (_vm->_game.features & GF_16BIT_COLOR)
-					WRITE_UINT16(dst, READ_LE_UINT16(_vm->_hePalettes + 2048 + color * 2));
-				else
-					*dst = _roomPalette[color] + _paletteMod;
-			}
+			if (!transpCheck || color != _transparentColor)
+				writeRoomColor(dst, color);
 			dst += dstPitch;
 			if (!READ_BIT) {
 			} else if (!READ_BIT) {
@@ -3065,12 +3048,8 @@
 		do {
 			for (x = 0; x < 8; x ++) {
 				byte color = *src++;
-				if (!transpCheck || color != _transparentColor) {
-					if (_vm->_game.features & GF_16BIT_COLOR)
-						WRITE_UINT16(dst + x * 2, READ_LE_UINT16(_vm->_hePalettes + 2048 + color * 2));
-					else
-						dst[x] = _roomPalette[color] + _paletteMod;
-				}
+				if (!transpCheck || color != _transparentColor)
+					writeRoomColor(dst + x * _vm->_bitDepth, color);
 			}
 			dst += dstPitch;
 		} while (--height);
@@ -3193,7 +3172,15 @@
 #undef NEXT_ROW
 #undef READ_BIT_256
 
+void Gdi16Bit::writeRoomColor(byte *dst, byte color) const {
+	WRITE_UINT16(dst, READ_LE_UINT16(_vm->_hePalettes + 2048 + color * 2));
+}
 
+void Gdi::writeRoomColor(byte *dst, byte color) const {
+	*dst = _roomPalette[color] + _paletteMod;
+}
+
+
 #pragma mark -
 #pragma mark --- Transition effects ---
 #pragma mark -

Modified: scummvm/branches/gsoc2009-16bit/engines/scumm/gfx.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/scumm/gfx.h	2009-06-05 08:09:37 UTC (rev 41194)
+++ scummvm/branches/gsoc2009-16bit/engines/scumm/gfx.h	2009-06-05 10:13:19 UTC (rev 41195)
@@ -215,6 +215,7 @@
 	void drawStrip3DO(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const;
 
 	void drawStripHE(byte *dst, int dstPitch, const byte *src, int width, int height, const bool transpCheck) const;
+	virtual void writeRoomColor(byte *dst, byte color) const;
 
 	/* Mask decompressors */
 	void decompressTMSK(byte *dst, const byte *tmsk, const byte *src, int height) const;
@@ -361,6 +362,13 @@
 	virtual void roomChanged(byte *roomptr);
 };
 
+class Gdi16Bit : public Gdi {
+protected:
+	virtual void writeRoomColor(byte *dst, byte color) const;
+public:
+	Gdi16Bit(ScummEngine *vm);
+};
+
 } // End of namespace Scumm
 
 #endif

Modified: scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.cpp	2009-06-05 08:09:37 UTC (rev 41194)
+++ scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.cpp	2009-06-05 10:13:19 UTC (rev 41195)
@@ -109,7 +109,9 @@
 	  _currentScript(0xFF), // Let debug() work on init stage
 	  _messageDialog(0), _pauseDialog(0), _scummMenuDialog(0), _versionDialog(0) {
 
-	if (_game.platform == Common::kPlatformNES) {
+	if (_game.features & GF_16BIT_COLOR) {
+		_gdi = new Gdi16Bit(this);
+	} else if (_game.platform == Common::kPlatformNES) {
 		_gdi = new GdiNES(this);
 	} else if (_game.version <= 1) {
 		_gdi = new GdiV1(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