diff options
author | Martin Kiewitz | 2009-10-16 16:03:32 +0000 |
---|---|---|
committer | Martin Kiewitz | 2009-10-16 16:03:32 +0000 |
commit | 2924dca0882f6f8ab0a21bf84d8af3a20573fb82 (patch) | |
tree | 4e1c94287f387dfea38adf425979ee1f4efbaf38 /engines/sci | |
parent | 739b462753ab8d63ff5a001728a3195203f161ca (diff) | |
download | scummvm-rg350-2924dca0882f6f8ab0a21bf84d8af3a20573fb82.tar.gz scummvm-rg350-2924dca0882f6f8ab0a21bf84d8af3a20573fb82.tar.bz2 scummvm-rg350-2924dca0882f6f8ab0a21bf84d8af3a20573fb82.zip |
SCI/newgui: SciGuiTransitions now supports diagonal rolls as well (includes bugfixes for other transitions)
svn-id: r45167
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/gui/gui_transitions.cpp | 62 | ||||
-rw-r--r-- | engines/sci/gui/gui_transitions.h | 4 |
2 files changed, 64 insertions, 2 deletions
diff --git a/engines/sci/gui/gui_transitions.cpp b/engines/sci/gui/gui_transitions.cpp index 6ec20ea112..a8a64054b2 100644 --- a/engines/sci/gui/gui_transitions.cpp +++ b/engines/sci/gui/gui_transitions.cpp @@ -50,9 +50,13 @@ SciGuiTransitions::~SciGuiTransitions() { static const GuiTransitionTranslateEntry oldTransitionIDs[] = { { 0, SCI_TRANSITIONS_VERTICALROLLFROMCENTER, false }, { 1, SCI_TRANSITIONS_HORIZONTALROLLFROMCENTER, false }, + { 6, SCI_TRANSITIONS_DIAGONALROLLFROMCENTER, false }, + { 7, SCI_TRANSITIONS_DIAGONALROLLTOCENTER, false }, { 8, SCI_TRANSITIONS_BLOCKS, false }, { 9, SCI_TRANSITIONS_VERTICALROLLTOCENTER, false }, { 10, SCI_TRANSITIONS_HORIZONTALROLLTOCENTER, false }, + { 15, SCI_TRANSITIONS_DIAGONALROLLFROMCENTER, true }, + { 16, SCI_TRANSITIONS_DIAGONALROLLTOCENTER, true }, { 17, SCI_TRANSITIONS_BLOCKS, true }, { 18, SCI_TRANSITIONS_PIXELATION, false }, { 27, SCI_TRANSITIONS_PIXELATION , true }, @@ -118,6 +122,10 @@ void SciGuiTransitions::doit(Common::Rect picRect) { case SCI_TRANSITIONS_HORIZONTALROLLTOCENTER: setNewPalette(); horizontalRollToCenter(); break; + case SCI_TRANSITIONS_DIAGONALROLLTOCENTER: + setNewPalette(); diagonalRollToCenter(); + case SCI_TRANSITIONS_DIAGONALROLLFROMCENTER: + setNewPalette(); diagonalRollFromCenter(); case SCI_TRANSITIONS_PIXELATION: setNewPalette(); pixelation(); @@ -314,7 +322,7 @@ void SciGuiTransitions::verticalRollFromCenter() { Common::Rect leftRect = Common::Rect(_picRect.left + (_picRect.width() / 2) -1, _picRect.top, _picRect.left + (_picRect.width() / 2), _picRect.bottom); Common::Rect rightRect = Common::Rect(leftRect.right, _picRect.top, leftRect.right + 1, _picRect.bottom); - while ((leftRect.left > _picRect.left) && (rightRect.right < _picRect.right)) { + while ((leftRect.left >= _picRect.left) || (rightRect.right <= _picRect.right)) { if (leftRect.left < _picRect.left) leftRect.translate(1, 0); if (rightRect.right > _picRect.right) @@ -324,6 +332,7 @@ void SciGuiTransitions::verticalRollFromCenter() { g_system->updateScreen(); g_system->delayMillis(2); } + g_system->delayMillis(5000); } // vertically displays new screen starting from edges - works on _picRect area only @@ -344,7 +353,7 @@ void SciGuiTransitions::horizontalRollFromCenter() { Common::Rect upperRect = Common::Rect(_picRect.left, _picRect.top + (_picRect.height() / 2) - 1, _picRect.right, _picRect.top + (_picRect.height() / 2)); Common::Rect lowerRect = Common::Rect(upperRect.left, upperRect.bottom, upperRect.right, upperRect.bottom + 1); - while ((upperRect.top > _picRect.top) && (lowerRect.bottom < _picRect.bottom)) { + while ((upperRect.top >= _picRect.top) || (lowerRect.bottom <= _picRect.bottom)) { if (upperRect.top < _picRect.top) upperRect.translate(0, 1); if (lowerRect.bottom > _picRect.bottom) @@ -369,4 +378,53 @@ void SciGuiTransitions::horizontalRollToCenter() { } } +// diagonally displays new screen starting from center - works on _picRect area only +// assumes that height of rect is larger than width, is also currently not optimized (TODO) +void SciGuiTransitions::diagonalRollFromCenter() { + int16 halfHeight = _picRect.height() / 2; + Common::Rect upperRect(_picRect.left + halfHeight - 2, _picRect.top + halfHeight, _picRect.right - halfHeight + 1, _picRect.top + halfHeight + 1); + Common::Rect lowerRect(upperRect.left, upperRect.top, upperRect.right, upperRect.bottom); + Common::Rect leftRect(upperRect.left, upperRect.top, upperRect.left + 1, lowerRect.bottom); + Common::Rect rightRect(upperRect.right, upperRect.top, upperRect.right + 1, lowerRect.bottom); + + while ((upperRect.top >= _picRect.top) || (lowerRect.bottom <= _picRect.bottom)) { + if (upperRect.top < _picRect.top) { + upperRect.translate(0, 1); leftRect.top++; rightRect.top++; + } + if (lowerRect.bottom > _picRect.bottom) { + lowerRect.translate(0, -1); leftRect.bottom--; rightRect.bottom--; + } + if (leftRect.left < _picRect.left) { + leftRect.translate(1, 0); upperRect.left++; lowerRect.left++; + } + if (rightRect.right > _picRect.right) { + rightRect.translate(-1, 0); upperRect.right--; lowerRect.right--; + } + _screen->copyRectToScreen(upperRect); upperRect.translate(0, -1); upperRect.left--; upperRect.right++; + _screen->copyRectToScreen(lowerRect); lowerRect.translate(0, 1); lowerRect.left--; lowerRect.right++; + _screen->copyRectToScreen(leftRect); leftRect.translate(-1, 0); leftRect.top--; leftRect.bottom++; + _screen->copyRectToScreen(rightRect); rightRect.translate(1, 0); rightRect.top--; rightRect.bottom++; + g_system->updateScreen(); + g_system->delayMillis(3); + } +} + +// diagonally displays new screen starting from edges - works on _picRect area only +// assumes that height of rect is larger than width +void SciGuiTransitions::diagonalRollToCenter() { + Common::Rect upperRect(_picRect.left, _picRect.top, _picRect.right, _picRect.top + 1); + Common::Rect lowerRect(_picRect.left, _picRect.bottom - 1, _picRect.right, _picRect.bottom); + Common::Rect leftRect(_picRect.left, _picRect.top, _picRect.left + 1, _picRect.bottom); + Common::Rect rightRect(_picRect.right - 1, _picRect.top, _picRect.right, _picRect.bottom); + + while (upperRect.top < lowerRect.bottom) { + _screen->copyRectToScreen(upperRect); upperRect.translate(0, 1); upperRect.left++; upperRect.right--; + _screen->copyRectToScreen(lowerRect); lowerRect.translate(0, -1); lowerRect.left++; lowerRect.right--; + _screen->copyRectToScreen(leftRect); leftRect.translate(1, 0); + _screen->copyRectToScreen(rightRect); rightRect.translate(-1, 0); + g_system->updateScreen(); + g_system->delayMillis(3); + } +} + } // End of namespace Sci diff --git a/engines/sci/gui/gui_transitions.h b/engines/sci/gui/gui_transitions.h index 998126a0e4..896473704d 100644 --- a/engines/sci/gui/gui_transitions.h +++ b/engines/sci/gui/gui_transitions.h @@ -39,6 +39,8 @@ struct GuiTransitionTranslateEntry { enum { SCI_TRANSITIONS_VERTICALROLLFROMCENTER = 0, SCI_TRANSITIONS_HORIZONTALROLLFROMCENTER = 1, + SCI_TRANSITIONS_DIAGONALROLLFROMCENTER = 6, + SCI_TRANSITIONS_DIAGONALROLLTOCENTER = 7, SCI_TRANSITIONS_BLOCKS = 8, SCI_TRANSITIONS_PIXELATION = 9, SCI_TRANSITIONS_FADEPALETTE = 10, @@ -75,6 +77,8 @@ private: void verticalRollToCenter(); void horizontalRollFromCenter(); void horizontalRollToCenter(); + void diagonalRollFromCenter(); + void diagonalRollToCenter(); SciGui *_gui; SciGuiScreen *_screen; |