aboutsummaryrefslogtreecommitdiff
path: root/sword1/screen.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2004-03-01 08:04:10 +0000
committerTorbjörn Andersson2004-03-01 08:04:10 +0000
commit82c451774cbdd25566cd417adf60d5de47a7b039 (patch)
tree61f28cf0690e76628d7519f0a90d444c3af079d8 /sword1/screen.cpp
parent85f888e5821fa372c9cc50f8da84d74a778edddc (diff)
downloadscummvm-rg350-82c451774cbdd25566cd417adf60d5de47a7b039.tar.gz
scummvm-rg350-82c451774cbdd25566cd417adf60d5de47a7b039.tar.bz2
scummvm-rg350-82c451774cbdd25566cd417adf60d5de47a7b039.zip
When scrolling, force a full redraw not only when the scroll offset changes
but also on the first frame where it doesn't. This is necessary because parallax layers may be drawn on the *old* scroll offset (for reasons unknown to me). To see the bug, walk right from the first screen until you reach the tree. Notice how the part of the tree you walk behind gets redrawn slightly to the left. svn-id: r13120
Diffstat (limited to 'sword1/screen.cpp')
-rw-r--r--sword1/screen.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/sword1/screen.cpp b/sword1/screen.cpp
index c037b1ae72..cc422bcd6c 100644
--- a/sword1/screen.cpp
+++ b/sword1/screen.cpp
@@ -70,6 +70,11 @@ void Screen::setScrolling(int16 offsetX, int16 offsetY) {
Logic::_scriptVars[SCROLL_FLAG] = 1;
_fullRefresh = true;
} else if (Logic::_scriptVars[SCROLL_FLAG] == 1) {
+ // Because parallax layers may be drawn on the old scroll offset, we
+ // want a full refresh not only when the scroll offset changes, but
+ // also on the frame where they become the same.
+ if (_oldScrollX != Logic::_scriptVars[SCROLL_OFFSET_X] || _oldScrollY != Logic::_scriptVars[SCROLL_OFFSET_Y])
+ _fullRefresh = true;
_oldScrollX = Logic::_scriptVars[SCROLL_OFFSET_X];
_oldScrollY = Logic::_scriptVars[SCROLL_OFFSET_Y];
int32 distX = inRange(-MAX_SCROLL_DISTANCE, _oldScrollX - offsetX, MAX_SCROLL_DISTANCE);