aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2002-12-31 02:09:57 +0000
committerMax Horn2002-12-31 02:09:57 +0000
commit166ea5bcee36aaab30ea6b7764bdc9872fc2dcf2 (patch)
tree50a5201e6cc80a9a7480c797b49458cd46d27b97 /scumm
parent1ce31266a981a94cdcdbf5831d0d02720b56ca71 (diff)
downloadscummvm-rg350-166ea5bcee36aaab30ea6b7764bdc9872fc2dcf2.tar.gz
scummvm-rg350-166ea5bcee36aaab30ea6b7764bdc9872fc2dcf2.tar.bz2
scummvm-rg350-166ea5bcee36aaab30ea6b7764bdc9872fc2dcf2.zip
get rid of DUMP_SCRIPTS; in its place, added run time option '-u' to enabled script dumping
svn-id: r6284
Diffstat (limited to 'scumm')
-rw-r--r--scumm/object.cpp14
-rw-r--r--scumm/resource.cpp6
-rw-r--r--scumm/scumm.h1
-rw-r--r--scumm/scummvm.cpp27
4 files changed, 22 insertions, 26 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp
index 22b1b68155..43c28b0576 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -440,16 +440,15 @@ void Scumm::loadRoomObjects()
else
od->obj_nr = READ_LE_UINT16(&(cdhd->v5.obj_id));
-#ifdef DUMP_SCRIPTS
- do {
+ if (_dumpScripts) {
char buf[32];
sprintf(buf, "roomobj-%d-", _roomResource);
if (_features & GF_AFTER_V8)
// TODO - maybe V8 is not the only that needs this?
ptr = findResource(MKID('VERB'), ptr, 0);
dumpResource(buf, od->obj_nr, ptr);
- } while (0);
-#endif
+ }
+
searchptr = NULL;
}
@@ -514,13 +513,12 @@ void Scumm::loadRoomObjectsSmall()
od->OBCDoffset = ptr - room;
od->obj_nr = READ_LE_UINT16(ptr + 6);
-#ifdef DUMP_SCRIPTS
- do {
+ if (_dumpScripts) {
char buf[32];
sprintf(buf, "roomobj-%d-", _roomResource);
dumpResource(buf, od->obj_nr, ptr);
- } while (0);
-#endif
+ }
+
searchptr = NULL;
}
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index 5a07623173..9788207ff3 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -585,12 +585,10 @@ int Scumm::loadResource(int type, int idx)
}
_fileHandle.read(createResource(type, idx, size), size);
- /* dump the resource */
-#ifdef DUMP_SCRIPTS
- if (type == rtScript) {
+ // dump the resource if requested
+ if (_dumpScripts && type == rtScript) {
dumpResource("script-", idx, getResourceAddress(rtScript, idx));
}
-#endif
if (!_fileHandle.ioFailed()) {
return 1;
diff --git a/scumm/scumm.h b/scumm/scumm.h
index 78b3e9c5c2..0a70e86e0b 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -377,6 +377,7 @@ public:
int16 _virtual_mouse_x, _virtual_mouse_y;
int _bootParam;
+ bool _dumpScripts;
uint16 _debugMode, _soundCardType;
/* Not sure where this stuff goes */
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index 12292137f7..bf94018b06 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -85,6 +85,7 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)
_debugMode = detector->_debugMode;
_debugLevel = detector->_debugLevel;
+ _dumpScripts = detector->_dumpScripts;
_bootParam = detector->_bootParam;
_exe_name = (char*)detector->_gameRealName.c_str();
_game_name = (char*)detector->_gameFileName.c_str();
@@ -755,18 +756,16 @@ void Scumm::initRoomSubBlocks()
ptr = findResourceData(MKID('EXCD'), roomResPtr);
if (ptr) {
_EXCD_offs = ptr - roomResPtr;
-#ifdef DUMP_SCRIPTS
- dumpResource("exit-", _roomResource, ptr - _resourceHeaderSize);
-#endif
+ if (_dumpScripts)
+ dumpResource("exit-", _roomResource, ptr - _resourceHeaderSize);
}
// Look for an entry script
ptr = findResourceData(MKID('ENCD'), roomResPtr);
if (ptr) {
_ENCD_offs = ptr - roomResPtr;
-#ifdef DUMP_SCRIPTS
- dumpResource("entry-", _roomResource, ptr - _resourceHeaderSize);
-#endif
+ if (_dumpScripts)
+ dumpResource("entry-", _roomResource, ptr - _resourceHeaderSize);
}
if (_features & GF_SMALL_HEADER) {
@@ -856,13 +855,13 @@ void Scumm::initRoomSubBlocks()
int id = 0;
ptr += _resourceHeaderSize; /* skip tag & size */
id = ptr[0];
-#ifdef DUMP_SCRIPTS
- do {
+
+ if (_dumpScripts) {
char buf[32];
sprintf(buf, "room-%d-", _roomResource);
dumpResource(buf, id, ptr - 6);
- } while (0);
-#endif
+ }
+
_localScriptList[id - _numGlobalScripts] = ptr + 1 - roomptr;
searchptr = NULL;
}
@@ -884,13 +883,13 @@ void Scumm::initRoomSubBlocks()
id = ptr[0];
_localScriptList[id - _numGlobalScripts] = ptr + 1 - roomResPtr;
}
-#ifdef DUMP_SCRIPTS
- do {
+
+ if (_dumpScripts) {
char buf[32];
sprintf(buf, "room-%d-", _roomResource);
dumpResource(buf, id, ptr - 8);
- } while (0);
-#endif
+ }
+
searchptr = NULL;
}
}