SCI/newgui: SciGuiTransitions scroll left/right now supported (kq1)
svn-id: r45086
This commit is contained in:
parent
07b73f6ea8
commit
c10052865d
2 changed files with 73 additions and 16 deletions
|
@ -72,6 +72,12 @@ void SciGuiTransitions::doit(Common::Rect picRect) {
|
||||||
fadeOut(); setNewScreen(); fadeIn();
|
fadeOut(); setNewScreen(); fadeIn();
|
||||||
break;
|
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:
|
case SCI_TRANSITIONS_VGA_SCROLLUP:
|
||||||
setNewPalette(); scroll(SCI_TRANSITIONS_SCROLL_UP);
|
setNewPalette(); scroll(SCI_TRANSITIONS_SCROLL_UP);
|
||||||
break;
|
break;
|
||||||
|
@ -95,6 +101,16 @@ void SciGuiTransitions::doit(Common::Rect picRect) {
|
||||||
fadeOut(); setNewScreen(); fadeIn();
|
fadeOut(); setNewScreen(); fadeIn();
|
||||||
break;
|
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:
|
default:
|
||||||
warning("SciGuiTransitions: EGA-%d not implemented", _number);
|
warning("SciGuiTransitions: EGA-%d not implemented", _number);
|
||||||
setNewScreen();
|
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
|
// scroll old screen (up/down/left/right) and insert new screen that way - works on _picRect area
|
||||||
void SciGuiTransitions::scroll(int16 direction) {
|
void SciGuiTransitions::scroll(int16 direction) {
|
||||||
int16 screenWidth, screenHeight;
|
int16 screenWidth, screenHeight;
|
||||||
int16 oldWidth, oldHeight;
|
|
||||||
int16 newWidth, newHeight;
|
|
||||||
byte *oldScreenPtr;
|
byte *oldScreenPtr;
|
||||||
int16 x, y;
|
int16 stepNr = 0;
|
||||||
|
Common::Rect oldMoveRect = _picRect;
|
||||||
|
Common::Rect newMoveRect = _picRect;
|
||||||
Common::Rect newScreenRect = _picRect;
|
Common::Rect newScreenRect = _picRect;
|
||||||
|
|
||||||
_screen->copyFromScreen(_oldScreen);
|
_screen->copyFromScreen(_oldScreen);
|
||||||
screenWidth = _screen->_displayWidth; screenHeight = _screen->_displayHeight;
|
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;
|
oldScreenPtr = _oldScreen + _picRect.left + _picRect.top * screenWidth;
|
||||||
|
|
||||||
switch (direction) {
|
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:
|
case SCI_TRANSITIONS_SCROLL_UP:
|
||||||
newScreenRect.bottom = newScreenRect.top;
|
newScreenRect.bottom = newScreenRect.top;
|
||||||
y += oldHeight;
|
newMoveRect.top = newMoveRect.bottom;
|
||||||
while (oldHeight > 0) {
|
while (oldMoveRect.top < oldMoveRect.bottom) {
|
||||||
oldScreenPtr += screenWidth; oldHeight--;
|
oldScreenPtr += screenWidth; oldMoveRect.top++;
|
||||||
if (oldHeight)
|
if (oldMoveRect.top < oldMoveRect.bottom)
|
||||||
g_system->copyRectToScreen(oldScreenPtr, _screen->_displayWidth, _picRect.left, _picRect.top, oldWidth, oldHeight);
|
g_system->copyRectToScreen(oldScreenPtr, screenWidth, _picRect.left, _picRect.top, oldMoveRect.width(), oldMoveRect.height());
|
||||||
newScreenRect.bottom++; y--;
|
newScreenRect.bottom++; newMoveRect.top--;
|
||||||
_screen->copyRectToScreen(newScreenRect, x, y);
|
_screen->copyRectToScreen(newScreenRect, newMoveRect.left, newMoveRect.top);
|
||||||
g_system->updateScreen();
|
g_system->updateScreen();
|
||||||
g_system->delayMillis(3);
|
g_system->delayMillis(3);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,19 +33,27 @@ namespace Sci {
|
||||||
enum {
|
enum {
|
||||||
SCI_TRANSITIONS_EGA_BLOCKS = 8,
|
SCI_TRANSITIONS_EGA_BLOCKS = 8,
|
||||||
SCI_TRANSITIONS_EGA_PIXELATION = 18,
|
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 {
|
enum {
|
||||||
SCI_TRANSITIONS_VGA_BLOCKS = 8,
|
SCI_TRANSITIONS_VGA_BLOCKS = 8,
|
||||||
SCI_TRANSITIONS_VGA_PIXELATION = 9,
|
SCI_TRANSITIONS_VGA_PIXELATION = 9,
|
||||||
SCI_TRANSITIONS_VGA_FADEPALETTE = 10,
|
SCI_TRANSITIONS_VGA_FADEPALETTE = 10,
|
||||||
|
SCI_TRANSITIONS_VGA_SCROLLRIGHT = 11,
|
||||||
|
SCI_TRANSITIONS_VGA_SCROLLLEFT = 12,
|
||||||
SCI_TRANSITIONS_VGA_SCROLLUP = 13,
|
SCI_TRANSITIONS_VGA_SCROLLUP = 13,
|
||||||
SCI_TRANSITIONS_VGA_SCROLLDOWN = 14
|
SCI_TRANSITIONS_VGA_SCROLLDOWN = 14
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
SCI_TRANSITIONS_SCROLL_UP = 1
|
SCI_TRANSITIONS_SCROLL_RIGHT = 1,
|
||||||
|
SCI_TRANSITIONS_SCROLL_LEFT = 2,
|
||||||
|
SCI_TRANSITIONS_SCROLL_UP = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
class SciGuiScreen;
|
class SciGuiScreen;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue