diff options
author | Paul Gilbert | 2012-05-11 23:36:13 +1000 |
---|---|---|
committer | Paul Gilbert | 2012-05-11 23:36:13 +1000 |
commit | 67c47e9045cab111ff9daadf9968553106f14bfe (patch) | |
tree | 61611011affdd8f4af3f8e3f024c2a05b768dd12 /engines | |
parent | beef5fdb264850079208b5513cf72626ff7edd86 (diff) | |
download | scummvm-rg350-67c47e9045cab111ff9daadf9968553106f14bfe.tar.gz scummvm-rg350-67c47e9045cab111ff9daadf9968553106f14bfe.tar.bz2 scummvm-rg350-67c47e9045cab111ff9daadf9968553106f14bfe.zip |
TONY: First attempt at simulating the circular fade in/out effect engine uses
The engine uses DirectX drawing functionality to do drawing of partial frames within an ellipsis, so we need to replicate that manually in code.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tony/window.cpp | 57 | ||||
-rw-r--r-- | engines/tony/window.h | 2 |
2 files changed, 54 insertions, 5 deletions
diff --git a/engines/tony/window.cpp b/engines/tony/window.cpp index 3185e5aa4d..da49b91109 100644 --- a/engines/tony/window.cpp +++ b/engines/tony/window.cpp @@ -147,11 +147,58 @@ void RMWindow::GetNewFrameWipe(byte *lpBuf, Common::Rect &rcBoundEllipse) { if (!rcBoundEllipse.isValidRect()) return; - // TODO: Do a proper circular wipe - for (int yp = rcBoundEllipse.top; yp < rcBoundEllipse.bottom; ++yp) { - const byte *pSrc = lpBuf + (yp * RM_SX * 2) + rcBoundEllipse.left * 2; - - g_system->copyRectToScreen(pSrc, RM_SX * 2, rcBoundEllipse.left, yp, rcBoundEllipse.width(), 1); + Common::Point center(rcBoundEllipse.left + rcBoundEllipse.width() / 2, + rcBoundEllipse.top + rcBoundEllipse.height() / 2); + int radius = rcBoundEllipse.width() / 2; + + int error = -radius; + int x = radius; + int y = 0; + + while (x >= y) { + plotSplices(lpBuf, center, x, y); + + error += y; + ++y; + error += y; + + if (error >= 0) { + error -= x; + --x; + error -= x; + } + } +} + +/** + * Handles drawing the line splices for the circle of viewable area + */ +void RMWindow::plotSplices(const byte *lpBuf, const Common::Point ¢er, int x, int y) { + plotLines(lpBuf, center, x, y); + if (x != y) + plotLines(lpBuf, center, y, x); +} + +/** + * Handles drawing the line splices for the circle of viewable area + */ +void RMWindow::plotLines(const byte *lpBuf, const Common::Point ¢er, int x, int y) { + // Skips lines that have no width (i.e. at the top of the circle) + if ((x == 0) || (y > center.y)) + return; + + const byte *pSrc; + + if ((center.y - y) >= 0) { + // Draw line in top half of circle + pSrc = lpBuf + ((center.y - y) * RM_SX * 2) + (center.x - x) * 2; + g_system->copyRectToScreen(pSrc, RM_SX * 2, center.x - x, center.y - y, x * 2, 1); + } + + if ((center.y + y) < RM_SY) { + // Draw line in bottom half of circle + pSrc = lpBuf + ((center.y + y) * RM_SX * 2) + (center.x - x) * 2; + g_system->copyRectToScreen(pSrc, RM_SX * 2, center.x - x, center.y + y, x * 2, 1); } } diff --git a/engines/tony/window.h b/engines/tony/window.h index 06f684a15b..56f48d7698 100644 --- a/engines/tony/window.h +++ b/engines/tony/window.h @@ -80,6 +80,8 @@ class RMWindow { private: bool Lock(); void Unlock(); + void plotSplices(const byte *lpBuf, const Common::Point ¢er, int x, int y); + void plotLines(const byte *lpBuf, const Common::Point ¢er, int x, int y); protected: void * /*LPDIRECTDRAWCLIPPER*/ m_MainClipper; |