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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun Mar 18 13:08:14 CET 2007


Revision: 26204
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26204&view=rev
Author:   lordhoto
Date:     2007-03-18 05:08:13 -0700 (Sun, 18 Mar 2007)

Log Message:
-----------
- little 'cleanup'
- finished MSC file support for Amiga version

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

Modified: scummvm/trunk/engines/kyra/kyra.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra.h	2007-03-18 10:38:31 UTC (rev 26203)
+++ scummvm/trunk/engines/kyra/kyra.h	2007-03-18 12:08:13 UTC (rev 26204)
@@ -503,7 +503,7 @@
 	int setCharacterPosition(int character, int *facingTable);
 	void setCharacterPositionHelper(int character, int *facingTable);
 	int getOppositeFacingDirection(int dir);
-	void loadSceneMSC();
+	void loadSceneMsc();
 	void startSceneScript(int brandonAlive);
 	void setupSceneItems();
 	void initSceneData(int facing, int unk1, int brandonAlive);

Modified: scummvm/trunk/engines/kyra/scene.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene.cpp	2007-03-18 10:38:31 UTC (rev 26203)
+++ scummvm/trunk/engines/kyra/scene.cpp	2007-03-18 12:08:13 UTC (rev 26204)
@@ -156,10 +156,10 @@
 	char fileNameBuffer[32];
 	strcpy(fileNameBuffer, _roomFilenameTable[tableId]);
 	strcat(fileNameBuffer, ".DAT");
-	_sprites->loadDAT(fileNameBuffer, _sceneExits);
+	_sprites->loadDat(fileNameBuffer, _sceneExits);
 	_sprites->setupSceneAnims();
 	_scriptInterpreter->unloadScript(_scriptClickData);
-	loadSceneMSC();
+	loadSceneMsc();
 	
 	_walkBlockNorth = currentRoom->northExit;
 	_walkBlockEast = currentRoom->eastExit;
@@ -429,7 +429,7 @@
 	return 0;
 }
 
-void KyraEngine::loadSceneMSC() {
+void KyraEngine::loadSceneMsc() {
 	assert(_currentCharacter->sceneId < _roomTableSize);
 	int tableId = _roomTable[_currentCharacter->sceneId].nameIndex;
 	assert(tableId < _roomFilenameTableSize);
@@ -448,6 +448,7 @@
 	char fileNameBuffer[32];
 	strcpy(fileNameBuffer, _roomFilenameTable[tableId]);
 	strcat(fileNameBuffer, ".CPS");
+	_screen->clearPage(3);
 	// FIXME: check this hack for amiga version
 	_screen->loadBitmap(fileNameBuffer, 3, 3, (_flags.platform == Common::kPlatformAmiga ? _screen->getPalette(1) : 0));
 	_sprites->loadSceneShapes();

Modified: scummvm/trunk/engines/kyra/screen.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen.cpp	2007-03-18 10:38:31 UTC (rev 26203)
+++ scummvm/trunk/engines/kyra/screen.cpp	2007-03-18 12:08:13 UTC (rev 26204)
@@ -1692,7 +1692,7 @@
 	}
 }
 
