diff options
author | athrxx | 2019-10-22 22:27:09 +0200 |
---|---|---|
committer | athrxx | 2019-10-31 13:10:23 +0100 |
commit | 72084365afa995ae3e78ff3af85c359245a91f19 (patch) | |
tree | 86798676e0877ba6b25a7fa63fcfc2bd3b6bffb1 /engines/kyra/gui | |
parent | 6651b08d311d90a8ae491f31b92ffa593795cbee (diff) | |
download | scummvm-rg350-72084365afa995ae3e78ff3af85c359245a91f19.tar.gz scummvm-rg350-72084365afa995ae3e78ff3af85c359245a91f19.tar.bz2 scummvm-rg350-72084365afa995ae3e78ff3af85c359245a91f19.zip |
KYRA: (LOL) - fix item pickup glitch
This fixes an original bug that recently got my attention.
While I never managed to duplicate items like the person in the video I did experience lockups.
Maybe the exploit works only with the original executable...
https://www.youtube.com/watch?v=fkJ2KilULco&feature=youtu.be
https://www.youtube.com/watch?v=4oRESbQLDig&feature=youtu.be
Diffstat (limited to 'engines/kyra/gui')
-rw-r--r-- | engines/kyra/gui/gui_lol.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/engines/kyra/gui/gui_lol.cpp b/engines/kyra/gui/gui_lol.cpp index 293d507e5f..602309c8ff 100644 --- a/engines/kyra/gui/gui_lol.cpp +++ b/engines/kyra/gui/gui_lol.cpp @@ -1300,9 +1300,18 @@ int LoLEngine::clickedScenePickupItem(Button *button) { redrawSceneItem(); + // WORKAROUND for original bug that allowed picking up items by clicking exactly 1 pixel from the + // left, right or bottom border (which could even cause lockups). We simply clip the item pixel + // search zone to the dimensions of the calling button... + const ScreenDim *dim = _screen->getScreenDim(button->dimTableIndex); + int clipLeft = (dim->sx << 3) + button->x; + int clipTop = dim->sy + button->y; + int clipRight = (dim->sx << 3) + button->x + button->width - 1; + int clipBottom = dim->sy + button->y + button->height - 1; + int p = 0; for (int i = 0; i < len; i++) { - p = _screen->getPagePixel(_screen->_curPage, CLIP(_mouseX + checkX[i], 0, 320), CLIP(_mouseY + checkY[i], 0, 200)); + p = _screen->getPagePixel(_screen->_curPage, CLIP(_mouseX + checkX[i], clipLeft, clipRight), CLIP(_mouseY + checkY[i], clipTop, clipBottom)); if (p) break; } |