diff options
author | Max Horn | 2009-05-14 23:39:36 +0000 |
---|---|---|
committer | Max Horn | 2009-05-14 23:39:36 +0000 |
commit | bd2e21c97afa10901fc8674fd23a76c6e3148fd4 (patch) | |
tree | d16f6b4cb6fe52c4ab0aeec003debd4b5a618cbc /engines/sci | |
parent | d2dfa0ac11ec1c5318ecef901919d260a27da30e (diff) | |
download | scummvm-rg350-bd2e21c97afa10901fc8674fd23a76c6e3148fd4.tar.gz scummvm-rg350-bd2e21c97afa10901fc8674fd23a76c6e3148fd4.tar.bz2 scummvm-rg350-bd2e21c97afa10901fc8674fd23a76c6e3148fd4.zip |
SCI: Fixed restoring scripts when loading a SCI 1.1 savestate
svn-id: r40582
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/savegame.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 8278730d61..a4f3606519 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -580,14 +580,22 @@ static void reconstruct_scripts(EngineState *s, SegManager *self) { case MEM_OBJ_SCRIPT: { Script *scr = (Script *)mobj; + // FIXME: Unify this code with script_instantiate_* load_script(s, i); scr->locals_block = (scr->locals_segment == 0) ? NULL : (LocalVariables *)(s->seg_manager->_heap[scr->locals_segment]); - scr->export_table = (uint16 *) find_unique_script_block(s, scr->buf, SCI_OBJ_EXPORTS); - scr->synonyms = find_unique_script_block(s, scr->buf, SCI_OBJ_SYNONYMS); - scr->_codeBlocks.clear(); - - if (!self->isSci1_1) + if (s->seg_manager->isSci1_1) { + scr->export_table = 0; + scr->synonyms = 0; + if (READ_LE_UINT16(scr->buf + 6) > 0) { + scr->export_table = (uint16 *)(scr->buf + 8); + scr->exports_nr = READ_LE_UINT16((byte *)(scr->export_table - 1)); + } + } else { + scr->export_table = (uint16 *) find_unique_script_block(s, scr->buf, SCI_OBJ_EXPORTS); + scr->synonyms = find_unique_script_block(s, scr->buf, SCI_OBJ_SYNONYMS); scr->export_table += 3; + } + scr->_codeBlocks.clear(); for (j = 0; j < scr->_objects.size(); j++) { byte *data = scr->buf + scr->_objects[j].pos.offset; |