diff options
author | Filippos Karapetis | 2010-05-30 16:38:08 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-05-30 16:38:08 +0000 |
commit | 5cdb13b3e8a160e7eae14c03644ad3be5a38b415 (patch) | |
tree | 98eda07103196ae8754f9f069e43198cc0df87af /engines/sci/engine/segment.cpp | |
parent | c32e88fe0bb61e75ca983072ba28102d4efbf123 (diff) | |
download | scummvm-rg350-5cdb13b3e8a160e7eae14c03644ad3be5a38b415.tar.gz scummvm-rg350-5cdb13b3e8a160e7eae14c03644ad3be5a38b415.tar.bz2 scummvm-rg350-5cdb13b3e8a160e7eae14c03644ad3be5a38b415.zip |
Made load_script() a member of the Script class
svn-id: r49328
Diffstat (limited to 'engines/sci/engine/segment.cpp')
-rw-r--r-- | engines/sci/engine/segment.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp index 8267de76bd..30cfe2d046 100644 --- a/engines/sci/engine/segment.cpp +++ b/engines/sci/engine/segment.cpp @@ -147,6 +147,27 @@ bool Script::init(int script_nr, ResourceManager *resMan) { return true; } +void Script::load(ResourceManager *resMan) { + Resource *script = resMan->findResource(ResourceId(kResourceTypeScript, _nr), 0); + assert(script != 0); + + _buf = (byte *)malloc(_bufSize); + assert(_buf); + + assert(_bufSize >= script->size); + memcpy(_buf, script->data, script->size); + + if (getSciVersion() >= SCI_VERSION_1_1) { + Resource *heap = resMan->findResource(ResourceId(kResourceTypeHeap, _nr), 0); + assert(heap != 0); + + _heapStart = _buf + _scriptSize; + + assert(_bufSize - _scriptSize <= heap->size); + memcpy(_heapStart, heap->data, heap->size); + } +} + void Script::setScriptSize(int script_nr, ResourceManager *resMan) { Resource *script = resMan->findResource(ResourceId(kResourceTypeScript, script_nr), 0); Resource *heap = resMan->findResource(ResourceId(kResourceTypeHeap, script_nr), 0); |