aboutsummaryrefslogtreecommitdiff
path: root/sword1/screen.cpp
diff options
context:
space:
mode:
authorRobert Göffringmann2003-12-21 17:45:15 +0000
committerRobert Göffringmann2003-12-21 17:45:15 +0000
commit6df4db88cd9f95cb7112d1d27236c870ea09447d (patch)
treebbcfec21b05a68d495ed9f32a6730a4555f529d9 /sword1/screen.cpp
parent21ab8e496e6eb64b73ede399e84122f38c916b1d (diff)
downloadscummvm-rg350-6df4db88cd9f95cb7112d1d27236c870ea09447d.tar.gz
scummvm-rg350-6df4db88cd9f95cb7112d1d27236c870ea09447d.tar.bz2
scummvm-rg350-6df4db88cd9f95cb7112d1d27236c870ea09447d.zip
fixed scrolling
svn-id: r11830
Diffstat (limited to 'sword1/screen.cpp')
-rw-r--r--sword1/screen.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/sword1/screen.cpp b/sword1/screen.cpp
index 08dfc4488e..f949136128 100644
--- a/sword1/screen.cpp
+++ b/sword1/screen.cpp
@@ -57,29 +57,23 @@ void SwordScreen::setScrolling(int16 offsetX, int16 offsetY) {
if (!SwordLogic::_scriptVars[SCROLL_FLAG])
return ; // screen is smaller than 640x400 => no need for scrolling
- uint32 scrlToX, scrlToY;
-
offsetX = inRange(0, offsetX, SwordLogic::_scriptVars[MAX_SCROLL_OFFSET_X]);
offsetY = inRange(0, offsetY, SwordLogic::_scriptVars[MAX_SCROLL_OFFSET_Y]);
- _oldScrollX = SwordLogic::_scriptVars[SCROLL_OFFSET_X];
- _oldScrollY = SwordLogic::_scriptVars[SCROLL_OFFSET_Y];
- scrlToX = (uint32)offsetX;
- scrlToY = (uint32)offsetY;
- if (SwordLogic::_scriptVars[SCROLL_FLAG] == 2) // first time on this screen - need absolute scroll immediately!
+ if (SwordLogic::_scriptVars[SCROLL_FLAG] == 2) { // first time on this screen - need absolute scroll immediately!
+ _oldScrollX = SwordLogic::_scriptVars[SCROLL_OFFSET_X] = (uint32)offsetX;
+ _oldScrollY = SwordLogic::_scriptVars[SCROLL_OFFSET_Y] = (uint32)offsetY;
SwordLogic::_scriptVars[SCROLL_FLAG] = 1;
- scrlToX = inRange(0, scrlToX, SwordLogic::_scriptVars[MAX_SCROLL_OFFSET_X]);
- scrlToY = inRange(0, scrlToY, SwordLogic::_scriptVars[MAX_SCROLL_OFFSET_Y]);
- if ((scrlToX != SwordLogic::_scriptVars[SCROLL_OFFSET_X]) || (scrlToY != SwordLogic::_scriptVars[SCROLL_OFFSET_Y])) {
_fullRefresh = true;
- SwordLogic::_scriptVars[SCROLL_OFFSET_X] = scrlToX;
- SwordLogic::_scriptVars[SCROLL_OFFSET_Y] = scrlToY;
- } else
- _fullRefresh = false;
- if (SwordLogic::_scriptVars[SCROLL_FLAG] == 2) {
- _oldScrollX = scrlToX;
- _oldScrollY = scrlToY;
- SwordLogic::_scriptVars[SCROLL_FLAG] = 1;
+ } else if (SwordLogic::_scriptVars[SCROLL_FLAG] == 1) {
+ _oldScrollX = SwordLogic::_scriptVars[SCROLL_OFFSET_X];
+ _oldScrollY = SwordLogic::_scriptVars[SCROLL_OFFSET_Y];
+ int32 distX = inRange(-MAX_SCROLL_DISTANCE, _oldScrollX - offsetX, MAX_SCROLL_DISTANCE);
+ int32 distY = inRange(-MAX_SCROLL_DISTANCE, _oldScrollY - offsetY, MAX_SCROLL_DISTANCE);
+ if ((distX != 0) || (distY != 0))
+ _fullRefresh = true;
+ SwordLogic::_scriptVars[SCROLL_OFFSET_X] -= distX;
+ SwordLogic::_scriptVars[SCROLL_OFFSET_Y] -= distY;
}
}