[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.243,1.244 gfx.cpp,2.274,2.275 gfx.h,1.61,1.62 intern.h,2.167,2.168 resource.cpp,1.213,1.214 resource.h,1.9,1.10 script_v6.cpp,1.336,1.337 script_v7he.cpp,2.16,2.17 scumm.cpp,1.42,1.43 scumm.h,1.405,1.406

Eugene Sandulenko sev at users.sourceforge.net
Tue Jun 22 18:38:00 CEST 2004


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

Modified Files:
	actor.cpp gfx.cpp gfx.h intern.h resource.cpp resource.h 
	script_v6.cpp script_v7he.cpp scumm.cpp scumm.h 
Log Message:
HE 7.0 fixes

 o Stub for o7_startSound
 o graphics decoders
 o findResource was moved to ScummEngine and extended
 o 7.0+ titles use akos costumes, so fix that in launcher
 o more o6_resourceRoutines stubs

Now HE 7.0 games (first 320x200 windows ports) show intros and some are
playable to some extent.


Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.243
retrieving revision 1.244
diff -u -d -r1.243 -r1.244
--- actor.cpp	2 Apr 2004 21:42:33 -0000	1.243
+++ actor.cpp	23 Jun 2004 01:36:47 -0000	1.244
@@ -1624,7 +1624,7 @@
 		return;
 	}
 
-	akpl = findResource(MKID('AKPL'), akos);
+	akpl = _vm->findResource(MKID('AKPL'), akos);
 	if (!akpl) {
 		warning("Can't remap actor %d, costume %d doesn't contain an AKPL block", number, costume);
 		return;
@@ -1660,7 +1660,7 @@
 		return;
 	}
 
-	akpl = findResource(MKID('AKPL'), akos);
+	akpl = _vm->findResource(MKID('AKPL'), akos);
 	if (!akpl) {
 		warning("Can't remap actor %d, costume %d doesn't contain an AKPL block", number, costume);
 		return;
@@ -1672,7 +1672,7 @@
 	//skip resource header
 	akpl = RES_DATA(akpl);
 
-	rgbs = findResource(MKID('RGBS'), akos);
+	rgbs = _vm->findResource(MKID('RGBS'), akos);
 
 	if (!rgbs) {
 		warning("Can't remap actor %d costume %d doesn't contain an RGB block", number, costume);

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.274
retrieving revision 2.275
diff -u -d -r2.274 -r2.275
--- gfx.cpp	20 Jun 2004 20:54:18 -0000	2.274
+++ gfx.cpp	23 Jun 2004 01:36:57 -0000	2.275
@@ -466,7 +466,11 @@
 		initVirtScreen(kMainVirtScreen, 0, virtscr[0].topline, _screenWidth, height, 1, 1);
 	}
 
-	room = getResourceAddress(rtRoom, _roomResource);
+	if (_heversion >= 70)
+		room = getResourceAddress(rtLast, _roomResource);
+	else
+		room = getResourceAddress(rtRoom, _roomResource);
+
 	if (_version <= 3) {
 		gdi._numZBuffer = 2;
 	} else if (_features & GF_SMALL_HEADER) {
@@ -488,6 +492,9 @@
 		// in V8 there is no RMIH and num z buffers is in RMHD
 		ptr = findResource(MKID('RMHD'), room);
 		gdi._numZBuffer = READ_LE_UINT32(ptr + 24) + 1;
+	} else if (_heversion >= 70) {
+		ptr = findResource(MKID('RMIH'), room);
+		gdi._numZBuffer = READ_LE_UINT16(ptr + 8) + 1;
 	} else {
 		ptr = findResource(MKID('RMIH'), findResource(MKID('RMIM'), room));
 		gdi._numZBuffer = READ_LE_UINT16(ptr + 8) + 1;
@@ -566,6 +573,8 @@
 }
 
 void ScummEngine::redrawBGStrip(int start, int num) {
+	byte *room;
+
 	int s = _screenStartStrip + start;
 
 	assert(s >= 0 && (size_t) s < sizeof(gfxUsageBits) / (3 * sizeof(gfxUsageBits[0])));
@@ -576,7 +585,12 @@
 	if (_version == 1) {
 		gdi._C64ObjectMode = false;
 	}
-	gdi.drawBitmap(getResourceAddress(rtRoom, _roomResource) + _IM00_offs,
+	if (_heversion >= 70)
+		room = getResourceAddress(rtRoomStart, _roomResource);
+	else
+		room = getResourceAddress(rtRoom, _roomResource);
+
+	gdi.drawBitmap(room + _IM00_offs,
 					&virtscr[0], s, 0, _roomWidth, virtscr[0].height, s, num, 0, _roomStrips);
 }
 
@@ -922,7 +936,7 @@
 	else if (_vm->_version == 8)
 		smap_ptr = ptr;
 	else
-		smap_ptr = findResource(MKID('SMAP'), ptr);
+		smap_ptr = _vm->findResource(MKID('SMAP'), ptr);
 
 	assert(smap_ptr);
 
@@ -974,7 +988,7 @@
 			};
 			
 			for (i = 1; i < numzbuf; i++) {
-				zplane_list[i] = findResource(zplane_tags[i], ptr);
+				zplane_list[i] = _vm->findResource(zplane_tags[i], ptr);
 			}
 		}
 	}
