[Scummvm-cvs-logs] CVS: scummvm/scumm object.cpp,1.172,1.173 object.h,1.8,1.9 script_v8.cpp,2.248,2.249 scumm.h,1.403,1.404

Travis Howell kirben at users.sourceforge.net
Sun Jun 20 19:34:03 CEST 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12828/scumm

Modified Files:
	object.cpp object.h script_v8.cpp scumm.h 
Log Message:

Add some missing code


Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.172
retrieving revision 1.173
diff -u -d -r1.172 -r1.173
--- object.cpp	13 Jun 2004 20:00:46 -0000	1.172
+++ object.cpp	21 Jun 2004 02:33:23 -0000	1.173
@@ -168,6 +168,23 @@
 	return -1;
 }
 
+int ScummEngine::getObjectImageCount(int object) {
+	const byte *ptr;
+	const ImageHeader *imhd;
+	int count, objnum;
+
+	objnum = getObjectIndex(object);
+	if (objnum == -1)
+		error("getObjectImageCount: object %d not in memory", object);
+
+	ptr = getOBIMFromObject(_objs[objnum]);
+	imhd = (const ImageHeader *)findResourceData(MKID('IMHD'), ptr);
+
+	count = READ_LE_UINT32(&imhd->v8.image_count);
+	debug(1, "getObjectImageCount: image count %d", count);
+	return count;
+}
+
 int ScummEngine::whereIsObject(int object) const {
 	int i;
 

Index: object.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- object.h	6 Jan 2004 12:45:30 -0000	1.8
+++ object.h	21 Jun 2004 02:33:23 -0000	1.9
@@ -131,7 +131,7 @@
 			char name[32];      //                                |
 			uint32 unk_1[2];	// always 0 ?                     v
 			uint32 version;		// 801; 801; 801; 801; 801; 801; 801
-			uint32 unk_2;		//   0;   0;   0;   0;   0:   1;   2
+			uint32 image_count;		//   0;   0;   0;   0;   0:   1;   2
 			uint32 x_pos;		//   0; 184; 264; 336; 450; 272;   0
 			uint32 y_pos;		//   0; 272; 248; 216; 168; 320;   0
 			uint32 width;		//  64; 128; 120; 128;  80;  48;  80

Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.248
retrieving revision 2.249
diff -u -d -r2.248 -r2.249
--- script_v8.cpp	5 Apr 2004 23:54:58 -0000	2.248
+++ script_v8.cpp	21 Jun 2004 02:33:23 -0000	2.249
@@ -1582,6 +1582,7 @@
 	int x = pop();
 	int obj = pop();
 	int objnum = getObjectIndex(obj);
+	int imagecount;
 	ObjectData *od;
 
 	if (!objnum)
@@ -1595,10 +1596,18 @@
 
 	addObjectToDrawQue(objnum);
 
-	if (state == 255 || state == 254)
-		warning("o8_drawObject(%d, %d, %d, %d): extended attributes unimplemented", x, y, objnum, state);
-	else
-		warning("o8_drawObject(%d, %d, %d, %d)", x, y, objnum, state);
+	if (state == 255) {
+		state = getState(obj);
+		imagecount = getObjectImageCount(obj);
+
+		if (imagecount != state)
+			state++;
+		else
+			state = 1;
+	}
+
+	if (state == 254)
+		state = _rnd.getRandomNumber(getObjectImageCount(obj));
 
 	putState(obj, state);
 }

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.403
retrieving revision 1.404
diff -u -d -r1.403 -r1.404
--- scumm.h	20 Jun 2004 21:01:31 -0000	1.403
+++ scumm.h	21 Jun 2004 02:33:23 -0000	1.404
@@ -723,6 +723,7 @@
 	int getObjOldDir(int obj);
 	int getObjNewDir(int obj);
 	int getObjectIndex(int object) const;
+	int getObjectImageCount(int object);
 	int whereIsObject(int object) const;
 	int findObject(int x, int y);
 	void findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint object, uint room);	





More information about the Scummvm-git-logs mailing list