diff options
author | Bastien Bouclet | 2010-11-29 21:01:30 +0000 |
---|---|---|
committer | Bastien Bouclet | 2010-11-29 21:01:30 +0000 |
commit | c393f8f9d20bee7e0a1724a54ddad1dcd130f00c (patch) | |
tree | d9e06faa1d61a87b34b42f7825ee88d8c76462e5 /engines/mohawk | |
parent | 3bd40b0d4b322625e9ecbe4ee586ce2f2f7160a7 (diff) | |
download | scummvm-rg350-c393f8f9d20bee7e0a1724a54ddad1dcd130f00c.tar.gz scummvm-rg350-c393f8f9d20bee7e0a1724a54ddad1dcd130f00c.tar.bz2 scummvm-rg350-c393f8f9d20bee7e0a1724a54ddad1dcd130f00c.zip |
MOHAWK: Implement retrieving the invoking resource from data for init and exit scripts.
svn-id: r54639
Diffstat (limited to 'engines/mohawk')
-rw-r--r-- | engines/mohawk/myst_scripts.cpp | 13 | ||||
-rw-r--r-- | engines/mohawk/myst_scripts.h | 2 |
2 files changed, 10 insertions, 5 deletions
diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp index fccb2e253f..f9a1315bde 100644 --- a/engines/mohawk/myst_scripts.cpp +++ b/engines/mohawk/myst_scripts.cpp @@ -41,7 +41,7 @@ MystScriptEntry::MystScriptEntry() { var = 0; argc = 0; argv = 0; - u0 = 0; + resourceId = 0; u1 = 0; } @@ -154,12 +154,17 @@ void MystScriptParser::setupOpcodes() { } void MystScriptParser::runScript(MystScript script, MystResource *invokingResource) { - _invokingResource = invokingResource; - debugC(kDebugScript, "Script Size: %d", script->size()); for (uint16 i = 0; i < script->size(); i++) { MystScriptEntry &entry = script->operator[](i); debugC(kDebugScript, "\tOpcode %d: %d", i, entry.opcode); + + if (entry.type == kMystScriptNormal) { + _invokingResource = invokingResource; + } else { + _invokingResource = _vm->_resources[entry.resourceId]; + } + runOpcode(entry.opcode, entry.var, entry.argc, entry.argv); } } @@ -202,7 +207,7 @@ MystScript MystScriptParser::readScript(Common::SeekableReadStream *stream, Myst // u0 only exists in INIT and EXIT scripts if (type != kMystScriptNormal) - entry.u0 = stream->readUint16LE(); + entry.resourceId = stream->readUint16LE(); entry.opcode = stream->readUint16LE(); entry.var = stream->readUint16LE(); diff --git a/engines/mohawk/myst_scripts.h b/engines/mohawk/myst_scripts.h index 0a741cec11..9be9113393 100644 --- a/engines/mohawk/myst_scripts.h +++ b/engines/mohawk/myst_scripts.h @@ -49,7 +49,7 @@ struct MystScriptEntry { ~MystScriptEntry(); MystScriptType type; - uint16 u0; + uint16 resourceId; uint16 opcode; uint16 var; uint16 argc; |