diff options
author | Marisa-Chan | 2013-10-17 20:24:17 +0000 |
---|---|---|
committer | Marisa-Chan | 2013-10-18 19:48:57 +0000 |
commit | b9ad7e80a5ec37f59f39858dd5eef7e519afffa2 (patch) | |
tree | d9974c9ad707104b5b11b288f11e932f4eb70d9b | |
parent | aba818d19578836aab41e0bc484dfbdfc5da3231 (diff) | |
download | scummvm-rg350-b9ad7e80a5ec37f59f39858dd5eef7e519afffa2.tar.gz scummvm-rg350-b9ad7e80a5ec37f59f39858dd5eef7e519afffa2.tar.bz2 scummvm-rg350-b9ad7e80a5ec37f59f39858dd5eef7e519afffa2.zip |
ZVISION: screenSpaceToImageSpace return 0,0 when pointer outside working window.
-rw-r--r-- | engines/zvision/render_manager.cpp | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index af8ca7fd64..cb13606b11 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -385,30 +385,34 @@ Common::Rect RenderManager::renderTextToWorkingWindow(uint32 idNumber, const Com } const Common::Point RenderManager::screenSpaceToImageSpace(const Common::Point &point) { - // Convert from screen space to working window space - Common::Point newPoint(point - Common::Point(_workingWindow.left, _workingWindow.top)); + if (_workingWindow.contains(point)) { + // Convert from screen space to working window space + Common::Point newPoint(point - Common::Point(_workingWindow.left, _workingWindow.top)); - RenderTable::RenderState state = _renderTable.getRenderState(); - if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { - newPoint = _renderTable.convertWarpedCoordToFlatCoord(newPoint); - } + RenderTable::RenderState state = _renderTable.getRenderState(); + if (state == RenderTable::PANORAMA || state == RenderTable::TILT) { + newPoint = _renderTable.convertWarpedCoordToFlatCoord(newPoint); + } - if (state == RenderTable::PANORAMA) { - newPoint -= (Common::Point(_screenCenterX, 0) - _backgroundOffset); - } else if (state == RenderTable::TILT) { - newPoint -= (Common::Point(0, _screenCenterY) - _backgroundOffset); - } + if (state == RenderTable::PANORAMA) { + newPoint -= (Common::Point(_screenCenterX, 0) - _backgroundOffset); + } else if (state == RenderTable::TILT) { + newPoint -= (Common::Point(0, _screenCenterY) - _backgroundOffset); + } - if (newPoint.x < 0) - newPoint.x += _backgroundWidth; - else if (newPoint.x >= _backgroundWidth) - newPoint.x -= _backgroundWidth; - if (newPoint.y < 0) - newPoint.y += _backgroundHeight; - else if (newPoint.y >= _backgroundHeight) - newPoint.y -= _backgroundHeight; + if (newPoint.x < 0) + newPoint.x += _backgroundWidth; + else if (newPoint.x >= _backgroundWidth) + newPoint.x -= _backgroundWidth; + if (newPoint.y < 0) + newPoint.y += _backgroundHeight; + else if (newPoint.y >= _backgroundHeight) + newPoint.y -= _backgroundHeight; - return newPoint; + return newPoint; + } else { + return Common::Point(0, 0); + } } const Common::Point RenderManager::imageSpaceToWorkingWindowSpace(const Common::Point &point) { |