[Scummvm-cvs-logs] CVS: scummvm/queen cutaway.cpp,1.29,1.30 cutaway.h,1.12,1.13 xref.txt,1.9,1.10

David Eriksson twogood at users.sourceforge.net
Sat Oct 18 05:04:21 CEST 2003


Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv22387

Modified Files:
	cutaway.cpp cutaway.h xref.txt 
Log Message:
Make the aeroplane fly (and Joe too... I wonder what he smoked.)


Index: cutaway.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- cutaway.cpp	17 Oct 2003 12:00:08 -0000	1.29
+++ cutaway.cpp	18 Oct 2003 10:58:10 -0000	1.30
@@ -32,6 +32,8 @@
 
    - Implement CUTAWAY_SCALE
 
+   - Implement SCENE_START and SCENE_END
+
    - Finish Cutaway::handleAnimation
 
    - Support the remaining cutaway object types:
@@ -493,6 +495,7 @@
 }
 
 byte *Cutaway::getCutawayAnim(byte *ptr, int header, CutawayAnim &anim) {
+	// lines 1531-1607 in cutaway.c
 
 	anim.currentFrame = 0;
 	anim.originalFrame = 0;
@@ -508,7 +511,7 @@
 		// XXX if(FULLSCREEN) bobs[0].y2=199;
 	}
 	else {
-		warning("Stuff not yet implemented in Cutaway::handleAnimation()");
+		//warning("Stuff not yet implemented in Cutaway::getCutawayAnim()");
 		
 		anim.object = _logic->findBob(header);
 
@@ -529,6 +532,24 @@
 	anim.bank = (int16)READ_BE_UINT16(ptr);
 	ptr += 2;
 
+	if (anim.bank == 0) {
+		anim.bank = 15;
+	}
+	else {
+		if (anim.bank != 13) {
+			/* XXX if (OLDBANK != T) */ {
+				_graphics->bankLoad(_bankNames[anim.bank], 8);
+				// XXX OLDBANK=T;
+			}
+
+			anim.bank = 8;
+		}
+		else {
+			// Make sure we ref correct JOE bank (7)
+			anim.bank = 7;
+		}
+	}
+
 	anim.mx = (int16)READ_BE_UINT16(ptr);
 	ptr += 2;
 
@@ -551,6 +572,14 @@
 	anim.song = 0;
 #endif
 
+	// Extract information that depend on the signedness of values
+	if (anim.unpackFrame < 0) {
+		anim.flip = true;
+		anim.unpackFrame = -anim.unpackFrame;
+	}
+	else
+		anim.flip = false;
+
 	return ptr;
 }
 
@@ -571,13 +600,16 @@
 }
 
 byte *Cutaway::handleAnimation(byte *ptr, CutawayObject &object) {
+	// lines 1517-1770 in cutaway.c
 	int frameCount = 0;
 	int header = 0;
+	int i;
+		
+	CutawayAnim objAnim[56];
 
 	// Read animation frames
 	for (;;) {
 
-		CutawayAnim tmp;      // make array
 		header = (int16)READ_BE_UINT16(ptr);
 		ptr += 2;
 
@@ -589,8 +621,8 @@
 		if (header > 1000)
 			error("Header too large");
 
-		ptr = getCutawayAnim(ptr, header, tmp);
-		dumpCutawayAnim(tmp);
+		ptr = getCutawayAnim(ptr, header, objAnim[frameCount]);
+		dumpCutawayAnim(objAnim[frameCount]);
 
 		frameCount++;
 
@@ -599,18 +631,72 @@
 	}
 
 	if (object.animType == 1) {
-		// XXX
+		// lines 1615-1636 in cutaway.c
+
+		if (/*(P_BNUM==1) &&*/ (_logic->currentRoom() == 47 || _logic->currentRoom() == 63)) {
+			// The oracle
+			warning("The oracle is not yet handled");
+		}
+		else {
+			int currentImage = 0;
+			currentImage = makeComplexAnimation(currentImage, objAnim, frameCount);
+		}
+
+		if (object.bobStartX || object.bobStartY) {
+			BobSlot *bob = _graphics->bob(objAnim[0].object);
+			bob->x = object.bobStartX;
+			bob->y = object.bobStartY;
+		}
 	}
 
 	// Setup the SYNCHRO bob channels
-	// XXX
+
+	for (i = 0; i < frameCount; i++) {
+		if (objAnim[i].mx || objAnim[i].my) {
+			BobSlot *bob = _graphics->bob(objAnim[i].object);
+			bob->frameNum = objAnim[i].originalFrame;
+			_graphics->bobMove(
+					objAnim[i].object, 
+					objAnim[i].mx, 
+					objAnim[i].my,
+					(object.specialMove > 0) ? object.specialMove : 4);
+		}
+	}
+
+	// Boat room hard coded
+	if (_logic->currentRoom() == 43) {
+		BobSlot *bob = _graphics->bob(0);
+		if (bob->x < 320)
+			_graphics->bobMove(
+					0, 
+					bob->x + 346, 
+					bob->y,
+					4);
+	}
 
 	// Normal cutaway
 
 	if (object.animType != 1) {
-		// XXX
+		// lines 1657-1761 in cutaway.c
 	}
 
+	bool moving = true;
+
+	while (moving) {
+		moving = false;
+		_graphics->update();
+		
+		for (i = 0; i < frameCount; i++) {
+			BobSlot *bob = _graphics->bob(objAnim[i].object);
+			if (bob->moving) {
+				moving = true;
+				break;
+			}
+		}
+
+		if (_quit)
+			break;
+	}
 
 	return ptr;
 }