-void Screen::convertAmigaGfx(uint8 *data, int w, int h, bool offscreen, int planeOffset) {
+void Screen::convertAmigaGfx(uint8 *data, int w, int h, bool offscreen) {
 	static uint8 tmp[320*200];
 
 	if (offscreen) {
@@ -1701,10 +1701,10 @@
 		int hC = h;
 		while (hC--) {
 			uint8 *dst1 = curLine;
-			uint8 *dst2 = dst1 + planeOffset;
-			uint8 *dst3 = dst2 + planeOffset;
-			uint8 *dst4 = dst3 + planeOffset;
-			uint8 *dst5 = dst4 + planeOffset;
+			uint8 *dst2 = dst1 + 8000;
+			uint8 *dst3 = dst2 + 8000;
+			uint8 *dst4 = dst3 + 8000;
+			uint8 *dst5 = dst4 + 8000;
 
 			int width = w >> 3;
 			while (width--) {
@@ -1727,30 +1727,49 @@
 			int bitPos = 7-x&7;
 
 			byte colorIndex = 0;
-			colorIndex |= (((tmp[bytePos + planeOffset * 0] & (1 << bitPos)) >> bitPos) & 0x1) << 0;
-			colorIndex |= (((tmp[bytePos + planeOffset * 1] & (1 << bitPos)) >> bitPos) & 0x1) << 1;
-			colorIndex |= (((tmp[bytePos + planeOffset * 2] & (1 << bitPos)) >> bitPos) & 0x1) << 2;
-			colorIndex |= (((tmp[bytePos + planeOffset * 3] & (1 << bitPos)) >> bitPos) & 0x1) << 3;
-			colorIndex |= (((tmp[bytePos + planeOffset * 4] & (1 << bitPos)) >> bitPos) & 0x1) << 4;
+			colorIndex |= (((tmp[bytePos + 8000 * 0] & (1 << bitPos)) >> bitPos) & 0x1) << 0;
+			colorIndex |= (((tmp[bytePos + 8000 * 1] & (1 << bitPos)) >> bitPos) & 0x1) << 1;
+			colorIndex |= (((tmp[bytePos + 8000 * 2] & (1 << bitPos)) >> bitPos) & 0x1) << 2;
+			colorIndex |= (((tmp[bytePos + 8000 * 3] & (1 << bitPos)) >> bitPos) & 0x1) << 3;
+			colorIndex |= (((tmp[bytePos + 8000 * 4] & (1 << bitPos)) >> bitPos) & 0x1) << 4;
 			*data++ = colorIndex;
 		}
 	}
 }
 
 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;
+	byte *plane1 = data + 5760 * 1;
+	byte *plane2 = data + 5760 * 2;
+	byte *plane3 = data + 5760 * 3;
+	byte *plane4 = data + 5760 * 4;
+	byte *plane5 = data + 5760 * 5;
+	byte *plane6 = data + 5760 * 6;
+	for (int i = 0; i < 5760; ++i) {
+		byte d = plane6[i];
+		d = (plane5[i] |= d);
+		d = (plane4[i] |= d);
+		d = (plane3[i] |= d);
+		d = (plane2[i] |= d);
+		d = (plane1[i] |= d);		
+	}
+	byte dst[320*144];
+	memset(dst, 0, sizeof(dst));
+	static const byte flagTable[] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
+	for (int y = 0; y < 144; ++y) {
+		for (int x = 0; x < 320; ++x) {
+			if (!(flagTable[x&7] & data[y*40+(x>>3)]))
+				dst[y*320+x] |= 0x80;
+
+			int layer = 0;
+			for (int i = 0; i < 7; ++i) {
+				if (flagTable[x&7] & data[y*40+(x>>3)+i*5760])
+					layer = i;
+			}
+			if (layer)
+				dst[y*320+x] |= (layer+1);
 		}
-		// FIXME: this is totally wrong, correct this 
-		src >>= 1;
-		src &= 0x7;
-		dst |= src;
-		*data++ = dst;
 	}
+	memcpy(data, dst, 320*144);
 }
 
 template<bool noXor>

Modified: scummvm/trunk/engines/kyra/screen.h
===================================================================
--- scummvm/trunk/engines/kyra/screen.h	2007-03-18 10:38:31 UTC (rev 26203)
+++ scummvm/trunk/engines/kyra/screen.h	2007-03-18 12:08:13 UTC (rev 26204)
@@ -167,7 +167,6 @@
 	int setNewShapeHeight(uint8 *shape, int height);
 	int resetShapeHeight(uint8 *shape);
 
-	void drawShapePlotPixelCallback1(uint8 *dst, uint8 color);
 	void drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int sd, int flags, ...);
 
 	// mouse handling
@@ -231,7 +230,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, int planeOffset = 8000);
+	static void convertAmigaGfx(uint8 *data, int w, int h, bool offscreen = true);
 	static void convertAmigaMsc(uint8 *data);
 
 	// maybe subclass screen for kyra3

Modified: scummvm/trunk/engines/kyra/sprites.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sprites.cpp	2007-03-18 10:38:31 UTC (rev 26203)
+++ scummvm/trunk/engines/kyra/sprites.cpp	2007-03-18 12:08:13 UTC (rev 26204)
@@ -396,7 +396,7 @@
 	}
 }
 
-void Sprites::loadDAT(const char *filename, SceneExits &exits) {
+void Sprites::loadDat(const char *filename, SceneExits &exits) {
 	debugC(9, kDebugLevelSprites,  "Sprites::loadDat('%s')", filename);
 	uint32 fileSize;
 

Modified: scummvm/trunk/engines/kyra/sprites.h
===================================================================
--- scummvm/trunk/engines/kyra/sprites.h	2007-03-18 10:38:31 UTC (rev 26203)
+++ scummvm/trunk/engines/kyra/sprites.h	2007-03-18 12:08:13 UTC (rev 26204)
@@ -66,7 +66,7 @@
 
 	void updateSceneAnims();
 	void setupSceneAnims();
-	void loadDAT(const char *filename, SceneExits &exits);
+	void loadDat(const char *filename, SceneExits &exits);
 	void loadSceneShapes();
 	
 	Anim _anims[MAX_NUM_ANIMS];


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