From 28df3debfdfbce08476bbec2900d53651de69bda Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Thu, 19 Apr 2007 13:51:57 +0000 Subject: - Fixed handling of the case split screen + vertical scrolling area - Added manual vertical scrolling - Restricting the mouse cursor to the upper part of the split screen now svn-id: r26547 --- engines/gob/game.cpp | 20 ++++++++++++++++++++ engines/gob/inter_v2.cpp | 4 +++- engines/gob/util.cpp | 7 ++++++- engines/gob/video.cpp | 12 +++++++----- engines/gob/video.h | 4 +++- 5 files changed, 39 insertions(+), 8 deletions(-) (limited to 'engines/gob') diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index 515d99c66a..926e9e3f68 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -303,10 +303,18 @@ void Game::evaluateScroll(int16 x, int16 y) { off = MIN(_vm->_draw->_cursorWidth, _vm->_draw->_scrollOffsetX); off = MAX(off / 2, 1); _vm->_draw->_scrollOffsetX -= off; + } else if ((y == 0) && (_vm->_draw->_scrollOffsetY > 0)) { + uint16 off; + + off = MIN(_vm->_draw->_cursorHeight, _vm->_draw->_scrollOffsetY); + off = MAX(off / 2, 1); + _vm->_draw->_scrollOffsetY -= off; } int16 cursorRight = x + _vm->_draw->_cursorWidth; int16 screenRight = _vm->_draw->_scrollOffsetX + 320; + int16 cursorBottom = y + _vm->_draw->_cursorHeight; + int16 screenBottom = _vm->_draw->_scrollOffsetY + 200; if ((cursorRight >= 320) && (screenRight < _vm->_video->_surfWidth)) { uint16 off; @@ -318,6 +326,18 @@ void Game::evaluateScroll(int16 x, int16 y) { _vm->_draw->_scrollOffsetX += off; _vm->_util->setMousePos(320 - _vm->_draw->_cursorWidth, y); + } else if ((cursorBottom >= (200 - _vm->_video->_splitHeight2)) && + (screenBottom < _vm->_video->_surfHeight)) { + uint16 off; + + off = MIN(_vm->_draw->_cursorHeight, + (int16) (_vm->_video->_surfHeight - screenBottom)); + off = MAX(off / 2, 1); + + _vm->_draw->_scrollOffsetY += off; + + _vm->_util->setMousePos(x, 200 - _vm->_video->_splitHeight2 - + _vm->_draw->_cursorHeight); } _vm->_util->setScrollOffset(); diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index d0677757d5..5a66300848 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -1376,7 +1376,9 @@ void Inter_v2::o2_initScreen() { if (height > 0) _vm->_video->_surfHeight = height; - _vm->_video->_splitHeight = _vm->_video->_surfHeight - offY; + _vm->_video->_splitHeight1 = MIN(200, _vm->_video->_surfHeight - offY); + _vm->_video->_splitHeight2 = offY; + _vm->_video->_splitStart = _vm->_video->_surfHeight - offY; _vm->_draw->closeScreen(); _vm->_util->clearPalette(); diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index 410c16e833..4970aee2e9 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -125,8 +125,13 @@ void Util::processInput(bool scroll) { } _vm->_global->_speedFactor = MIN(_fastMode + 1, 3); - if (scroll && hasMove) + if (scroll && hasMove) { + if (y >= (200 - _vm->_video->_splitHeight2)) { + y = 200 - _vm->_video->_splitHeight2 - 1; + _vm->_util->setMousePos(x, y); + } _vm->_game->evaluateScroll(x, y); + } } void Util::clearKeyBuf(void) { diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp index 4af5ece7c5..93b9f9b470 100644 --- a/engines/gob/video.cpp +++ b/engines/gob/video.cpp @@ -89,7 +89,9 @@ Video::Video(GobEngine *vm) : _vm(vm) { _surfHeight = 200; _scrollOffsetX = 0; _scrollOffsetY = 0; - _splitHeight = 200; + _splitHeight1 = 200; + _splitHeight2 = 0; + _splitStart = 0; _curSparse = 0; _lastSparse = 0xFFFFFFFF; @@ -162,11 +164,11 @@ void Video::retrace(bool mouse) { if (_vm->_global->_primarySurfDesc) { g_system->copyRectToScreen(_vm->_global->_primarySurfDesc->getVidMem() + _scrollOffsetY * _surfWidth + _scrollOffsetX, _surfWidth, - 0, 0, 320, _splitHeight); - if (_splitHeight < _surfHeight) + 0, 0, 320, _splitHeight1); + if (_splitHeight2 > 0) g_system->copyRectToScreen(_vm->_global->_primarySurfDesc->getVidMem() + - _splitHeight * _surfWidth, _surfWidth, 0, _splitHeight, 320, - _surfHeight - _splitHeight); + _splitStart * _surfWidth, _surfWidth, 0, + 200 - _splitHeight2, 320, _splitHeight2); g_system->updateScreen(); } } diff --git a/engines/gob/video.h b/engines/gob/video.h index d3d297d8cb..265392a7a2 100644 --- a/engines/gob/video.h +++ b/engines/gob/video.h @@ -99,7 +99,9 @@ public: int16 _surfHeight; int16 _scrollOffsetX; int16 _scrollOffsetY; - int16 _splitHeight; + int16 _splitHeight1; + int16 _splitHeight2; + int16 _splitStart; void freeDriver(); void initPrimary(int16 mode); -- cgit v1.2.3