diff mm7_4.cpp @ 956:e9292c58644a

Слияние
author Ritor1
date Thu, 02 May 2013 11:03:26 +0600
parents 21cc2b274220 c0d0656aa662
children d7f0572335ec
line wrap: on
line diff
--- a/mm7_4.cpp	Thu May 02 11:02:48 2013 +0600
+++ b/mm7_4.cpp	Thu May 02 11:03:26 2013 +0600
@@ -28,7 +28,6 @@
 #include "DecorationList.h"
 #include "SaveLoad.h"
 #include "stru123.h"
-#include "stru287.h"
 #include "Time.h"
 #include "IconFrameTable.h"
 #include "GUIProgressBar.h"
@@ -38,15 +37,13 @@
 #include "Awards.h"
 #include "Autonotes.h"
 #include "stru160.h"
-#include "stru279.h"
 #include "TurnEngine.h"
 #include "FactionTable.h"
 #include "StorylineTextTable.h"
 #include "Random.h"
-#include "stru277.h"
+#include "CastSpellInfo.h"
 #include "stru298.h"
 #include "stru12.h"
-#include "stru351.h"
 #include "Events2D.h"
 #include "stru159.h"
 #include "texts.h"
@@ -2103,7 +2100,7 @@
       else
       {
         v11 = &pObjectList->pObjects->uObjectID;
-        while ( stru_4E3ACC[8].field_0 != *v11 )
+        while ( stru_4E3ACC[8].uType != *v11 )
         {
           ++v10;
           v11 += 28;
@@ -3488,7 +3485,7 @@
 
   a1[0] = 0;
   pPlayer = &pParty->pPlayers[v6];
-  v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 155);
+  v59 = TargetColor(255, 255, 155);
   //v61 = pPlayer;
   memset(pTmpBuf2, 0, sizeof(pTmpBuf2));
 
@@ -6221,7 +6218,7 @@
   v7 = pSpellStats->pInfos[v1].pName;
   a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1;
   a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
-  v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
+  v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
   a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u);
   a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0);
   a1.uFrameZ = a1.uFrameX + 107;
@@ -6256,7 +6253,7 @@
     sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// 
                                                 // "%s is in no condition to %s"
                                                 // "do anything"
-    v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 0x9Bu);
+    v2 = TargetColor(255, 255, 0x9Bu);
     v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0);
     v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u);
     result = 0;
@@ -7334,8 +7331,8 @@
   a1.uFrameZ -= 10;
   v58 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)];
   v6 = v58;
-  v55 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
-  v7 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u);
+  v55 = TargetColor(0xE1u, 0xCDu, 0x23u);
+  v7 = TargetColor(0x15u, 0x99u, 0xE9u);
   v8 = v6->uProfession;
   if ( v8 )
     sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]);
@@ -7414,9 +7411,9 @@
         if ( !v28 )
         {
           v29 = (char *)&pMonsterStats + 88 * word_F8B1A0;
-          v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
+          v30 = TargetColor(0xFFu, 0xFFu, 0xFFu);
           v31 = *(int *)v29;
-          v32 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
+          v32 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
           sprintf(pTmpBuf, &byte_4F0F98, v32, v31, v30);
           sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]);
           current_npc_text = pTmpBuf2;
@@ -7499,8 +7496,8 @@
     }
   }
   v34 = 0;
-  v54 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
-  v35 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
+  v54 = TargetColor(0xFFu, 0xFFu, 0xFFu);
+  v35 = TargetColor(0xE1u, 0xCDu, 0x23u);
   v36 = v14->pStartingPosActiveItem;
   v55 = v35;
   for ( i = v36 + v14->pNumPresenceButton; (signed int)v36 < (signed int)i; i = pDialogueWindow->pNumPresenceButton
@@ -7850,10 +7847,9 @@
   ContractSelectText(pEventCode);
   pDialogueWindow->Release();
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0);
-  pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7, 0x1BD, 0xA9, 0x23, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], // Cancel
-                 pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
-  pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
-  pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0);
+  pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape,                    0, 0, pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); // Cancel
+                    pDialogueWindow->CreateButton(  0,   0,   0,  0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
+                    pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_ClickNPCTopic,             0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0);
   pDialogueWindow->_41D08F(1, 1, 0, 2);
   dialog_menu_id = HOUSE_DIALOGUE_OTHER;
 }
@@ -7873,9 +7869,7 @@
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0);
   v2 = "";
   pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u,  0x23u,   1,  0, UIMSG_Escape, 0,   0,
-                 pGlobalTXT_LocalizationStrings[34],
-                 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0),
-                 0);
+                 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
   pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
   if ( contract_approved )
     v2 = pGlobalTXT_LocalizationStrings[535];
@@ -7898,7 +7892,7 @@
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0);
   pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu,  0xA9u,   0x23u,  1,  0,  UIMSG_Escape,  0,   0,
                  pGlobalTXT_LocalizationStrings[34], //"Cancel"
-                 (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0),
+                 pIcons_LOD->GetTexture(uExitCancelTextureId),
                  0);
   pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
   if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) )
@@ -7934,14 +7928,10 @@
     pDialogueWindow->Release();
     pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0);
     sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName);
-    pBtn_ExitCancel = pDialogueWindow->CreateButton( 566, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0x4Eu,
-                   pGlobalTXT_LocalizationStrings[34],// "Cancel"
-                   (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0),0);
-    pBtn_YES = pDialogueWindow->CreateButton( 486u, 445u,  75u, 33u, 1, 0,  UIMSG_BF,  1u,  0x59u,
-                   sHouseName,
-                   (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0);
+    pBtn_ExitCancel = pDialogueWindow->CreateButton(566, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);// "Cancel"
+    pBtn_YES        = pDialogueWindow->CreateButton(486, 445, 75, 33, 1, 0, UIMSG_BF,     1, 'Y', sHouseName, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0);
     pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0,  UIMSG_BF, 1u, 0x20u,  sHouseName, 0);
-    pDialogueWindow->CreateButton(8u, 8u, 460u, 344u, 1, 0, UIMSG_BF, 1u, 0x59u, sHouseName, 0);
+    pDialogueWindow->CreateButton(8, 8, 460, 344, 1, 0, UIMSG_BF, 1, 0x59u, sHouseName, 0);
   }
   else
   {
@@ -7958,7 +7948,7 @@
     pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
     pBtn_ExitCancel = pDialogueWindow->CreateButton(  471u,  445u,  169u, 35u,  1,   0, UIMSG_Escape,  0,  0,
                    pGlobalTXT_LocalizationStrings[74],// "End Conversation"
-                   (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0),   0);
+                   pIcons_LOD->GetTexture(uExitCancelTextureId),   0);
     pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
     if ( pDialogueNPCCount == 1 && dword_591080 )
     {
@@ -8420,8 +8410,8 @@
   v28.uFrameX = 483;
   v28.uFrameWidth = 148;
   v28.uFrameZ = 334;
-  v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
-  v31 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
+  v30 = TargetColor(0xFFu, 0xFFu, 0xFFu);
+  v31 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
   v2 = 52 * (unsigned int)v0->ptr_1C;
   //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100;
   v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100;
@@ -9157,7 +9147,7 @@
   v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
   v13 = pHouse_ExitPictures[v10];
   pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12];
-  pTexture_outside = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v13, TEXTURE_16BIT_PALETTE)];
+  pTexture_outside = pIcons_LOD->LoadTexturePtr(v13, TEXTURE_16BIT_PALETTE);
   if ( v9 )
   {
     if ( !v23 )