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

DrawTranslucent -> DrawTextureGrayShade Removed old texture drawing stuff
author a.parshin
date Wed, 09 Mar 2016 01:39:52 +0200
parents 0c67be4ec900
children
line wrap: on
line diff
--- a/GUI/UI/UIShops.cpp	Mon Mar 07 03:48:40 2016 +0200
+++ b/GUI/UI/UIShops.cpp	Wed Mar 09 01:39:52 2016 +0200
@@ -26,6 +26,8 @@
 
 Image *shop_ui_background = nullptr;
 
+std::array<Image *, 12> shop_ui_items_in_store;
+
 
 //----- (004B910F) --------------------------------------------------------
 void  WeaponShopDialog()
@@ -92,8 +94,11 @@
       {
         if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
         {
-          pRenderer->DrawTextureIndexedAlpha((60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X, weapons_Ypos[i] + 30, ItemsInShopTexture[i]);
-          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X + window->GetWidth() * (weapons_Ypos[i] + 30)], ItemsInShopTexture[i], i + 1);
+          pRenderer->DrawTextureAlphaNew(
+              ((60 - ((signed int)shop_ui_items_in_store[i]->GetWidth() / 2)) + item_X)/640.0f,
+              (weapons_Ypos[i] + 30)/480.0f,
+              shop_ui_items_in_store[i]);
+          //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)shop_ui_items_in_store[i]->uTextureWidth / 2)) + item_X + window->GetWidth() * (weapons_Ypos[i] + 30)], shop_ui_items_in_store[i], i + 1);
         }
         item_X += 70;
       }
@@ -143,8 +148,11 @@
       {
         if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
         {
-          pRenderer->DrawTextureIndexedAlpha((60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X, weapons_Ypos[i] + 30, ItemsInShopTexture[i]);
-          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_X + window->GetWidth() * (weapons_Ypos[i] + 30)], ItemsInShopTexture[i], i + 1);
+          pRenderer->DrawTextureAlphaNew(
+              ((60 - ((signed int)shop_ui_items_in_store[i]->GetWidth() / 2)) + item_X)/640.0f,
+              (weapons_Ypos[i] + 30)/480.0f,
+              shop_ui_items_in_store[i]);
+          //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[(60 - ((signed int)shop_ui_items_in_store[i]->uTextureWidth / 2)) + item_X + window->GetWidth() * (weapons_Ypos[i] + 30)], shop_ui_items_in_store[i], i + 1);
         }
         item_X += 70;
       }
@@ -420,15 +428,21 @@
         {
           if ( i >= 4 )  //low row
           {
-            pRenderer->DrawTextureIndexedAlpha((90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x - 420, 126, ItemsInShopTexture[i]);
-            v59 = (90 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + 80220;
+            pRenderer->DrawTextureAlphaNew(
+                ((90 - (shop_ui_items_in_store[i]->GetWidth() / 2)) + item_x - 420)/640.0f,
+                126/480.0f,
+                shop_ui_items_in_store[i]);
+            v59 = (90 - (shop_ui_items_in_store[i]->GetWidth() / 2)) + item_x + 80220;
           }
           else
           {
-            pRenderer->DrawTextureIndexedAlpha(( 86 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x, 98 -  ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]);
-            v59 = item_x + (86 - (ItemsInShopTexture[i]->uTextureWidth / 2)) + window->GetWidth() * (98 -  ItemsInShopTexture[i]->uTextureHeight);
+            pRenderer->DrawTextureAlphaNew(
+                ((86 - (shop_ui_items_in_store[i]->GetWidth() / 2)) + item_x)/640.0f,
+                (98 -  shop_ui_items_in_store[i]->GetWidth())/480.0f,
+                shop_ui_items_in_store[i]);
+            v59 = item_x + (86 - (shop_ui_items_in_store[i]->GetWidth() / 2)) + window->GetWidth() * (98 -  shop_ui_items_in_store[i]->GetHeight());
           }
-          ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1);
+          //ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], shop_ui_items_in_store[i], i + 1);
         }
         item_x += 105;
       }
