diff options
-rw-r--r-- | engines/gob/inter_v2.cpp | 21 | ||||
-rw-r--r-- | engines/gob/inter_v4.cpp | 9 | ||||
-rw-r--r-- | engines/gob/video.cpp | 4 |
3 files changed, 22 insertions, 12 deletions
diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index db79971d88..e442ec4eca 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -1502,18 +1502,27 @@ void Inter_v2::o2_scroll() { } void Inter_v2::o2_setScrollOffset() { - int16 offset; + int16 offsetX, offsetY; - offset = _vm->_parse->parseValExpr(); + offsetX = _vm->_parse->parseValExpr(); + offsetY = _vm->_parse->parseValExpr(); - if (offset == -1) { - _vm->_parse->parseValExpr(); + if (offsetX == -1) { WRITE_VAR(2, _vm->_draw->_scrollOffsetX); WRITE_VAR(3, _vm->_draw->_scrollOffsetY); } else { - _vm->_draw->_scrollOffsetX = offset; - _vm->_draw->_scrollOffsetY = _vm->_parse->parseValExpr(); + int16 screenW = _vm->_video->_surfWidth; + int16 screenH = _vm->_video->_surfHeight; + + if (screenW > _vm->_width) + screenW -= _vm->_width; + if (screenH > _vm->_height) + screenH -= _vm->_height; + + _vm->_draw->_scrollOffsetX = CLIP<int16>(offsetX, 0, screenW); + _vm->_draw->_scrollOffsetY = CLIP<int16>(offsetY, 0, screenH); } + _vm->_util->setScrollOffset(); _noBusyWait = true; } diff --git a/engines/gob/inter_v4.cpp b/engines/gob/inter_v4.cpp index 4c7c29255c..fd90b731a2 100644 --- a/engines/gob/inter_v4.cpp +++ b/engines/gob/inter_v4.cpp @@ -505,7 +505,7 @@ void Inter_v4::setupOpcodes() { /* 30 */ OPCODE(o1_returnTo), OPCODE(o1_loadSpriteContent), - OPCODE(o3_copySprite), + OPCODE(o1_copySprite), OPCODE(o1_fillRect), /* 34 */ OPCODE(o1_drawLine), @@ -772,6 +772,10 @@ void Inter_v4::o4_initScreen() { memset(_vm->_global->_greenPalette, 0, 256); memset(_vm->_global->_bluePalette, 0, 256); + _vm->_video->_splitSurf = 0; + _vm->_draw->_spritesArray[24] = 0; + _vm->_draw->_spritesArray[25] = 0; + _vm->_global->_videoMode = videoMode; _vm->_video->initPrimary(videoMode); WRITE_VAR(15, _vm->_global->_fakeVideoMode); @@ -786,9 +790,6 @@ void Inter_v4::o4_initScreen() { _vm->_util->setScrollOffset(); - _vm->_video->_splitSurf = 0; - _vm->_draw->_spritesArray[24] = 0; - _vm->_draw->_spritesArray[25] = 0; if (offY > 0) { _vm->_draw->_spritesArray[24] = new SurfaceDesc(videoMode, _vm->_width, offY); _vm->_draw->_spritesArray[25] = new SurfaceDesc(videoMode, _vm->_width, offY); diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp index e5d6f17574..453613d1ae 100644 --- a/engines/gob/video.cpp +++ b/engines/gob/video.cpp @@ -182,8 +182,8 @@ void Video::retrace(bool mouse) { int screenOffset = _scrollOffsetY * _surfWidth + _scrollOffsetX; int screenX = _screenDeltaX; int screenY = _screenDeltaY; - int screenWidth = MIN<int>(_surfWidth, _vm->_width); - int screenHeight = MIN<int>(_surfHeight - _splitHeight2, _vm->_height); + int screenWidth = MIN<int>(_surfWidth - _scrollOffsetX, _vm->_width); + int screenHeight = MIN<int>(_surfHeight - _splitHeight2 - _scrollOffsetY, _vm->_height); g_system->copyRectToScreen(_vm->_global->_primarySurfDesc->getVidMem() + screenOffset, _surfWidth, screenX, screenY, screenWidth, screenHeight); |