From 30bfde4182d8a576a58357a12713f6353d06b429 Mon Sep 17 00:00:00 2001 From: shweet Date: Fri, 13 Nov 2026 01:26:46 -0500 Subject: [PATCH] Held interactions keep their area, new ones start only on click --- src/interact.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/interact.cpp b/src/interact.cpp index e884d91..187f1ff 100644 --- a/src/interact.cpp +++ b/src/interact.cpp @@ -19,6 +19,8 @@ constexpr float AUTO_SPEED = 9; constexpr float AUTO_TARGET_EPSILON = 0.001f; constexpr int AUTO_CLICK_COOLDOWN = 45; +// Hovers and works the interact areas under the cursor. An interaction starts only on a click, and a held one keeps its +// area until let go or left, never passing to another the cursor drifts over. void Interactions::update(Play& play, Pointer pointer) { Character& character = *play.character; @@ -42,6 +44,8 @@ void Interactions::update(Play& play, Pointer pointer) for (int i = 0; i < (int)character.interactAreas.size(); i++) { + if (isInteracting && area >= 0 && i != area) + continue; InteractArea& entry = character.interactAreas[i]; bool isInside = is_point_in_rect(body.actor.null_rect_get(entry.null), pointer.position); if (play.cursorState == CURSOR_DEFAULT && isInside && !pointer.isCaptured && entry.type == pointer.type) @@ -50,8 +54,7 @@ void Interactions::update(Play& play, Pointer pointer) active.play(entry.cursorHover, TRANSITION_IF_IDLE); isHovering = true; area = i; - bool isHoldStart = entry.isHold && (pointer.isClicked || (pointer.isDown && !isInteracting)); - if (isHoldStart || (!entry.isHold && pointer.isClicked)) + if (pointer.isClicked) { if (entry.isHold) isInteracting = isHolding = true;