diff options
author | Max Horn | 2009-09-16 23:32:48 +0000 |
---|---|---|
committer | Max Horn | 2009-09-16 23:32:48 +0000 |
commit | 68dfdce043546b6c6720d6c1b8e622ac552a4b00 (patch) | |
tree | e11bc1673774a327fb9038c1ce63b69b70e3700b /engines/sci/engine/memobj.cpp | |
parent | a277123f54c7dd6f6d784501830b4e8975d47c27 (diff) | |
download | scummvm-rg350-68dfdce043546b6c6720d6c1b8e622ac552a4b00.tar.gz scummvm-rg350-68dfdce043546b6c6720d6c1b8e622ac552a4b00.tar.bz2 scummvm-rg350-68dfdce043546b6c6720d6c1b8e622ac552a4b00.zip |
SCI: Turn some SegManager methods into Script methods
svn-id: r44127
Diffstat (limited to 'engines/sci/engine/memobj.cpp')
-rw-r--r-- | engines/sci/engine/memobj.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/engines/sci/engine/memobj.cpp b/engines/sci/engine/memobj.cpp index 9ed5eb8758..4697e0a706 100644 --- a/engines/sci/engine/memobj.cpp +++ b/engines/sci/engine/memobj.cpp @@ -114,7 +114,21 @@ void Script::freeScript() { _codeBlocks.clear(); } -void Script::init() { +bool Script::init(int script_nr, ResourceManager *resMan) { + setScriptSize(script_nr, resMan); + + _buf = (byte *)malloc(_bufSize); + +#ifdef DEBUG_segMan + printf("_buf = %p ", _buf); +#endif + if (!_buf) { + freeScript(); + warning("Not enough memory space for script size"); + _bufSize = 0; + return false; + } + _localsOffset = 0; _localsBlock = NULL; @@ -124,6 +138,16 @@ void Script::init() { _markedAsDeleted = false; _objIndices = new IntMapper(); + + _nr = script_nr; + + _sciVersion = resMan->sciVersion(); + if (_sciVersion >= SCI_VERSION_1_1) + _heapStart = _buf + _scriptSize; + else + _heapStart = _buf; + + return true; } Object *Script::allocateObject(uint16 offset) { |