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

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sat Dec 6 12:35:31 CET 2008


Revision: 35257
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35257&view=rev
Author:   dreammaster
Date:     2008-12-06 11:35:31 +0000 (Sat, 06 Dec 2008)

Log Message:
-----------
Library routine and interpreter fixes for the DW1 demo

Modified Paths:
--------------
    scummvm/trunk/engines/tinsel/bg.cpp
    scummvm/trunk/engines/tinsel/pcode.cpp
    scummvm/trunk/engines/tinsel/tinlib.cpp
    scummvm/trunk/engines/tinsel/tinsel.h

Modified: scummvm/trunk/engines/tinsel/bg.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/bg.cpp	2008-12-06 11:01:44 UTC (rev 35256)
+++ scummvm/trunk/engines/tinsel/bg.cpp	2008-12-06 11:35:31 UTC (rev 35257)
@@ -189,6 +189,33 @@
 }
 
 /**
+ * Runs secondary reels for a scene background
+ */
+static void BGotherProcess(CORO_PARAM, const void *param) {
+	// COROUTINE
+	CORO_BEGIN_CONTEXT;
+		OBJECT *pObj;
+		ANIM anim;
+	CORO_END_CONTEXT(_ctx);
+
+	const FREEL *pReel = (const FREEL *)param;
+	const MULTI_INIT *pmi = (const MULTI_INIT *)LockMem(FROM_LE_32(pReel->mobj));
+
+	CORO_BEGIN_CODE(_ctx);
+
+	// Initialise and insert the object, and initialise its script.
+	_ctx->pObj = MultiInitObject(pmi);
+	MultiInsertObject(GetPlayfieldList(FIELD_WORLD), _ctx->pObj);
+
+	InitStepAnimScript(&_ctx->anim, pBG[0], FROM_LE_32(pReel->script), BGspeed);
+
+	while (StepAnimScript(&_ctx->anim) != ScriptFinished)
+		CORO_SLEEP(1);
+	
+	CORO_END_CODE;
+}
+
+/**
  * AetBgPal()
  */
 void SetBackPal(SCNHANDLE hPal) {
@@ -222,14 +249,21 @@
 	hBackground = hFilm;		// Save handle in case of Save_Scene()
 
 	pim = GetImageFromFilm(hFilm, 0, NULL, NULL, &pfilm);
-	SetBackPal(FROM_LE_32(pim->hImgPal));
 
+	if (!TinselV0)
+		SetBackPal(FROM_LE_32(pim->hImgPal));
+
 	// Extract the film speed
 	BGspeed = ONE_SECOND / FROM_LE_32(pfilm->frate);
 
 	// Start display process for each reel in the film
 	g_scheduler->createProcess(PID_REEL, BGmainProcess, &pfilm->reels[0], sizeof(FREEL));
 
+	if (TinselV0) {
+		for (uint i = 1; i < FROM_LE_32(pfilm->numreels); ++i)
+			g_scheduler->createProcess(PID_REEL, BGotherProcess, &pfilm->reels[i], sizeof(FREEL));
+	}
+
 	if (pBG[0] == NULL)
 		ControlStartOff();
 

Modified: scummvm/trunk/engines/tinsel/pcode.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/pcode.cpp	2008-12-06 11:01:44 UTC (rev 35256)
+++ scummvm/trunk/engines/tinsel/pcode.cpp	2008-12-06 11:35:31 UTC (rev 35257)
@@ -405,8 +405,7 @@
 	int32 tmp;
 	if (TinselV0) {
 		// Fetch a 32 bit value.
-		tmp = (int32)READ_LE_UINT32(code + ip);
-		ip += 4;
+		tmp = (int32)READ_LE_UINT32(code + ip++ * 4);
 	} else if (opcode & OPSIZE8) {
 		// Fetch and sign extend a 8 bit value to 32 bits.
 		tmp = *(int8 *)(code + ip);
@@ -430,12 +429,9 @@
 	do {
 		int tmp, tmp2;
 		int ip = ic->ip;
-		byte opcode = ic->code[ip++];
-		if (TinselV0) {
-			ip += 3;	// DW1 demo opcodes are 4 bytes long
-			if ((opcode & OPMASK) > OP_IMM)
-				opcode += 3;
-		}
+		byte opcode = ic->code[ip++ * (TinselV0 ? 4 : 1)];
+		if (TinselV0 && ((opcode & OPMASK) > OP_IMM))
+			opcode += 3;
 
 		debug(7, "ip=%d  Opcode %d (-> %d)", ic->ip, opcode, opcode & OPMASK);
 		switch (opcode & OPMASK) {
@@ -493,7 +489,6 @@
 		case OP_CALL:				// procedure call
 
 			tmp = Fetch(opcode, ic->code, ip);
-			if (TinselV0) tmp *= 4;
 			//assert(0 <= tmp && tmp < codeSize);	// TODO: Verify jumps are not out of bounds
 			ic->stack[ic->sp + 1] = 0;	// static link
 			ic->stack[ic->sp + 2] = ic->bp;	// dynamic link

Modified: scummvm/trunk/engines/tinsel/tinlib.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/tinlib.cpp	2008-12-06 11:01:44 UTC (rev 35256)
+++ scummvm/trunk/engines/tinsel/tinlib.cpp	2008-12-06 11:35:31 UTC (rev 35257)
@@ -187,7 +187,7 @@
 	PLAY, PLAYSAMPLE, PREPARESCENE, PRINT, PRINTOBJ, PRINTTAG, RESTORESCENE, SAVESCENE,
 	SCANICON, SCROLL, SETACTOR, SETBLOCK, HIGHEST_LIBCODE, SETTAG, SETTIMER, SHOWPOS,
 	SPLAY, STAND, STANDTAG, STOPWALK, HIGHEST_LIBCODE, SWALK, TAGACTOR, TALK,
-	SCREENYPOS, UNTAGACTOR, VIBRATE, WAITFRAME, WAITTIME, WALK, WALKINGACTOR, WALKPOLY,
+	SCREENYPOS, UNTAGACTOR, VIBRATE, WAITKEY, WAITTIME, WALK, WALKINGACTOR, WALKPOLY,
 	WALKTAG, RANDOM, TIMER
 };
 

Modified: scummvm/trunk/engines/tinsel/tinsel.h
===================================================================
--- scummvm/trunk/engines/tinsel/tinsel.h	2008-12-06 11:01:44 UTC (rev 35256)
+++ scummvm/trunk/engines/tinsel/tinsel.h	2008-12-06 11:35:31 UTC (rev 35257)
@@ -120,6 +120,7 @@
 
 #define TinselVersion (_vm->getVersion())
 #define TinselV0 (TinselVersion == TINSEL_V0)
+#define TinselV1 (TinselVersion == TINSEL_V1)
 #define TinselV2 (TinselVersion == TINSEL_V2)
 
 class TinselEngine : public Engine {


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