aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWalter van Niftrik2010-04-24 14:10:52 +0000
committerWalter van Niftrik2010-04-24 14:10:52 +0000
commitb6c92b90b6bed242bbea8521615ca971c81171ca (patch)
treecabd66fcde48b826898d92187e6db06e80090206
parentca93a6ce9c51d4d994ce2657c57794bea1cb7223 (diff)
downloadscummvm-rg350-b6c92b90b6bed242bbea8521615ca971c81171ca.tar.gz
scummvm-rg350-b6c92b90b6bed242bbea8521615ca971c81171ca.tar.bz2
scummvm-rg350-b6c92b90b6bed242bbea8521615ca971c81171ca.zip
SCI: Fix regression in locals init for re-used segments
svn-id: r48783
-rw-r--r--engines/sci/engine/script.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index b09462e70c..98fc47e2c0 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -167,7 +167,11 @@ void SegManager::scriptInitialiseLocalsZero(SegmentId seg, int count) {
scr->_localsOffset = -count * 2; // Make sure it's invalid
- allocLocalsSegment(scr, count);
+ LocalVariables *locals = allocLocalsSegment(scr, count);
+ if (locals) {
+ for (int i = 0; i < count; i++)
+ locals->_locals[i] = NULL_REG;
+ }
}
void SegManager::scriptInitialiseLocals(reg_t location) {
@@ -195,7 +199,7 @@ void SegManager::scriptInitialiseLocals(reg_t location) {
byte *base = (byte *)(scr->_buf + location.offset);
for (i = 0; i < count; i++)
- locals->_locals[i].offset = READ_LE_UINT16(base + i * 2);
+ locals->_locals[i] = make_reg(0, READ_LE_UINT16(base + i * 2));
}
}