diff GUI/UI/Chest.cpp @ 2575:a76d408c5132 tip

DrawTranslucent -> DrawTextureGrayShade Removed old texture drawing stuff
author a.parshin
date Wed, 09 Mar 2016 01:39:52 +0200
parents dd36326a9994
children
line wrap: on
line diff
--- a/GUI/UI/Chest.cpp	Mon Mar 07 03:48:40 2016 +0200
+++ b/GUI/UI/Chest.cpp	Wed Mar 09 01:39:52 2016 +0200
@@ -57,10 +57,10 @@
         auto uChestID = (unsigned int)ptr_1C;
 
         int chestBitmapId; // eax@1
-        unsigned int v5; // eax@1
+        //Image *v5; // eax@1
         int chest_item_index; // ecx@3
-        unsigned int item_texture_id; // eax@4
-        Texture_MM7 *item_texture; // esi@4
+        //unsigned int item_texture_id; // eax@4
+        //Texture_MM7 *item_texture; // esi@4
         signed int itemPixelWidth; // ecx@4
         signed int itemPixelHeght; // edx@4
         //    signed int v11; // eax@4
@@ -84,20 +84,26 @@
         chestWidthCells = pChestWidthsByType[chestBitmapId];
         chestHeghtCells = pChestHeightsByType[chestBitmapId];
         sprintfex(pTmpBuf.data(), "chest%02d", pChestList->pChests[chestBitmapId].uTextureID);
-        v5 = pIcons_LOD->LoadTexture(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
-        pRenderer->DrawTextureTransparentColorKey(8u, 8u, pIcons_LOD->GetTexture(v5));
+
+        //v5 = pIcons_LOD->LoadTexture(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
+        auto chest_background = assets->GetImage_16BitColorKey(pTmpBuf.data(), 0x7FF);
+        pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, chest_background);
 
         for (item_counter = 0; item_counter < chestWidthCells * chestHeghtCells; ++item_counter)
         {
             chest_item_index = pChests[uChestID].pInventoryIndices[item_counter];
             if (chest_item_index > 0)
             {
-                item_texture_id = pIcons_LOD->LoadTexture(
-                    //pItemsTable->pItems[*(int *)((char *)&pOtherOverlayList->pOverlays[49].field_4 + 36 * v6 + v3 * 5324)].pIconName,
-                    pChests[uChestID].igChestItems[chest_item_index - 1].GetIconName(), TEXTURE_16BIT_PALETTE);
-                item_texture = pIcons_LOD->GetTexture(item_texture_id);
-                itemPixelWidth = item_texture->uTextureWidth;
-                itemPixelHeght = item_texture->uTextureHeight;
+                //item_texture_id = pIcons_LOD->LoadTexture(
+                //    //pItemsTable->pItems[*(int *)((char *)&pOtherOverlayList->pOverlays[49].field_4 + 36 * v6 + v3 * 5324)].pIconName,
+                //    pChests[uChestID].igChestItems[chest_item_index - 1].GetIconName(), TEXTURE_16BIT_PALETTE);
+                //item_texture = pIcons_LOD->GetTexture(item_texture_id);
+                //itemPixelWidth = item_texture->uTextureWidth;
+                //itemPixelHeght = item_texture->uTextureHeight;
+                auto item_texture = assets->GetImage_16BitColorKey(pChests[uChestID].igChestItems[chest_item_index - 1].GetIconName(), 0x7FF);
+                itemPixelWidth = item_texture->GetWidth();
+                itemPixelHeght = item_texture->GetHeight();
+
                 if (itemPixelWidth < 14)
                     itemPixelWidth = 14;
                 v12 = itemPixelWidth - 14;
@@ -107,9 +113,9 @@
                     itemPixelHeght = 14;
                 itemPixelPosX = chest_offs_x + 32 * (item_counter % chestWidthCells) + ((signed int)(v13 - itemPixelWidth) / 2);
                 itemPixelPosY = chest_offs_y + 32 * (item_counter / chestHeghtCells) +
-                    ((signed int)(((itemPixelHeght - 14) & 0xFFFFFFE0) + 32 - item_texture->uTextureHeight) / 2);
-                pRenderer->DrawTextureIndexedAlpha(itemPixelPosX, itemPixelPosY, item_texture);
-                ZBuffer_DoFill2(&v16[itemPixelPosX + pSRZBufferLineOffsets[itemPixelPosY]], item_texture, item_counter + 1);
+                    ((signed int)(((itemPixelHeght - 14) & 0xFFFFFFE0) + 32 - item_texture->GetHeight()) / 2);
+                pRenderer->DrawTextureAlphaNew(itemPixelPosX/640.0f, itemPixelPosY/480.0f, item_texture);
+                //ZBuffer_DoFill2(&v16[itemPixelPosX + pSRZBufferLineOffsets[itemPixelPosY]], item_texture, item_counter + 1);
             }
         }
         pRenderer->DrawTextureAlphaNew(pBtn_ExitCancel->uX/640.0f, pBtn_ExitCancel->uY/480.0f, ui_exit_cancel_button_background);