annotate UI/UIGuilds.cpp @ 1475:d7720c1f1d3b

Слияние
author Ritor1
date Wed, 28 Aug 2013 14:39:01 +0600
parents ff2118028c71
children 58d15177edd0 5cc08e71a308
rev   line source
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
1 #include "..\Items.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
2 #include "..\GUIWindow.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
3 #include "..\mm7_data.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
4 #include "..\texts.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
5 #include "UIHouses.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
6 #include "..\GUIFont.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
7 #include "..\Render.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
8 #include "..\Party.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
9 #include "..\Texture.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
10 #include "..\Mouse.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
11 #include "..\Events2D.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
12 #include "..\AudioPlayer.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
13 #include "..\LOD.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
14
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
15 //----- (004B5D7C) --------------------------------------------------------
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
16 void GuildDialog()
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
17 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
18 signed int base_teach_price; // ebx@1
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
19 int v3; // edi@6
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
20 int result; // eax@11
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
21 int v6; // esi@13
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
22 signed int v7; // esi@17
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
23 int v8; // esi@22
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
24 signed int v9; // ecx@22
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
25 char *v10; // eax@22
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
26 const char *statusbar_string; // ecx@26
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
27 POINT *v12; // esi@30
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
28 int v13; // ecx@30
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
29 void *v14; // ST1C_4@31
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
30 ItemGen *v15; // ST18_4@31
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
31 int v16; // ST10_4@31
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
32 int v17; // eax@31
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
33 char *v18; // edx@31
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
34 int v19; // eax@32
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
35 int pActiveItem; // esi@35
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
36 int v22; // eax@35
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
37 unsigned int v23; // eax@36
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
38 int v24; // eax@39
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
39 int v25; // eax@40
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
40 int v26; // ecx@47
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
41 GUIButton *pButton; // eax@49
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
42 unsigned int v29; // eax@49
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
43 char *pText; // eax@52
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
44 int pTextHeight; // eax@55
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
45 unsigned int v32; // ecx@55
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
46 int v33; // eax@55
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
47 unsigned __int16 pTextColor; // ax@55
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
48 int v35; // eax@58
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
49 const char *v36; // ST20_4@61
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
50 unsigned __int16 v37; // ST1C_2@61
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
51 int v38; // eax@61
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
52 int v40; // [sp-14h] [bp-300h]@31
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
53 int v41; // [sp-10h] [bp-2FCh]@31
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
54 unsigned __int16 v42; // [sp-Ch] [bp-2F8h]@31
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
55 char *v43; // [sp-8h] [bp-2F4h]@31
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
56 unsigned int v44; // [sp-4h] [bp-2F0h]@31
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
57 char Dest[100]; // [sp+Ch] [bp-2E0h]@3
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
58 char v46[100]; // [sp+70h] [bp-27Ch]@3
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
59 char v47[100]; // [sp+D4h] [bp-218h]@3
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
60 char v48[100]; // [sp+138h] [bp-1B4h]@3
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
61 char v49[100]; // [sp+19Ch] [bp-150h]@3
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
62 POINT v50; // [sp+264h] [bp-88h]@30
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
63 POINT v51; // [sp+26Ch] [bp-80h]@30
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
64 GUIWindow working_window; // [sp+274h] [bp-78h]@1
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
65 signed int v53; // [sp+27Ch] [bp-70h]@1
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
66 signed int v54; // [sp+284h] [bp-68h]@1
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
67 int pColorWhite; // [sp+2CCh] [bp-20h]@1
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
68 int pColorYellow; // [sp+2D0h] [bp-1Ch]@1
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
69 int v58; // [sp+2D4h] [bp-18h]@1
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
70 unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
71 bool pSkillFlag; // [sp+2DCh] [bp-10h]@35
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
72 int v61; // [sp+2E0h] [bp-Ch]@35
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
73 int pItemNum;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
74 unsigned int v62; // [sp+2E4h] [bp-8h]@13
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
75 int v63; // [sp+2E8h] [bp-4h]@1
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
76 int pNumActivItem;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
77 int all_text_height;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
78
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
79 memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow));
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
80 working_window.uFrameX = 483;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
81 working_window.uFrameWidth = 148;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
82 working_window.uFrameZ = 334;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
83 pColorWhite = TargetColor(0xFFu, 0xFFu, 0xFFu);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
84 pColorYellow = TargetColor(0xFFu, 0xFFu, 0x9Bu);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
85 base_teach_price = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * 500.0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
86 v63 = base_teach_price * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
87 if ( v63 < base_teach_price / 3 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
88 v63 = base_teach_price / 3;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
89 strcpy(Dest, "");
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
90 strcpy(v46, "");
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
91 strcpy(v47, "");
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
92 strcpy(v48, "");
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
93 strcpy(v49, "");
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
94 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
95 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
96 if ( dialog_menu_id != HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) //buy skill
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
97 {
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1300
diff changeset
98 if ( HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
99 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
100 if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
101 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
102 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
103 ShowStatusBarString(pTmpBuf.data(), 2);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
104 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
105 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
106 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
107 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
108 if ( pParty->uNumGold < v63 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
109 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
110 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
111 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
112 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
113 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
114 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
115 Party::TakeGold(v63);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
116 pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
117 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
118 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
119 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
120 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
121 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
122 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
123 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
124 v6 = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
125 v62 = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
126 v63 = 32;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
127 do
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
128 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
129 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID)
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
130 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
131 pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
132 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
133 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
134 v63 += 70;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
135 v62 += 280;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
136 ++v6;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
137 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
138 while ( v63 < 452 );
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
139 v62 = 1680;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
140 v7 = 6;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
141 v63 = 32;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
142 do
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
143 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
144 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID)
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
145 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
146 pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
147 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
148 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
149 v63 += 70;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
150 v62 += 280;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
151 ++v7;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
152 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
153 while ( v63 < 452 );
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1300
diff changeset
154 if ( HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
155 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
156 v8 = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
157 v9 = 12;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
158 do
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
159 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
160 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
161 ++v8;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
162 --v9;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
163 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
164 while ( v9 );
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
165 GetAsyncKeyState(17);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
166 statusbar_string = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
167 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
168 statusbar_string = pGlobalTXT_LocalizationStrings[196]; //"Select the Special Item to Buy"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
169 DrawTextAtStatusBar(statusbar_string, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
170 if ( !v8 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
171 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
172 working_window.DrawCurrentTime(__PAIR__( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44472],
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
173 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44468]) - pParty->uTimePlayed);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
174 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
175 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
176 v12 = pMouse->GetCursorPos(&v51);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
177 result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y];
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
178 v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
179 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
180 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
181 v14 = window_SpeakInHouse->ptr_1C;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
182 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14));
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
183 v16 = (int)window_SpeakInHouse->ptr_1C;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
184 uPlayerID = uActiveCharacter - 1;
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
185 v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, BuildingType_MagicShop, v16, 2);
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1393
diff changeset
186 v18 = BuildDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
187 v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
188 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorWhite, v18, 3);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
189 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
190 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
191 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
192 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
193 }
1460
ff2118028c71 renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents: 1411
diff changeset
194 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits,
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
195 guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
196 { //you must me member
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
197 v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
198 working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, pColorYellow, pNPCTopics[121].pText, 3u);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
199 pDialogueWindow->pNumPresenceButton = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
200 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
201 }
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1300
diff changeset
202 if ( !HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
203 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
204 v61 = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
205 pSkillFlag = false;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
206 pActiveItem = pDialogueWindow->pStartingPosActiveItem;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
207 v22 = pActiveItem + pDialogueWindow->pNumPresenceButton;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
208 pItemNum = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
209 if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
210 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
211 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
212 strcat(pTmpBuf.data(), "\n \n");
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
213 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
214 v19 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
215 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
216 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
217 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
218 all_text_height = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
219 do
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
220 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
221 v23 = pDialogueWindow->GetControl(pActiveItem)->msg_param;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
222 if ( v23 == 18 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
223 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
224 all_text_height += pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
225 v61++;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
226 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
227 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
228 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
229 if( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v23 - 36]
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
230 && !pPlayers[uActiveCharacter]->pActiveSkills[v23 - 36] )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
231 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
232 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v23 - 36], &working_window, 0, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
233 v61++;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
234 pSkillFlag = true;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
235 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
236 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
237 ++pActiveItem;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
238 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
239 while ( pActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
240 if ( !v61 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
241 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
242 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
243 strcat(pTmpBuf.data(), "\n \n");
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
244 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
245 v19 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
246 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
247 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
248 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
249 if ( pSkillFlag )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
250 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
251 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v63); //"Skill Cost: %lu"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
252 working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
253 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
254 v58 = (149 - all_text_height) / v61;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
255 if ( v58 > 32 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
256 v58 = 32;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
257 v26 = (149 - v61 * v58 - all_text_height) / 2 - v58 / 2 + 162;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
258 pNumActivItem = pDialogueWindow->pStartingPosActiveItem;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
259 if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
260 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
261 pItemNum = 2;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
262 do
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
263 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
264 pButton = pDialogueWindow->GetControl(pItemNum);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
265 v29 = pButton->msg_param;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
266 if ( v29 == 18 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
267 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
268 pText = pGlobalTXT_LocalizationStrings[400]; //"Buy Spells"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
269 pButton->uY = v58 + v26;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
270 pTextHeight = pFontArrus->CalcTextHeight(pText, &working_window, 0, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
271 v32 = pButton->uY;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
272 pButton->uHeight = pTextHeight;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
273 v33 = v32 + pTextHeight - 1;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
274 pButton->uW = v33;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
275 v26 = v33;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
276 pTextColor = pColorYellow;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
277 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
278 pTextColor = pColorWhite;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
279 working_window.DrawTitleText(pFontArrus, 0, v32, pTextColor, pText, 3);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
280 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
281 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
282 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
283 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v29 - 36]
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
284 && !pPlayers[uActiveCharacter]->pActiveSkills[v29 - 36] )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
285 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
286 pButton->uY = v58 + v26;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
287 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v29 - 36], &working_window, 0, 0);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
288 v32 = pButton->uY;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
289 pButton->uHeight = pTextHeight;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
290 v33 = v32 + pTextHeight - 1;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
291 pButton->uW = v33;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
292 v26 = v33;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
293 pTextColor = pColorYellow;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
294 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
295 pTextColor = pColorWhite;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
296 working_window.DrawTitleText(pFontArrus, 0, v32, pTextColor, pSkillNames[v29 - 36], 3);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
297 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
298 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
299 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
300 pButton->uW = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
301 pButton->uHeight = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
302 pButton->uY = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
303 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
304 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
305 ++pItemNum;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
306 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
307 while ( pItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
308 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
309 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
310 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
311 //----- (004BC8D5) --------------------------------------------------------
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
312 void SpellBookGenerator()//for GuildDialogs
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
313 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
314 int pItemNum; // esi@1
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
315 int v4; // esi@7
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
316
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
317 for( int i = 0; i < 12; ++i )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
318 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
319 if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType >= 5 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
320 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
321 if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 13 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
322 pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType + 345;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
323 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
324 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
325 if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 14 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
326 v4 = rand() % 4;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
327 else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 15 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
328 v4 = rand() % 3 + 4;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
329 else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 16 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
330 v4 = rand() % 2 + 7;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
331 if( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 16 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
332 pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * v4 + 400;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
333 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
334 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
335 if ( pItemNum == 487 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
336 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
337 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
338 pItemNum = 486;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
339 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
340 ItemGen * item_spellbook = &pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i];
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
341 item_spellbook->Reset();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
342 pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].uItemID = pItemNum;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
343 pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].Identified();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
344 ItemsInShopTexture[i] = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[pItemNum].pIconName, TEXTURE_16BIT_PALETTE);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
345 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
346 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
347 }