[Scummvm-cvs-logs] SF.net SVN: scummvm:[35268] scummvm/trunk/engines/tinsel

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sun Dec 7 08:44:52 CET 2008


Revision: 35268
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35268&view=rev
Author:   dreammaster
Date:     2008-12-07 07:44:52 +0000 (Sun, 07 Dec 2008)

Log Message:
-----------
Added code differences for DW1 demo to allow the first game screen to start

Modified Paths:
--------------
    scummvm/trunk/engines/tinsel/bg.cpp
    scummvm/trunk/engines/tinsel/dialogs.cpp
    scummvm/trunk/engines/tinsel/dw.h
    scummvm/trunk/engines/tinsel/graphics.cpp
    scummvm/trunk/engines/tinsel/strres.cpp
    scummvm/trunk/engines/tinsel/tinlib.cpp

Modified: scummvm/trunk/engines/tinsel/bg.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/bg.cpp	2008-12-07 00:27:39 UTC (rev 35267)
+++ scummvm/trunk/engines/tinsel/bg.cpp	2008-12-07 07:44:52 UTC (rev 35268)
@@ -250,8 +250,7 @@
 
 	pim = GetImageFromFilm(hFilm, 0, NULL, NULL, &pfilm);
 
-	if (!TinselV0)
-		SetBackPal(FROM_LE_32(pim->hImgPal));
+	SetBackPal(FROM_LE_32(pim->hImgPal));
 
 	// Extract the film speed
 	BGspeed = ONE_SECOND / FROM_LE_32(pfilm->frate);

