SCI: Clean up the script initialization code
This commit is contained in:
parent
577d7e41c9
commit
e1ae110860
1 changed files with 8 additions and 22 deletions
|
@ -37,17 +37,22 @@ Script::Script() : SegmentObj(SEG_TYPE_SCRIPT) {
|
||||||
_buf = NULL;
|
_buf = NULL;
|
||||||
_bufSize = 0;
|
_bufSize = 0;
|
||||||
_scriptSize = 0;
|
_scriptSize = 0;
|
||||||
|
|
||||||
|
_heapStart = NULL;
|
||||||
_heapSize = 0;
|
_heapSize = 0;
|
||||||
|
|
||||||
_synonyms = NULL;
|
|
||||||
_heapStart = NULL;
|
|
||||||
_exportTable = NULL;
|
_exportTable = NULL;
|
||||||
|
_numExports = 0;
|
||||||
|
_synonyms = NULL;
|
||||||
|
_numSynonyms = 0;
|
||||||
|
|
||||||
_localsOffset = 0;
|
_localsOffset = 0;
|
||||||
_localsSegment = 0;
|
_localsSegment = 0;
|
||||||
_localsBlock = NULL;
|
_localsBlock = NULL;
|
||||||
_localsCount = 0;
|
_localsCount = 0;
|
||||||
|
|
||||||
|
_lockers = 1;
|
||||||
|
|
||||||
_markedAsDeleted = false;
|
_markedAsDeleted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,25 +70,11 @@ void Script::freeScript() {
|
||||||
|
|
||||||
void Script::init(int script_nr, ResourceManager *resMan) {
|
void Script::init(int script_nr, ResourceManager *resMan) {
|
||||||
Resource *script = resMan->findResource(ResourceId(kResourceTypeScript, script_nr), 0);
|
Resource *script = resMan->findResource(ResourceId(kResourceTypeScript, script_nr), 0);
|
||||||
|
|
||||||
if (!script)
|
if (!script)
|
||||||
error("Script %d not found", script_nr);
|
error("Script %d not found", script_nr);
|
||||||
|
|
||||||
_localsOffset = 0;
|
|
||||||
_localsBlock = NULL;
|
|
||||||
_localsCount = 0;
|
|
||||||
|
|
||||||
_markedAsDeleted = false;
|
|
||||||
|
|
||||||
_nr = script_nr;
|
_nr = script_nr;
|
||||||
_buf = 0;
|
_bufSize = _scriptSize = script->size;
|
||||||
_heapStart = 0;
|
|
||||||
|
|
||||||
_scriptSize = script->size;
|
|
||||||
_bufSize = script->size;
|
|
||||||
_heapSize = 0;
|
|
||||||
|
|
||||||
_lockers = 1;
|
|
||||||
|
|
||||||
if (getSciVersion() == SCI_VERSION_0_EARLY) {
|
if (getSciVersion() == SCI_VERSION_0_EARLY) {
|
||||||
_bufSize += READ_LE_UINT16(script->data) * 2;
|
_bufSize += READ_LE_UINT16(script->data) * 2;
|
||||||
|
@ -163,11 +154,6 @@ void Script::load(ResourceManager *resMan) {
|
||||||
memcpy(_heapStart, heap->data, heap->size);
|
memcpy(_heapStart, heap->data, heap->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
_exportTable = 0;
|
|
||||||
_numExports = 0;
|
|
||||||
_synonyms = 0;
|
|
||||||
_numSynonyms = 0;
|
|
||||||
|
|
||||||
if (getSciVersion() <= SCI_VERSION_1_LATE) {
|
if (getSciVersion() <= SCI_VERSION_1_LATE) {
|
||||||
_exportTable = (const uint16 *)findBlockSCI0(SCI_OBJ_EXPORTS);
|
_exportTable = (const uint16 *)findBlockSCI0(SCI_OBJ_EXPORTS);
|
||||||
if (_exportTable) {
|
if (_exportTable) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue