diff GUI/UI/UIPopup.cpp @ 2524:c7264ab7132f

Main menu rendered using d3d11
author a.parshin
date Fri, 10 Oct 2014 17:42:05 +0300
parents 9b96a51011fb
children 1bcadc6dd203
line wrap: on
line diff
--- a/GUI/UI/UIPopup.cpp	Thu Oct 09 23:33:36 2014 +0300
+++ b/GUI/UI/UIPopup.cpp	Fri Oct 10 17:42:05 2014 +0300
@@ -67,45 +67,48 @@
   unsigned int coord_x; // [sp+2Ch] [bp-Ch]@3
   unsigned int coord_y; // [sp+34h] [bp-4h]@5
 
-  pRenderer->SetTextureClipRect(uX, uY, uX + uWidth, uY + uHeight);
-  if ( pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth && pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureHeight)
+  auto parchment = pIcons_LOD->GetTexture(uTextureID_Parchment);
+
+  if ( parchment->uTextureWidth && parchment->uTextureHeight)
   {
-    uNumTiles = uWidth / pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth;
-    if ( uWidth % pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth )
+    pRenderer->SetUIClipRect(uX, uY, uX + uWidth, uY + uHeight);
+
+    uNumTiles = uWidth / parchment->uTextureWidth;
+    if ( uWidth % parchment->uTextureWidth )
       ++uNumTiles;
     coord_y = uY;
-    for ( uint j = 0; j <= uHeight / pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureHeight; j++ )
+    for ( uint j = 0; j <= uHeight / parchment->uTextureHeight; j++ )
     {
-      coord_x = uX - pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth;
+      coord_x = uX - parchment->uTextureWidth;
       for ( uint i = uNumTiles + 1; i; --i )
       {
-        coord_x += pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth;
-        pRenderer->DrawTextureIndexed(coord_x, coord_y, pIcons_LOD->GetTexture(uTextureID_Parchment));
+        coord_x += parchment->uTextureWidth;
+        pRenderer->DrawTextureIndexed(coord_x, coord_y, parchment);
       }
-      coord_y += pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureHeight;
+      coord_y += parchment->uTextureHeight;
     }
-    pRenderer->DrawTextureTransparent(uX,               uY,                pIcons_LOD->GetTexture(uTextureID_5076AC));
-    pRenderer->DrawTextureTransparent(uX,               uY + uHeight - 32, pIcons_LOD->GetTexture(uTextureID_5076B4));
-    pRenderer->DrawTextureTransparent(uX + uWidth - 32, uY,                pIcons_LOD->GetTexture(uTextureID_5076A8));
-    pRenderer->DrawTextureTransparent(uX + uWidth - 32, uY + uHeight - 32, pIcons_LOD->GetTexture(uTextureID_5076B0));
+    pRenderer->DrawTextureIndexedAlpha(uX,               uY,                pIcons_LOD->GetTexture(uTextureID_5076AC));
+    pRenderer->DrawTextureIndexedAlpha(uX,               uY + uHeight - 32, pIcons_LOD->GetTexture(uTextureID_5076B4));
+    pRenderer->DrawTextureIndexedAlpha(uX + uWidth - 32, uY,                pIcons_LOD->GetTexture(uTextureID_5076A8));
+    pRenderer->DrawTextureIndexedAlpha(uX + uWidth - 32, uY + uHeight - 32, pIcons_LOD->GetTexture(uTextureID_5076B0));
     if ( uWidth > 64 )
     {
-      pRenderer->SetTextureClipRect(uX + 32, uY, uX + uWidth - 32, uY + uHeight);
-      pRenderer->DrawTextureTransparent(uX + 32, uY,                pIcons_LOD->GetTexture(uTextureID_507698));
-      pRenderer->DrawTextureTransparent(uX + 32, uY + uHeight - 10, pIcons_LOD->GetTexture(uTextureID_5076A4));
+      pRenderer->SetUIClipRect(uX + 32, uY, uX + uWidth - 32, uY + uHeight);
+      pRenderer->DrawTextureIndexedAlpha(uX + 32, uY,                pIcons_LOD->GetTexture(uTextureID_507698));
+      pRenderer->DrawTextureIndexedAlpha(uX + 32, uY + uHeight - 10, pIcons_LOD->GetTexture(uTextureID_5076A4));
       if ( uWidth > 512 )
       {
-        pRenderer->DrawTextureTransparent(uX + 544, uY,                pIcons_LOD->GetTexture(uTextureID_507698));
-        pRenderer->DrawTextureTransparent(uX + 544, uY + uHeight - 10, pIcons_LOD->GetTexture(uTextureID_5076A4));
+        pRenderer->DrawTextureIndexedAlpha(uX + 544, uY,                pIcons_LOD->GetTexture(uTextureID_507698));
+        pRenderer->DrawTextureIndexedAlpha(uX + 544, uY + uHeight - 10, pIcons_LOD->GetTexture(uTextureID_5076A4));
       }
     }
     if ( uHeight > 64 )
     {
-      pRenderer->SetTextureClipRect(uX, uY + 32, uX + uWidth, uY + uHeight - 32);
-      pRenderer->DrawTextureTransparent(uX,               uY + 32, pIcons_LOD->GetTexture(uTextureID_5076A0));
-      pRenderer->DrawTextureTransparent(uX + uWidth - 10, uY + 32, pIcons_LOD->GetTexture(uTextureID_50769C));
+      pRenderer->SetUIClipRect(uX, uY + 32, uX + uWidth, uY + uHeight - 32);
+      pRenderer->DrawTextureIndexedAlpha(uX,               uY + 32, pIcons_LOD->GetTexture(uTextureID_5076A0));
+      pRenderer->DrawTextureIndexedAlpha(uX + uWidth - 10, uY + 32, pIcons_LOD->GetTexture(uTextureID_50769C));
     }
-    pRenderer->ResetTextureClipRect();
+    pRenderer->ResetUIClipRect();
   }
 }
 
