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

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Mon Oct 26 10:11:18 CET 2009


Revision: 45393
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45393&view=rev
Author:   Kirben
Date:     2009-10-26 09:11:18 +0000 (Mon, 26 Oct 2009)

Log Message:
-----------
Switch PCE version of Loom to 16bit color, since it used 9bit color.

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/costume.cpp
    scummvm/trunk/engines/scumm/cursor.cpp
    scummvm/trunk/engines/scumm/detection_tables.h
    scummvm/trunk/engines/scumm/gfx.cpp
    scummvm/trunk/engines/scumm/palette.cpp
    scummvm/trunk/engines/scumm/scumm.cpp
    scummvm/trunk/engines/scumm/scumm.h

Modified: scummvm/trunk/engines/scumm/costume.cpp
===================================================================
--- scummvm/trunk/engines/scumm/costume.cpp	2009-10-26 09:03:54 UTC (rev 45392)
+++ scummvm/trunk/engines/scumm/costume.cpp	2009-10-26 09:11:18 UTC (rev 45393)
@@ -297,7 +297,7 @@
 		return 2;
 	}
 
-	v1.destptr = (byte *)_out.pixels + v1.y * _out.pitch + v1.x;
+	v1.destptr = (byte *)_out.pixels + v1.y * _out.pitch + v1.x * _vm->_bytesPerPixel;
 
 	v1.mask_ptr = _vm->getMaskBuffer(0, v1.y, _zbuf);
 
@@ -647,7 +647,7 @@
 			for (int row = 0; row < 16; ++row) {
 				xPos = xStep * x * 16;
 				for (int col = 0; col < 16; ++col) {
-					dst = v1.destptr + yPos * _out.pitch + xPos;
+					dst = v1.destptr + yPos * _out.pitch + xPos * _vm->_bytesPerPixel;
 					mask = v1.mask_ptr + yPos * _numStrips + (v1.x + xPos) / 8;
 					maskbit = revBitMask((v1.x + xPos) % 8);
 
@@ -657,7 +657,7 @@
 							 (v1.mask_ptr && (mask[0] & maskbit));
 
 					if (color && !masked) {
-						*dst = color;
+						WRITE_UINT16(dst, _vm->_16BitPalette[color]);
 					}
 
 					xPos += xStep;

Modified: scummvm/trunk/engines/scumm/cursor.cpp
===================================================================
--- scummvm/trunk/engines/scumm/cursor.cpp	2009-10-26 09:03:54 UTC (rev 45392)
+++ scummvm/trunk/engines/scumm/cursor.cpp	2009-10-26 09:11:18 UTC (rev 45393)
@@ -364,10 +364,10 @@
 	s.pixels = buf;
 	s.w = _charset->getCharWidth(chr);
 	s.h = _charset->getFontHeight();
-	s.pitch = s.w;
+	s.pitch = s.w * _bytesPerPixel;
 	// s.h = 17 for FM-TOWNS Loom Japanese. Fixes bug #1166917
 	assert(s.w <= 16 && s.h <= 17);
-	s.bytesPerPixel = 1;
+	s.bytesPerPixel = _bytesPerPixel;
 
 	_charset->drawChar(chr, s, 0, 0);
 
@@ -378,7 +378,7 @@
 			if (buf[s.pitch * h + w] != 123)
 				*ptr |= 1 << (15 - w);
 		}
-		ptr++;
+		ptr += _bytesPerPixel;
 	}
 
 //	_charset->setCurID(oldID);
@@ -536,7 +536,12 @@
 	byte color = default_cursor_colors[idx];
 	const uint16 *src = _cursorImages[_currentCursor];
 
-	memset(_grabbedCursor, 0xFF, sizeof(_grabbedCursor));
+	if (_bytesPerPixel == 2) {
+		for (i = 0; i < 1024; i++)
+			WRITE_UINT16(_grabbedCursor + i * 2, 0xFF);
+	} else {
+		memset(_grabbedCursor, 0xFF, sizeof(_grabbedCursor));
+	}
 
 	_cursor.hotspotX = _cursorHotspots[2 * _currentCursor];
 	_cursor.hotspotY = _cursorHotspots[2 * _currentCursor + 1];
