diff options
author | Robert Göffringmann | 2005-11-04 15:40:54 +0000 |
---|---|---|
committer | Robert Göffringmann | 2005-11-04 15:40:54 +0000 |
commit | 5d7a97690fea3f87979e5306916439f389f3f993 (patch) | |
tree | c51b3a339e83b4539bc22f4d0fc334b364761934 | |
parent | 549a052967c4c4d1c2d313b3eb2d520960e963e7 (diff) | |
download | scummvm-rg350-5d7a97690fea3f87979e5306916439f389f3f993.tar.gz scummvm-rg350-5d7a97690fea3f87979e5306916439f389f3f993.tar.bz2 scummvm-rg350-5d7a97690fea3f87979e5306916439f389f3f993.zip |
fixed bug #1345130: BS1: Scrolling regression.
Could possibly cause other problems, needs testing.
Testing, also in respect to #1077394
svn-id: r19426
-rw-r--r-- | sword1/screen.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/sword1/screen.cpp b/sword1/screen.cpp index 0603bf5375..280d4f47b2 100644 --- a/sword1/screen.cpp +++ b/sword1/screen.cpp @@ -76,12 +76,6 @@ int32 Screen::inRange(int32 a, int32 b, int32 c) { // return b(!) so that: a <= } void Screen::setScrolling(int16 offsetX, int16 offsetY) { - if (!Logic::_scriptVars[SCROLL_FLAG]) { - Logic::_scriptVars[SCROLL_OFFSET_X] = _oldScrollX = 0; - Logic::_scriptVars[SCROLL_OFFSET_Y] = _oldScrollY = 0; - return ; // screen is smaller than 640x400 => no need for scrolling - } - offsetX = inRange(0, offsetX, Logic::_scriptVars[MAX_SCROLL_OFFSET_X]); offsetY = inRange(0, offsetY, Logic::_scriptVars[MAX_SCROLL_OFFSET_Y]); @@ -106,6 +100,17 @@ void Screen::setScrolling(int16 offsetX, int16 offsetY) { _fullRefresh = true; Logic::_scriptVars[SCROLL_OFFSET_X] = inRange(0, Logic::_scriptVars[SCROLL_OFFSET_X] + scrlDistX, Logic::_scriptVars[MAX_SCROLL_OFFSET_X]); Logic::_scriptVars[SCROLL_OFFSET_Y] = inRange(0, Logic::_scriptVars[SCROLL_OFFSET_Y] + scrlDistY, Logic::_scriptVars[MAX_SCROLL_OFFSET_Y]); + } else { + // SCROLL_FLAG == 0, this usually means that the screen is smaller than 640x400 and doesn't need scrolling at all + // however, it can also mean that the gamescript overwrote the scrolling flag to take care of scrolling directly, + // (see bug report #1345130) so we ignore the offset arguments in this case + Logic::_scriptVars[SCROLL_OFFSET_X] = inRange(0, Logic::_scriptVars[SCROLL_OFFSET_X], Logic::_scriptVars[MAX_SCROLL_OFFSET_X]); + Logic::_scriptVars[SCROLL_OFFSET_Y] = inRange(0, Logic::_scriptVars[SCROLL_OFFSET_Y], Logic::_scriptVars[MAX_SCROLL_OFFSET_Y]); + if ((Logic::_scriptVars[SCROLL_OFFSET_X] != _oldScrollX) || (Logic::_scriptVars[SCROLL_OFFSET_Y] != _oldScrollY)) { + _fullRefresh = true; + _oldScrollX = Logic::_scriptVars[SCROLL_OFFSET_X]; + _oldScrollY = Logic::_scriptVars[SCROLL_OFFSET_Y]; + } } } @@ -151,7 +156,7 @@ bool Screen::stillFading(void) { } bool Screen::showScrollFrame(void) { - if ((!_fullRefresh) || Logic::_scriptVars[NEW_PALETTE] || (!Logic::_scriptVars[SCROLL_FLAG])) + if ((!_fullRefresh) || Logic::_scriptVars[NEW_PALETTE]) return false; // don't draw an additional frame if we aren't scrolling or have to change the palette if ((_oldScrollX == Logic::_scriptVars[SCROLL_OFFSET_X]) && (_oldScrollY == Logic::_scriptVars[SCROLL_OFFSET_Y])) @@ -290,9 +295,10 @@ void Screen::newScreen(uint32 screen) { Logic::_scriptVars[SCROLL_FLAG] = 0; Logic::_scriptVars[MAX_SCROLL_OFFSET_X] = 0; Logic::_scriptVars[MAX_SCROLL_OFFSET_Y] = 0; - Logic::_scriptVars[SCROLL_OFFSET_X] = 0; - Logic::_scriptVars[SCROLL_OFFSET_Y] = 0; } + Logic::_scriptVars[SCROLL_OFFSET_X] = 0; + Logic::_scriptVars[SCROLL_OFFSET_Y] = 0; + if (_screenBuf) free(_screenBuf); if (_screenGrid) |