diff options
-rw-r--r-- | engines/hdb/gfx.cpp | 18 | ||||
-rw-r--r-- | engines/hdb/gfx.h | 2 |
2 files changed, 11 insertions, 9 deletions
diff --git a/engines/hdb/gfx.cpp b/engines/hdb/gfx.cpp index cc43b06b54..eda51b7ce7 100644 --- a/engines/hdb/gfx.cpp +++ b/engines/hdb/gfx.cpp @@ -91,6 +91,10 @@ bool Gfx::init() { _eTop = 0; _eBottom = g_hdb->_screenHeight; + // Need two main memory screen-sized surfaces for screen fading + _fadeBuffer1.create(g_hdb->_screenWidth, g_hdb->_screenHeight, g_hdb->_format); + _fadeBuffer2.create(g_hdb->_screenWidth, g_hdb->_screenHeight, g_hdb->_format); + // Load Game Font if (!loadFont("normalprop")) return false; @@ -308,15 +312,11 @@ void Gfx::updateFade() { debug(7, "updateFade: active: %d stayFaded: %d isBlack: %d speed: %d isFadeIn: %d curStep: %d", _fadeInfo.active, _fadeInfo.stayFaded, _fadeInfo.isBlack, _fadeInfo.speed, _fadeInfo.isFadeIn, _fadeInfo.curStep); - Graphics::ManagedSurface fadeBuffer1, fadeBuffer2; - fadeBuffer1.create(g_hdb->_screenWidth, g_hdb->_screenHeight, g_hdb->_format); - fadeBuffer2.create(g_hdb->_screenWidth, g_hdb->_screenHeight, g_hdb->_format); - - fadeBuffer2.blitFrom(_globalSurface); + _fadeBuffer2.blitFrom(_globalSurface); do { // Copy pristine copy of background to modification buffer - fadeBuffer1.blitFrom(fadeBuffer2); + _fadeBuffer1.blitFrom(_fadeBuffer2); // do the actual alphablending @@ -326,7 +326,7 @@ void Gfx::updateFade() { // Black Fade for (int y = 0; y < g_hdb->_screenHeight; y++) { - ptr = (uint16 *)fadeBuffer1.getBasePtr(0, y); + ptr = (uint16 *)_fadeBuffer1.getBasePtr(0, y); for (int x = 0; x < g_hdb->_screenWidth; x++) { value = *ptr; if (value) { @@ -343,7 +343,7 @@ void Gfx::updateFade() { // White Fade for (int y = 0; y < g_hdb->_screenHeight; y++) { - ptr = (uint16 *)fadeBuffer1.getBasePtr(0, y); + ptr = (uint16 *)_fadeBuffer1.getBasePtr(0, y); for (int x = 0; x < g_hdb->_screenWidth; x++) { value = *ptr; g_hdb->_format.colorToRGB(value, r, g, b); @@ -356,7 +356,7 @@ void Gfx::updateFade() { } } - _globalSurface.blitFrom(fadeBuffer1); + _globalSurface.blitFrom(_fadeBuffer1); // step the fading values to the next one and // see if we're done yet diff --git a/engines/hdb/gfx.h b/engines/hdb/gfx.h index 903b57948c..976b182850 100644 --- a/engines/hdb/gfx.h +++ b/engines/hdb/gfx.h @@ -157,6 +157,8 @@ private: TileLookup *_tLookupArray; uint16 _skyTiles[kMaxSkies]; + Graphics::ManagedSurface _fadeBuffer1, _fadeBuffer2; + Common::Array<GfxCache *> *_gfxCache; int _currentSky; // 0 if no Sky, 1+ for which Sky to use |