[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.52,1.53 akos.cpp,1.34,1.35 intern.h,2.29,2.30 script_v6.cpp,1.36,1.37 script_v8.cpp,2.93,2.94

Max Horn fingolfin at users.sourceforge.net
Mon Jan 6 05:42:10 CET 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv28437

Modified Files:
	actor.cpp akos.cpp intern.h script_v6.cpp script_v8.cpp 
Log Message:
cleanup; added a hack to avoid crash in the canon scene (at least it works this way for me)

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- actor.cpp	6 Jan 2003 02:18:27 -0000	1.52
+++ actor.cpp	6 Jan 2003 13:41:28 -0000	1.53
@@ -474,7 +474,7 @@
 		if (f == 3 && _vm->_gameId == GID_INDY3_256 && (_vm->_currentRoom != 79))
 			f = initFrame;
 
-		if (isInCurrentRoom() && costume) {
+		if (isInCurrentRoom() && costume != 0) {
 			animProgress = 0;
 			cost.animCounter1 = 0;
 			needRedraw = true;

Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- akos.cpp	5 Jan 2003 23:53:16 -0000	1.34
+++ akos.cpp	6 Jan 2003 13:41:29 -0000	1.35
@@ -70,17 +70,14 @@
 
 bool Scumm::akos_hasManyDirections(Actor *a)
 {
-	if (_features & GF_NEW_COSTUMES) {
-		byte *akos;
-		AkosHeader *akhd;
+	byte *akos;
+	AkosHeader *akhd;
 
-		akos = getResourceAddress(rtCostume, a->costume);
-		assert(akos);
+	akos = getResourceAddress(rtCostume, a->costume);
+	assert(akos);
 
-		akhd = (AkosHeader *) findResourceData(MKID('AKHD'), akos);
-		return (akhd->flags & 2) != 0;
-	}
-	return 0;
+	akhd = (AkosHeader *) findResourceData(MKID('AKHD'), akos);
+	return (akhd->flags & 2) != 0;
 }
 
 int Scumm::akos_frameToAnim(Actor *a, int frame)

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.29
retrieving revision 2.30
diff -u -d -r2.29 -r2.30
--- intern.h	6 Jan 2003 01:53:38 -0000	2.29
+++ intern.h	6 Jan 2003 13:41:29 -0000	2.30
@@ -429,6 +429,8 @@
 	void o8_kernelGetFunctions();
 	void o8_getDateTime();
 
+	void o8_getActorChore();
+
 	void o8_getObjectImageX();
 	void o8_getObjectImageY();
 	void o8_getObjectImageWidth();

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- script_v6.cpp	6 Jan 2003 01:53:38 -0000	1.36
+++ script_v6.cpp	6 Jan 2003 13:41:29 -0000	1.37
@@ -2845,7 +2845,7 @@
 void Scumm_v6::o6_delayFrames()
 {
 	ScriptSlot *ss = &vm.slot[_currentScript];
-	if (ss->delayFrameCount== 0) {
+	if (ss->delayFrameCount == 0) {
 		ss->delayFrameCount = pop();
 	} else {
 		ss->delayFrameCount--;

Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.93
retrieving revision 2.94
diff -u -d -r2.93 -r2.94
--- script_v8.cpp	5 Jan 2003 22:17:26 -0000	2.93
+++ script_v8.cpp	6 Jan 2003 13:41:29 -0000	2.94
@@ -336,8 +336,7 @@
 		OPCODE(o6_getObjectX),
 		/* EC */
 		OPCODE(o6_getObjectY),
-		OPCODE(o6_getActorAnimCounter1),	// FIXME: This is bogus, it should return the value set by setActorChoreLimbFrame
-							// It's pretty critical, and part of (At least) the cannon toomanyscripts crash
+		OPCODE(o8_getActorChore),
 		OPCODE(o6_distObjectObject),
 		OPCODE(o6_distPtPt),
 		/* F0 */
@@ -584,16 +583,21 @@
 void Scumm_v8::o8_wait()
 {
 	// TODO
+	int actnum, offs;
+	Actor *a;
 	byte subOp = fetchScriptByte();
+
 	switch (subOp) {
-	case 0x1E: {		// SO_WAIT_FOR_ACTOR Wait for actor (to finish current action?)
-		int offs = fetchScriptWordSigned();
-		if (derefActorSafe(pop(), "o8_wait:SO_WAIT_FOR_ACTOR")->moving) {
+	case 0x1E:		// SO_WAIT_FOR_ACTOR Wait for actor (to finish current action?)
+		offs = fetchScriptWordSigned();
+		actnum = pop();
+		a = derefActorSafe(actnum, "o8_wait:SO_WAIT_FOR_ACTOR");
+		assert(a);
+		if (a->moving) {
 			_scriptPointer += offs;
 			o6_breakHere();
 		}
 		return;
-	}
 	case 0x1F:		// SO_WAIT_FOR_MESSAGE Wait for message
 		if (_vars[VAR_HAVE_MSG])
 			break;
@@ -611,27 +615,26 @@
 		if (!isScriptInUse(_vars[VAR_SENTENCE_SCRIPT]))
 			return;
 		break;
-	case 0x22: {		// SO_WAIT_FOR_ANIMATION
-		int actnum = pop();
-		Actor *a = derefActorSafe(actnum, "o8_wait:SO_WAIT_FOR_ANIMATION");
-		int offs = fetchScriptWordSigned();
-		if (a && a->isInCurrentRoom() && a->needRedraw) {
+	case 0x22:		// SO_WAIT_FOR_ANIMATION
+		offs = fetchScriptWordSigned();
+		actnum = pop();
+		a = derefActorSafe(actnum, "o8_wait:SO_WAIT_FOR_ANIMATION");
+		assert(a);
+		if (a->isInCurrentRoom() && a->needRedraw) {
 			_scriptPointer += offs;
 			o6_breakHere();
 		}
 		return;
-	}
-	case 0x23: {		// SO_WAIT_FOR_TURN
-		int actnum = pop();
-		Actor *a = derefActorSafe(actnum, "o8_wait:SO_WAIT_FOR_TURN");
-		int offs = fetchScriptWordSigned();
-		if (a && a->isInCurrentRoom() && a->moving & MF_TURN) {
+	case 0x23:		// SO_WAIT_FOR_TURN
+		offs = fetchScriptWordSigned();
+		actnum = pop();
+		a = derefActorSafe(actnum, "o8_wait:SO_WAIT_FOR_TURN");
+		assert(a);
+		if (a->isInCurrentRoom() && a->moving & MF_TURN) {
 			_scriptPointer += offs;
 			o6_breakHere();
 		}
 		return;
-	}
-
 	default:
 		error("o8_wait: default case 0x%x", subOp);
 	}
@@ -1315,6 +1318,7 @@
 void Scumm_v8::o8_kernelSetFunctions()
 {
 	// TODO
+	Actor *a;
 	int args[30];
 	int len = getStackList(args, sizeof(args) / sizeof(args[0]));
 
@@ -1336,10 +1340,14 @@
 //		}
 		break;
 	case 13:	// remapCostume
-		derefActorSafe(args[1], "o8_kernelSetFunctions:remapCostume")->remapActorPalette(args[2], args[3], args[4], -1);
+		a = derefActorSafe(args[1], "o8_kernelSetFunctions:remapCostume");
+		assert(a);
+		a->remapActorPalette(args[2], args[3], args[4], -1);
 		break;
 	case 14:	// remapCostumeInsert
-		derefActorSafe(args[1], "o8_kernelSetFunctions:remapCostumeInsert")->remapActorPalette(args[2], args[3], args[4], args[5]);
+		a = derefActorSafe(args[1], "o8_kernelSetFunctions:remapCostumeInsert");
+		assert(a);
+		a->remapActorPalette(args[2], args[3], args[4], args[5]);
 		break;
 	case 15:	// setVideoFrameRate
 		// not used anymore (was smush frame rate)
@@ -1353,8 +1361,29 @@
 	case 22:	// setBannerColors
 //		warning("o8_kernelSetFunctions: setBannerColors(%d, %d, %d, %d)", args[1], args[2], args[3], args[4]);
 		break;
-	case 23:	// setActorChoreLimbFrame - FIXME: This is critical, and is the cause of the Cannon "too many scripts" crash
-//		warning("o8_kernelSetFunctions: setActorChoreLimbFrame(%d, %d, %d, %d)", args[1], args[2], args[3], args[4]);
+	case 23:	// setActorChoreLimbFrame
+		{
+		// FIXME: This is critical, and is the cause of the Cannon "too many scripts" crash
+		// This opcode is used a lot in script 28.
+		warning("o8_kernelSetFunctions: setActorChoreLimbFrame(%d, %d, %d, %d)", args[1], args[2], args[3], args[4]);
+		a = derefActorSafe(args[1], "o8_kernelSetFunctions:setActorChoreLimbFrame");
+		assert(a);
+/*
+		// The naming of this opcode would suggest this labeling of variables:
+		int chore = args[2];	// mostly the return value of actorTalkAnimation() 
+		int limb = args[3];		// mostly 0 and 1, but also 2, 3
+		int frame = args[4];	// some number usually derived from lipSyncWidth and lipSyncHeight
+		
+		// However, I am not fully sure that is correct (names can deceive, or can simply be wrong).
+		// And even if it is, the question is how to use it...
+		
+		// Note that akos_decodeData takes as parameter a "chore" = frame and bitmask
+		// specifiying a set of limbs. That would lead to code like this:
+		a->frame = chore;
+		akos_decodeData(a, frame, 0x8000 >> limb);
+		// But that seems to be quite bogus :-) Anyway, this is just random guessing, and
+		// it would be much better if somebody would disassmble the code in question.
+*/		}
 		break;
 	case 24:	// clearTextQueue
 		warning("o8_kernelSetFunctions: clearTextQueue()");
@@ -1449,9 +1478,17 @@
 		break;
 	case 0xDA:		// lipSyncWidth
 	case 0xDB:		// lipSyncHeight
+		// TODO - these methods are probably for lip syncing?
+		push(0);
+		break;
 	case 0xDC:		// actorTalkAnimation
-		// TODO - these methods are for lip syncing. Not so important right now, though
+		// TODO - this method is used mostly to compute a parameter for setActorChoreLimbFrame 
+		// (to be precise, the second parameter, i.e. args[1])
+		{
+		Actor *a = derefActorSafe(args[1], "actorTalkAnimation");
+		assert(a);
 		push(0);
+		}
 		break;
 	case 0xDD:		// getMasterSFXVol
 		push(_sound->_sound_volume_sfx / 2);
@@ -1486,6 +1523,19 @@
 		error("o8_kernelGetFunctions: default case 0x%x (len = %d)", args[0], len);
 	}
 
+}
+
+void Scumm_v8::o8_getActorChore()
+{
+	int actnum = pop();
+	Actor *a = derefActorSafe(actnum, "o8_getActorChore");
+	assert(a);
+
+	// FIXME: hack to avoid the "Too many scripts running" in the canon scene
+	push(11);
+	// Maybe this would be the correct code here? What scumm calls a "chore" corresponds
+	// to our actor "frame", I think.
+//	push(a->frame);
 }
 
 void Scumm_v8::o8_getObjectImageX()





More information about the Scummvm-git-logs mailing list