[Scummvm-cvs-logs] SF.net SVN: scummvm:[51921] scummvm/trunk

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sun Aug 8 03:08:17 CEST 2010


Revision: 51921
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51921&view=rev
Author:   drmccoy
Date:     2010-08-08 01:08:17 +0000 (Sun, 08 Aug 2010)

Log Message:
-----------
VIDEO: Use proper palettes in CoktelDecoder

Not just the 6 bits per color component used in VGA

Modified Paths:
--------------
    scummvm/trunk/engines/gob/videoplayer.cpp
    scummvm/trunk/graphics/video/coktel_decoder.cpp

Modified: scummvm/trunk/engines/gob/videoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.cpp	2010-08-08 01:07:45 UTC (rev 51920)
+++ scummvm/trunk/engines/gob/videoplayer.cpp	2010-08-08 01:08:17 UTC (rev 51921)
@@ -749,8 +749,11 @@
 	if (palEnd < 0)
 		palEnd = 255;
 
-	memcpy(((char *)(_vm->_global->_pPaletteDesc->vgaPal)) + palStart * 3,
-			video.decoder->getPalette() + palStart * 3, (palEnd - palStart + 1) * 3);
+	palStart =  palStart      * 3;
+	palEnd   = (palEnd   + 1) * 3;
+
+	for (int i = palStart; i <= palEnd; i++)
+		((char *)(_vm->_global->_pPaletteDesc->vgaPal))[i] = video.decoder->getPalette()[i] >> 2;
 }
 
 } // End of namespace Gob

Modified: scummvm/trunk/graphics/video/coktel_decoder.cpp
===================================================================
--- scummvm/trunk/graphics/video/coktel_decoder.cpp	2010-08-08 01:07:45 UTC (rev 51920)
+++ scummvm/trunk/graphics/video/coktel_decoder.cpp	2010-08-08 01:08:17 UTC (rev 51921)
@@ -916,7 +916,8 @@
 	_features |= kFeaturesPalette;
 
 	// Palette
-	_stream->read((byte *)_palette, 768);
+	for (int i = 0; i < 768; i++)
+		_palette[i] = _stream->readByte() << 2;
 
 	_paletteDirty = true;
 
@@ -1194,7 +1195,9 @@
 
 			_paletteDirty = true;
 
-			_stream->read(_palette, 768);
+			for (int i = 0; i < 768; i++)
+				_palette[i] = _stream->readByte() << 2;
+
 			cmd = _stream->readUint16LE();
 		}
 
@@ -1307,9 +1310,11 @@
 
 		// One byte index
 		int index = *dataPtr++;
-		// 16 entries with each 3 bytes (RGB)
-		memcpy(_palette + index * 3, dataPtr, MIN((255 - index) * 3, 48));
 
+		int count = MIN((255 - index) * 3, 48);
+		for (int i = 0; i < count; i++)
+			_palette[index * 3 + i] = dataPtr[i] << 2;
+
 		dataPtr += 48;
 		type ^= 0x10;
 
@@ -1605,7 +1610,8 @@
 	_videoCodec = _stream->readUint32BE();
 
 	if (_features & kFeaturesPalette) {
-		_stream->read((byte *)_palette, 768);
+		for (int i = 0; i < 768; i++)
+			_palette[i] = _stream->readByte() << 2;
 
 		_paletteDirty = true;
 	}
@@ -2011,7 +2017,9 @@
 				uint8 index = _stream->readByte();
 				uint8 count = _stream->readByte();
 
-				_stream->read(_palette + index * 3, (count + 1) * 3);
+				for (int j = 0; j < ((count + 1) * 3); j++)
+					_palette[index * 3 + j] = _stream->readByte() << 2;
+
 				_stream->skip((255 - count) * 3);
 
 				_paletteDirty = true;


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