@@ -479,15 +493,21 @@
         {
           if ( i >= 4 )
           {
-            pRenderer->DrawTextureIndexedAlpha(item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) - 420, 126, ItemsInShopTexture[i]);
-            v59 = item_x + (90 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + 80220;
+            pRenderer->DrawTextureAlphaNew(
+                (item_x + (90 - ((signed int)shop_ui_items_in_store[i]->GetWidth() / 2)) - 420)/640.0f,
+                126/480.0f,
+                shop_ui_items_in_store[i]);
+            v59 = item_x + (90 - ((signed int)shop_ui_items_in_store[i]->GetWidth() / 2)) + 80220;
           }
           else
           {
-            pRenderer->DrawTextureIndexedAlpha(86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2) + item_x, 98 - ItemsInShopTexture[i]->uTextureHeight, ItemsInShopTexture[i]);
-            v59 = (86 - ((signed int)ItemsInShopTexture[i]->uTextureWidth / 2)) + item_x + window->GetWidth() * (98 - ItemsInShopTexture[i]->uTextureHeight);
+            pRenderer->DrawTextureAlphaNew(
+                (86 - ((signed int)shop_ui_items_in_store[i]->GetWidth() / 2) + item_x)/640.0f,
+                (98 - shop_ui_items_in_store[i]->GetHeight())/480.0f,
+                shop_ui_items_in_store[i]);
+            v59 = (86 - ((signed int)shop_ui_items_in_store[i]->GetWidth() / 2)) + item_x + window->GetWidth() * (98 - shop_ui_items_in_store[i]->GetHeight());
           }
-          ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1);
+          //ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], shop_ui_items_in_store[i], i + 1);
         }
         item_x += 105;
       }
@@ -764,38 +784,38 @@
       {
         if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID )
         {
-          product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight;
+          product_height_1row = 152 - shop_ui_items_in_store[i]->GetHeight();
           if ( (signed int)product_height_1row < 1 )
             product_height_1row = 0;
-          product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40;
+          product_width_1row = 75 * i - shop_ui_items_in_store[i]->GetWidth() / 2 + 40;
           if ( i )
           {
             if ( i == 5 )
             {
-              if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth )
-                product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth;
+              if ( (signed int)product_width_1row > 457 - shop_ui_items_in_store[5]->GetWidth())
+                product_width_1row = 457 - shop_ui_items_in_store[5]->GetWidth();
             }
           }
           else if ( (signed int)product_width_1row < 18 )
             product_width_1row = 18;
-          pRenderer->DrawTextureIndexedAlpha(product_width_1row, product_height_1row, ItemsInShopTexture[i]);
-          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1);
+          pRenderer->DrawTextureAlphaNew(product_width_1row/640.0f, product_height_1row/480.0f, shop_ui_items_in_store[i]);
+          //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], shop_ui_items_in_store[i], i + 1);
         }
       }
       for ( uint i = 0; i < 6; ++i )
       {
         if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID )
         {
-          product_height_2row = 308 - ItemsInShopTexture[i + 6]->uTextureHeight;
+          product_height_2row = 308 - shop_ui_items_in_store[i + 6]->GetHeight();
           if ( (signed int)product_height_2row < 1 )
             product_height_2row = 0;
-          product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40;
+          product_width_2row = 75 * i - shop_ui_items_in_store[i + 6]->GetWidth() / 2 + 40;
           if ( i )
           {
             if ( i == 5 )
             {
-              if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth )
-                product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth;
+              if ( (signed int)product_width_2row > 457 - shop_ui_items_in_store[11]->GetWidth())
+                product_width_2row = 457 - shop_ui_items_in_store[11]->GetWidth();
             }
           }
           else
@@ -803,8 +823,8 @@
             if ( (signed int)product_width_2row < 18 )
               product_width_2row = 18;
           }
-          pRenderer->DrawTextureIndexedAlpha(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]);
-          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], ItemsInShopTexture[i + 6], i + 7);
+          pRenderer->DrawTextureAlphaNew(product_width_2row/640.0f, product_height_2row/480.0f, shop_ui_items_in_store[i + 6]);
+          //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], shop_ui_items_in_store[i + 6], i + 7);
         }
       }
       if ( HouseUI_CheckIfPlayerCanInteract() )