@@ -1043,6 +1129,45 @@
 
 		Talk::talk(_talkFile, 0 /* XXX */, nextFilename, _graphics, _logic, _resource);
 	}
+}
+
+
+int Cutaway::makeComplexAnimation(int16 currentImage, Cutaway::CutawayAnim *objAnim, int frameCount) {
+	AnimFrame cutAnim[17][30];
+	bool hasFrame[256];
+	int i;
+	int bobNum = objAnim[0].object;
+
+	memset(hasFrame, 0, sizeof(hasFrame));
+
+	BobSlot *bob = _graphics->bob(bobNum);
+	bob->xflip = objAnim[0].flip;
+
+	for (i = 0; i < frameCount; i++) {
+		cutAnim[bobNum][i].frame = currentImage + objAnim[i].unpackFrame;
+		cutAnim[bobNum][i].speed = objAnim[i].speed;
+		hasFrame[objAnim[i].unpackFrame] = true;
+	}
+
+	cutAnim[bobNum][frameCount].frame = 0;	
+	cutAnim[bobNum][frameCount].speed = 0;
+
+	int uniqueFrameCount = 0;
+
+	for (i = 1; i < 256; i++)
+		if (hasFrame[i])
+			uniqueFrameCount++;
+
+	for (i = 1; i < 256; i++) {
+		if (hasFrame[i]) {
+			currentImage++;
+			_graphics->bankUnpack(i, currentImage, objAnim[0].bank);
+		}
+	}
+
+	_graphics->bobAnimString(bobNum, cutAnim[bobNum]);
+
+	return currentImage + 1;
 }
 
 } // End of namespace Queen

Index: cutaway.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cutaway.h	17 Oct 2003 16:42:10 -0000	1.12
+++ cutaway.h	18 Oct 2003 10:58:10 -0000	1.13
@@ -106,7 +106,7 @@
 
 		struct CutawayAnim {
 			int object;
-			int unpackFrame;          // Frame to unpack 
+			int unpackFrame;          // Frame to unpack
 			int speed;
 			int bank;
 			int mx;
@@ -117,6 +117,7 @@
 			int currentFrame;  // Index to Current Frame
 			int originalFrame;  // Index to Original Object Frame
 			int song;
+			bool flip;		// set this if unpackFrame is negative
 		};
 
 		struct ObjectDataBackup {
@@ -259,6 +260,9 @@
 
 		//! Get CutawayAnim data from ptr and return new ptr
 		byte *getCutawayAnim(byte *ptr, int header, CutawayAnim &anim);
+
+		//! Special animation
+		int makeComplexAnimation(int16 currentImage, CutawayAnim *objAnim, int frameCount);
 
 		//! Read a CutawayObject from ptr and return new ptr
 		static byte *getCutawayObject(byte *ptr, CutawayObject &object);

Index: xref.txt
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/xref.txt,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- xref.txt	18 Oct 2003 08:11:59 -0000	1.9
+++ xref.txt	18 Oct 2003 10:58:10 -0000	1.10
@@ -44,15 +44,17 @@
 CUTAWAY
 =======
 CUTAWAY()					Cutaway::run
+MAKE_COMPLEX_ANIM()			Cutaway::makeComplexAnimation
 SCENE_START()
 SCENE_END()
--
 CUTJOEF
 CUTON
-CUTQUIT
-FINAL_ROOM
-IROOM
-TROOM
+CUTQUIT						Cutaway::_quit (rename and move to Logic?)
+FINAL_ROOM					Cutaway::_finalRoom
+IROOM						Cutaway::_initialRoom
+TROOM						Cutaway::_temporaryRoom
+OBJ_CUT
+OBJ_ANIM
 
 
 DEBUG
@@ -398,7 +400,7 @@
 OBJMAXv,
 OBJ_DESC_DATA,
 PERSON_DATA,
-PERSON_OBJ,OBJ_CUT,OBJ_ANIM,
+PERSON_OBJ
 FS,FE,FACE,TY,DY,BS,DS,
 TEMPA,
 I2,





More information about the Scummvm-git-logs mailing list