Skip to content

Commit

Permalink
SCI32: Fix mouse position clamping
Browse files Browse the repository at this point in the history
  • Loading branch information
csnover committed Oct 15, 2016
1 parent c3adfc0 commit 6303468
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions engines/sci/event.cpp
Expand Up @@ -173,20 +173,18 @@ SciEvent EventManager::getScummVMEvent() {
if (getSciVersion() >= SCI_VERSION_2) {
const Buffer &screen = g_sci->_gfxFrameout->getCurrentBuffer();

// This will clamp `mousePos` according to the restricted zone,
// so any cursor or screen item associated with the mouse position
// does not bounce when it hits the edge (or ignore the edge)
g_sci->_gfxCursor32->deviceMoved(mousePos);

Common::Point mousePosSci = mousePos;
mulru(mousePosSci, Ratio(screen.scriptWidth, screen.screenWidth), Ratio(screen.scriptHeight, screen.screenHeight));
noEvent.mousePosSci = input.mousePosSci = mousePosSci;

if (ev.type == Common::EVENT_MOUSEMOVE) {
// This will clamp `mousePos` according to the restricted zone,
// so any cursor or screen item associated with the mouse position
// does not bounce when it hits the edge (or ignore the edge)
g_sci->_gfxCursor32->deviceMoved(mousePos);
if (_hotRectanglesActive) {
checkHotRectangles(mousePosSci);
}
if (_hotRectanglesActive) {
checkHotRectangles(mousePosSci);
}

} else {
#endif
g_sci->_gfxScreen->adjustBackUpscaledCoordinates(mousePos.y, mousePos.x);
Expand Down

0 comments on commit 6303468

Please sign in to comment.