diff Engine/Objects/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/Engine/Objects/Chest.cpp	Mon Mar 07 03:48:40 2016 +0200
+++ b/Engine/Objects/Chest.cpp	Wed Mar 09 01:39:52 2016 +0200
@@ -218,8 +218,8 @@
 bool Chest::CanPlaceItemAt( signed int test_cell_position, int item_id, signed int uChestID )
     {
 //    int v3; // eax@1
-    unsigned int item_texture_id; // eax@1
-    Texture_MM7 *item_texture; // ecx@1
+    //unsigned int item_texture_id; // eax@1
+    //Image *item_texture; // ecx@1
     signed int v6; // eax@1
 //    signed int v7; // edi@3
     signed int v8; // eax@3
@@ -235,21 +235,30 @@
 
     chest_cell_heght = pChestHeightsByType[pChests[uChestID].uChestBitmapID];
     chest_cell_width = pChestWidthsByType[pChests[uChestID].uChestBitmapID];
-    item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[item_id].pIconName, TEXTURE_16BIT_PALETTE);
-    item_texture = pIcons_LOD->GetTexture(item_texture_id);
-    v6 = item_texture->uTextureWidth;
+
+    auto item_texture = assets->GetImage_16BitColorKey(pItemsTable->pItems[item_id].pIconName, 0x7FF);
+    //item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[item_id].pIconName, TEXTURE_16BIT_PALETTE);
+    //item_texture = pIcons_LOD->GetTexture(item_texture_id);
+    v6 = item_texture->GetWidth();
     if ( v6 < 14 )
       v6 = 14;
     texture_cell_width = ((v6 - 14) >> 5) + 1;
-    v8 = item_texture->uTextureHeight;
+    v8 = item_texture->GetHeight();
     if ( v8 < 14 )
         v8 = 14;
     texture_cell_height = ((v8 - 14) >> 5) + 1;
-    if ( !areWeLoadingTexture )
+
+    if (item_texture)
+    {
+        item_texture->Release();
+        item_texture = nullptr;
+    }
+    /*if ( !areWeLoadingTexture )
     {
       item_texture->Release();
       pIcons_LOD->SyncLoadedFilesCount();
-    }
+    }*/
+
     if ( (texture_cell_width + test_cell_position % chest_cell_width <= chest_cell_width) && 
         (texture_cell_height + test_cell_position / chest_cell_width <= chest_cell_heght) )
     { //we not put over borders
@@ -312,9 +321,9 @@
   ItemGen *v4; // edi@1
   int v5; // esi@1
   int result; // eax@11
-  unsigned int v7; // eax@12
+  //unsigned int v7; // eax@12
   int v8; // edx@12
-  Texture_MM7 *texture; // ecx@12
+  //Texture_MM7 *texture; // ecx@12
   signed int v10; // eax@12
   signed int v11; // edi@14
   unsigned int v12; // esi@14
@@ -351,15 +360,18 @@
         pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
       return 0;
     }
-    v7 = pIcons_LOD->LoadTexture(v4->GetIconName(), TEXTURE_16BIT_PALETTE);
     HIWORD(v8) = 0;
-    texture = pIcons_LOD->GetTexture(v7);
-    v10 = texture->uTextureWidth;
-    if ( texture->uTextureWidth < 14 )
+
+    auto texture = assets->GetImage_16BitColorKey(v4->GetIconName(), 0x7FF);
+    //v7 = pIcons_LOD->LoadTexture(v4->GetIconName(), TEXTURE_16BIT_PALETTE);
+    //texture = pIcons_LOD->GetTexture(v7);
+
+    v10 = texture->GetWidth();
+    if ( texture->GetWidth() < 14 )
       v10 = 14;
     v12 = ((v10 - 14) >> 5) + 1;
-    v11 = texture->uTextureHeight;
-    if ( texture->uTextureHeight < 14 )
+    v11 = texture->GetHeight();
+    if ( texture->GetHeight() < 14 )
       v11 = 14;
     v13 = ((v11 - 14) >> 5) + 1;
     if ( !areWeLoadingTexture )