[Scummvm-git-logs] scummvm master -> 7afe1d9b45ec05bdeb2687a3516afef9c8db04e1
bluegr
noreply at scummvm.org
Thu May 14 01:40:59 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
7afe1d9b45 NANCY: Fix closeup positions in multibuildpuzzle
Commit: 7afe1d9b45ec05bdeb2687a3516afef9c8db04e1
https://github.com/scummvm/scummvm/commit/7afe1d9b45ec05bdeb2687a3516afef9c8db04e1
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2026-05-14T04:40:02+03:00
Commit Message:
NANCY: Fix closeup positions in multibuildpuzzle
Fix #16750
Changed paths:
engines/nancy/action/puzzle/multibuildpuzzle.cpp
diff --git a/engines/nancy/action/puzzle/multibuildpuzzle.cpp b/engines/nancy/action/puzzle/multibuildpuzzle.cpp
index df0163b85f9..ead89f99a40 100644
--- a/engines/nancy/action/puzzle/multibuildpuzzle.cpp
+++ b/engines/nancy/action/puzzle/multibuildpuzzle.cpp
@@ -388,12 +388,20 @@ void MultiBuildPuzzle::handleInput(NancyInput &input) {
pp.registerGraphics();
if (_hasCloseupImage && !pp.cuSrcRect.isEmpty()) {
- // First click shows close-up view, centered in the viewport.
+ // First click shows the close-up view centered on the
+ // piece's current center.
_selectedPiece = topmost;
- int cuW = pp.cuSrcRect.width();
- int cuH = pp.cuSrcRect.height();
- int cuLeft = (vpScreen.width() - cuW) / 2;
- int cuTop = (vpScreen.height() - cuH) / 2;
+ const int cuW = pp.cuSrcRect.width();
+ const int cuH = pp.cuSrcRect.height();
+ const int pieceW = pp.rotateSurfaces[pp.curRotation].w;
+ const int pieceH = pp.rotateSurfaces[pp.curRotation].h;
+ const int centerX = pp.gameRect.left + pieceW / 2;
+ const int centerY = pp.gameRect.top + pieceH / 2;
+ int cuLeft = centerX - cuW / 2;
+ int cuTop = centerY - cuH / 2;
+ // Clamp so the close-up stays fully inside the viewport.
+ cuLeft = CLIP<int>(cuLeft, 0, MAX(0, vpScreen.width() - cuW));
+ cuTop = CLIP<int>(cuTop, 0, MAX(0, vpScreen.height() - cuH));
pp.gameRect = Common::Rect(cuLeft, cuTop, cuLeft + cuW, cuTop + cuH);
} else {
// Direct drag: first click immediately starts dragging
More information about the Scummvm-git-logs
mailing list