diff --git a/Source/engine/render/scrollrt.cpp b/Source/engine/render/scrollrt.cpp index dfdd273d1..847b90696 100644 --- a/Source/engine/render/scrollrt.cpp +++ b/Source/engine/render/scrollrt.cpp @@ -263,13 +263,15 @@ void DrawCursor(const Surface &out) // Copy the buffer before the item cursor and its 1px outline are drawn to a temporary buffer. const int outlineWidth = !MyPlayer->HoldItem.isEmpty() ? 1 : 0; + Displacement offset = !MyPlayer->HoldItem.isEmpty() ? Displacement { cursSize / 2 } : Displacement { 0 }; + Point cursPosition = MousePosition - offset; Rectangle &rect = cursor.rect; - rect.position.x = MousePosition.x - outlineWidth; + rect.position.x = cursPosition.x - outlineWidth; rect.size.width = cursSize.width + 2 * outlineWidth; Clip(rect.position.x, rect.size.width, out.w()); - rect.position.y = MousePosition.y - outlineWidth; + rect.position.y = cursPosition.y - outlineWidth; rect.size.height = cursSize.height + 2 * outlineWidth; Clip(rect.position.y, rect.size.height, out.h()); @@ -277,7 +279,7 @@ void DrawCursor(const Surface &out) return; BlitCursor(cursor.behindBuffer, rect.size.width, &out[rect.position], out.pitch(), rect.size.width, rect.size.height); - DrawSoftwareCursor(out, MousePosition + Displacement { 0, cursSize.height - 1 }, pcurs); + DrawSoftwareCursor(out, cursPosition + Displacement { 0, cursSize.height - 1 }, pcurs); } /** diff --git a/Source/inv.cpp b/Source/inv.cpp index 8350fc7aa..dee00b18f 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -288,12 +288,6 @@ int FindSlotUnderCursor(Point cursorPosition, Size itemSize) int i = cursorPosition.x; int j = cursorPosition.y; - if (!IsHardwareCursor()) { - // offset the cursor position to match the hot pixel we'd use for a hardware cursor - i += itemSize.width * INV_SLOT_HALF_SIZE_PX; - j += itemSize.height * INV_SLOT_HALF_SIZE_PX; - } - for (int r = 0; r < NUM_XY_SLOTS; r++) { int xo = GetRightPanel().position.x; int yo = GetRightPanel().position.y; @@ -554,8 +548,6 @@ 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); } } @@ -819,11 +811,6 @@ 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)); - } } } } diff --git a/Source/qol/stash.cpp b/Source/qol/stash.cpp index 14e5105e3..630554d13 100644 --- a/Source/qol/stash.cpp +++ b/Source/qol/stash.cpp @@ -94,12 +94,10 @@ void CheckStashPaste(Point cursorPosition) Player &player = *MyPlayer; const Size itemSize = GetInventorySize(player.HoldItem); - const Displacement hotPixelOffset = Displacement(itemSize * INV_SLOT_HALF_SIZE_PX); - if (IsHardwareCursor()) { - // It's more natural to select the top left cell of the region the sprite is overlapping when putting an item - // into an inventory grid, so compensate for the adjusted hot pixel of hardware cursors. - cursorPosition -= hotPixelOffset; - } + + // It's more natural to select the top left cell of the region the sprite is overlapping when putting an item + // into an inventory grid, so compensate for the adjusted hot pixel of item cursors. + cursorPosition -= Displacement(itemSize * INV_SLOT_HALF_SIZE_PX); if (!IsItemAllowedInStash(player.HoldItem)) return; @@ -111,10 +109,6 @@ void CheckStashPaste(Point cursorPosition) player.HoldItem.clear(); PlaySFX(IS_GOLD); Stash.dirty = true; - if (!IsHardwareCursor()) { - // To make software cursors behave like hardware cursors we need to adjust the hand cursor position manually - SetCursorPos(cursorPosition + hotPixelOffset); - } NewCursor(CURSOR_HAND); return; } @@ -165,10 +159,6 @@ void CheckStashPaste(Point cursorPosition) Stash.dirty = true; - if (player.HoldItem.isEmpty() && !IsHardwareCursor()) { - // To make software cursors behave like hardware cursors we need to adjust the hand cursor position manually - SetCursorPos(cursorPosition + hotPixelOffset); - } NewCursor(player.HoldItem); } @@ -243,11 +233,6 @@ void CheckStashCut(Point cursorPosition, bool automaticMove) holdItem.clear(); } else { NewCursor(holdItem); - if (!IsHardwareCursor()) { - // 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)); - } } } } diff --git a/test/fixtures/timedemo/WarriorLevel1to2/demo_0.dmo b/test/fixtures/timedemo/WarriorLevel1to2/demo_0.dmo index a7c10bc76..ebebbb491 100644 Binary files a/test/fixtures/timedemo/WarriorLevel1to2/demo_0.dmo and b/test/fixtures/timedemo/WarriorLevel1to2/demo_0.dmo differ