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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sat Mar 17 00:09:00 CET 2007


Revision: 26153
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26153&view=rev
Author:   lordhoto
Date:     2007-03-16 16:08:59 -0700 (Fri, 16 Mar 2007)

Log Message:
-----------
Basic support for Amiga MSC files.

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

Modified: scummvm/trunk/engines/kyra/screen.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen.cpp	2007-03-16 23:07:08 UTC (rev 26152)
+++ scummvm/trunk/engines/kyra/screen.cpp	2007-03-16 23:08:59 UTC (rev 26153)
@@ -415,8 +415,10 @@
 
 void Screen::setScreenPalette(const uint8 *palData) {
 	debugC(9, kDebugLevelScreen, "Screen::setScreenPalette(%p)", (const void *)palData);
+
 	if (palData != _screenPalette)
 		memcpy(_screenPalette, palData, 768);
+
 	uint8 screenPal[256 * 4];
 	for (int i = 0; i < 256; ++i) {
 		screenPal[4 * i + 0] = (palData[0] << 2) | (palData[0] & 3);
@@ -1690,7 +1692,7 @@
 	}
 }
 
-void Screen::convertAmigaGfx(uint8 *data, int w, int h, bool offscreen) {
+void Screen::convertAmigaGfx(uint8 *data, int w, int h, bool offscreen, int planeOffset) {
 	static uint8 tmp[320*200];
 
 	if (offscreen) {
@@ -1699,10 +1701,10 @@
 		int hC = h;
 		while (hC--) {
 			uint8 *dst1 = curLine;
-			uint8 *dst2 = dst1 + 8000;
-			uint8 *dst3 = dst2 + 8000;
-			uint8 *dst4 = dst3 + 8000;
-			uint8 *dst5 = dst4 + 8000;
+			uint8 *dst2 = dst1 + planeOffset;
+			uint8 *dst3 = dst2 + planeOffset;
+			uint8 *dst4 = dst3 + planeOffset;
+			uint8 *dst5 = dst4 + planeOffset;
 
 			int width = w >> 3;
 			while (width--) {
@@ -1719,7 +1721,6 @@
 		memcpy(tmp, data, w*h);
 	}
 
-	int planeOffset = 8000;
 	for (int y = 0; y < h; ++y) {
 		for (int x = 0; x < w; ++x) {
 			int bytePos = x/8+y*40;
@@ -1736,6 +1737,22 @@
 	}
 }
 
+void Screen::convertAmigaMsc(uint8 *data) {
+	Screen::convertAmigaGfx(data, 320, 200, false, 5760);
+	for (int i = 0; i < 64000; ++i) {
+		byte src = *data;
+		byte dst = 0;
+		if (!(src & 0x1)) {
+			dst |= 0x80;
+		}
+		// FIXME: this is totally wrong, correct this 
+		src >>= 1;
+		src &= 0x7;
+		dst |= src;
+		*data++ = dst;
+	}
+}
+
 template<bool noXor>
 void Screen::wrapped_decodeFrameDeltaPage(uint8 *dst, const uint8 *src, int pitch) {
 	int count = 0;
@@ -2282,9 +2299,8 @@
 	color &= 0x80;
 	color ^= 0x80;
 
-	if (color & 0x80) {
+	if (color & 0x80)
 		return 1;
-	}
 	return 0;
 }
 
@@ -2558,7 +2574,11 @@
 	}
 
 	if (_vm->gameFlags().platform == Common::kPlatformAmiga) {
-		Screen::convertAmigaGfx(dstData, 320, 200, false);
+		const char *ext = filename + strlen(filename) - 3;
+		if (!scumm_stricmp(ext, "MSC"))
+			Screen::convertAmigaMsc(dstData);
+		else
+			Screen::convertAmigaGfx(dstData, 320, 200, false);
 	}
 
 	delete [] srcData;

Modified: scummvm/trunk/engines/kyra/screen.h
===================================================================
--- scummvm/trunk/engines/kyra/screen.h	2007-03-16 23:07:08 UTC (rev 26152)
+++ scummvm/trunk/engines/kyra/screen.h	2007-03-16 23:08:59 UTC (rev 26153)
@@ -231,7 +231,8 @@
 	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 convertAmigaGfx(uint8 *data, int w, int h, bool offscreen = true, int planeOffset = 8000);
+	static void convertAmigaMsc(uint8 *data);
 
 	// maybe subclass screen for kyra3
 	static const ScreenDim _screenDimTableK3[];

Modified: scummvm/trunk/engines/kyra/sprites.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sprites.cpp	2007-03-16 23:07:08 UTC (rev 26152)
+++ scummvm/trunk/engines/kyra/sprites.cpp	2007-03-16 23:08:59 UTC (rev 26153)
@@ -422,7 +422,6 @@
 	}
 	// XXX
 	_engine->_paletteChanged = 1;
-	// FIXME: check this...
 	if (_engine->gameFlags().platform != Common::kPlatformAmiga) {
 		_screen->loadPalette(_dat + 0x17, _screen->getPalette(1) + 684, 60);
 	}


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