[Scummvm-cvs-logs] SF.net SVN: scummvm:[41867] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Thu Jun 25 17:22:08 CEST 2009


Revision: 41867
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41867&view=rev
Author:   lordhoto
Date:     2009-06-25 15:22:08 +0000 (Thu, 25 Jun 2009)

Log Message:
-----------
Implement proper color index conversion for Lands of Lore PC98. (The intro and menu screen work fine now)

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/screen.h
    scummvm/trunk/engines/kyra/screen_lol.cpp
    scummvm/trunk/engines/kyra/screen_lol.h
    scummvm/trunk/engines/kyra/staticres.cpp

Modified: scummvm/trunk/engines/kyra/screen.h
===================================================================
--- scummvm/trunk/engines/kyra/screen.h	2009-06-25 15:08:49 UTC (rev 41866)
+++ scummvm/trunk/engines/kyra/screen.h	2009-06-25 15:22:08 UTC (rev 41867)
@@ -327,6 +327,7 @@
 	static uint decodeFrame4(const uint8 *src, uint8 *dst, uint32 dstSize);
 	static void decodeFrameDelta(uint8 *dst, const uint8 *src, bool noXor = false);
 	static void decodeFrameDeltaPage(uint8 *dst, const uint8 *src, const int pitch, bool noXor);
+
 	static void convertAmigaGfx(uint8 *data, int w, int h, bool offscreen = true);
 	static void convertAmigaMsc(uint8 *data);
 

Modified: scummvm/trunk/engines/kyra/screen_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen_lol.cpp	2009-06-25 15:08:49 UTC (rev 41866)
+++ scummvm/trunk/engines/kyra/screen_lol.cpp	2009-06-25 15:22:08 UTC (rev 41867)
@@ -971,6 +971,30 @@
 	return shp[10];
 }
 
+void Screen_LoL::mergeOverlay(int x, int y, int w, int h) {
+	// For now we convert to 16 colors on overlay merging. If that gives
+	// any problems, like Screen functionallity not prepared for the
+	// format PC98 16 color uses, we'll need to think of a better way.
+	//
+	// We must do this before merging the overlay, else the font colors
+	// will be wrong.
+	if (_use16ColorMode)
+		convertPC98Gfx(_sjisOverlayPtrs[0] + y * 640 + x, w, h, 640);
+
+	Screen_v2::mergeOverlay(x, y, w, h);
+}
+
+void Screen_LoL::convertPC98Gfx(uint8 *data, int w, int h, int pitch) {
+	while (h--) {
+		for (int i = 0; i < w; ++i) {
+			*data = _paletteConvTable[*data];
+			++data;
+		}
+
+		data += pitch - w;
+	}
+}
+
 } // end of namespace Kyra
 
 #endif // ENABLE_LOL

Modified: scummvm/trunk/engines/kyra/screen_lol.h
===================================================================
--- scummvm/trunk/engines/kyra/screen_lol.h	2009-06-25 15:08:49 UTC (rev 41866)
+++ scummvm/trunk/engines/kyra/screen_lol.h	2009-06-25 15:22:08 UTC (rev 41867)
@@ -92,6 +92,9 @@
 	uint8 *_grayOverlay;
 	int _fadeFlag;
 
+	// PC98 specific
+	static void convertPC98Gfx(uint8 *data, int w, int h, int pitch);
+
 private:
 	LoLEngine *_vm;
 
@@ -106,6 +109,9 @@
 
 	uint8 *_levelOverlays[8];
 
+	static const uint8 _paletteConvTable[256];
+	void mergeOverlay(int x, int y, int w, int h);
+
 	// magic atlas
 	void calcBoundariesIntern(int dstX, int dstY, int c, int d);
 

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2009-06-25 15:08:49 UTC (rev 41866)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2009-06-25 15:22:08 UTC (rev 41867)
@@ -3159,6 +3159,42 @@
 
 const int Screen_LoL::_screenDimTableCount = ARRAYSIZE(Screen_LoL::_screenDimTable256C);
 
+// 256 -> 16 color conversion table
+const uint8 Screen_LoL::_paletteConvTable[256] = {
+	0x0, 0x1, 0x0, 0x3, 0x0, 0x5, 0x0, 0x7,
+	0x0, 0x9, 0x0, 0xB, 0x0, 0xD, 0x0, 0xF,
+	0x1, 0x1, 0x1, 0x3, 0x1, 0x5, 0x1, 0x7,
+	0x1, 0x9, 0x1, 0xB, 0x1, 0xD, 0x1, 0xF,
+	0x2, 0x1, 0x2, 0x3, 0x2, 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	0xE, 0x9, 0xE, 0xB, 0xE, 0xD, 0xE, 0xF,
+	0xF, 0x1, 0xF, 0x3, 0xF, 0x5, 0xF, 0x7,
+	0xF, 0x9, 0xF, 0xB, 0xF, 0xD, 0xF, 0xF
+};
+
 const char * const LoLEngine::_languageExt[] = {
 	"ENG",
 	"FRE",


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