@@ -545,8 +550,12 @@
 
 	for (i = 0; i < 16; i++) {
 		for (j = 0; j < 16; j++) {
-			if (src[i] & (1 << j))
-				_grabbedCursor[16 * i + 15 - j] = color;
+			if (src[i] & (1 << j)) {
+				if (_bytesPerPixel == 2)
+					WRITE_UINT16(_grabbedCursor + 16 * i + (15 - j) * 2, _16BitPalette[color]);
+				else
+					_grabbedCursor[16 * i + 15 - j] = color;
+			}
 		}
 	}
 

Modified: scummvm/trunk/engines/scumm/detection_tables.h
===================================================================
--- scummvm/trunk/engines/scumm/detection_tables.h	2009-10-26 09:03:54 UTC (rev 45392)
+++ scummvm/trunk/engines/scumm/detection_tables.h	2009-10-26 09:11:18 UTC (rev 45393)
@@ -216,7 +216,9 @@
 
 	{"loom", "EGA",      "ega", GID_LOOM, 3, 0, MDT_PCSPK | MDT_CMS | MDT_ADLIB | MDT_MIDI, 0, UNK, GUIO_NOSPEECH},
 	{"loom", "No Adlib", "ega", GID_LOOM, 3, 0, MDT_PCSPK | MDT_CMS,                        0, UNK, GUIO_NOSPEECH | GUIO_NOMIDI},
-	{"loom", "PC-Engine",    0, GID_LOOM, 3, 0, MDT_NONE,                         GF_AUDIOTRACKS | GF_OLD256, Common::kPlatformPCEngine, GUIO_NOSPEECH | GUIO_NOMIDI},
+#ifdef USE_RGB_COLOR
+	{"loom", "PC-Engine",    0, GID_LOOM, 3, 0, MDT_NONE,                         GF_AUDIOTRACKS | GF_OLD256 | GF_16BIT_COLOR, Common::kPlatformPCEngine, GUIO_NOSPEECH | GUIO_NOMIDI},
+#endif
 	{"loom", "FM-TOWNS",     0, GID_LOOM, 3, 0, MDT_TOWNS,                        GF_AUDIOTRACKS | GF_OLD256, Common::kPlatformFMTowns, GUIO_NOSPEECH | GUIO_NOMIDI},
 	{"loom", "VGA",      "vga", GID_LOOM, 4, 0, MDT_NONE,                         GF_AUDIOTRACKS,             Common::kPlatformPC, GUIO_NOSPEECH | GUIO_NOMIDI},
 

Modified: scummvm/trunk/engines/scumm/gfx.cpp
===================================================================
--- scummvm/trunk/engines/scumm/gfx.cpp	2009-10-26 09:03:54 UTC (rev 45392)
+++ scummvm/trunk/engines/scumm/gfx.cpp	2009-10-26 09:11:18 UTC (rev 45393)
@@ -1023,7 +1023,10 @@
 			fill(mask, _textSurface.pitch, CHARSET_MASK_TRANSPARENCY, width, height, _textSurface.bytesPerPixel);
 		}
 	} else {
-		fill(screenBuf, vs->pitch, backColor, width, height, vs->bytesPerPixel);
+		if (_game.features & GF_16BIT_COLOR)
+			fill(screenBuf, vs->pitch, _16BitPalette[backColor], width, height, vs->bytesPerPixel);
+		else
+			fill(screenBuf, vs->pitch, backColor, width, height, vs->bytesPerPixel);
 	}
 }
 
@@ -1262,7 +1265,10 @@
 			fill(backbuff, vs->pitch, flags, width, height, vs->bytesPerPixel);
 		}
 	} else {
-		fill(backbuff, vs->pitch, color, width, height, vs->bytesPerPixel);
+		if (_game.features & GF_16BIT_COLOR)
+			fill(backbuff, vs->pitch, _16BitPalette[color], width, height, vs->bytesPerPixel);
+		else
+			fill(backbuff, vs->pitch, color, width, height, vs->bytesPerPixel);
 	}
 }
 
@@ -2882,7 +2888,7 @@
 		for (int row = 0; row < 8; row++) {
 			for (int col = 0; col < 8; col++) {
 				paletteEntry = tile[row * 8 + col];
-				dst[col] = paletteOffset + paletteEntry;
+				WRITE_UINT16(dst + col * 2, _vm->_16BitPalette[paletteOffset + paletteEntry]);
 			}
 			dst += dstPitch;
 		}

