diff options
author | Nicola Mettifogo | 2008-12-06 04:51:04 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2008-12-06 04:51:04 +0000 |
commit | 7681461b16ee09eb8620fc99d8cd9445c263594b (patch) | |
tree | 960f1af1edde885e2243214cf447b401e5b38615 /engines/parallaction/parallaction.cpp | |
parent | 7a4984304721eb91ca5c3349871be1cab228451d (diff) | |
download | scummvm-rg350-7681461b16ee09eb8620fc99d8cd9445c263594b.tar.gz scummvm-rg350-7681461b16ee09eb8620fc99d8cd9445c263594b.tar.bz2 scummvm-rg350-7681461b16ee09eb8620fc99d8cd9445c263594b.zip |
Implemented horizontal scrolling for BRA, by using a back buffer. Dialogues in scrollable locations are a bit messed up for the moment.
svn-id: r35253
Diffstat (limited to 'engines/parallaction/parallaction.cpp')
-rw-r--r-- | engines/parallaction/parallaction.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 7623025d7f..4a5436b4a6 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -143,12 +143,40 @@ Common::Error Parallaction::init() { return Common::kNoError; } +bool canScroll() { + return (_vm->_gfx->_backgroundInfo->width > _vm->_screenWidth); +} + void Parallaction::updateView() { if ((_engineFlags & kEnginePauseJobs) && (_input->_inputMode != Input::kInputModeInventory)) { return; } + #define SCROLL_BAND_WIDTH 120 + + if (canScroll()) { + int scrollX = _gfx->getScrollPos(); + + Common::Point foot; + _char.getFoot(foot); + + foot.x -= scrollX; + //foot.y -= ... + + int min = SCROLL_BAND_WIDTH; + int max = _vm->_screenWidth - SCROLL_BAND_WIDTH; + + if (foot.x < min) { + scrollX = CLIP(scrollX - (min - foot.x), 0, scrollX); + } else + if (foot.x > max) { + scrollX = CLIP(scrollX + (foot.x - max), scrollX, _vm->_gfx->_backgroundInfo->width - _vm->_screenWidth); + } + + _gfx->setScrollPos(scrollX); + } + _gfx->animatePalette(); _gfx->updateScreen(); _vm->_system->delayMillis(30); |