aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/script.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2010-05-30 21:49:07 +0000
committerFilippos Karapetis2010-05-30 21:49:07 +0000
commita0ee93ece52213cd989a50902281d917fe392ea4 (patch)
treec3f56972fc286a2fd399ad61dd0fd1d648b9a775 /engines/sci/engine/script.cpp
parente13abd77e92a4c363731f4a6775aa26865bb4ad6 (diff)
downloadscummvm-rg350-a0ee93ece52213cd989a50902281d917fe392ea4.tar.gz
scummvm-rg350-a0ee93ece52213cd989a50902281d917fe392ea4.tar.bz2
scummvm-rg350-a0ee93ece52213cd989a50902281d917fe392ea4.zip
SCI: Script exports and synonyms are now initialized when a script is loaded. Removed a sanity check inside script_instantiate_sci0 for a bug which no longer exists
svn-id: r49336
Diffstat (limited to 'engines/sci/engine/script.cpp')
-rw-r--r--engines/sci/engine/script.cpp26
1 files changed, 2 insertions, 24 deletions
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index fda7d05aa0..793f78e030 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -275,9 +275,7 @@ int script_instantiate_common(ResourceManager *resMan, SegManager *segMan, int s
// Set heap position (beyond the size word)
scr->setLockers(1);
- scr->setExportTableOffset(0);
- scr->setSynonymsOffset(0);
- scr->setSynonymsNr(0);
+
*was_new = 0;
@@ -309,7 +307,7 @@ int script_instantiate_sci0(ResourceManager *resMan, SegManager *segMan, int scr
}
// Now do a first pass through the script objects to find the
- // export table and local variable block
+ // local variable blocks
do {
objType = scr->getHeap(curOffset);
@@ -317,29 +315,12 @@ int script_instantiate_sci0(ResourceManager *resMan, SegManager *segMan, int scr
break;
objLength = scr->getHeap(curOffset + 2);
-
- // This happens in some demos (e.g. the EcoQuest 1 demo). Not sure what is the
- // actual cause of it, but the scripts of these demos can't be loaded properly
- // and we're stuck forever in this loop, as objLength never changes
- if (!objLength) {
- warning("script_instantiate_sci0: objLength is 0, unable to parse script");
- return 0;
- }
-
curOffset += 4; // skip header
switch (objType) {
- case SCI_OBJ_EXPORTS:
- scr->setExportTableOffset(curOffset);
- break;
- case SCI_OBJ_SYNONYMS:
- scr->setSynonymsOffset(curOffset);
- scr->setSynonymsNr((objLength) / 4);
- break;
case SCI_OBJ_LOCALVARS:
segMan->scriptInitialiseLocals(make_reg(seg_id, curOffset));
break;
-
case SCI_OBJ_CLASS: {
int classpos = curOffset - SCRIPT_OBJECT_MAGIC_OFFSET;
int species = scr->getHeap(curOffset - SCRIPT_OBJECT_MAGIC_OFFSET + SCRIPT_SPECIES_OFFSET);
@@ -424,9 +405,6 @@ int script_instantiate_sci11(ResourceManager *resMan, SegManager *segMan, int sc
Script *scr = segMan->getScript(seg_id);
- if (READ_SCI11ENDIAN_UINT16(scr->_buf + 6) > 0)
- scr->setExportTableOffset(6);
-
int heapStart = scr->getScriptSize();
segMan->scriptInitialiseLocals(make_reg(seg_id, heapStart + 4));
segMan->scriptInitialiseObjectsSci11(seg_id);