diff options
author | Denis Kasak | 2009-06-28 16:28:16 +0000 |
---|---|---|
committer | Denis Kasak | 2009-06-28 16:28:16 +0000 |
commit | 6a78781889a9803ae06f2818c2809f2625baefb8 (patch) | |
tree | f050c6533978cdc61812f115222f03ae37d01a0a /engines/draci/script.cpp | |
parent | f61b2d289d0e6ec960e20ac5b59a0fe7dfe8740e (diff) | |
download | scummvm-rg350-6a78781889a9803ae06f2818c2809f2625baefb8.tar.gz scummvm-rg350-6a78781889a9803ae06f2818c2809f2625baefb8.tar.bz2 scummvm-rg350-6a78781889a9803ae06f2818c2809f2625baefb8.zip |
Added an offset parameter to Script::run() so we can specify where to start the GPL program execution. Also, the init script for the dragon object is now run inside Game::Game().
svn-id: r41928
Diffstat (limited to 'engines/draci/script.cpp')
-rw-r--r-- | engines/draci/script.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp index 751aadc3f3..ce38960265 100644 --- a/engines/draci/script.cpp +++ b/engines/draci/script.cpp @@ -247,6 +247,7 @@ GPL2Command *Script::findCommand(byte num, byte subnum) { /** * @brief GPL2 bytecode disassembler * @param program GPL program in the form of a GPL2Program struct + * offset Offset into the program where execution should begin * * GPL2 is short for Game Programming Language 2 which is the script language * used by Draci Historie. This is a simple disassembler for the language. @@ -274,9 +275,17 @@ GPL2Command *Script::findCommand(byte num, byte subnum) { * value comes from. */ -int Script::run(GPL2Program program) { +int Script::run(GPL2Program program, uint16 offset) { Common::MemoryReadStream reader(program._bytecode, program._length); + // Offset is given as number of 16-bit integers so we need to convert + // it to a number of bytes + offset -= 1; + offset *= 2; + + // Seek to the requested part of the program + reader.seek(offset); + GPL2Command *cmd; do { // read in command pair |