Modified: scummvm/trunk/engines/tinsel/dialogs.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/dialogs.cpp	2008-12-07 00:27:39 UTC (rev 35267)
+++ scummvm/trunk/engines/tinsel/dialogs.cpp	2008-12-07 07:44:52 UTC (rev 35268)
@@ -3887,6 +3887,10 @@
 void OpenMenu(CONFTYPE menuType) {
 	int curX, curY;
 
+	// In the DW 1 demo, don't allow any menu to be opened
+	if (TinselV0)
+		return;
+
 	if (InventoryState != IDLE_INV)
 		return;
 
@@ -5523,7 +5527,18 @@
 	numObjects = num;
 	invObjects = (INV_OBJECT *) cptr;
 
-	if (TinselV2) {
+	if (TinselV0) {
+		// In Tinsel 0, the INV_OBJECT structure doesn't have an attributes field, so we
+		// need to 'unpack' the source structures into the standard Tinsel v1/v2 format
+		invObjects = (INV_OBJECT *)MemoryAlloc(DWM_FIXED, numObjects * sizeof(INV_OBJECT));
+		byte *srcP = (byte *)cptr;
+		INV_OBJECT *destP = (INV_OBJECT *)invObjects;
+
+		for (int i = 0; i < num; ++i, ++destP, srcP += 12) {
+			memmove(destP, srcP, 12);
+			destP->attribute = 0;
+		}
+	} else if (TinselV2) {
 		if (invFilms == NULL)
 			// First time - allocate memory
 			invFilms = (SCNHANDLE *)MemoryAlloc(DWM_FIXED | DWM_ZEROINIT, numObjects * sizeof(SCNHANDLE));

Modified: scummvm/trunk/engines/tinsel/dw.h
===================================================================
--- scummvm/trunk/engines/tinsel/dw.h	2008-12-07 00:27:39 UTC (rev 35267)
+++ scummvm/trunk/engines/tinsel/dw.h	2008-12-07 07:44:52 UTC (rev 35268)
@@ -57,15 +57,9 @@
 // the maximum value a integer number can have
 #define	MAX_INT	(~MIN_INT)
 
-// TODO: v1->v2 scene files
-#ifdef FILE_SPLIT
-// each scene is split into 2 files
-#define	INV_OBJ_SCNHANDLE	(2 << SCNHANDLE_SHIFT)	// inventory object handle (if there are inventory objects)
-#else
-#define	INV_OBJ_SCNHANDLE	(1 << SCNHANDLE_SHIFT)	// inventory object handle (if there are inventory objects)
-#endif
+// inventory object handle (if there are inventory objects)
+#define	INV_OBJ_SCNHANDLE (TinselV0 ? (2 << SCNHANDLE_SHIFT) : (1 << SCNHANDLE_SHIFT))
 
-
 #define FIELD_WORLD	0
 #define FIELD_STATUS	1
 

Modified: scummvm/trunk/engines/tinsel/graphics.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/graphics.cpp	2008-12-07 00:27:39 UTC (rev 35267)
+++ scummvm/trunk/engines/tinsel/graphics.cpp	2008-12-07 07:44:52 UTC (rev 35268)
@@ -623,6 +623,10 @@
 		case 0x48:
 			WrtAll(pObj, srcPtr, destPtr, typeId >= 0x40);
 			break;
+		case 0x84:
+		case 0xC4:
+			WrtTrans(pObj, destPtr, (typeId & 0x40) != 0);
+			break;
 		default:
 			error("Unknown drawing type %d", typeId);
 		}

Modified: scummvm/trunk/engines/tinsel/strres.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/strres.cpp	2008-12-07 00:27:39 UTC (rev 35267)
+++ scummvm/trunk/engines/tinsel/strres.cpp	2008-12-07 07:44:52 UTC (rev 35268)
@@ -170,6 +170,10 @@
 	// pointer to strings
 	pText = pText + index;
 
+	// For Tinsel 0 Ids, reduce the skip amount by 1
+	if (TinselV0 && (strSkip != 0))
+		--strSkip;
+
 	// skip to the correct string
 	while (strSkip-- != 0) {
 		// skip to next string

Modified: scummvm/trunk/engines/tinsel/tinlib.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/tinlib.cpp	2008-12-07 00:27:39 UTC (rev 35267)
+++ scummvm/trunk/engines/tinsel/tinlib.cpp	2008-12-07 07:44:52 UTC (rev 35268)
@@ -180,7 +180,7 @@
 const MASTER_LIB_CODES DW1DEMO_CODES[] = {
 	ACTORREF, ACTORXPOS, ACTORYPOS, ADDTOPIC, ADDINV1, ADDINV2, AUXSCALE, BACKGROUND,
 	CAMERA, CONTROL, CONVERSATION, CONVTOPIC, HIGHEST_LIBCODE, CURSORXPOS, CURSORYPOS,
-	DECCONVW, DECCURSOR, DECFLAGS, DECINVW, DECINV1, DECINV2, DECLEAD, DELICON,
+	DECCONVW, DECCURSOR, DECTAGFONT, DECINVW, DECINV1, DECINV2, DECLEAD, DELICON,
 	DELINV, EVENT, HIGHEST_LIBCODE, HELDOBJECT, HIDEACTOR, ININVENTORY, HIGHEST_LIBCODE,
 	INVENTORY, HIGHEST_LIBCODE, KILLACTOR, KILLBLOCK, KILLTAG, SCREENXPOS,
 	HIGHEST_LIBCODE, MOVECURSOR, NEWSCENE, NOSCROLL, OBJECTHELD, OFFSET, HIGHEST_LIBCODE,
@@ -987,6 +987,8 @@
  */
 static void DecTagFont(SCNHANDLE hf) {
 	SetTagFontHandle(hf);		// Store the font handle
+	if (TinselV0)
+		SetTalkFontHandle(hf);	// Also re-use for talk text
 }
 
 /**
@@ -2371,6 +2373,9 @@
 	int i = 0;
 	uint32 value;
 
+	// In DW1 demo, upper/lower limit can be reversed
+	if (n2 < n1) SWAP(n1, n2);
+
 	do {
 		value = n1 + _vm->getRandomNumber(n2 - n1);
 	} while ((lastValue == value) && (norpt == RAND_NORPT) && (++i <= 10));
@@ -3719,7 +3724,7 @@
 
 	for (;;) {
 		_ctx->startEvent = getUserEvents();
-		if (!TinselV2) {
+		if (TinselV1) {
 			// Store cursor position
 			while (!GetCursorXYNoWait(&_ctx->startX, &_ctx->startY, false))
 				CORO_SLEEP(1);
@@ -3729,7 +3734,7 @@
 			CORO_SLEEP(1);
 
 			// Not necessary to monitor escape as it's an event anyway
-			if (!TinselV2) {
+			if (TinselV1) {
 				int curX, curY;
 				GetCursorXY(&curX, &curY, false);	// Store cursor position
 				if (curX != _ctx->startX || curY != _ctx->startY)


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