@@ -199,7 +202,7 @@
   if (inspect_item->IsBroken())
   {
     iteminfo_window.DrawMessageBox(0);
-    pRenderer->SetTextureClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12,
+    pRenderer->SetUIClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12,
     iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, 
     iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12);
     iteminfo_window.uFrameWidth -= 24;
@@ -214,7 +217,7 @@
     iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pText, 3);
     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->ResetTextureClipRect();
+    pRenderer->ResetUIClipRect();
     if ( !areWeLoadingTexture )
     {
       pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
@@ -225,17 +228,17 @@
   if (!inspect_item->IsIdentified())
   {
     iteminfo_window.DrawMessageBox(0);
-    pRenderer->SetTextureClipRect(iteminfo_window.uFrameX + 12,  iteminfo_window.uFrameY + 12,
+    pRenderer->SetUIClipRect(iteminfo_window.uFrameX + 12,  iteminfo_window.uFrameY + 12,
           iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12,  iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12);
     iteminfo_window.uFrameWidth -= 24;
     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->DrawTextureTransparent(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE));
+    pRenderer->DrawTextureIndexedAlpha(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE));
     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->ResetTextureClipRect();
+    pRenderer->ResetUIClipRect();
     if ( !areWeLoadingTexture )
     {
       pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
@@ -337,13 +340,13 @@
   iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
   iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
   iteminfo_window.DrawMessageBox(0);
-  pRenderer->SetTextureClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12,
+  pRenderer->SetUIClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12,
          iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12);
   iteminfo_window.uFrameWidth -= 12;
   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->DrawTextureTransparent(iteminfo_window.uFrameX + v78,
+  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));
 
@@ -370,7 +373,7 @@
   {
     sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], v77);//"Value"
     iteminfo_window.DrawText(pFontComic, 100, iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0);
-    pRenderer->ResetTextureClipRect();
+    pRenderer->ResetUIClipRect();
   }
   else
   {
@@ -407,7 +410,7 @@
     {
       if ( !(inspect_item->uAttributes & ITEM_HARDENED) )
       {
-        pRenderer->ResetTextureClipRect();
+        pRenderer->ResetUIClipRect();
         if ( !areWeLoadingTexture )
         {
           pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
@@ -420,7 +423,7 @@
     LOWORD(inspect_item->uAttributes) = r_mask;
     iteminfo_window.DrawText(pFontComic, pFontComic->GetLineWidth(pTmpBuf.data()) + 132,
           iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), inspect_item->uAttributes, pText, 0, 0, 0);
-    pRenderer->ResetTextureClipRect();
+    pRenderer->ResetUIClipRect();
   }
   if ( !areWeLoadingTexture )
   {