[Scummvm-cvs-logs] scummvm master -> 96397a5741e6495cb7f9494841ff5b815bc96bda

bluegr bluegr at gmail.com
Sat Dec 15 07:15:40 CET 2012


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:
1713d7ee3c TINSEL: Always convert the inventory objects to the native endianess
b41d78bdd8 TINSEL: Fix intro scene skipping in DW1 Mac
96397a5741 TINSEL: Initial version of the graphics drawing function for DW1 Mac


Commit: 1713d7ee3c1bad21c8dcc2cb5eba144eb692c9a4
    https://github.com/scummvm/scummvm/commit/1713d7ee3c1bad21c8dcc2cb5eba144eb692c9a4
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2012-12-14T22:14:54-08:00

Commit Message:
TINSEL: Always convert the inventory objects to the native endianess

This is needed for DW1 Mac

Changed paths:
    engines/tinsel/tinsel.cpp



diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp
index 944613b..e836fdf 100644
--- a/engines/tinsel/tinsel.cpp
+++ b/engines/tinsel/tinsel.cpp
@@ -730,8 +730,7 @@ void LoadBasicChunks() {
 
 	cptr = FindChunk(INV_OBJ_SCNHANDLE, CHUNK_OBJECTS);
 
-#ifdef SCUMM_BIG_ENDIAN
-	//convert to native endianness
+	// Convert to native endianness
 	INV_OBJECT *io = (INV_OBJECT *)cptr;
 	for (int i = 0; i < numObjects; i++, io++) {
 		io->id        = FROM_32(io->id);
@@ -739,7 +738,6 @@ void LoadBasicChunks() {
 		io->hScript   = FROM_32(io->hScript);
 		io->attribute = FROM_32(io->attribute);
 	}
-#endif
 
 	RegisterIcons(cptr, numObjects);
 


Commit: b41d78bdd82edc0147d963def57edee29e342735
    https://github.com/scummvm/scummvm/commit/b41d78bdd82edc0147d963def57edee29e342735
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2012-12-14T22:14:55-08:00

Commit Message:
TINSEL: Fix intro scene skipping in DW1 Mac

Changed paths:
    engines/tinsel/scene.cpp



diff --git a/engines/tinsel/scene.cpp b/engines/tinsel/scene.cpp
index 986d54f..9181f85 100644
--- a/engines/tinsel/scene.cpp
+++ b/engines/tinsel/scene.cpp
@@ -159,7 +159,8 @@ static void SceneTinselProcess(CORO_PARAM, const void *param) {
 	// The following myEscape value setting is used for enabling title screen skipping in DW1
 	if (TinselV1 && (g_sceneCtr == 1)) g_initialMyEscape = GetEscEvents();
 	// DW1 PSX has its own scene skipping script code for scenes 2 and 3 (bug #3541542).
-	_ctx->myEscape = (TinselV1 && (g_sceneCtr < (TinselV1PSX ? 2 : 4))) ? g_initialMyEscape : 0;
+	// Same goes for DW1 Mac.
+	_ctx->myEscape = (TinselV1 && (g_sceneCtr < ((TinselV1PSX || TinselV1Mac) ? 2 : 4))) ? g_initialMyEscape : 0;
 
 	// get the stuff copied to process when it was created
 	_ctx->pInit = (const TP_INIT *)param;


Commit: 96397a5741e6495cb7f9494841ff5b815bc96bda
    https://github.com/scummvm/scummvm/commit/96397a5741e6495cb7f9494841ff5b815bc96bda
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2012-12-14T22:14:55-08:00

Commit Message:
TINSEL: Initial version of the graphics drawing function for DW1 Mac

Still some graphical glitches remain, as clipping isn't done correctly

Changed paths:
    engines/tinsel/graphics.cpp



diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp
index 5f200b5..b23f6bc 100644
--- a/engines/tinsel/graphics.cpp
+++ b/engines/tinsel/graphics.cpp
@@ -212,6 +212,59 @@ static void t0WrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool apply
 }
 
 /**
+ * Straight rendering with transparency support, Mac variant
+ */
+static void MacDrawTiles(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool applyClipping) {
+	// TODO: Finish off clipping
+
+	if (applyClipping) {
+		// Adjust the height down to skip any bottom clipping
+		pObj->height -= pObj->botClip;
+
+		// Make adjustment for the top clipping row
+		srcP += sizeof(uint16) * ((pObj->width + 3) >> 2) * (pObj->topClip >> 2);
+		pObj->height -= pObj->topClip;
+		pObj->topClip %= 4;
+	}
+
+	// Simple RLE-like scheme: the two first bytes of each data chunk determine
+	// if bytes should be repeated or copied.
+	// Example: 10 00 00 20 will repeat byte 0x0 0x10 times, and will copy 0x20
+	// bytes from the input stream afterwards
+
+	// Vertical loop
+	for (int y = 0; y < pObj->height; ++y) {
+		// Horizontal loop
+		for (int x = 0; x < pObj->width; ) {
+			byte repeatBytes = *srcP++;
+			if (repeatBytes > 0) {
+				byte fillColor = *srcP++;
+				if (fillColor > 0)	// color 0 is transparent
+					memset(destP, fillColor, repeatBytes);
+				destP += repeatBytes;
+				x += repeatBytes;
+			} else {
+				byte copyBytes = *srcP++;
+				for (int z = 0; z < copyBytes; ++z) {
+					if (*srcP > 0)	// color 0 is transparent
+						*destP = *srcP;
+					srcP++;
+					destP++;
+				}
+				// Round up to the next even number
+				if (copyBytes % 2)
+					srcP++;
+				x += copyBytes;
+			}
+		}	// horizontal loop
+
+		// Move to next line
+		destP += (SCREEN_WIDTH - pObj->width);
+	}	// vertical loop
+}
+
+
+/**
  * Straight rendering with transparency support, PSX variant supporting also 4-BIT clut data
  */
 static void PsxDrawTiles(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool applyClipping, bool fourBitClut, uint32 psxSkipBytes, byte *psxMapperTable, bool transparency) {
@@ -272,7 +325,7 @@ static void PsxDrawTiles(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool apply
 			assert(boxBounds.bottom >= boxBounds.top);
 			assert(boxBounds.right >= boxBounds.left);
 
-			int16 indexVal = READ_16(srcP);
+			int16 indexVal = READ_LE_UINT16(srcP);
 			srcP += sizeof(uint16);
 
 			// Draw a 4x4 block based on the opcode as in index into the block list
@@ -381,7 +434,7 @@ static void WrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool applyCl
 			assert(boxBounds.bottom >= boxBounds.top);
 			assert(boxBounds.right >= boxBounds.left);
 
-			int16 indexVal = READ_16(srcP);
+			int16 indexVal = READ_LE_UINT16(srcP);
 			srcP += sizeof(uint16);
 
 			if (indexVal >= 0) {
@@ -763,8 +816,8 @@ void DrawObject(DRAWOBJECT *pObj) {
 			byte *p = (byte *)LockMem(pObj->hBits & HANDLEMASK);
 
 			srcPtr = p + (pObj->hBits & OFFSETMASK);
-			pObj->charBase = (char *)p + READ_32(p + 0x10);
-			pObj->transOffset = READ_32(p + 0x14);
+			pObj->charBase = (char *)p + READ_LE_UINT32(p + 0x10);
+			pObj->transOffset = READ_LE_UINT32(p + 0x14);
 
 			// Decompress block indexes for Discworld PSX
 			if (TinselV1PSX) {
@@ -793,7 +846,7 @@ void DrawObject(DRAWOBJECT *pObj) {
 						psxPaletteMapper(pObj->pPal, srcPtr + sizeof(uint16), psxMapperTable);
 
 						psxFourBitClut = true;
-						psxSkipBytes = READ_32(p + sizeof(uint32) * 5) << 4; // Fetch number of bytes we have to skip
+						psxSkipBytes = READ_LE_UINT32(p + sizeof(uint32) * 5) << 4; // Fetch number of bytes we have to skip
 						switch (indexType) {
 							case 0xDD: // Normal uncompressed indexes
 								psxRLEindex = false;
@@ -852,7 +905,7 @@ void DrawObject(DRAWOBJECT *pObj) {
 			else if (TinselV1PSX)
 				PsxDrawTiles(pObj, srcPtr, destPtr, typeId == 0x41, psxFourBitClut, psxSkipBytes, psxMapperTable, true);
 			else if (TinselV1Mac)
-				{} // TODO
+				MacDrawTiles(pObj, srcPtr, destPtr, typeId == 0x41);
 			else if (TinselV1)
 				WrtNonZero(pObj, srcPtr, destPtr, typeId == 0x41);
 			else if (TinselV0)






More information about the Scummvm-git-logs mailing list