aboutsummaryrefslogtreecommitdiff
path: root/scumm/scummvm.cpp
diff options
context:
space:
mode:
authorMax Horn2003-04-28 13:59:57 +0000
committerMax Horn2003-04-28 13:59:57 +0000
commitab622ba5552d69cc5ea775fc513669a68e07e18b (patch)
treefd55784a5849e0e9e0f5f89e7c7cd84aaef516d9 /scumm/scummvm.cpp
parent6ae1ed74171ec1fa0a925a7e8c5cad0078f8e8a7 (diff)
downloadscummvm-rg350-ab622ba5552d69cc5ea775fc513669a68e07e18b.tar.gz
scummvm-rg350-ab622ba5552d69cc5ea775fc513669a68e07e18b.tar.bz2
scummvm-rg350-ab622ba5552d69cc5ea775fc513669a68e07e18b.zip
dump local resources in OLD_BUNDLE games, too (requires some hackery)
svn-id: r7179
Diffstat (limited to 'scumm/scummvm.cpp')
-rw-r--r--scumm/scummvm.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index 21a1c9d570..9275fd52ae 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -1089,7 +1089,20 @@ void Scumm::initRoomSubBlocks() {
_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 @@ void Scumm::initRoomSubBlocks() {
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 @@ void Scumm::initRoomSubBlocks() {
if (_dumpScripts) {
char buf[32];
sprintf(buf, "room-%d-", _roomResource);
- dumpResource(buf, id, ptr - 8);
+ dumpResource(buf, id, ptr - _resourceHeaderSize);
}
searchptr = NULL;