Modified: scummvm/trunk/engines/scumm/palette.cpp
===================================================================
--- scummvm/trunk/engines/scumm/palette.cpp	2009-10-26 09:03:54 UTC (rev 45392)
+++ scummvm/trunk/engines/scumm/palette.cpp	2009-10-26 09:11:18 UTC (rev 45393)
@@ -260,6 +260,11 @@
 		*dest++ = 6 << 5;
 	}
 
+	if (_game.features & GF_16BIT_COLOR) {
+		for (int i = firstIndex; i < firstIndex + numcolor - 1; ++i) {
+			_16BitPalette[i] = get16BitColor(_currentPalette[i * 3 + 0], _currentPalette[i * 3 + 1], _currentPalette[i * 3 + 2]);
+		}
+	}
 	setDirtyColors(firstIndex, firstIndex + numcolor - 1);
 }
 
@@ -708,6 +713,9 @@
 			if (color > max)
 				color = max;
 			_currentPalette[idx * 3 + 2] = color;
+
+			if (_game.features & GF_16BIT_COLOR)
+				_16BitPalette[idx] = get16BitColor(_currentPalette[idx * 3 + 0], _currentPalette[idx * 3 + 1], _currentPalette[idx * 3 + 2]);
 		}
 		if (_game.heversion != 70)
 			setDirtyColors(startColor, endColor);
@@ -888,6 +896,11 @@
 	ap[2] = bp[2];
 	bp[2] = t;
 
+	if (_game.features & GF_16BIT_COLOR) {
+		_16BitPalette[a] = get16BitColor(ap[0], ap[1], ap[2]);
+		_16BitPalette[b] = get16BitColor(bp[0], bp[1], bp[2]);
+	}
+
 	setDirtyColors(a, a);
 	setDirtyColors(b, b);
 }
@@ -905,6 +918,9 @@
 	dp[1] = sp[1];
 	dp[2] = sp[2];
 
+	if (_game.features & GF_16BIT_COLOR)
+		_16BitPalette[dst] = get16BitColor(sp[0], sp[1], sp[2]);
+
 	setDirtyColors(dst, dst);
 }
 
@@ -920,6 +936,10 @@
 		_darkenPalette[idx * 3 + 1] = g;
 		_darkenPalette[idx * 3 + 2] = b;
 	}
+
+	if (_game.features & GF_16BIT_COLOR)
+		_16BitPalette[idx] = get16BitColor(r, g, b);
+
 	setDirtyColors(idx, idx);
 }
 
@@ -982,6 +1002,9 @@
 }
 
 void ScummEngine::updatePalette() {
+	if (_game.features & GF_16BIT_COLOR)
+		return;
+
 	if (_palDirtyMax == -1)
 		return;
 

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2009-10-26 09:03:54 UTC (rev 45392)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2009-10-26 09:11:18 UTC (rev 45393)
@@ -111,12 +111,12 @@
 	  _currentScript(0xFF), // Let debug() work on init stage
 	  _messageDialog(0), _pauseDialog(0), _scummMenuDialog(0), _versionDialog(0) {
 
-	if (_game.features & GF_16BIT_COLOR) {
-		_gdi = new Gdi16Bit(this);
-	} else if (_game.platform == Common::kPlatformNES) {
+	if (_game.platform == Common::kPlatformNES) {
 		_gdi = new GdiNES(this);
 	} else if (_game.platform == Common::kPlatformPCEngine) {
 		_gdi = new GdiPCEngine(this);
+	} else if (_game.features & GF_16BIT_COLOR) {
+		_gdi = new Gdi16Bit(this);
 	} else if (_game.version <= 1) {
 		_gdi = new GdiV1(this);
 	} else if (_game.version == 2) {
@@ -1486,6 +1486,9 @@
 void ScummEngine_v3::resetScumm() {
 	ScummEngine_v4::resetScumm();
 
+	_16BitPalette = (uint16 *)malloc(512);
+	memset(_16BitPalette, 0, 512);
+
 	delete _savePreparedSavegame;
 	_savePreparedSavegame = NULL;
 }

Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h	2009-10-26 09:03:54 UTC (rev 45392)
+++ scummvm/trunk/engines/scumm/scumm.h	2009-10-26 09:11:18 UTC (rev 45393)
@@ -1124,6 +1124,7 @@
 	byte _HEV7ActorPalette[256];
 	uint8 *_hePalettes;
 	uint16 _hePaletteSlot;
+	uint16 *_16BitPalette;
 
 protected:
 	int _shadowPaletteSize;


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