[Scummvm-cvs-logs] CVS: scummvm/scumm scummvm.cpp,2.107,2.108

Max Horn fingolfin at users.sourceforge.net
Mon Apr 28 07:01:01 CEST 2003


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

Modified Files:
	scummvm.cpp 
Log Message:
dump local resources in OLD_BUNDLE games, too (requires some hackery)

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.107
retrieving revision 2.108
diff -u -d -r2.107 -r2.108
--- scummvm.cpp	28 Apr 2003 13:35:36 -0000	2.107
+++ scummvm.cpp	28 Apr 2003 13:59:57 -0000	2.108
@@ -1089,7 +1089,20 @@
 				_localScriptList[id - _numGlobalScripts] = READ_LE_UINT16(ptr + 1);
 				ptr += 3;
 				
-				// TODO: add script dumping, but how do we determine the script length?
+				if (_dumpScripts) {
+					char buf[32];
+					sprintf(buf, "room-%d-", _roomResource);
+
+					// HACK: to determine the sizes of the local scripts, we assume that
+					// a) their order in the data file is the same as in the index
+					// b) the last script at the same time is the last item in the room "header"
+					int len = - _localScriptList[id - _numGlobalScripts] + _resourceHeaderSize;
+					if (*ptr)
+						len += READ_LE_UINT16(ptr + 1);
+					else
+						len += READ_LE_UINT16(roomResPtr);
+					dumpResource(buf, id, roomResPtr + _localScriptList[id - _numGlobalScripts] - _resourceHeaderSize, len);
+				}
 			}
 		}
 	} else if (_features & GF_SMALL_HEADER) {
@@ -1101,7 +1114,7 @@
 			if (_dumpScripts) {
 				char buf[32];
 				sprintf(buf, "room-%d-", _roomResource);
-				dumpResource(buf, id, ptr - 6);
+				dumpResource(buf, id, ptr - _resourceHeaderSize);
 			}
 
 			_localScriptList[id - _numGlobalScripts] = ptr + 1 - roomptr;
@@ -1129,7 +1142,7 @@
 			if (_dumpScripts) {
 				char buf[32];
 				sprintf(buf, "room-%d-", _roomResource);
-				dumpResource(buf, id, ptr - 8);
+				dumpResource(buf, id, ptr - _resourceHeaderSize);
 			}
 
 			searchptr = NULL;





More information about the Scummvm-git-logs mailing list