aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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];
}