From a08b0b9e59edb25eb8870582cd161640b2b2f8bc Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Fri, 12 Jun 2015 11:11:55 +0200 Subject: SHERLOCK: remove transBlitFromUnscaled3DO --- engines/sherlock/animation.cpp | 4 +- engines/sherlock/scalpel/scalpel.cpp | 18 ++++----- engines/sherlock/surface.cpp | 72 +++++++++++++++++------------------- engines/sherlock/surface.h | 3 -- 4 files changed, 45 insertions(+), 52 deletions(-) diff --git a/engines/sherlock/animation.cpp b/engines/sherlock/animation.cpp index 73f3a9220f..50cb200d0b 100644 --- a/engines/sherlock/animation.cpp +++ b/engines/sherlock/animation.cpp @@ -201,10 +201,10 @@ bool Animation::play3DO(const Common::String &filename, bool intro, int minDelay // Draw the sprite. Note that we explicitly use the raw frame below, rather than the ImageFrame, // since we don't want the offsets in the image file to be used, just the explicit position we specify if (!fadeActive) { - screen.transBlitFromUnscaled3DO(images[imageFrame]._frame, pt); + screen.transBlitFrom(images[imageFrame]._frame, pt); } else { // Fade active, blit to backbuffer1 - screen._backBuffer1.transBlitFromUnscaled3DO(images[imageFrame]._frame, pt); + screen._backBuffer1.transBlitFrom(images[imageFrame]._frame, pt); } } else { // At this point, either the sprites for the frame has been complete, or there weren't any sprites diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp index a3ada427ad..02e0f383bc 100644 --- a/engines/sherlock/scalpel/scalpel.cpp +++ b/engines/sherlock/scalpel/scalpel.cpp @@ -533,7 +533,7 @@ bool ScalpelEngine::show3DOSplash() { // 3DO EA Splash screen ImageFile3DO titleImage_3DOSplash("3DOSplash.cel"); - _screen->transBlitFromUnscaled3DO(titleImage_3DOSplash[0]._frame, Common::Point(0, -20)); + _screen->transBlitFrom(titleImage_3DOSplash[0]._frame, Common::Point(0, -20)); bool finished = _events->delay(3000, true); if (finished) { @@ -577,7 +577,7 @@ bool ScalpelEngine::showCityCutscene3DO() { // "London, England" ImageFile3DO titleImage_London("title2a.cel"); - _screen->_backBuffer1.transBlitFromUnscaled3DO(titleImage_London[0]._frame, Common::Point(30, 50)); + _screen->_backBuffer1.transBlitFrom(titleImage_London[0]._frame, Common::Point(30, 50)); _screen->fadeIntoScreen3DO(1); finished = _events->delay(1500, true); @@ -585,7 +585,7 @@ bool ScalpelEngine::showCityCutscene3DO() { if (finished) { // "November, 1888" ImageFile3DO titleImage_November("title2b.cel"); - _screen->_backBuffer1.transBlitFromUnscaled3DO(titleImage_November[0]._frame, Common::Point(100, 100)); + _screen->_backBuffer1.transBlitFrom(titleImage_November[0]._frame, Common::Point(100, 100)); _screen->fadeIntoScreen3DO(1); finished = _music->waitUntilMSec(14700, 0, 0, 5000); @@ -605,7 +605,7 @@ bool ScalpelEngine::showCityCutscene3DO() { // "Sherlock Holmes" (title) ImageFile3DO titleImage_SherlockHolmesTitle("title1ab.cel"); - _screen->_backBuffer1.transBlitFromUnscaled3DO(titleImage_SherlockHolmesTitle[0]._frame, Common::Point(34, 5)); + _screen->_backBuffer1.transBlitFrom(titleImage_SherlockHolmesTitle[0]._frame, Common::Point(34, 5)); // Blend in _screen->fadeIntoScreen3DO(2); @@ -615,7 +615,7 @@ bool ScalpelEngine::showCityCutscene3DO() { if (finished) { ImageFile3DO titleImage_Copyright("title1c.cel"); - _screen->transBlitFromUnscaled3DO(titleImage_Copyright[0]._frame, Common::Point(20, 190)); + _screen->transBlitFrom(titleImage_Copyright[0]._frame, Common::Point(20, 190)); finished = _events->delay(3500, true); } } @@ -632,7 +632,7 @@ bool ScalpelEngine::showCityCutscene3DO() { 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->_backBuffer1.transBlitFrom(titleImage_InTheAlley[0]._frame, Common::Point(72, 51)); // Fade in _screen->fadeIntoScreen3DO(4); @@ -670,7 +670,7 @@ bool ScalpelEngine::showAlleyCutscene3DO() { ImageFile3DO titleImage_ScreamingVictim("scream.cel"); _screen->clear(); - _screen->transBlitFromUnscaled3DO(titleImage_ScreamingVictim[0]._frame, Common::Point(0, 0)); + _screen->transBlitFrom(titleImage_ScreamingVictim[0]._frame, Common::Point(0, 0)); // Play "scream.aiff" if (_sound->_voices) @@ -699,7 +699,7 @@ bool ScalpelEngine::showAlleyCutscene3DO() { 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->_backBuffer1.transBlitFrom(titleImage_EarlyTheFollowingMorning[0]._frame, Common::Point(35, 51)); // Fade in _screen->fadeIntoScreen3DO(4); @@ -754,7 +754,7 @@ bool ScalpelEngine::showOfficeCutscene3DO() { ImageFile3DO titleImage_CoffeeNote("note.cel"); _screen->clear(); - _screen->transBlitFromUnscaled3DO(titleImage_CoffeeNote[0]._frame, Common::Point(0, 0)); + _screen->transBlitFrom(titleImage_CoffeeNote[0]._frame, Common::Point(0, 0)); if (_sound->_voices) { finished = _sound->playSound("prologue/sounds/note.aiff", WAIT_KBD_OR_FINISH); diff --git a/engines/sherlock/surface.cpp b/engines/sherlock/surface.cpp index 3005c815ed..d67e958219 100644 --- a/engines/sherlock/surface.cpp +++ b/engines/sherlock/surface.cpp @@ -172,46 +172,42 @@ void Surface::transBlitFromUnscaled(const Graphics::Surface &src, const Common:: addDirtyRect(Common::Rect(destPt.x, destPt.y, destPt.x + drawRect.width(), destPt.y + drawRect.height())); - // Draw loop - for (int yp = 0; yp < drawRect.height(); ++yp) { - const byte *srcP = (const byte *)src.getBasePtr( - flipped ? drawRect.right - 1 : drawRect.left, drawRect.top + yp); - byte *destP = (byte *)getBasePtr(destPt.x, destPt.y + yp); - - for (int xp = 0; xp < drawRect.width(); ++xp, ++destP) { - if (*srcP != TRANSPARENCY) - *destP = overrideColor ? overrideColor : *srcP; - - srcP = flipped ? srcP - 1 : srcP + 1; + switch (src.format.bytesPerPixel) { + case 1: + // 8-bit palettized: Draw loop + assert(_surface.format.bytesPerPixel == 1); // Security check + for (int yp = 0; yp < drawRect.height(); ++yp) { + const byte *srcP = (const byte *)src.getBasePtr( + flipped ? drawRect.right - 1 : drawRect.left, drawRect.top + yp); + byte *destP = (byte *)getBasePtr(destPt.x, destPt.y + yp); + + for (int xp = 0; xp < drawRect.width(); ++xp, ++destP) { + if (*srcP != TRANSPARENCY) + *destP = overrideColor ? overrideColor : *srcP; + + srcP = flipped ? srcP - 1 : srcP + 1; + } } - } -} - -// TODO: Needs to get implemented properly -void Surface::transBlitFromUnscaled3DO(const Graphics::Surface &src, const Common::Point &pt) { - Common::Rect drawRect(0, 0, src.w, src.h); - Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h); - - // Clip the display area to on-screen - if (!clip(drawRect, destRect)) - // It's completely off-screen - return; - - Common::Point destPt(destRect.left, destRect.top); - addDirtyRect(Common::Rect(destPt.x, destPt.y, destPt.x + drawRect.width(), - destPt.y + drawRect.height())); - - // Draw loop - for (int yp = 0; yp < drawRect.height(); ++yp) { - const uint16 *srcP = (const uint16 *)src.getBasePtr(drawRect.left, drawRect.top + yp); - uint16 *destP = (uint16 *)getBasePtr(destPt.x, destPt.y + yp); - - for (int xp = 0; xp < drawRect.width(); ++xp, ++destP) { - if (*srcP) // 0 = transparent on 3DO - *destP = *srcP; - - srcP = srcP + 1; + break; + case 2: + // 3DO 15-bit RGB565: Draw loop + assert(_surface.format.bytesPerPixel == 2); // Security check + for (int yp = 0; yp < drawRect.height(); ++yp) { + const uint16 *srcP = (const uint16 *)src.getBasePtr( + flipped ? drawRect.right - 1 : drawRect.left, drawRect.top + yp); + uint16 *destP = (uint16 *)getBasePtr(destPt.x, destPt.y + yp); + + for (int xp = 0; xp < drawRect.width(); ++xp, ++destP) { + if (*srcP) // RGB 0, 0, 0 -> transparent on 3DO + *destP = *srcP; // overrideColor ? overrideColor : *srcP; + + srcP = flipped ? srcP - 1 : srcP + 1; + } } + break; + default: + error("Surface: unsupported bytesperpixel"); + break; } } diff --git a/engines/sherlock/surface.h b/engines/sherlock/surface.h index 4e9300b0a3..6032592084 100644 --- a/engines/sherlock/surface.h +++ b/engines/sherlock/surface.h @@ -65,9 +65,6 @@ private: void transBlitFromUnscaled(const Graphics::Surface &src, const Common::Point &pt, bool flipped, int overrideColor); -public: - void transBlitFromUnscaled3DO(const Graphics::Surface &src, const Common::Point &pt); - protected: Graphics::Surface _surface; -- cgit v1.2.3