comparison UI/UIGuilds.cpp @ 1661:e1d1fe32c194

NPCTopics
author Ritor1
date Wed, 18 Sep 2013 14:19:37 +0600
parents 19f1735fca80
children ffef0fe0b59d
comparison
equal deleted inserted replaced
1654:d11b5669f089 1661:e1d1fe32c194
24 signed int v9; // ecx@22 24 signed int v9; // ecx@22
25 char *v10; // eax@22 25 char *v10; // eax@22
26 const char *statusbar_string; // ecx@26 26 const char *statusbar_string; // ecx@26
27 POINT *v12; // esi@30 27 POINT *v12; // esi@30
28 int v13; // ecx@30 28 int v13; // ecx@30
29 void *v14; // ST1C_4@31 29 //void *v14; // ST1C_4@31
30 ItemGen *v15; // ST18_4@31 30 ItemGen *v15; // ST18_4@31
31 int v16; // ST10_4@31 31 //int v16; // ST10_4@31
32 int v17; // eax@31 32 int v17; // eax@31
33 char *v18; // edx@31 33 char *v18; // edx@31
34 int v19; // eax@32
35 int pActiveItem; // esi@35 34 int pActiveItem; // esi@35
36 int v22; // eax@35
37 unsigned int v23; // eax@36
38 int v24; // eax@39 35 int v24; // eax@39
39 int v25; // eax@40 36 int v25; // eax@40
40 int v26; // ecx@47 37 int v26; // ecx@47
41 GUIButton *pButton; // eax@49 38 GUIButton *pButton; // eax@49
42 unsigned int v29; // eax@49
43 int pTextHeight; // eax@55 39 int pTextHeight; // eax@55
44 unsigned int v32; // ecx@55
45 int v33; // eax@55
46 unsigned __int16 pTextColor; // ax@55 40 unsigned __int16 pTextColor; // ax@55
47 int v35; // eax@58 41 int v35; // eax@58
48 const char *v36; // ST20_4@61 42 const char *v36; // ST20_4@61
49 unsigned __int16 v37; // ST1C_2@61 43 unsigned __int16 v37; // ST1C_2@61
50 int v38; // eax@61
51 int v40; // [sp-14h] [bp-300h]@31 44 int v40; // [sp-14h] [bp-300h]@31
52 int v41; // [sp-10h] [bp-2FCh]@31 45 int v41; // [sp-10h] [bp-2FCh]@31
53 unsigned __int16 v42; // [sp-Ch] [bp-2F8h]@31 46 unsigned __int16 v42; // [sp-Ch] [bp-2F8h]@31
54 char *v43; // [sp-8h] [bp-2F4h]@31 47 char *v43; // [sp-8h] [bp-2F4h]@31
55 unsigned int v44; // [sp-4h] [bp-2F0h]@31 48 unsigned int v44; // [sp-4h] [bp-2F0h]@31
64 signed int v53; // [sp+27Ch] [bp-70h]@1 57 signed int v53; // [sp+27Ch] [bp-70h]@1
65 signed int v54; // [sp+284h] [bp-68h]@1 58 signed int v54; // [sp+284h] [bp-68h]@1
66 int pColorWhite; // [sp+2CCh] [bp-20h]@1 59 int pColorWhite; // [sp+2CCh] [bp-20h]@1
67 int pColorYellow; // [sp+2D0h] [bp-1Ch]@1 60 int pColorYellow; // [sp+2D0h] [bp-1Ch]@1
68 int v58; // [sp+2D4h] [bp-18h]@1 61 int v58; // [sp+2D4h] [bp-18h]@1
69 unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31 62 //unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31
70 bool pSkillFlag; // [sp+2DCh] [bp-10h]@35 63 bool pSkillFlag; // [sp+2DCh] [bp-10h]@35
71 int v61; // [sp+2E0h] [bp-Ch]@35 64 int v61; // [sp+2E0h] [bp-Ch]@35
72 int pItemNum;
73 unsigned int v62; // [sp+2E4h] [bp-8h]@13 65 unsigned int v62; // [sp+2E4h] [bp-8h]@13
74 int pPrice; // [sp+2E8h] [bp-4h]@1 66 int pPrice; // [sp+2E8h] [bp-4h]@1
75 int pNumActivItem;
76 int all_text_height; 67 int all_text_height;
77 int pX; 68 int pX;
78 69
79 memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow)); 70 memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow));
80 working_window.uFrameX = 483; 71 working_window.uFrameX = 483;
89 strcpy(Dest, ""); 80 strcpy(Dest, "");
90 strcpy(v46, ""); 81 strcpy(v46, "");
91 strcpy(v47, ""); 82 strcpy(v47, "");
92 strcpy(v48, ""); 83 strcpy(v48, "");
93 strcpy(v49, ""); 84 strcpy(v49, "");
94 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) 85 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN )
95 { 86 {
96 if ( dialog_menu_id != HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) //buy skill 87 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits,
97 { 88 guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) )
98 if ( HouseUI_CheckIfPlayerCanInteract() ) 89 { //you must me member
99 { 90 pTextHeight = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
100 if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] ) 91 working_window.DrawTitleText(pFontArrus, 0, (212 - pTextHeight) / 2 + 101, pColorYellow, pNPCTopics[121].pText, 3);
101 { 92 pDialogueWindow->pNumPresenceButton = 0;
102 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill" 93 return;
103 ShowStatusBarString(pTmpBuf.data(), 2); 94 }
104 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); 95 if ( !HouseUI_CheckIfPlayerCanInteract() )
96 return;
97 if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
98 {
99 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"
100 strcat(pTmpBuf.data(), "\n \n");
101 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
102 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0);
103 working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
104 return;
105 }
106 v61 = 0;
107 pSkillFlag = false;
108 all_text_height = 0;
109 for ( int i = pDialogueWindow->pStartingPosActiveItem;
110 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
111 {
112 if ( pDialogueWindow->GetControl(i)->msg_param == 18 )
113 {
114 all_text_height += pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells"
115 v61++;
116 }
117 else
118 {
119 if( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36]
120 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] )
121 {
122 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &working_window, 0, 0);
123 v61++;
124 pSkillFlag = true;
125 }
126 }
127 }
128 if ( !v61 )
129 {
130 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"
131 strcat(pTmpBuf.data(), "\n \n");
132 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
133 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0);
134 working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
135 return;
136 }
137 if ( pSkillFlag )
138 {
139 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); //"Skill Cost: %lu"
140 working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
141 }
142 v58 = (149 - all_text_height) / v61;
143 if ( v58 > 32 )
144 v58 = 32;
145 v26 = (149 - v61 * v58 - all_text_height) / 2 - v58 / 2 + 162;
146 for ( int i = pDialogueWindow->pStartingPosActiveItem;
147 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
148 {
149 pButton = pDialogueWindow->GetControl(i);
150 if ( pButton->msg_param == 18 )
151 {
152 pButton->uY = v58 + v26;
153 pTextHeight = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0);
154 pButton->uHeight = pTextHeight;
155 v26 = pButton->uY + pTextHeight - 1;
156 pButton->uW = v26;
157 pTextColor = pColorYellow;
158 if ( pDialogueWindow->pCurrentPosActiveItem != i )
159 pTextColor = pColorWhite;
160 working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pGlobalTXT_LocalizationStrings[400], 3);//"Buy Spells"
161 }
162 else
163 {
164 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36]
165 && !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] )
166 {
167 pButton->uY = v58 + v26;
168 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &working_window, 0, 0);
169 pButton->uHeight = pTextHeight;
170 v26 = pButton->uY + pTextHeight - 1;
171 pButton->uW = v26;
172 pTextColor = pColorYellow;
173 if ( pDialogueWindow->pCurrentPosActiveItem != i )
174 pTextColor = pColorWhite;
175 working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3);
105 } 176 }
106 else 177 else
107 { 178 {
108 if ( pParty->uNumGold < pPrice ) 179 pButton->uW = 0;
109 { 180 pButton->uHeight = 0;
110 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); //"You don't have enough gold" 181 pButton->uY = 0;
111 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); 182 }
112 } 183 }
113 else 184 }
114 { 185 return;
115 Party::TakeGold(pPrice); 186 }
116 pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1; 187 if ( dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) //buy skill
117 } 188 {
118 }
119 }
120 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
121 return;
122 }
123 pRenderer->DrawTextureIndexed(8, 8, ShopTexture); 189 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
124 v6 = 0; 190 v6 = 0;
125 v62 = 0; 191 v62 = 0;
126 for ( pX = 32; pX < 452; pX += 70 )//расположение в верхнем ряду 192 for ( pX = 32; pX < 452; pX += 70 )//расположение в верхнем ряду
127 { 193 {
166 v12 = pMouse->GetCursorPos(&v51); 232 v12 = pMouse->GetCursorPos(&v51);
167 result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y]; 233 result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y];
168 v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF; 234 v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF;
169 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) 235 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
170 { 236 {
171 v14 = window_SpeakInHouse->ptr_1C; 237 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)window_SpeakInHouse->ptr_1C));
172 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14)); 238 v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)window_SpeakInHouse->ptr_1C, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2);
173 v16 = (int)window_SpeakInHouse->ptr_1C; 239 v18 = BuildDialogueString((char *)pMerchantsBuyPhrases[v17], uActiveCharacter - 1, v15, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
174 uPlayerID = uActiveCharacter - 1; 240 pTextHeight = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0);
175 v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, BuildingType_MagicShop, v16, 2); 241 working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v18, 3);
176 v18 = BuildDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0);
177 v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0);
178 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorWhite, v18, 3);
179 return; 242 return;
180 } 243 }
181 } 244 }
182 return; 245 return;
183 } 246 }
184 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, 247 if ( dialog_menu_id == HOUSE_DIALOGUE_GUILD_LEARN_SKILL )
185 guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) ) 248 {
186 { //you must me member 249 if ( HouseUI_CheckIfPlayerCanInteract() )
187 v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0); 250 {
188 working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, pColorYellow, pNPCTopics[121].pText, 3); 251 if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] )
189 pDialogueWindow->pNumPresenceButton = 0; 252 {
253 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill"
254 ShowStatusBarString(pTmpBuf.data(), 2);
255 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
256 }
257 else
258 {
259 if ( pParty->uNumGold < pPrice )
260 {
261 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); //"You don't have enough gold"
262 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
263 }
264 else
265 {
266 Party::TakeGold(pPrice);
267 pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1;
268 }
269 }
270 }
271 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
190 return; 272 return;
191 } 273 }
192 if ( !HouseUI_CheckIfPlayerCanInteract() )
193 return;
194 v61 = 0;
195 pSkillFlag = false;
196 pActiveItem = pDialogueWindow->pStartingPosActiveItem;
197 v22 = pActiveItem + pDialogueWindow->pNumPresenceButton;
198 pItemNum = 0;
199 if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
200 {
201 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"
202 strcat(pTmpBuf.data(), "\n \n");
203 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
204 v19 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0);
205 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
206 return;
207 }
208 all_text_height = 0;
209 do
210 {
211 v23 = pDialogueWindow->GetControl(pActiveItem)->msg_param;
212 if ( v23 == 18 )
213 {
214 all_text_height += pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells"
215 v61++;
216 }
217 else
218 {
219 if( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v23 - 36]
220 && !pPlayers[uActiveCharacter]->pActiveSkills[v23 - 36] )
221 {
222 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[v23 - 36], &working_window, 0, 0);
223 v61++;
224 pSkillFlag = true;
225 }
226 }
227 ++pActiveItem;
228 }
229 while ( pActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
230 if ( !v61 )
231 {
232 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"
233 strcat(pTmpBuf.data(), "\n \n");
234 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
235 v19 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0);
236 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, pColorYellow, pTmpBuf.data(), 3);
237 return;
238 }
239 if ( pSkillFlag )
240 {
241 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); //"Skill Cost: %lu"
242 working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
243 }
244 v58 = (149 - all_text_height) / v61;
245 if ( v58 > 32 )
246 v58 = 32;
247 v26 = (149 - v61 * v58 - all_text_height) / 2 - v58 / 2 + 162;
248 pNumActivItem = pDialogueWindow->pStartingPosActiveItem;
249 if (pDialogueWindow->pStartingPosActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
250 {
251 pItemNum = 2;
252 do
253 {
254 pButton = pDialogueWindow->GetControl(pItemNum);
255 v29 = pButton->msg_param;
256 if ( v29 == 18 )
257 {
258 pButton->uY = v58 + v26;
259 pTextHeight = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0);
260 v32 = pButton->uY;
261 pButton->uHeight = pTextHeight;
262 v33 = v32 + pTextHeight - 1;
263 pButton->uW = v33;
264 v26 = v33;
265 pTextColor = pColorYellow;
266 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
267 pTextColor = pColorWhite;
268 working_window.DrawTitleText(pFontArrus, 0, v32, pTextColor, pGlobalTXT_LocalizationStrings[400], 3);//"Buy Spells"
269 }
270 else
271 {
272 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v29 - 36]
273 && !pPlayers[uActiveCharacter]->pActiveSkills[v29 - 36] )
274 {
275 pButton->uY = v58 + v26;
276 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v29 - 36], &working_window, 0, 0);
277 v32 = pButton->uY;
278 pButton->uHeight = pTextHeight;
279 v33 = v32 + pTextHeight - 1;
280 pButton->uW = v33;
281 v26 = v33;
282 pTextColor = pColorYellow;
283 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
284 pTextColor = pColorWhite;
285 working_window.DrawTitleText(pFontArrus, 0, v32, pTextColor, pSkillNames[v29 - 36], 3);
286 }
287 else
288 {
289 pButton->uW = 0;
290 pButton->uHeight = 0;
291 pButton->uY = 0;
292 }
293 }
294 ++pItemNum;
295 }
296 while ( pItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
297 }
298 return;
299 } 274 }
300 //----- (004BC8D5) -------------------------------------------------------- 275 //----- (004BC8D5) --------------------------------------------------------
301 void SpellBookGenerator()//for GuildDialogs 276 void SpellBookGenerator()//for GuildDialogs
302 { 277 {
303 int pItemNum; // esi@1 278 int pItemNum; // esi@1