@@ -849,16 +869,16 @@
       {
         if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
         {
-          product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight;
+          product_height_1row = 152 - shop_ui_items_in_store[i]->GetHeight();
           if ( (signed int)product_height_1row < 1 )
             product_height_1row = 0;
-          product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40;
+          product_width_1row = 75 * i - shop_ui_items_in_store[i]->GetWidth() / 2 + 40;
           if ( i )
           {
             if ( i == 5 )
             {
-              if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth )
-                product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth;
+              if ( (signed int)product_width_1row > 457 - shop_ui_items_in_store[5]->GetWidth())
+                product_width_1row = 457 - shop_ui_items_in_store[5]->GetWidth();
             }
           }
           else
@@ -866,24 +886,24 @@
             if ( (signed int)product_width_1row < 18 )
               product_width_1row = 18;
           }
-          pRenderer->DrawTextureIndexedAlpha(product_width_1row, product_height_1row, ItemsInShopTexture[i]);
-          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1);
+          pRenderer->DrawTextureAlphaNew(product_width_1row/640.0f, product_height_1row/480.0f, shop_ui_items_in_store[i]);
+          //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], shop_ui_items_in_store[i], i + 1);
         }
       }
       for ( uint i = 0; i < 6; ++i )
       {
         if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)i + 6].uItemID) //not itemid
         {
-          product_height_2row = 308 - ItemsInShopTexture[i + 6]->uTextureHeight;
+          product_height_2row = 308 - shop_ui_items_in_store[i + 6]->GetHeight();
           if ( (signed int)product_height_2row < 1 )
             product_height_2row = 0;
-          product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40;
+          product_width_2row = 75 * i - shop_ui_items_in_store[i + 6]->GetWidth() / 2 + 40;
           if ( i )
           {
             if ( i == 5 )
             {
-              if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth )
-                product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth;
+              if ( (signed int)product_width_2row > 457 - shop_ui_items_in_store[11]->GetWidth())
+                product_width_2row = 457 - shop_ui_items_in_store[11]->GetWidth();
             }
           }
           else
@@ -891,8 +911,8 @@
             if ( (signed int)product_width_2row < 18 )
               product_width_2row = 18;
           }
-          pRenderer->DrawTextureIndexedAlpha(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]);
-          ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], ItemsInShopTexture[i + 6], i + 7);
+          pRenderer->DrawTextureAlphaNew(product_width_2row/640.0f, product_height_2row/480.0f, shop_ui_items_in_store[i + 6]);
+          //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], shop_ui_items_in_store[i + 6], i + 7);
         }
       }
       if ( HouseUI_CheckIfPlayerCanInteract() )
@@ -1138,16 +1158,16 @@
     {
       if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID)
       {
-        product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight;
+        product_height_1row = 152 - shop_ui_items_in_store[i]->GetHeight();
         if ( (signed int)product_height_1row < 1 )
           product_height_1row = 0;
-        product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40;
+        product_width_1row = 75 * i - shop_ui_items_in_store[i]->GetWidth() / 2 + 40;
         if ( i )
         {
           if ( i == 5 )
           {
-            if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth )
-              product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth;
+            if ( (signed int)product_width_1row > 457 - shop_ui_items_in_store[5]->GetWidth())
+              product_width_1row = 457 - shop_ui_items_in_store[5]->GetWidth();
           }
         }
         else
@@ -1155,22 +1175,22 @@
           if ( (signed int)product_width_1row < 18 )
             product_width_1row = 18;
         }
-        pRenderer->DrawTextureIndexedAlpha(product_width_1row, product_height_1row, ItemsInShopTexture[i]);
-        ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1);
+        pRenderer->DrawTextureAlphaNew(product_width_1row/640.0f, product_height_1row/480.0f, shop_ui_items_in_store[i]);
+        //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], shop_ui_items_in_store[i], i + 1);
       }
     }
     for ( uint i = 0; i < 6; ++i )
     {
       if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID)
       {
-        product_height_2row = 306 - ItemsInShopTexture[i + 6]->uTextureHeight;
-        product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40;
+        product_height_2row = 306 - shop_ui_items_in_store[i + 6]->GetHeight();
+        product_width_2row = 75 * i - shop_ui_items_in_store[i + 6]->GetWidth() / 2 + 40;
         if ( i )
         {
           if ( i == 5 )
           {
-            if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth )
-              product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth;
+            if ( (signed int)product_width_2row > 457 - shop_ui_items_in_store[11]->GetWidth())
+              product_width_2row = 457 - shop_ui_items_in_store[11]->GetWidth();
           }
         }
         else
