aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2011-12-17 16:39:01 +0100
committerWillem Jan Palenstijn2011-12-17 16:40:15 +0100
commit3185dac25e2f1984ccf92e7c33eee12caa6cd676 (patch)
tree4af2588d3bed85be9564ef9269d5337486a0979a
parent9fdb38d39510d81de43c887e95bae5b6e6a91156 (diff)
downloadscummvm-rg350-3185dac25e2f1984ccf92e7c33eee12caa6cd676.tar.gz
scummvm-rg350-3185dac25e2f1984ccf92e7c33eee12caa6cd676.tar.bz2
scummvm-rg350-3185dac25e2f1984ccf92e7c33eee12caa6cd676.zip
DREAMWEB: Work around runtime limitation
The WordRef accessor writes back its value too late. Example: in the call printDirect(data.word(kLastxpos), .....) the destructor isn't called until after printDirect returns. This destroys the modifications to lastXPos that printDirect makes.
-rw-r--r--engines/dreamweb/segment.h5
-rw-r--r--engines/dreamweb/use.cpp3
2 files changed, 7 insertions, 1 deletions
diff --git a/engines/dreamweb/segment.h b/engines/dreamweb/segment.h
index 9464015478..65bc2335ea 100644
--- a/engines/dreamweb/segment.h
+++ b/engines/dreamweb/segment.h
@@ -56,6 +56,11 @@ public:
}
inline ~WordRef() {
+ // FIXME: This is _too late_ to write back the
+ // value. Example: in the call
+ // printDirect(data.word(kLastxpos), .....)
+ // the destructor isn't called until after printDirect returns. This
+ // destroys the modifications to lastXPos that printDirect makes.
_data[0] = _value & 0xff;
_data[1] = _value >> 8;
_value = _data[0] | (_data[1] << 8);
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp
index 4be3c7a6b3..ba1e8e4952 100644
--- a/engines/dreamweb/use.cpp
+++ b/engines/dreamweb/use.cpp
@@ -1581,7 +1581,8 @@ void DreamGenContext::withWhat() {
copyName(data.byte(kObjecttype), data.byte(kCommand), commandLine);
printMessage2(100, 21, 63, 200, false, 2);
- printDirect(commandLine, data.word(kLastxpos) + 5, 21, 220, false);
+ uint16 x = data.word(kLastxpos) + 5;
+ printDirect(commandLine, x, 21, 220, false);
printMessage2(data.word(kLastxpos) + 5, 21, 63, 200, false, 3);
fillRyan();