diff options
author | Paul Gilbert | 2012-05-21 23:11:59 +1000 |
---|---|---|
committer | Paul Gilbert | 2012-05-21 23:11:59 +1000 |
commit | 3f00f51ef3239b02e01fed80c9205835b2d654e9 (patch) | |
tree | 35643d1ab13751c7c162ab82978367924c229333 /engines/tony | |
parent | 7303849490881f75c990edba895118ec03152320 (diff) | |
download | scummvm-rg350-3f00f51ef3239b02e01fed80c9205835b2d654e9.tar.gz scummvm-rg350-3f00f51ef3239b02e01fed80c9205835b2d654e9.tar.bz2 scummvm-rg350-3f00f51ef3239b02e01fed80c9205835b2d654e9.zip |
TONY: Improve the screen wipe logic.
The circular area now properly reaches to the edge of the screen when changing scenes.
Diffstat (limited to 'engines/tony')
-rw-r--r-- | engines/tony/window.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/engines/tony/window.cpp b/engines/tony/window.cpp index 481393c5ed..0f36c72f97 100644 --- a/engines/tony/window.cpp +++ b/engines/tony/window.cpp @@ -138,8 +138,17 @@ void RMWindow::GetNewFrameWipe(byte *lpBuf, Common::Rect &rcBoundEllipse) { Common::Point center(rcBoundEllipse.left + rcBoundEllipse.width() / 2, rcBoundEllipse.top + rcBoundEllipse.height() / 2); - int radius = rcBoundEllipse.width() / 2; + // The rectangle technically defines the area inside the ellipse, with the corners touching + // the ellipse boundary. Since we're currently simulating the ellipse using a plain circle, + // we need to calculate a necessary width using the hypotenuse of X/2 & Y/2 + int x2y2 = (rcBoundEllipse.width() / 2) * (rcBoundEllipse.width() / 2) + + (rcBoundEllipse.height() / 2) * (rcBoundEllipse.height() / 2); + int radius = 0; + while ((radius * radius) < x2y2) + ++radius; + + // Proceed copying a circular area of the frame with the calculated radius onto the screen int error = -radius; int x = radius; int y = 0; @@ -177,17 +186,19 @@ void RMWindow::plotLines(const byte *lpBuf, const Common::Point ¢er, int x, return; const byte *pSrc; + int xs = MAX(center.x - x, 0); + int width = MIN(RM_SX - xs, x * 2); 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); + pSrc = lpBuf + ((center.y - y) * RM_SX * 2) + xs * 2; + g_system->copyRectToScreen(pSrc, RM_SX * 2, xs, center.y - y, width, 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); + pSrc = lpBuf + ((center.y + y) * RM_SX * 2) + xs * 2; + g_system->copyRectToScreen(pSrc, RM_SX * 2, xs, center.y + y, width, 1); } } |