[Scummvm-cvs-logs] SF.net SVN: scummvm:[55733] scummvm/trunk/engines/gob/inter_v7.cpp

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Wed Feb 2 17:51:31 CET 2011


Revision: 55733
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55733&view=rev
Author:   drmccoy
Date:     2011-02-02 16:51:31 +0000 (Wed, 02 Feb 2011)

Log Message:
-----------
GOB: Implement o7_loadLBMPalette

Modified Paths:
--------------
    scummvm/trunk/engines/gob/inter_v7.cpp

Modified: scummvm/trunk/engines/gob/inter_v7.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v7.cpp	2011-02-02 16:50:57 UTC (rev 55732)
+++ scummvm/trunk/engines/gob/inter_v7.cpp	2011-02-02 16:51:31 UTC (rev 55733)
@@ -442,7 +442,38 @@
 	if (startIndex > stopIndex)
 		SWAP(startIndex, stopIndex);
 
-	warning("Addy Stub: Load LBM palette: \"%s\", %d-%d", file.c_str(), startIndex, stopIndex);
+	Common::SeekableReadStream *lbmFile = _vm->_dataIO->getFile(file);
+	if (!lbmFile) {
+		warning("o7_loadLBMPalette(): No such file \"%s\"", file.c_str());
+		return;
+	}
+
+	ImageType type = Surface::identifyImage(*lbmFile);
+	if (type != kImageTypeLBM) {
+		warning("o7_loadLBMPalette(): \"%s\" is no LBM", file.c_str());
+		return;
+	}
+
+	byte palette[768];
+
+	LBMLoader lbm(*lbmFile);
+	if (!lbm.loadPalette(palette)) {
+		warning("o7_loadLBMPalette(): Failed reading palette from LBM \"%s\"", file.c_str());
+		return;
+	}
+
+	memset(palette      , 0x00, 3);
+	memset(palette + 765, 0xFF, 3);
+	for (int i = 0; i < 768; i++)
+		palette[i] >>= 2;
+
+	int16 count = stopIndex - startIndex + 1;
+
+	startIndex *= 3;
+	count      *= 3;
+
+	memcpy((char *)_vm->_draw->_vgaPalette + startIndex, palette + startIndex, count);
+	_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
 }
 
 void Inter_v7::o7_opendBase() {


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