diff options
author | Sylvain Dupont | 2010-10-16 00:17:19 +0000 |
---|---|---|
committer | Sylvain Dupont | 2010-10-16 00:17:19 +0000 |
commit | 2c2ca3e353e3f9dec82c7ad10f8eaf2d984a2e5b (patch) | |
tree | d8c640f8cf782b22d4a86900aee65dbd5d891d56 /engines/toon/toon.cpp | |
parent | 63c30e959fb9dc6ff40fd8cb4d3d4a4969f5e019 (diff) | |
download | scummvm-rg350-2c2ca3e353e3f9dec82c7ad10f8eaf2d984a2e5b.tar.gz scummvm-rg350-2c2ca3e353e3f9dec82c7ad10f8eaf2d984a2e5b.tar.bz2 scummvm-rg350-2c2ca3e353e3f9dec82c7ad10f8eaf2d984a2e5b.zip |
TOON: Fixed bug #3086000 there was no magnifier effect
Bug #3086000: "TOON: Magnifying glass cursor drawn incorrectly"
Zoom magnifier postprocess fx has been implemented
svn-id: r53529
Diffstat (limited to 'engines/toon/toon.cpp')
-rw-r--r-- | engines/toon/toon.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp index 619942713a..efcd5016b5 100644 --- a/engines/toon/toon.cpp +++ b/engines/toon/toon.cpp @@ -400,9 +400,59 @@ void ToonEngine::render() { } } +void ToonEngine::doMagnifierEffect() +{ + int32 posX = _mouseX + state()->_currentScrollValue - _cursorOffsetX; + int32 posY = _mouseY - _cursorOffsetY - 2; + + Graphics::Surface& surface = *_mainSurface; + + // fast sqrt table lookup ( values up to 144 only) + static const byte intSqrt[] = { + 0, 1, 1, 1, 2, 2, 2, 2, 2, 3, + 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 12 + }; + + byte tempBuffer[25*25]; + for (int32 y = -12; y <= 12; y++) { + for (int32 x = -12; x <= 12; x++) { + int32 destPitch = surface.pitch; + uint8 *curRow = (uint8 *)surface.pixels + (posY + y) * destPitch + (posX + x); + tempBuffer[(y+12) * 25 + x + 12] = *curRow; + } + } + + for (int32 y = -12; y <= 12; y++) { + for (int32 x = -12; x <= 12; x++) { + int32 dist = y * y + x * x; + if (dist > 144) + continue; + int32 destPitch = surface.pitch; + uint8 *curRow = (uint8 *)surface.pixels + (posY + y) * destPitch + (posX + x); + int32 lerp = (512 + intSqrt[dist] * 256 / 12) ; + *curRow = tempBuffer[(y*lerp/1024+12) * 25 + x*lerp/1024 + 12] ; + } + } +} + void ToonEngine::copyToVirtualScreen(bool updateScreen) { // render cursor last if (!_gameState->_mouseHidden) { + if (_cursorAnimationInstance->getFrame() == 7) // magnifier icon needs a special effect + doMagnifierEffect(); _cursorAnimationInstance->setPosition(_mouseX - 40 + state()->_currentScrollValue - _cursorOffsetX, _mouseY - 40 - _cursorOffsetY, 0, false); _cursorAnimationInstance->render(); } |