diff UIHouses.cpp @ 956:e9292c58644a

Слияние
author Ritor1
date Thu, 02 May 2013 11:03:26 +0600
parents 27bfe64b13b5 c0d0656aa662
children 9334a8c59c8d
line wrap: on
line diff
--- a/UIHouses.cpp	Thu May 02 11:02:48 2013 +0600
+++ b/UIHouses.cpp	Thu May 02 11:03:26 2013 +0600
@@ -621,7 +621,7 @@
   v5.uFrameX = 483;
   v5.uFrameWidth = 148;
   v5.uFrameZ = 334;
-  v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
+  v2 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
   v3 = pFontArrus->CalcTextHeight(v0, &v5, 0, 0);
   v5.DrawTitleText(pFontArrus, 0, (310 - v3) / 2 + 18, v2, v1, 3u);
 }
@@ -1733,8 +1733,8 @@
   v53.uFrameX = 483;
   v53.uFrameWidth = 148;
   v53.uFrameZ = 334;
-  auto color_default = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 255);
-  auto color_selected = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 155);
+  auto color_default = TargetColor(255, 255, 255);
+  auto color_selected = TargetColor(255, 255, 155);
   v3 = 52 * (unsigned int)v0->ptr_1C;
   //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50);
   //v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != BildingType_Stables) - 1) & 0xFFFFFFE7) + 50);
@@ -2031,8 +2031,8 @@
   _this.uFrameX = 483;
   _this.uFrameWidth = 148;
   _this.uFrameZ = 334;
-  v28 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
-  v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
+  v28 = TargetColor(0xFFu, 0xFFu, 0xFFu);
+  v30 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
   sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);
   _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u);
   switch(dialog_menu_id)
@@ -2092,9 +2092,9 @@
 	case HOUSE_DIALOGUE_TOWNHALL_99:
 		{
 		v5 = &pMonsterStats->pInfos[word_F8B1A0];
-		v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
+		v6 = TargetColor(0xFFu, 0xFFu, 0xFFu);
 		v7 = v5->pName;
-		v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
+		v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
 		sprintf(pTmpBuf, &byte_4F0F98, v8, v7, v6);
 		sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel);
 		current_npc_text = pTmpBuf2;
@@ -2109,8 +2109,8 @@
 			v9 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7;
 		}
 
-		auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0);
-		pRenderer->_4A6A68(8u, 352 - v9, pTex, (pTex ? pTex->uTextureHeight : 26) - v9);
+		auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather);
+		pRenderer->_4A6A68(8u, 352 - v9, pTex, pTex->uTextureHeight - v9);
 		pRenderer->DrawTextureIndexed(8u, 347 - v9, pTexture_591428);
 		v10 = FitTextInAWindow(current_npc_text, pOutString, &w, 0xDu, 0);
 		a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0);
@@ -2201,8 +2201,8 @@
   _this.uFrameX = 483;
   _this.uFrameWidth = 148;
   _this.uFrameZ = 334;
-  *(int *)v13 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
-  *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
+  *(int *)v13 = TargetColor(0xFFu, 0xFFu, 0xFFu);
+  *(int *)v14 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
   sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);
   _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u);
   switch(dialog_menu_id)
@@ -2429,8 +2429,8 @@
   dialog_window.uFrameX = 483;
   dialog_window.uFrameWidth = 148;
   dialog_window.uFrameZ = 334;
-  pColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
-  pColorYellow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
+  pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu);
+  pColorYellow = TargetColor(0xFFu, 0xFFu, 0x9Bu);
   v2 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
   *(float *)&v83 = v2;
   *(float *)&v89 = v2 * v2;
@@ -2550,8 +2550,8 @@
         pOutString = pFontCreate;
         pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf, &dialog_window, 12, 0) + 7;
       }
-      auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0);
-      pRenderer->_4A6A68(8, 352 - pTextHeight, pTex, (pTex ? pTex->uTextureHeight : 26) - pTextHeight);
+      auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather);
+      pRenderer->_4A6A68(8, 352 - pTextHeight, pTex, pTex->uTextureHeight - pTextHeight);
       pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428);
       v63 = FitTextInAWindow(pTmpBuf, pOutString, &dialog_window, 0xCu, 0);
       window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, v63, 0, 0, 0);
