aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorScott Percival2019-11-05 00:01:25 +0800
committerEugene Sandulenko2019-11-17 22:31:54 +0100
commitcaf2a2301c9d14347442b9738e801cd0c171b580 (patch)
tree6d62c958e6c5cdfc8b7a5b64562122c3f77b884e /engines
parent82af1428405de8da6236dca7e352a7bf299174bb (diff)
downloadscummvm-rg350-caf2a2301c9d14347442b9738e801cd0c171b580.tar.gz
scummvm-rg350-caf2a2301c9d14347442b9738e801cd0c171b580.tar.bz2
scummvm-rg350-caf2a2301c9d14347442b9738e801cd0c171b580.zip
DIRECTOR: Fix functions_offset in addCodeV4
Diffstat (limited to 'engines')
-rw-r--r--engines/director/lingo/lingo-bytecode.cpp7
-rw-r--r--engines/director/lingo/lingo.cpp3
2 files changed, 7 insertions, 3 deletions
diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index 3b800f8fd9..af3ae68efe 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -93,14 +93,15 @@ void Lingo::addCodeV4(Common::SeekableSubReadStreamEndian &stream, ScriptType ty
for (uint32 i = 0; i < 0x2e; i++) {
stream.readByte();
}
- uint16 functions_offset = stream.readUint16();
+ uint16 globals_offset = stream.readUint16();
+ uint16 globals_count = stream.readUint16();
// unk3
- for (uint32 i = 0; i < 0x6; i++) {
+ for (uint32 i = 0; i < 0x4; i++) {
stream.readByte();
}
uint16 functions_count = stream.readUint16();
stream.readUint16();
- stream.readUint16();
+ uint16 functions_offset = stream.readUint16();
uint16 consts_count = stream.readUint16();
stream.readUint16();
uint16 consts_offset = stream.readUint16();
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index b0af7945b6..9864fc860c 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -123,6 +123,9 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
debugC(1, kDebugLingoCompile, "Add code \"%s\" for type %s with id %d", code, scriptType2str(type), id);
if (_scriptContexts[type].contains(id)) {
+ for (size_t j = 0; j < _scriptContexts[type][id]->functions.size(); j++) {
+ delete _scriptContexts[type][id]->functions[j];
+ }
delete _scriptContexts[type][id];
}