diff --git a/src/inventory.cc b/src/inventory.cc index efa47ef..886df5e 100644 --- a/src/inventory.cc +++ b/src/inventory.cc @@ -72,13 +72,13 @@ #define INVENTORY_ARMOR_SLOT_MAX_X (INVENTORY_ARMOR_SLOT_X + INVENTORY_LARGE_SLOT_WIDTH) #define INVENTORY_ARMOR_SLOT_MAX_Y (INVENTORY_ARMOR_SLOT_Y + INVENTORY_LARGE_SLOT_HEIGHT) -#define INVENTORY_TRADE_SCROLLER_Y 35 +#define INVENTORY_TRADE_SCROLLER_Y 30 #define INVENTORY_TRADE_INNER_SCROLLER_Y 20 #define INVENTORY_TRADE_LEFT_SCROLLER_X 29 #define INVENTORY_TRADE_LEFT_SCROLLER_Y INVENTORY_TRADE_SCROLLER_Y -#define INVENTORY_TRADE_RIGHT_SCROLLER_X 395 +#define INVENTORY_TRADE_RIGHT_SCROLLER_X 388 #define INVENTORY_TRADE_RIGHT_SCROLLER_Y INVENTORY_TRADE_SCROLLER_Y #define INVENTORY_TRADE_INNER_LEFT_SCROLLER_X 165 @@ -103,7 +103,7 @@ #define INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_Y 10 #define INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_MAX_X (INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_X + INVENTORY_SLOT_WIDTH) -#define INVENTORY_LOOT_LEFT_SCROLLER_X 176 +#define INVENTORY_LOOT_LEFT_SCROLLER_X 180 #define INVENTORY_LOOT_LEFT_SCROLLER_Y 37 #define INVENTORY_LOOT_LEFT_SCROLLER_MAX_X (INVENTORY_LOOT_LEFT_SCROLLER_X + INVENTORY_SLOT_WIDTH) @@ -111,7 +111,7 @@ #define INVENTORY_LOOT_RIGHT_SCROLLER_Y 37 #define INVENTORY_LOOT_RIGHT_SCROLLER_MAX_X (INVENTORY_LOOT_RIGHT_SCROLLER_X + INVENTORY_SLOT_WIDTH) -#define INVENTORY_SCROLLER_X 44 +#define INVENTORY_SCROLLER_X 46 #define INVENTORY_SCROLLER_Y 35 #define INVENTORY_SCROLLER_MAX_X (INVENTORY_SCROLLER_X + INVENTORY_SLOT_WIDTH) @@ -154,12 +154,10 @@ #define INVENTORY_LOOT_RIGHT_SCROLLER_X_PAD (INVENTORY_LOOT_RIGHT_SCROLLER_X + INVENTORY_SLOT_PADDING) #define INVENTORY_LOOT_RIGHT_SCROLLER_Y_PAD (INVENTORY_LOOT_RIGHT_SCROLLER_Y + INVENTORY_SLOT_PADDING) -#define INVENTORY_TRADE_LEFT_SCROLLER_X_PAD 26 +#define INVENTORY_TRADE_LEFT_SCROLLER_X_PAD (INVENTORY_TRADE_LEFT_SCROLLER_Y + INVENTORY_SLOT_PADDING) #define INVENTORY_TRADE_LEFT_SCROLLER_Y_PAD (INVENTORY_TRADE_LEFT_SCROLLER_Y + INVENTORY_SLOT_PADDING) -#define INVENTORY_TRADE_LEFT_SCROLLER_X_AUX 20 - -#define INVENTORY_TRADE_RIGHT_SCROLLER_X_PAD (INVENTORY_TRADE_RIGHT_SCROLLER_X + 2) +#define INVENTORY_TRADE_RIGHT_SCROLLER_X_PAD (INVENTORY_TRADE_RIGHT_SCROLLER_X + INVENTORY_SLOT_PADDING) #define INVENTORY_TRADE_RIGHT_SCROLLER_Y_PAD (INVENTORY_TRADE_RIGHT_SCROLLER_Y + INVENTORY_SLOT_PADDING) #define INVENTORY_TRADE_INNER_LEFT_SCROLLER_X_PAD (INVENTORY_TRADE_INNER_LEFT_SCROLLER_X + INVENTORY_SLOT_PADDING) @@ -1240,7 +1238,6 @@ static void _display_inventory(int a1, int a2, int inventoryWindowType) unsigned char* windowBuffer = windowGetBuffer(gInventoryWindow); int pitch; - int v49 = 0; if (inventoryWindowType == INVENTORY_WINDOW_TYPE_NORMAL) { pitch = INVENTORY_WINDOW_WIDTH; @@ -1304,8 +1301,7 @@ static void _display_inventory(int a1, int a2, int inventoryWindowType) windowBuffer = windowGetBuffer(gInventoryWindow); - blitBufferToBuffer(windowGetBuffer(_barter_back_win) + INVENTORY_TRADE_LEFT_SCROLLER_Y * INVENTORY_TRADE_BACKGROUND_WINDOW_WIDTH + INVENTORY_TRADE_LEFT_SCROLLER_X_AUX + INVENTORY_TRADE_WINDOW_OFFSET, INVENTORY_SLOT_WIDTH, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount, INVENTORY_TRADE_BACKGROUND_WINDOW_WIDTH, windowBuffer + pitch * INVENTORY_TRADE_LEFT_SCROLLER_Y + INVENTORY_TRADE_LEFT_SCROLLER_X_AUX, pitch); - v49 = -INVENTORY_TRADE_LEFT_SCROLLER_X_AUX; + blitBufferToBuffer(windowGetBuffer(_barter_back_win) + INVENTORY_TRADE_LEFT_SCROLLER_Y * INVENTORY_TRADE_BACKGROUND_WINDOW_WIDTH + INVENTORY_TRADE_LEFT_SCROLLER_X + INVENTORY_TRADE_WINDOW_OFFSET, INVENTORY_SLOT_WIDTH, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount, INVENTORY_TRADE_BACKGROUND_WINDOW_WIDTH, windowBuffer + pitch * INVENTORY_TRADE_LEFT_SCROLLER_Y + INVENTORY_TRADE_LEFT_SCROLLER_X, pitch); } else { assert(false && "Should be unreachable"); } @@ -1334,29 +1330,28 @@ static void _display_inventory(int a1, int a2, int inventoryWindowType) for (int v19 = 0; v19 + a1 < _pud->length && v19 < gInventorySlotsCount; v19 += 1) { int v21 = v19 + a1 + 1; - int width; int offset; if (inventoryWindowType == INVENTORY_WINDOW_TYPE_TRADE) { offset = pitch * (y + INVENTORY_TRADE_LEFT_SCROLLER_Y_PAD) + INVENTORY_TRADE_LEFT_SCROLLER_X_PAD; - width = 59; } else { if (inventoryWindowType == INVENTORY_WINDOW_TYPE_LOOT) { offset = pitch * (y + INVENTORY_LOOT_LEFT_SCROLLER_Y_PAD) + INVENTORY_LOOT_LEFT_SCROLLER_X_PAD; } else { offset = pitch * (y + INVENTORY_SCROLLER_Y_PAD) + INVENTORY_SCROLLER_X_PAD; } - width = INVENTORY_SLOT_WIDTH_PAD; } InventoryItem* inventoryItem = &(_pud->items[_pud->length - v21]); int inventoryFid = itemGetInventoryFid(inventoryItem->item); - artRender(inventoryFid, windowBuffer + offset, width, INVENTORY_SLOT_HEIGHT_PAD, pitch); + artRender(inventoryFid, windowBuffer + offset, INVENTORY_SLOT_WIDTH_PAD, INVENTORY_SLOT_HEIGHT_PAD, pitch); if (inventoryWindowType == INVENTORY_WINDOW_TYPE_LOOT) { - offset = pitch * (y + INVENTORY_LOOT_LEFT_SCROLLER_Y_PAD) + INVENTORY_LOOT_LEFT_SCROLLER_X_PAD + v49; + offset = pitch * (y + INVENTORY_LOOT_LEFT_SCROLLER_Y_PAD) + INVENTORY_LOOT_LEFT_SCROLLER_X_PAD; + } else if (inventoryWindowType == INVENTORY_WINDOW_TYPE_TRADE) { + offset = pitch * (y + INVENTORY_TRADE_LEFT_SCROLLER_Y_PAD) + INVENTORY_TRADE_LEFT_SCROLLER_X_PAD; } else { - offset = pitch * (y + INVENTORY_SCROLLER_Y_PAD) + INVENTORY_SCROLLER_X_PAD + v49; + offset = pitch * (y + INVENTORY_SCROLLER_Y_PAD) + INVENTORY_SCROLLER_X_PAD; } _display_inventory_info(inventoryItem->item, inventoryItem->quantity, windowBuffer + offset, pitch, v19 == a2);