@@ -2564,8 +2564,8 @@
       dialog_window.uFrameZ = 452;
       v61 = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 12, 0);
       pTextHeight = v61 + 7;
-      auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : nullptr);
-      pRenderer->_4A6A68(8, 352 - (v61 + 7), pTex, (pTex ? pTex->uTextureHeight : 26) - (v61 + 7));
+      auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather);
+      pRenderer->_4A6A68(8, 352 - (v61 + 7), pTex, pTex->uTextureHeight - (v61 + 7));
       pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428);
       v63 = FitTextInAWindow(pTmpBuf, pFontArrus, &dialog_window, 0xCu, 0);
       window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, v63, 0, 0, 0);
@@ -2878,8 +2878,8 @@
   dialog_window.uFrameX = 483;
   dialog_window.uFrameWidth = 148;
   dialog_window.uFrameZ = 334;
-  pColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
-  pColorYellow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
+  pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu);
+  pColorYellow = TargetColor(0xE1u, 0xCDu, 0x23u);
 
   switch(dialog_menu_id)
   {
@@ -3409,8 +3409,8 @@
   dialog_window.uFrameX = 483;
   dialog_window.uFrameWidth = 148;
   dialog_window.uFrameZ = 334;
-  pColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
-  pColorYellow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
+  pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu);
+  pColorYellow = TargetColor(0xE1u, 0xCDu, 0x23u);
   switch(dialog_menu_id)
   {
     case HOUSE_DIALOGUE_MAIN:
@@ -3998,8 +3998,8 @@
   dialog_window.uFrameX = 483;
   dialog_window.uFrameWidth = 148;
   dialog_window.uFrameZ = 334;
-  pWhiteColor = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
-  pYellowColor = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
+  pWhiteColor = TargetColor(0xFFu, 0xFFu, 0xFFu);
+  pYellowColor = TargetColor(0xE1u, 0xCDu, 0x23u);
   switch (dialog_menu_id)
   {
     case HOUSE_DIALOGUE_MAIN:
@@ -4496,8 +4496,8 @@
   working_window.uFrameX = 483;
   working_window.uFrameWidth = 148;
   working_window.uFrameZ = 334;
-  pColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
-  pColorYellow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
+  pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu);
+  pColorYellow = TargetColor(0xFFu, 0xFFu, 0x9Bu);
   base_teach_price = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * 500.0);
   v63 = base_teach_price * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
   if ( v63 < base_teach_price / 3 )
@@ -4799,8 +4799,8 @@
     v57.uFrameX = 483;
     v57.uFrameWidth = 148;
     v57.uFrameZ = 334;
-    HIDWORD(v58) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
-    HIDWORD(v59) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
+    HIDWORD(v58) = TargetColor(0xFFu, 0xFFu, 0xFFu);
+    HIDWORD(v59) = TargetColor(0xFFu, 0xFFu, 0x9Bu);
     v1 = pPlayers[uActiveCharacter];
     //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]);
     v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier);
@@ -5190,8 +5190,8 @@
   v65.uFrameX = 483;
   v65.uFrameWidth = 148;
   v65.uFrameZ = 334;
-  white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 255);
-  color2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
+  white = TargetColor(255, 255, 255);
+  color2 = TargetColor(0xE1u, 0xCDu, 0x23u);
   //v71 = color2;
   //v2 = v0->uLevel;
   //v3 = 0;
@@ -5600,8 +5600,8 @@
   dialog_window.uFrameX = 483;
   dialog_window.uFrameWidth = 148;
   dialog_window.uFrameZ = 334;
-  pWhiteColor = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 255);
-  pYellowColor = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(225, 205, 35);
+  pWhiteColor = TargetColor(255, 255, 255);
+  pYellowColor = TargetColor(225, 205, 35);
   if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN)
   {
     if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )