| 1058 | } |
| 1059 | |
| 1060 | void DrawInv(const Surface &out) |
| 1061 | { |
| 1062 | ClxDraw(out, GetPanelPosition(UiPanels::Inventory, { 0, 351 }), (*pInvCels)[0]); |
| 1063 | |
| 1064 | Size slotSize[] = { |
| 1065 | { 2, 2 }, // head |
| 1066 | { 1, 1 }, // left ring |
| 1067 | { 1, 1 }, // right ring |
| 1068 | { 1, 1 }, // amulet |
| 1069 | { 2, 3 }, // left hand |
| 1070 | { 2, 3 }, // right hand |
| 1071 | { 2, 3 }, // chest |
| 1072 | }; |
| 1073 | |
| 1074 | Point slotPos[] = { |
| 1075 | { 133, 59 }, // head |
| 1076 | { 48, 205 }, // left ring |
| 1077 | { 249, 205 }, // right ring |
| 1078 | { 205, 60 }, // amulet |
| 1079 | { 17, 160 }, // left hand |
| 1080 | { 248, 160 }, // right hand |
| 1081 | { 133, 160 }, // chest |
| 1082 | }; |
| 1083 | |
| 1084 | Player &myPlayer = *InspectPlayer; |
| 1085 | |
| 1086 | for (int slot = INVLOC_HEAD; slot < NUM_INVLOC; slot++) { |
| 1087 | if (!myPlayer.InvBody[slot].isEmpty()) { |
| 1088 | int screenX = slotPos[slot].x; |
| 1089 | int screenY = slotPos[slot].y; |
| 1090 | InvDrawSlotBack(out, GetPanelPosition(UiPanels::Inventory, { screenX, screenY }), { slotSize[slot].width * InventorySlotSizeInPixels.width, slotSize[slot].height * InventorySlotSizeInPixels.height }, myPlayer.InvBody[slot]._iMagical); |
| 1091 | |
| 1092 | const int cursId = myPlayer.InvBody[slot]._iCurs + CURSOR_FIRSTITEM; |
| 1093 | |
| 1094 | auto frameSize = GetInvItemSize(cursId); |
| 1095 | |
| 1096 | // calc item offsets for weapons/armor smaller than 2x3 slots |
| 1097 | if (IsAnyOf(slot, INVLOC_HAND_LEFT, INVLOC_HAND_RIGHT, INVLOC_CHEST)) { |
| 1098 | screenX += frameSize.width == InventorySlotSizeInPixels.width ? INV_SLOT_HALF_SIZE_PX : 0; |
| 1099 | screenY += frameSize.height == (3 * InventorySlotSizeInPixels.height) ? 0 : -INV_SLOT_HALF_SIZE_PX; |
| 1100 | } |
| 1101 | |
| 1102 | const ClxSprite sprite = GetInvItemSprite(cursId); |
| 1103 | const Point position = GetPanelPosition(UiPanels::Inventory, { screenX, screenY }); |
| 1104 | |
| 1105 | if (pcursinvitem == slot) { |
| 1106 | ClxDrawOutline(out, GetOutlineColor(myPlayer.InvBody[slot], true), position, sprite); |
| 1107 | } |
| 1108 | |
| 1109 | DrawItem(myPlayer.InvBody[slot], out, position, sprite); |
| 1110 | |
| 1111 | if (slot == INVLOC_HAND_LEFT) { |
| 1112 | if (myPlayer.GetItemLocation(myPlayer.InvBody[slot]) == ILOC_TWOHAND) { |
| 1113 | InvDrawSlotBack(out, GetPanelPosition(UiPanels::Inventory, slotPos[INVLOC_HAND_RIGHT]), { slotSize[INVLOC_HAND_RIGHT].width * InventorySlotSizeInPixels.width, slotSize[INVLOC_HAND_RIGHT].height * InventorySlotSizeInPixels.height }, myPlayer.InvBody[slot]._iMagical); |
| 1114 | const int dstX = GetRightPanel().position.x + slotPos[INVLOC_HAND_RIGHT].x + (frameSize.width == InventorySlotSizeInPixels.width ? INV_SLOT_HALF_SIZE_PX : 0) - 1; |
| 1115 | const int dstY = GetRightPanel().position.y + slotPos[INVLOC_HAND_RIGHT].y; |
| 1116 | ClxDrawBlended(out, { dstX, dstY }, sprite); |
| 1117 | } |
no test coverage detected