diff options
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); |