SCI: fixing scroll transitions for kq6 hires

fixes bug #3034587

svn-id: r51334
This commit is contained in:
Martin Kiewitz 2010-07-26 21:25:07 +00:00
parent 57136cd86a
commit ea5f8049a2
2 changed files with 26 additions and 40 deletions

View File

@ -407,39 +407,39 @@ void GfxTransitions::straight(int16 number, bool blackoutFlag) {
} }
} }
void GfxTransitions::scrollCopyOldToScreen(Common::Rect screenRect, int16 x, int16 y) {
byte *oldScreenPtr = _oldScreen;
int16 screenWidth = _screen->getDisplayWidth();
if (_screen->getUpscaledHires()) {
_screen->adjustToUpscaledCoordinates(screenRect.top, screenRect.left);
_screen->adjustToUpscaledCoordinates(screenRect.bottom, screenRect.right);
_screen->adjustToUpscaledCoordinates(y, x);
}
oldScreenPtr += screenRect.left + screenRect.top * screenWidth;
g_system->copyRectToScreen(oldScreenPtr, screenWidth, x, y, screenRect.width(), screenRect.height());
}
// Scroll old screen (up/down/left/right) and insert new screen that way - works // Scroll old screen (up/down/left/right) and insert new screen that way - works
// on _picRect area only. // on _picRect area only.
void GfxTransitions::scroll(int16 number) { void GfxTransitions::scroll(int16 number) {
int16 screenWidth, screenHeight; int16 screenWidth, screenHeight;
byte *oldScreenPtr;
int16 stepNr = 0; int16 stepNr = 0;
Common::Rect oldMoveRect = _picRect; Common::Rect oldMoveRect = _picRect;
Common::Rect oldScreenRect = _picRect;
Common::Rect newMoveRect = _picRect; Common::Rect newMoveRect = _picRect;
Common::Rect newScreenRect = _picRect; Common::Rect newScreenRect = _picRect;
_screen->copyFromScreen(_oldScreen); _screen->copyFromScreen(_oldScreen);
screenWidth = _screen->getDisplayWidth(); screenHeight = _screen->getDisplayHeight(); screenWidth = _screen->getDisplayWidth(); screenHeight = _screen->getDisplayHeight();
oldScreenPtr = _oldScreen + _picRect.left + _picRect.top * screenWidth;
if (_screen->getUpscaledHires()) {
oldScreenPtr += _picRect.left + _picRect.top * screenWidth;
}
switch (number) { switch (number) {
case SCI_TRANSITIONS_SCROLL_LEFT: case SCI_TRANSITIONS_SCROLL_LEFT:
newScreenRect.right = newScreenRect.left; newScreenRect.right = newScreenRect.left;
newMoveRect.left = newMoveRect.right; newMoveRect.left = newMoveRect.right;
while (oldMoveRect.left < oldMoveRect.right) { while (oldMoveRect.left < oldMoveRect.right) {
oldScreenPtr++; oldMoveRect.right--; oldScreenRect.left++;
if (_screen->getUpscaledHires()) if (oldMoveRect.right > oldMoveRect.left)
oldScreenPtr++; scrollCopyOldToScreen(oldScreenRect, oldMoveRect.left, oldMoveRect.top);
oldMoveRect.right--;
if (oldMoveRect.right > oldMoveRect.left) {
if (!_screen->getUpscaledHires())
g_system->copyRectToScreen(oldScreenPtr, screenWidth, oldMoveRect.left, oldMoveRect.top, oldMoveRect.width(), oldMoveRect.height());
else
g_system->copyRectToScreen(oldScreenPtr, screenWidth, oldMoveRect.left * 2, oldMoveRect.top * 2, oldMoveRect.width() * 2, oldMoveRect.height() * 2);
}
newScreenRect.right++; newMoveRect.left--; newScreenRect.right++; newMoveRect.left--;
_screen->copyRectToScreen(newScreenRect, newMoveRect.left, newMoveRect.top); _screen->copyRectToScreen(newScreenRect, newMoveRect.left, newMoveRect.top);
if ((stepNr & 1) == 0) { if ((stepNr & 1) == 0) {
@ -458,13 +458,9 @@ void GfxTransitions::scroll(int16 number) {
case SCI_TRANSITIONS_SCROLL_RIGHT: case SCI_TRANSITIONS_SCROLL_RIGHT:
newScreenRect.left = newScreenRect.right; newScreenRect.left = newScreenRect.right;
while (oldMoveRect.left < oldMoveRect.right) { while (oldMoveRect.left < oldMoveRect.right) {
oldMoveRect.left++; oldMoveRect.left++; oldScreenRect.right--;
if (oldMoveRect.right > oldMoveRect.left) { if (oldMoveRect.right > oldMoveRect.left)
if (!_screen->getUpscaledHires()) scrollCopyOldToScreen(oldScreenRect, oldMoveRect.left, oldMoveRect.top);
g_system->copyRectToScreen(oldScreenPtr, screenWidth, oldMoveRect.left, oldMoveRect.top, oldMoveRect.width(), oldMoveRect.height());
else
g_system->copyRectToScreen(oldScreenPtr, screenWidth, oldMoveRect.left * 2, oldMoveRect.top * 2, oldMoveRect.width() * 2, oldMoveRect.height() * 2);
}
newScreenRect.left--; newScreenRect.left--;
_screen->copyRectToScreen(newScreenRect, newMoveRect.left, newMoveRect.top); _screen->copyRectToScreen(newScreenRect, newMoveRect.left, newMoveRect.top);
if ((stepNr & 1) == 0) { if ((stepNr & 1) == 0) {
@ -484,16 +480,9 @@ void GfxTransitions::scroll(int16 number) {
newScreenRect.bottom = newScreenRect.top; newScreenRect.bottom = newScreenRect.top;
newMoveRect.top = newMoveRect.bottom; newMoveRect.top = newMoveRect.bottom;
while (oldMoveRect.top < oldMoveRect.bottom) { while (oldMoveRect.top < oldMoveRect.bottom) {
oldScreenPtr += screenWidth; oldMoveRect.top++; oldScreenRect.top++;
if (_screen->getUpscaledHires()) if (oldMoveRect.top < oldMoveRect.bottom)
oldScreenPtr += screenWidth; scrollCopyOldToScreen(oldScreenRect, _picRect.left, _picRect.top);
oldMoveRect.top++;
if (oldMoveRect.top < oldMoveRect.bottom) {
if (!_screen->getUpscaledHires())
g_system->copyRectToScreen(oldScreenPtr, screenWidth, _picRect.left, _picRect.top, oldMoveRect.width(), oldMoveRect.height());
else
g_system->copyRectToScreen(oldScreenPtr, screenWidth, _picRect.left * 2, _picRect.top * 2, oldMoveRect.width() * 2, oldMoveRect.height() * 2);
}
newScreenRect.bottom++; newMoveRect.top--; newScreenRect.bottom++; newMoveRect.top--;
_screen->copyRectToScreen(newScreenRect, newMoveRect.left, newMoveRect.top); _screen->copyRectToScreen(newScreenRect, newMoveRect.left, newMoveRect.top);
updateScreenAndWait(3); updateScreenAndWait(3);
@ -503,13 +492,9 @@ void GfxTransitions::scroll(int16 number) {
case SCI_TRANSITIONS_SCROLL_DOWN: case SCI_TRANSITIONS_SCROLL_DOWN:
newScreenRect.top = newScreenRect.bottom; newScreenRect.top = newScreenRect.bottom;
while (oldMoveRect.top < oldMoveRect.bottom) { while (oldMoveRect.top < oldMoveRect.bottom) {
oldMoveRect.top++; oldMoveRect.top++; oldScreenRect.bottom--;
if (oldMoveRect.top < oldMoveRect.bottom) { if (oldMoveRect.top < oldMoveRect.bottom)
if (!_screen->getUpscaledHires()) scrollCopyOldToScreen(oldScreenRect, oldMoveRect.left, oldMoveRect.top);
g_system->copyRectToScreen(oldScreenPtr, screenWidth, oldMoveRect.left, oldMoveRect.top, oldMoveRect.width(), oldMoveRect.height());
else
g_system->copyRectToScreen(oldScreenPtr, screenWidth, oldMoveRect.left * 2, oldMoveRect.top * 2, oldMoveRect.width() * 2, oldMoveRect.height() * 2);
}
newScreenRect.top--; newScreenRect.top--;
_screen->copyRectToScreen(newScreenRect, _picRect.left, _picRect.top); _screen->copyRectToScreen(newScreenRect, _picRect.left, _picRect.top);
updateScreenAndWait(3); updateScreenAndWait(3);

View File

@ -83,6 +83,7 @@ private:
void pixelation(bool blackoutFlag); void pixelation(bool blackoutFlag);
void blocks(bool blackoutFlag); void blocks(bool blackoutFlag);
void straight(int16 number, bool blackoutFlag); void straight(int16 number, bool blackoutFlag);
void scrollCopyOldToScreen(Common::Rect screenRect, int16 x, int16 y);
void scroll(int16 number); void scroll(int16 number);
void verticalRollFromCenter(bool blackoutFlag); void verticalRollFromCenter(bool blackoutFlag);
void verticalRollToCenter(bool blackoutFlag); void verticalRollToCenter(bool blackoutFlag);