@@ -1632,6 +1646,23 @@
 		unkDecodeA_trans(bgbak_ptr, src, numLinesToProcess);
 		break;
 
+	case 134:
+	case 135:
+	case 136:
+	case 137:
+	case 138:
+		decodeStripHE(bgbak_ptr, src, numLinesToProcess, false);
+		break;
+
+	case 144:
+	case 145:
+	case 146:
+	case 147:
+	case 148:
+		useOrDecompress = true;
+		decodeStripHE(bgbak_ptr, src, numLinesToProcess, true);
+		break;
+
 	default:
 		error("Gdi::decompressBitmap: default case %d", code);
 	}
@@ -2241,6 +2272,56 @@
 }
 
 
+void Gdi::decodeStripHE(byte *dst, const byte *src, int height, byte transpCheck) {
+	uint32 color, dataBit, data, shift, iteration;
+
+     color = *src;
+	 src++;
+	 data = READ_LE_UINT24(src);
+	 src += 3;
+     shift = 24;
+
+	 while (height) {
+		 for (iteration = 0; iteration < 8; iteration++) {
+			 if (color != _transparentColor || !transpCheck)
+				 *dst = color;
+			 dst++;
+			 if (shift <= 16) {
+				 data |= *src << shift;
+				 src++;
+				 shift += 8;
+				 data |= *src << shift;
+				 src++;
+				 shift += 8;
+			 }
+			 
+			 dataBit = data & 1;
+			 shift--;
+			 data >>= 1;
+			 if (dataBit) {
+				 dataBit = data & 1;
+				 shift--;
+				 data >>= 1;
+				 if (!dataBit) {
+					 color = _decomp_mask & data;
+					 shift -= _decomp_shr;
+					 data >>= _decomp_shr;
+				 } else {
+					 dataBit = data & 7;
+					 shift -= 3;
+					 data >>= 3;
+					 if (dataBit >= 4)
+						 color += dataBit - 3;
+					 else
+						 color += dataBit - 4;
+				 }
+			 }
+		 }
+		 dst += 312;
+		 height--;
+	 }
+}
+
 #undef NEXT_ROW
 #undef READ_256BIT
 

Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.h,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- gfx.h	20 Jun 2004 20:54:18 -0000	1.61
+++ gfx.h	23 Jun 2004 01:36:57 -0000	1.62
@@ -249,6 +249,7 @@
 	void unkDecode10(byte *dst, const byte *src, int height);
 	void unkDecode11(byte *dst, const byte *src, int height);
 	void decodeStrip3DO(byte *dst, const byte *src, int height, byte transpCheck);
+	void decodeStripHE(byte *dst, const byte *src, int height, byte transpCheck);
 
 	void draw8ColWithMasking(byte *dst, const byte *src, int height, byte *mask);
 	void draw8Col(byte *dst, const byte *src, int height);

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.167
retrieving revision 2.168
diff -u -d -r2.167 -r2.168
--- intern.h	22 Jun 2004 10:39:46 -0000	2.167
+++ intern.h	23 Jun 2004 01:36:57 -0000	2.168
@@ -636,6 +636,7 @@
 	void o7_unknownFB();
 	void o7_quitPauseRestart();
 	void o7_pickupObject();
+	void o7_startSound();
 };
 
 class ScummEngine_v7 : public ScummEngine_v6 {

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.213
retrieving revision 1.214
diff -u -d -r1.213 -r1.214
--- resource.cpp	22 Jun 2004 13:52:38 -0000	1.213
+++ resource.cpp	23 Jun 2004 01:36:57 -0000	1.214
@@ -2283,21 +2283,32 @@
 	return result;
 }
 
-const byte *findResource(uint32 tag, const byte *searchin) {
+const byte *ScummEngine::findResource(uint32 tag, const byte *searchin) {
 	uint32 curpos, totalsize, size;
 
-	// It seems that in HE games if searchin == NULL, it continues
-	// search from last position
-	assert(searchin);
+	debugC(DEBUG_RESOURCE, "findResource(%s, %lx)", tag2str(tag), searchin);
 
-	searchin += 4;
-	totalsize = READ_BE_UINT32(searchin);
-	curpos = 8;
-	searchin += 4;
+	if (!searchin) {
+		if (_heversion >= 70) {
+			searchin = _resourceLastSearchBuf;
+			totalsize = _resourceLastSearchSize;
+			curpos = 0;
+		} else {
+			assert(searchin);
+			return NULL;
+		}
+	} else {
+		searchin += 4;
+		_resourceLastSearchSize = totalsize = READ_BE_UINT32(searchin);
+		curpos = 8;
+		searchin += 4;
+	}
 
 	while (curpos < totalsize) {
-		if (READ_UINT32(searchin) == tag)
+		if (READ_UINT32(searchin) == tag) {
+			_resourceLastSearchBuf = searchin;
 			return searchin;
+		}
 
 		size = READ_BE_UINT32(searchin + 4);
 		if ((int32)size <= 0) {

Index: resource.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- resource.h	19 Jan 2004 20:27:31 -0000	1.9
+++ resource.h	23 Jun 2004 01:36:57 -0000	1.10
@@ -59,7 +59,6 @@
 };
 
 
-const byte *findResource(uint32 tag, const byte *searchin);
 const byte *findResourceSmall(uint32 tag, const byte *searchin);
 
 class ResourceIterator {

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.336
retrieving revision 1.337
diff -u -d -r1.336 -r1.337
--- script_v6.cpp	20 Jun 2004 21:01:31 -0000	1.336
+++ script_v6.cpp	23 Jun 2004 01:36:57 -0000	1.337
@@ -386,7 +386,7 @@
 int ScummEngine_v6::popRoomAndObj(int *room) {
 	int obj;
 
-	if (_version >= 7) {
+	if (_version >= 7 || _heversion >= 70) {
 		obj = pop();
 		*room = getObjectRoom(obj);
 	} else {
@@ -1461,6 +1461,7 @@
 	int resid, op;
 	op = fetchScriptByte();
 
+	debug(0, "resourceRoutines op: %d", op);
 	switch (op) {
 	case 100:		// SO_LOAD_SCRIPT
 		resid = pop();
@@ -1586,7 +1587,7 @@
 			// QL_QueGlobForLoad(3, pop(), 1);
 			break;
 		}
-	case 123: 
+	case 123:
 		{
 			if (_heversion < 70)
 				error("o6_resourceRoutines: default case %d", op);
@@ -1597,6 +1598,16 @@
 			// QL_QueGlobForLoad(1, resid, 1);
 			break;
 		}
+	case 233:
+		resid = pop();
+		warning("stub o6_resourceRoutines resource %d, 1", resid);
+		// foo(resid, 1);
+		break;
+	case 235:
+		resid = pop();
+		warning("stub o6_resourceRoutines resource %d, 0", resid);
+		// foo(resid, 0);
+		break;
 	default:
 		error("o6_resourceRoutines: default case %d", op);
 	}

Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.16
retrieving revision 2.17
diff -u -d -r2.16 -r2.17
--- script_v7he.cpp	22 Jun 2004 10:39:46 -0000	2.16
+++ script_v7he.cpp	23 Jun 2004 01:36:57 -0000	2.17
@@ -196,7 +196,7 @@
 		OPCODE(o6_getOwner),
 		OPCODE(o6_jump),
 		/* 74 */
-		OPCODE(o6_startSound),
+		OPCODE(o7_startSound),
 		OPCODE(o6_stopSound),
 		OPCODE(o6_startMusic),
 		OPCODE(o6_stopObjectScript),
@@ -644,4 +644,48 @@
 }
 
 
+void ScummEngine_v7he::o7_startSound() {
+	byte op;
+	op = fetchScriptByte();
+
+	switch (op) {
+	case 224:
+		// _staticVar1 = pop();
+		pop();
+		break;
+
+	case 230:
+		// _staticVar2 = pop();
+		pop();
+		break;
+
+	case 231:
+		// _staticVar3 = pop();
+		pop();
+		break;
+
+	case 232:
+		pop();
+		// _staticVar4 = pop();
+		// _staticVar3 = 0;
+		// _staticVar1 = 11025;
+		// _staticVar2 = VAR(VAR_MUSIC_TIMER);
+		break;
+
+	case 245:
+		// _staticVar5 |= 1;
+		break;
+
+	case 255:
+		// _sound->addSoundToQueue(_staticVar4, _staticVar3, _staticVar2, _staticVar5);
+		// _staticVar5 = 0;
+		break;
+
+	default:
+		break;
+	}
+	warning("o7_startSound stub (%d)", op);
+}
+
+
 } // End of namespace Scumm

Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- scumm.cpp	21 Jun 2004 10:06:52 -0000	1.42
+++ scumm.cpp	23 Jun 2004 01:36:57 -0000	1.43
@@ -2060,6 +2060,7 @@
 	}
 
 	initRoomSubBlocks();
+
 	if (_features & GF_OLD_BUNDLE)
 		loadRoomObjectsOldBundle();
 	else if (_features & GF_SMALL_HEADER)
@@ -2149,7 +2150,7 @@
 void ScummEngine::initRoomSubBlocks() {
 	int i;
 	const byte *ptr;
-	byte *roomptr, *searchptr, *roomResPtr;
+	byte *roomptr, *searchptr, *roomResPtr, *roomStartPtr = 0;
 	const RoomHeader *rmhd;
 
 	_ENCD_offs = 0;
@@ -2169,7 +2170,9 @@
 
 	// Determine the room and room script base address
 	roomResPtr = roomptr = getResourceAddress(rtRoom, _roomResource);
-	if (_version == 8)
+	if (_heversion >= 70)
+		roomStartPtr = getResourceAddress(rtRoomStart, _roomResource);
+	else if (_version == 8)
 		roomResPtr = getResourceAddress(rtRoomScripts, _roomResource);
 	if (!roomptr || !roomResPtr)
 		error("Room %d: data not found (" __FILE__  ":%d)", _roomResource, __LINE__);
@@ -2222,6 +2225,8 @@
 		_IM00_offs = getObjectImage(roomptr, 1) - roomptr;
 	} else if (_features & GF_SMALL_HEADER) {
 		_IM00_offs = findResourceData(MKID('IM00'), roomptr) - roomptr;
+	} else if (_heversion >= 70) {
+		_IM00_offs = findResource(MKID('IM00'), roomStartPtr) - roomStartPtr;
 	} else {
 		_IM00_offs = findResource(MKID('IM00'), findResource(MKID('RMIM'), roomptr)) - roomptr;
 	}
@@ -2990,8 +2995,10 @@
 
 		// There are both Windows and DOS versions of early HE titles
 		// specify correct version here
-		if (game.features & GF_HUMONGOUS && (game.heversion == 60 || game.id == GID_PUTTDEMO))
+		if (game.features & GF_HUMONGOUS && (game.heversion == 60 || game.id == GID_PUTTDEMO)) {
 			game.heversion = 70;
+			game.features |= GF_NEW_COSTUMES;
+		}
 		break;
 	case Common::kPlatformFMTowns:
 		if (game.version == 3) {

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.405
retrieving revision 1.406
diff -u -d -r1.405 -r1.406
--- scumm.h	22 Jun 2004 13:52:39 -0000	1.405
+++ scumm.h	23 Jun 2004 01:36:57 -0000	1.406
@@ -204,6 +204,7 @@
 	rtBox = 15,
 	rtObjectName = 16,
 	rtRoomScripts = 17,
+	rtRoomStart = 17,
 	rtLast = 17,
 	rtNumTypes = 18
 };
@@ -626,6 +627,8 @@
 	byte _expire_counter;
 	byte *_HEV7RoomOffsets;
 	uint32 *_HEV7RoomIntOffsets;
+	const byte *_resourceLastSearchBuf; // FIXME: need to put it to savefile?
+	uint32 _resourceLastSearchSize;    // FIXME: need to put it to savefile?
 
 	void allocateArrays();
 	void openRoom(int room);
@@ -677,6 +680,7 @@
 	int _lastLoadedRoom;
 public:
 	const byte *findResourceData(uint32 tag, const byte *ptr);
+	const byte *findResource(uint32 tag, const byte *ptr);
 	int getResourceDataSize(const byte *ptr) const;
 	void dumpResource(const char *tag, int index, const byte *ptr, int length = -1);
 





More information about the Scummvm-git-logs mailing list