@@ -1178,8 +1198,8 @@
           if ( (signed int)product_width_2row < 18 )
             product_width_2row = 18;
         }
-        pRenderer->DrawTextureIndexedAlpha(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]);
-        ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], ItemsInShopTexture[i + 6], i + 7);
+        pRenderer->DrawTextureAlphaNew(product_width_2row/640.0f, product_height_2row/480.0f, shop_ui_items_in_store[i + 6]);
+        //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], shop_ui_items_in_store[i + 6], i + 7);
       }
     }
     if ( HouseUI_CheckIfPlayerCanInteract() )
@@ -1224,16 +1244,16 @@
     {
       if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID )
       {
-        product_height_1row = 152 - ItemsInShopTexture[i]->uTextureHeight;
+        product_height_1row = 152 - shop_ui_items_in_store[i]->GetHeight();
         if ( (signed int)product_height_1row < 1 )
           product_height_1row = 0;
-        product_width_1row = 75 * i - ItemsInShopTexture[i]->uTextureWidth / 2 + 40;
+        product_width_1row = 75 * i - shop_ui_items_in_store[i]->GetWidth() / 2 + 40;
         if ( i )
         {
           if ( i == 5 )
           {
-            if ( (signed int)product_width_1row > 457 - ItemsInShopTexture[5]->uTextureWidth )
-              product_width_1row = 457 - ItemsInShopTexture[5]->uTextureWidth;
+            if ( (signed int)product_width_1row > 457 - shop_ui_items_in_store[5]->GetWidth())
+              product_width_1row = 457 - shop_ui_items_in_store[5]->GetWidth();
           }
         }
         else
@@ -1241,24 +1261,24 @@
           if ( (signed int)product_width_1row < 18 )
             product_width_1row = 18;
         }
-        pRenderer->DrawTextureIndexedAlpha(product_width_1row, product_height_1row, ItemsInShopTexture[i]);
-        ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], ItemsInShopTexture[i], i + 1);
+        pRenderer->DrawTextureAlphaNew(product_width_1row/640.0f, product_height_1row/480.0f, shop_ui_items_in_store[i]);
+        //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_1row + window->GetWidth() * product_height_1row], shop_ui_items_in_store[i], i + 1);
       }
     }
     for ( uint i = 0; i < 6; ++i )
     {
       if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i + 6].uItemID)
       {
-        product_height_2row = 306 - ItemsInShopTexture[i + 6]->uTextureHeight;
+        product_height_2row = 306 - shop_ui_items_in_store[i + 6]->GetHeight();
         if ( (signed int)product_height_2row < 1 )
           product_height_2row = 0;
-        product_width_2row = 75 * i - ItemsInShopTexture[i + 6]->uTextureWidth / 2 + 40;
+        product_width_2row = 75 * i - shop_ui_items_in_store[i + 6]->GetWidth() / 2 + 40;
         if ( i )
         {
           if ( i == 5 )
           {
-            if ( (signed int)product_width_2row > 457 - ItemsInShopTexture[11]->uTextureWidth )
-              product_width_2row = 457 - ItemsInShopTexture[11]->uTextureWidth;
+            if ( (signed int)product_width_2row > 457 - shop_ui_items_in_store[11]->GetWidth())
+              product_width_2row = 457 - shop_ui_items_in_store[11]->GetWidth();
           }
         }
         else
@@ -1266,8 +1286,8 @@
           if ( (signed int)product_width_2row < 18 )
             product_width_2row = 18;
         }
-        pRenderer->DrawTextureIndexedAlpha(product_width_2row, product_height_2row, ItemsInShopTexture[i + 6]);
-        ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], ItemsInShopTexture[i + 6], i + 7);
+        pRenderer->DrawTextureAlphaNew(product_width_2row/640.0f, product_height_2row/480.0f, shop_ui_items_in_store[i + 6]);
+        //ZBuffer_DoFill2(&pRenderer->pActiveZBuffer[product_width_2row + window->GetWidth() * product_height_2row], shop_ui_items_in_store[i + 6], i + 7);
       }
     }
     if ( HouseUI_CheckIfPlayerCanInteract() )