diff GUI/UI/UIPopup.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/UIPopup.cpp	Mon Mar 07 03:48:40 2016 +0200
+++ b/GUI/UI/UIPopup.cpp	Wed Mar 09 01:39:52 2016 +0200
@@ -208,6 +208,9 @@
 
   if (!inspect_item->uItemID)
     return;
+
+  auto inspect_item_image = assets->GetImage_16BitColorKey(inspect_item->GetIconName(), 0x7FF);
+
   iteminfo_window.Hint = nullptr;
   iteminfo_window.uFrameWidth = 384;
   iteminfo_window.uFrameHeight = 180;
@@ -217,8 +220,8 @@
   else
     v2 = pMouse->GetCursorPos(&a2)->x - iteminfo_window.uFrameWidth - 30;
   iteminfo_window.uFrameX = v2;
-  v78 = 100 - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureWidth;
-  v81 = 144 - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight;
+  v78 = 100 - inspect_item_image->GetWidth();
+  v81 = 144 - inspect_item_image->GetHeight();
   if ( v78 > 0 )
     v78 = v78 / 2;
   if ( v81 <= 0 )
@@ -284,7 +287,7 @@
         (iteminfo_window.uFrameX + v78) / 640.0f,
         (v81 + iteminfo_window.uFrameY + 30) / 480.0f,
         //pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE));
-        assets->GetImage_16BitAlpha(inspect_item->GetIconName()));
+        inspect_item_image);
     if ( inspect_item->IsIdentified())
       pText = (char *)inspect_item->GetIdentifiedName();
     else
@@ -293,11 +296,13 @@
     iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &iteminfo_window, 0, 0) / 2,
                    Color16(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item"
     pRenderer->ResetUIClipRect();
-    if ( !areWeLoadingTexture )
+
+    if (inspect_item_image)
     {
-      pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
-      pIcons_LOD->SyncLoadedFilesCount();
+        inspect_item_image->Release();
+        inspect_item_image = nullptr;
     }
+
     return;
   }
   if (!inspect_item->IsIdentified())
@@ -309,15 +314,19 @@
     iteminfo_window.uFrameHeight -= 12;
     iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
     iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
-    pRenderer->DrawTextureIndexedAlpha(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE));
+    pRenderer->DrawTextureAlphaNew(
+        (iteminfo_window.uFrameX + v78)/640.0f,
+        (v81 + iteminfo_window.uFrameY + 30)/480.0f,
+        inspect_item_image);
     iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName, 3);
     iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &iteminfo_window, 0, 0) / 2,
                         Color16(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[232], 3);//"Not Identified"
     pRenderer->ResetUIClipRect();
-    if ( !areWeLoadingTexture )
+
+    if (inspect_item_image)
     {
-      pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
-      pIcons_LOD->SyncLoadedFilesCount();
+        inspect_item_image->Release();
+        inspect_item_image = nullptr;
     }
     return;
   }
@@ -421,9 +430,11 @@
   iteminfo_window.uFrameHeight -= 12;
   iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
   iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
-  pRenderer->DrawTextureIndexedAlpha(iteminfo_window.uFrameX + v78,
-      iteminfo_window.uFrameY + (signed int)(iteminfo_window.uFrameHeight - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight) / 2,
-      pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE));
+  pRenderer->DrawTextureAlphaNew(
+      (iteminfo_window.uFrameX + v78)/640.0f,
+      (iteminfo_window.uFrameY + (signed int)(iteminfo_window.uFrameHeight - inspect_item_image->GetHeight()) / 2)/480.0f,
+      inspect_item_image
+  );
 
   v34 = (int)(v85 + 35);
   Str = out_text;
@@ -507,8 +518,6 @@
   }
   return;
 }
-// 4E455C: using guessed type int dword_4E455C;
-// 506128: using guessed type int areWeLoadingTexture;
 
 //----- (0041E360) --------------------------------------------------------
 void MonsterPopup_Draw(unsigned int uActorID, GUIWindow *pWindow)