[Scummvm-cvs-logs] scummvm master -> fad3e645507030a2c34e4d6e5a37ec1bcd526105

clone2727 clone2727 at gmail.com
Mon Feb 14 00:02:57 CET 2011


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
dbc6910eae SCI: Add support for Phantasmagoria 2 CLUT resources
71edec7b80 SCI: Add detection for GK2 Mac
fad3e64550 SCI: Fix GK2 Mac picture 2315


Commit: dbc6910eae6a174fbab08a39a7e5e0fcfb135793
    https://github.com/scummvm/scummvm/commit/dbc6910eae6a174fbab08a39a7e5e0fcfb135793
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-02-13T14:29:15-08:00

Commit Message:
SCI: Add support for Phantasmagoria 2 CLUT resources

My test of ising the clut associated with the intro video produced a decent quality color conversion. This is not yet hooked up to the video player.

Changed paths:
    engines/sci/graphics/palette.cpp
    engines/sci/graphics/palette.h



diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp
index 616ee84..b27b5f3 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -69,11 +69,19 @@ GfxPalette::GfxPalette(ResourceManager *resMan, GfxScreen *screen, bool useMergi
 	_useMerging = useMerging;
 
 	palVaryInit();
+	
+#ifdef ENABLE_SCI32
+	_clutTable = 0;
+#endif
 }
 
 GfxPalette::~GfxPalette() {
 	if (_palVaryResourceId != -1)
 		palVaryRemoveTimer();
+
+#ifdef ENABLE_SCI32
+	unloadClut();
+#endif
 }
 
 bool GfxPalette::isMerging() {
@@ -787,4 +795,57 @@ void GfxPalette::palVaryProcess(int signal, bool setPalette) {
 	}
 }
 
+#ifdef ENABLE_SCI32
+
+bool GfxPalette::loadClut(uint16 clutId) {
+	// loadClut() will load a color lookup table from a clu file and set
+	// the palette found in the file. This is to be used with Phantasmagoria 2.
+
+	unloadClut();
+
+	Common::String filename = Common::String::format("%d.clu", clutId);
+	Common::File clut;
+
+	if (!clut.open(filename) || clut.size() != 0x10000 + 236 * 3)
+		return false;
+
+	// Read in the lookup table
+	// It maps each RGB565 color to a palette index
+	_clutTable = new byte[0x10000];
+	clut.read(_clutTable, 0x10000);
+
+	Palette pal;
+	memset(&pal, 0, sizeof(Palette));
+
+	// Setup 1:1 mapping
+	for (int i = 0; i < 256; i++)
+		pal.mapping[i] = i;
+
+	// Now load in the palette
+	for (int i = 1; i <= 236; i++) {
+		pal.colors[i].used = 1;
+		pal.colors[i].r = clut.readByte();
+		pal.colors[i].g = clut.readByte();
+		pal.colors[i].b = clut.readByte();
+	}
+
+	set(&pal, true);
+	setOnScreen();
+	return true;
+}
+
+byte GfxPalette::matchClutColor(uint16 color) {
+	// Match a color in RGB565 format to a palette index based on the loaded CLUT
+	assert(_clutTable);
+	return _clutTable[color];
+}
+
+void GfxPalette::unloadClut() {
+	// This will only unload the actual table, but not reset any palette
+	delete[] _clutTable;
+	_clutTable = 0;
+}
+ 
+#endif
+
 } // End of namespace Sci
diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h
index 879bbcf..84334a4 100644
--- a/engines/sci/graphics/palette.h
+++ b/engines/sci/graphics/palette.h
@@ -88,6 +88,12 @@ public:
 	virtual void saveLoadWithSerializer(Common::Serializer &s);
 	void palVarySaveLoadPalette(Common::Serializer &s, Palette *palette);
 
+#ifdef ENABLE_SCI32
+	bool loadClut(uint16 clutId);
+	byte matchClutColor(uint16 color);
+	void unloadClut();
+#endif
+
 private:
 	void palVaryInit();
 	void palVaryInstallTimer();
@@ -113,6 +119,10 @@ private:
 	uint16 _palVaryTicks;
 	int _palVaryPaused;
 	int _palVarySignal;
+	
+#ifdef ENABLE_SCI32
+	byte *_clutTable;
+#endif
 };
 
 } // End of namespace Sci


Commit: 71edec7b80c5fe060b05132ec2cb8f7f11bd1862
    https://github.com/scummvm/scummvm/commit/71edec7b80c5fe060b05132ec2cb8f7f11bd1862
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-02-13T14:45:30-08:00

Commit Message:
SCI: Add detection for GK2 Mac

Changed paths:
    engines/sci/detection_tables.h



diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index 03ba568..f042664 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -740,6 +740,18 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		Common::FR_FRA, Common::kPlatformPC, 0,
 		GUIO_NOSPEECH	},
 
+	// Gabriel Knight 2 - English Macintosh
+	// NOTE: This only contains disc 1 files (as well as the persistent file:
+	// Data1. Other discs have conflicting names :(
+	{"gk2", "", {
+		{"Data1", 0, "81cb3b4461af845efc59450a74b49fe6", 693041},
+		{"Data2", 0, "69a05445a7c8c2da06d8f5a70200974d", 16774575},
+		{"Data3", 0, "256309284f6447aaa5028103753e7e78", 15451830},
+		{"Data4", 0, "8b843c62eb53136a855d6e0087e3cb0d", 5889553},
+		{"Data5", 0, "f9fcf9ab2eb13b2125c33a1cda03a093", 14349984},
+		AD_LISTEND},
+		Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO_NONE },
+
 #endif // ENABLE_SCI32
 
 	// Hoyle 1 - English DOS (supplied by ssburnout in bug report #3049193)


Commit: fad3e645507030a2c34e4d6e5a37ec1bcd526105
    https://github.com/scummvm/scummvm/commit/fad3e645507030a2c34e4d6e5a37ec1bcd526105
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-02-13T15:00:39-08:00

Commit Message:
SCI: Fix GK2 Mac picture 2315

It hardcodes the picture so it doesn't get run with the decompressor

Changed paths:
    engines/sci/resource.cpp



diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index d1bf869..8c8bc6d 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -459,6 +459,13 @@ void MacResourceForkResourceSource::decompressResource(Common::SeekableReadStrea
 	bool canBeCompressed = !(g_sci && g_sci->getGameId() == GID_KQ6) && isCompressableResource(resource->_id.getType()); 
 	uint32 uncompressedSize = 0;
 
+	// GK2 Mac is crazy. In its Patches resource fork, picture 2315 is not
+	// compressed and it is hardcoded in the executable to say that it's
+	// not compressed. Why didn't they just add four zeroes to the end of
+	// the resource? (Checked with PPC disasm)
+	if (g_sci && g_sci->getGameId() == GID_GK2 && resource->_id.getType() == kResourceTypePic && resource->_id.getNumber() == 2315)
+		canBeCompressed = false;
+
 	// Get the uncompressed size from the end of the resource
 	if (canBeCompressed && stream->size() > 4) {
 		stream->seek(stream->size() - 4);






More information about the Scummvm-git-logs mailing list