diff options
Diffstat (limited to 'engines/saga/script.cpp')
-rw-r--r-- | engines/saga/script.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/engines/saga/script.cpp b/engines/saga/script.cpp index f53aa3d663..a81635d587 100644 --- a/engines/saga/script.cpp +++ b/engines/saga/script.cpp @@ -85,15 +85,30 @@ Script::Script(SagaEngine *vm) : _vm(vm) { error("Script::Script() resource context not found"); } + uint32 scriptResourceId = 0; + + if (!_vm->isSaga2()) { + scriptResourceId = _vm->getResourceDescription()->moduleLUTResourceId; + debug(3, "Loading module LUT from resource %i", scriptResourceId); + _vm->_resource->loadResource(resourceContext, scriptResourceId, resourcePointer, resourceLength); + } else { + uint32 saga2DataSegId = MKID_BE('__DA'); + int32 scr = _scriptContext->getEntryNum(saga2DataSegId); + if (scr < 0) + error("Unable to locate the script's data segment"); + scriptResourceId = (uint32)scr; + debug(3, "Loading module LUT from resource %i", scriptResourceId); + _vm->_resource->loadResource(_scriptContext, scriptResourceId, resourcePointer, resourceLength); + + //uint32 saga2ExportSegId = MKID_BE('_EXP'); + // TODO: SAGA2 script export segment + } + // Do nothing for SAGA2 games for now if (_vm->isSaga2()) { return; } - debug(3, "Loading module LUT from resource %i", _vm->getResourceDescription()->moduleLUTResourceId); - _vm->_resource->loadResource(resourceContext, _vm->getResourceDescription()->moduleLUTResourceId, resourcePointer, resourceLength); - - // Create logical script LUT from resource if (resourceLength % S_LUT_ENTRYLEN_ITECD == 0) { _modulesLUTEntryLen = S_LUT_ENTRYLEN_ITECD; |