diff options
author | Martin Kiewitz | 2015-06-09 12:14:41 +0200 |
---|---|---|
committer | Willem Jan Palenstijn | 2015-06-10 07:14:13 +0200 |
commit | 866d7a27d8b0ea28a533f75774dd9ee16c288d38 (patch) | |
tree | 9b589b642736bb375af0fbf220799f59a1a926c7 /engines | |
parent | 15b9d61f6e5c49f5fab43fe0ff038a27853fb95c (diff) | |
download | scummvm-rg350-866d7a27d8b0ea28a533f75774dd9ee16c288d38.tar.gz scummvm-rg350-866d7a27d8b0ea28a533f75774dd9ee16c288d38.tar.bz2 scummvm-rg350-866d7a27d8b0ea28a533f75774dd9ee16c288d38.zip |
SHERLOCK: 3DO intro: implement fade in/out/merge
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sherlock/scalpel/scalpel.cpp | 72 | ||||
-rw-r--r-- | engines/sherlock/screen.cpp | 84 | ||||
-rw-r--r-- | engines/sherlock/screen.h | 5 |
3 files changed, 130 insertions, 31 deletions
diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp index f3566f6d46..2f802e2efb 100644 --- a/engines/sherlock/scalpel/scalpel.cpp +++ b/engines/sherlock/scalpel/scalpel.cpp @@ -561,21 +561,22 @@ bool ScalpelEngine::showCityCutscene3DO() { finished = _animation->play3DO("26open1", true, 1, 255, 2); if (finished) { - // TODO: Both of these should actually fade into the screen - _screen->_backBuffer2.blitFrom(*_screen); + _screen->_backBuffer1.blitFrom(*_screen); // save into backbuffer 1, used for fade + _screen->_backBuffer2.blitFrom(*_screen); // save into backbuffer 2, for restoring later // "London, England" ImageFile3DO titleImage_London("title2a.cel"); + _screen->_backBuffer1.transBlitFromUnscaled3DO(titleImage_London[0]._frame, Common::Point(30, 50)); - _screen->transBlitFromUnscaled3DO(titleImage_London[0]._frame, Common::Point(30, 50)); - finished = _events->delay(2000, true); + _screen->fadeIntoScreen3DO(1); + finished = _events->delay(1500, true); if (finished) { // "November, 1888" ImageFile3DO titleImage_November("title2b.cel"); + _screen->_backBuffer1.transBlitFromUnscaled3DO(titleImage_November[0]._frame, Common::Point(101, 100)); - _screen->transBlitFromUnscaled3DO(titleImage_November[0]._frame, Common::Point(101, 100)); - + _screen->fadeIntoScreen3DO(1); finished = _music->waitUntilMSec(14700, 0, 0, 5000); } @@ -589,10 +590,14 @@ bool ScalpelEngine::showCityCutscene3DO() { finished = _animation->play3DO("26open2", true, 1, 0, 2); if (finished) { + _screen->_backBuffer1.blitFrom(*_screen); // save into backbuffer 1, used for fade + // "Sherlock Holmes" (title) ImageFile3DO titleImage_SherlockHolmesTitle("title1ab.cel"); + _screen->_backBuffer1.transBlitFromUnscaled3DO(titleImage_SherlockHolmesTitle[0]._frame, Common::Point(34, 5)); - _screen->transBlitFromUnscaled3DO(titleImage_SherlockHolmesTitle[0]._frame, Common::Point(34, 5)); + // Blend in + _screen->fadeIntoScreen3DO(2); finished = _events->delay(500, true); // Title should fade in, Copyright should be displayed a bit after that @@ -602,53 +607,52 @@ bool ScalpelEngine::showCityCutscene3DO() { _screen->transBlitFromUnscaled3DO(titleImage_Copyright[0]._frame, Common::Point(20, 190)); finished = _events->delay(3500, true); } - // Title is supposed to get faded away after that } if (finished) finished = _music->waitUntilMSec(33600, 0, 0, 2000); if (finished) { - // TODO: fade to black - _screen->clear(); + // Fade to black + _screen->_backBuffer1.clear(); + _screen->fadeIntoScreen3DO(3); } if (finished) { // "In the alley behind the Regency Theatre..." ImageFile3DO titleImage_InTheAlley("title1d.cel"); + _screen->_backBuffer1.transBlitFromUnscaled3DO(titleImage_InTheAlley[0]._frame, Common::Point(72, 51)); - _screen->transBlitFromUnscaled3DO(titleImage_InTheAlley[0]._frame, Common::Point(72, 51)); - // TODO: Supposed to get faded in and out + // Fade in + _screen->fadeIntoScreen3DO(4); finished = _music->waitUntilMSec(39900, 0, 0, 2500); // Fade out - _screen->clear(); + _screen->_backBuffer1.clear(); + _screen->fadeIntoScreen3DO(4); } return finished; } bool ScalpelEngine::showAlleyCutscene3DO() { - bool finished = _music->waitUntilMSec(44000, 0, 0, 1000); + bool finished = _music->waitUntilMSec(43500, 0, 0, 1000); if (finished) finished = _animation->play3DO("27PRO1", true, 1, 3, 2); if (finished) { // Fade out... - _screen->clear(); + _screen->_backBuffer1.clear(); + _screen->fadeIntoScreen3DO(3); - finished = _music->waitUntilMSec(66700, 0, 0, 1000); + finished = _music->waitUntilMSec(67100, 0, 0, 1000); // 66700 } if (finished) finished = _animation->play3DO("27PRO2", true, 1, 0, 2); - if (finished) { - // Fade out - _screen->clear(); - + if (finished) finished = _music->waitUntilMSec(76000, 0, 0, 1000); - } if (finished) { // Show screaming victim @@ -665,8 +669,9 @@ bool ScalpelEngine::showAlleyCutscene3DO() { } if (finished) { - // TODO: quick fade out - _screen->clear(); + // Fade out + _screen->_backBuffer1.clear(); + _screen->fadeIntoScreen3DO(5); finished = _music->waitUntilMSec(84400, 0, 0, 2000); } @@ -675,17 +680,18 @@ bool ScalpelEngine::showAlleyCutscene3DO() { finished = _animation->play3DO("27PRO3", true, 1, 0, 2); if (finished) { - // Fade to black - _screen->clear(); + // Fade out + _screen->_backBuffer1.clear(); + _screen->fadeIntoScreen3DO(5); } if (finished) { // "Early the following morning on Baker Street..." ImageFile3DO titleImage_EarlyTheFollowingMorning("title3.cel"); + _screen->_backBuffer1.transBlitFromUnscaled3DO(titleImage_EarlyTheFollowingMorning[0]._frame, Common::Point(35, 51)); - _screen->transBlitFromUnscaled3DO(titleImage_EarlyTheFollowingMorning[0]._frame, Common::Point(35, 51)); - // TODO: Fade in - + // Fade in + _screen->fadeIntoScreen3DO(4); finished = _music->waitUntilMSec(96700, 0, 0, 3000); } @@ -697,7 +703,8 @@ bool ScalpelEngine::showStreetCutscene3DO() { if (finished) { // fade out "Early the following morning..." - _screen->clear(); + _screen->_backBuffer1.clear(); + _screen->fadeIntoScreen3DO(4); // wait for music a bit finished = _music->waitUntilMSec(100300, 0, 0, 1000); @@ -708,8 +715,11 @@ bool ScalpelEngine::showStreetCutscene3DO() { if (finished) finished = _animation->play3DO("14NOTE", true, 1, 0, 3); - // TODO: fade out - _screen->clear(); + if (finished) { + // Fade out + _screen->_backBuffer1.clear(); + _screen->fadeIntoScreen3DO(4); + } return finished; } diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp index de93d0aec3..de9bf51f46 100644 --- a/engines/sherlock/screen.cpp +++ b/engines/sherlock/screen.cpp @@ -231,6 +231,90 @@ void Screen::verticalTransition() { } } +void Screen::fadeIntoScreen3DO(int speed) { + Events &events = *_vm->_events; + Common::Rect changedRect; + uint16 *currentScreenBasePtr = (uint16 *)getPixels(); + uint16 *targetScreenBasePtr = (uint16 *)_backBuffer->getPixels(); + uint16 *currentScreenPtr = NULL; + uint16 *targetScreenPtr = NULL; + uint16 currentScreenPixel = 0; + uint16 targetScreenPixel = 0; + + uint16 currentScreenPixelRed = 0; + uint16 currentScreenPixelGreen = 0; + uint16 currentScreenPixelBlue = 0; + + uint16 targetScreenPixelRed = 0; + uint16 targetScreenPixelGreen = 0; + uint16 targetScreenPixelBlue = 0; + + uint16 screenWidth = this->w(); + uint16 screenHeight = this->h(); + uint16 screenX = 0; + uint16 screenY = 0; + uint16 pixelsChanged = 0; + + _dirtyRects.clear(); + + do { + pixelsChanged = 0; + currentScreenPtr = currentScreenBasePtr; + targetScreenPtr = targetScreenBasePtr; + + for (screenY = 0; screenY < screenHeight; screenY++) { + for (screenX = 0; screenX < screenWidth; screenX++) { + currentScreenPixel = *currentScreenPtr; + targetScreenPixel = *targetScreenPtr; + + if (currentScreenPixel != targetScreenPixel) { + // pixel doesn't match, adjust accordingly + currentScreenPixelRed = currentScreenPixel & 0xF800; + currentScreenPixelGreen = currentScreenPixel & 0x07E0; + currentScreenPixelBlue = currentScreenPixel & 0x001F; + targetScreenPixelRed = targetScreenPixel & 0xF800; + targetScreenPixelGreen = targetScreenPixel & 0x07E0; + targetScreenPixelBlue = targetScreenPixel & 0x001F; + + if (currentScreenPixelRed != targetScreenPixelRed) { + if (currentScreenPixelRed < targetScreenPixelRed) { + currentScreenPixelRed += 0x0800; + } else { + currentScreenPixelRed -= 0x0800; + } + } + if (currentScreenPixelGreen != targetScreenPixelGreen) { + // Adjust +2/-2 because we are running RGB555 at RGB565 + if (currentScreenPixelGreen < targetScreenPixelGreen) { + currentScreenPixelGreen += 0x0040; + } else { + currentScreenPixelGreen -= 0x0040; + } + } + if (currentScreenPixelBlue != targetScreenPixelBlue) { + if (currentScreenPixelBlue < targetScreenPixelBlue) { + currentScreenPixelBlue += 0x0001; + } else { + currentScreenPixelBlue -= 0x0001; + } + } + *currentScreenPtr = currentScreenPixelRed | currentScreenPixelGreen | currentScreenPixelBlue; + pixelsChanged++; + } + + currentScreenPtr++; + targetScreenPtr++; + } + } + + // Too much considered dirty at the moment + addDirtyRect(Common::Rect(0, 0, screenWidth, screenHeight)); + + events.pollEvents(); + events.delay(10 * speed); + } while ((pixelsChanged) && (!_vm->shouldQuit())); +} + void Screen::restoreBackground(const Common::Rect &r) { if (r.width() > 0 && r.height() > 0) { Common::Rect tempRect = r; diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h index 9d394da3c8..e4cc665b5f 100644 --- a/engines/sherlock/screen.h +++ b/engines/sherlock/screen.h @@ -149,6 +149,11 @@ public: void verticalTransition(); /** + * Fade backbuffer 1 into screen (3DO RGB!) + */ + void fadeIntoScreen3DO(int speed); + + /** * Prints the text passed onto the back buffer at the given position and color. * The string is then blitted to the screen */ |