diff options
-rw-r--r-- | engines/sci/gui/gui_transitions.cpp | 77 | ||||
-rw-r--r-- | engines/sci/gui/gui_transitions.h | 12 |
2 files changed, 73 insertions, 16 deletions
diff --git a/engines/sci/gui/gui_transitions.cpp b/engines/sci/gui/gui_transitions.cpp index 517bf14dc1..2d32581af8 100644 --- a/engines/sci/gui/gui_transitions.cpp +++ b/engines/sci/gui/gui_transitions.cpp @@ -72,6 +72,12 @@ void SciGuiTransitions::doit(Common::Rect picRect) { fadeOut(); setNewScreen(); fadeIn(); break; + case SCI_TRANSITIONS_VGA_SCROLLRIGHT: + setNewPalette(); scroll(SCI_TRANSITIONS_SCROLL_RIGHT); + break; + case SCI_TRANSITIONS_VGA_SCROLLLEFT: + setNewPalette(); scroll(SCI_TRANSITIONS_SCROLL_LEFT); + break; case SCI_TRANSITIONS_VGA_SCROLLUP: setNewPalette(); scroll(SCI_TRANSITIONS_SCROLL_UP); break; @@ -95,6 +101,16 @@ void SciGuiTransitions::doit(Common::Rect picRect) { fadeOut(); setNewScreen(); fadeIn(); break; + case SCI_TRANSITIONS_EGA_SCROLLRIGHT: + scroll(SCI_TRANSITIONS_SCROLL_RIGHT); + break; + case SCI_TRANSITIONS_EGA_SCROLLLEFT: + scroll(SCI_TRANSITIONS_SCROLL_LEFT); + break; + case SCI_TRANSITIONS_EGA_SCROLLUP: + scroll(SCI_TRANSITIONS_SCROLL_UP); + break; + default: warning("SciGuiTransitions: EGA-%d not implemented", _number); setNewScreen(); @@ -191,31 +207,64 @@ void SciGuiTransitions::blocks() { // scroll old screen (up/down/left/right) and insert new screen that way - works on _picRect area void SciGuiTransitions::scroll(int16 direction) { int16 screenWidth, screenHeight; - int16 oldWidth, oldHeight; - int16 newWidth, newHeight; byte *oldScreenPtr; - int16 x, y; + int16 stepNr = 0; + Common::Rect oldMoveRect = _picRect; + Common::Rect newMoveRect = _picRect; Common::Rect newScreenRect = _picRect; _screen->copyFromScreen(_oldScreen); screenWidth = _screen->_displayWidth; screenHeight = _screen->_displayHeight; - x = _picRect.left; y = _picRect.top; - oldWidth = _picRect.width(); oldHeight = _picRect.height(); - newWidth = 0; newHeight = 0; - oldScreenPtr = _oldScreen + _picRect.left + _picRect.top * screenWidth; switch (direction) { + case SCI_TRANSITIONS_SCROLL_LEFT: + newScreenRect.right = newScreenRect.left; + newMoveRect.left = newMoveRect.right; + while (oldMoveRect.left < oldMoveRect.right) { + oldScreenPtr++; oldMoveRect.right--; + if (oldMoveRect.right > oldMoveRect.left) + g_system->copyRectToScreen(oldScreenPtr, screenWidth, oldMoveRect.left, oldMoveRect.top, oldMoveRect.width(), oldMoveRect.height()); + newScreenRect.right++; newMoveRect.left--; + _screen->copyRectToScreen(newScreenRect, newMoveRect.left, newMoveRect.top); + if ((stepNr & 1) == 0) { + g_system->updateScreen(); + g_system->delayMillis(1); + } + stepNr++; + } + if ((stepNr & 1) == 0) + g_system->updateScreen(); + break; + + case SCI_TRANSITIONS_SCROLL_RIGHT: + newScreenRect.left = newScreenRect.right; + while (oldMoveRect.left < oldMoveRect.right) { + oldMoveRect.left++; + if (oldMoveRect.right > oldMoveRect.left) + g_system->copyRectToScreen(oldScreenPtr, screenWidth, oldMoveRect.left, oldMoveRect.top, oldMoveRect.width(), oldMoveRect.height()); + newScreenRect.left--; + _screen->copyRectToScreen(newScreenRect, newMoveRect.left, newMoveRect.top); + if ((stepNr & 1) == 0) { + g_system->updateScreen(); + g_system->delayMillis(1); + } + stepNr++; + } + if ((stepNr & 1) == 0) + g_system->updateScreen(); + break; + case SCI_TRANSITIONS_SCROLL_UP: newScreenRect.bottom = newScreenRect.top; - y += oldHeight; - while (oldHeight > 0) { - oldScreenPtr += screenWidth; oldHeight--; - if (oldHeight) - g_system->copyRectToScreen(oldScreenPtr, _screen->_displayWidth, _picRect.left, _picRect.top, oldWidth, oldHeight); - newScreenRect.bottom++; y--; - _screen->copyRectToScreen(newScreenRect, x, y); + newMoveRect.top = newMoveRect.bottom; + while (oldMoveRect.top < oldMoveRect.bottom) { + oldScreenPtr += screenWidth; oldMoveRect.top++; + if (oldMoveRect.top < oldMoveRect.bottom) + g_system->copyRectToScreen(oldScreenPtr, screenWidth, _picRect.left, _picRect.top, oldMoveRect.width(), oldMoveRect.height()); + newScreenRect.bottom++; newMoveRect.top--; + _screen->copyRectToScreen(newScreenRect, newMoveRect.left, newMoveRect.top); g_system->updateScreen(); g_system->delayMillis(3); } diff --git a/engines/sci/gui/gui_transitions.h b/engines/sci/gui/gui_transitions.h index db3d2ea4e7..89791b3127 100644 --- a/engines/sci/gui/gui_transitions.h +++ b/engines/sci/gui/gui_transitions.h @@ -33,19 +33,27 @@ namespace Sci { enum { SCI_TRANSITIONS_EGA_BLOCKS = 8, SCI_TRANSITIONS_EGA_PIXELATION = 18, - SCI_TRANSITIONS_EGA_FADEPALETTE = 30 + SCI_TRANSITIONS_EGA_FADEPALETTE = 30, + SCI_TRANSITIONS_EGA_SCROLLRIGHT = 40, + SCI_TRANSITIONS_EGA_SCROLLLEFT = 41, + SCI_TRANSITIONS_EGA_SCROLLUP = 42, + SCI_TRANSITIONS_EGA_SCROLLDOWN = 43 }; enum { SCI_TRANSITIONS_VGA_BLOCKS = 8, SCI_TRANSITIONS_VGA_PIXELATION = 9, SCI_TRANSITIONS_VGA_FADEPALETTE = 10, + SCI_TRANSITIONS_VGA_SCROLLRIGHT = 11, + SCI_TRANSITIONS_VGA_SCROLLLEFT = 12, SCI_TRANSITIONS_VGA_SCROLLUP = 13, SCI_TRANSITIONS_VGA_SCROLLDOWN = 14 }; enum { - SCI_TRANSITIONS_SCROLL_UP = 1 + SCI_TRANSITIONS_SCROLL_RIGHT = 1, + SCI_TRANSITIONS_SCROLL_LEFT = 2, + SCI_TRANSITIONS_SCROLL_UP = 3, }; class SciGuiScreen; |