diff GUI/UI/UIHouses.cpp @ 2574:dd36326a9994

More texture refactoring GetLeather -> DrawTextureCustomHeight
author a.parshin
date Mon, 07 Mar 2016 03:48:40 +0200
parents 0c67be4ec900
children a76d408c5132
line wrap: on
line diff
--- a/GUI/UI/UIHouses.cpp	Sat Mar 05 16:25:53 2016 +0200
+++ b/GUI/UI/UIHouses.cpp	Mon Mar 07 03:48:40 2016 +0200
@@ -7,6 +7,8 @@
 #include "Engine/Engine.h"
 #include "Engine/AssetsManager.h"
 
+#include "GUI/UI/UIGame.h"
+
 #include "UIGuilds.h"
 #include "UIPartyCreation.h"
 #include "UIShops.h"
@@ -804,7 +806,7 @@
     //	int v11; // ecx@17
     //	unsigned int v12; // kr00_4@25
     //	int v14; // eax@25
-    unsigned int v17; // eax@37
+    //unsigned int v17; // eax@37
     signed int v18; // edi@37
     signed int v19; // edi@41
     char pContainer[40]; // [sp+Ch] [bp-30h]@32
@@ -901,9 +903,10 @@
         default: Error("Invalid alignment type: %u", pParty->alignment);
         }
 
-		v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-		pDialogueNPCCount = 0;
-		pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17];
+        pDialogueNPCCount = 0;
+		//v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+		//game_ui_dialogue_background = &pIcons_LOD->pTextures[v17];
+        game_ui_dialogue_background = assets->GetImage_16Bit(pContainer);
 
 		PrepareHouse(uHouseID);
 		v18 = 1;
@@ -1042,7 +1045,7 @@
       pDialogueWindow->Release();
       pDialogueWindow = new GUIWindow(0, 0, window->GetWidth(), 345, 0, 0);
       pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
-                                                       pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
+          ui_buttdesc2, 0);
       pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr);
     }
     if ( in_current_building_type != BuildingType_Training )
@@ -1054,7 +1057,7 @@
         pDialogueWindow->Release();
         pDialogueWindow = new GUIWindow(0, 0, window->GetWidth(), 345, 0, 0);
         pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
-                                                         pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
+            ui_buttdesc2, 0);
         pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr);
       }
       else if (uActiveCharacter)
@@ -1736,7 +1739,7 @@
         pOutString = pFontCreate;
         pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &window, 13, 0) + 7;
       }
-      pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight);
+      pRenderer->DrawTextureCustomHeight(8/640.0f, (352 - pTextHeight)/480.0f, ui_leather_mm7, pTextHeight);
       pRenderer->DrawTextureAlphaNew(8/640.0f, (347 - pTextHeight)/480.0f, _591428_endcap);
       window.DrawText(pOutString, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pOutString, &window, 13, 0), 0, 0, 0);
       break;
@@ -2035,7 +2038,7 @@
         pOutString = pFontCreate;
         pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7;
       }
-      pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight);
+      pRenderer->DrawTextureCustomHeight(8/640.0f, (352 - pTextHeight)/480.0f, ui_leather_mm7, pTextHeight);
       pRenderer->DrawTextureAlphaNew(8/640.0f, (347 - pTextHeight)/480.0f, _591428_endcap);
       window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, FitTextInAWindow(pTmpBuf.data(), pOutString, &dialog_window, 0xCu, 0), 0, 0, 0);
       break;
@@ -2046,7 +2049,7 @@
       dialog_window.uFrameWidth = game_viewport_width;
       dialog_window.uFrameZ = 452;
       pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7;
-      pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight);
+      pRenderer->DrawTextureCustomHeight(8/640.0f, (352 - pTextHeight)/480.0f, ui_leather_mm7, pTextHeight);
       pRenderer->DrawTextureAlphaNew(8/640.0f, (347 - pTextHeight)/480.0f, _591428_endcap);
       window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0,
                                     FitTextInAWindow(pTmpBuf.data(), pFontArrus, &dialog_window, 0xCu, 0), 0, 0, 0);
@@ -2924,9 +2927,11 @@
         house_window.uFrameZ = 452;
         pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreetings[((pNPC->uFlags & 3) == 2)];
         //pInString = (char *)*(&pNPCStats->field_17884 + ((pNPC->uFlags & 3) == 2) + 2 * pNPC->greet);
-        pRenderer->GetLeather(8, 352 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7),
-           pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight
-           - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7));
+        pRenderer->DrawTextureCustomHeight(
+            8/640.0f,
+            (352 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7))/480.0f,
+            ui_leather_mm7,
+            (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7));
 
         int h = (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7);
         pRenderer->DrawTextureAlphaNew(8/640.0f, (347 - h)/480.0f, _591428_endcap);
@@ -3084,7 +3089,7 @@
       pTextFont = pFontCreate;
       pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7;
     }
-    pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight);
+    pRenderer->DrawTextureCustomHeight(8/640.0f, (352 - pTextHeight)/480.0f, ui_leather_mm7, pTextHeight);
     pRenderer->DrawTextureAlphaNew(8/640.0f, (347 - pTextHeight)/480.0f, _591428_endcap);
     house_window.DrawText(pTextFont, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pTextFont, &w, 13, 0), 0, 0, 0);
   }