Browse Source

Fix alignment for 2x2 armor sprite in the chest slot

pull/5817/head
staphen 3 years ago committed by Anders Jenbo
parent
commit
5e832e75d9
  1. 7
      Source/inv.cpp

7
Source/inv.cpp

@ -1122,13 +1122,10 @@ void DrawInv(const Surface &out)
auto frameSize = GetInvItemSize(cursId);
// calc item offsets for weapons smaller than 2x3 slots
if (slot == INVLOC_HAND_LEFT) {
// calc item offsets for weapons/armor smaller than 2x3 slots
if (IsAnyOf(slot, INVLOC_HAND_LEFT, INVLOC_HAND_RIGHT, INVLOC_CHEST)) {
screenX += frameSize.width == InventorySlotSizeInPixels.width ? INV_SLOT_HALF_SIZE_PX : 0;
screenY += frameSize.height == (3 * InventorySlotSizeInPixels.height) ? 0 : -INV_SLOT_HALF_SIZE_PX;
} else if (slot == INVLOC_HAND_RIGHT) {
screenX += frameSize.width == InventorySlotSizeInPixels.width ? (INV_SLOT_HALF_SIZE_PX - 1) : 1;
screenY += frameSize.height == (3 * InventorySlotSizeInPixels.height) ? 0 : -INV_SLOT_HALF_SIZE_PX;
}
const ClxSprite sprite = GetInvItemSprite(cursId);

Loading…
Cancel
Save