diff --git a/Source/cursor.cpp b/Source/cursor.cpp index 6f20233e9..c5af4f927 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -297,9 +297,8 @@ void DrawSoftwareCursor(const Surface &out, Point position, int cursId) const ClxSprite sprite = GetInvItemSprite(cursId); if (!MyPlayer->HoldItem.isEmpty()) { const auto &heldItem = MyPlayer->HoldItem; - Size cursSize = GetInvItemSize(cursId); - ClxDrawOutline(out, GetOutlineColor(heldItem, true), position - Displacement(cursSize / 2), sprite); - DrawItem(heldItem, out, position - Displacement(cursSize / 2), sprite); + ClxDrawOutline(out, GetOutlineColor(heldItem, true), position, sprite); + DrawItem(heldItem, out, position, sprite); } else { ClxDraw(out, position, sprite); } diff --git a/Source/inv.cpp b/Source/inv.cpp index 3a52b2366..8350fc7aa 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -320,9 +320,8 @@ int FindSlotUnderCursor(Point cursorPosition, Size itemSize) void CheckInvPaste(Player &player, Point cursorPosition) { Size itemSize = GetInventorySize(player.HoldItem); - Size cursSize = GetInvItemSize(player.HoldItem._iCurs); - int slot = FindSlotUnderCursor(cursorPosition - Displacement(cursSize / 2), itemSize); + int slot = FindSlotUnderCursor(cursorPosition, itemSize); if (slot == NUM_XY_SLOTS) return; @@ -555,6 +554,8 @@ void CheckInvPaste(Player &player, Point cursorPosition) } CalcPlrInv(player, true); if (&player == MyPlayer) { + if (player.HoldItem.isEmpty() && !IsHardwareCursor()) + SetCursorPos(MousePosition + Displacement { itemSize * INV_SLOT_HALF_SIZE_PX }); NewCursor(player.HoldItem); } } @@ -818,6 +819,11 @@ void CheckInvCut(Player &player, Point cursorPosition, bool automaticMove, bool holdItem.clear(); } else { NewCursor(holdItem); + if (!IsHardwareCursor() && !dropItem) { + // For a hardware cursor, we set the "hot point" to the center of the item instead. + Size cursSize = GetInvItemSize(holdItem._iCurs + CURSOR_FIRSTITEM); + SetCursorPos(cursorPosition - Displacement(cursSize / 2)); + } } } }